]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - make/gnutlscert.pm
Fix for feature request in bug #262, needs a bit of QA. Simpler prompting for gnutls...
[user/henk/code/inspircd.git] / make / gnutlscert.pm
1 package make::gnutlscert;
2
3 use Exporter 'import';
4 use make::configure;
5 @EXPORT = qw(make_gnutls_cert);
6
7
8 sub make_gnutls_cert()
9 {
10         open (FH, ">certtool.template");
11         my $timestr = time();
12         my $org = promptstring("Please enter the organization name", "My IRC Network");
13         my $unit = promptstring("Please enter the unit Name", "Server Admins");
14         my $state = promptstring("Pleae enter your state (two letter code)", "CA");
15         my $country = promptstring("Please enter your country", "Oompa Loompa Land");
16         my $commonname = promptstring("Please enter the certificate common name (hostname)", "irc.mynetwork.com");
17         my $email = promptstring("Please enter a contact email address", "oompa\@loompa.com");
18         print FH <<__END__;
19 # X.509 Certificate options
20 #
21 # DN options
22
23 # The organization of the subject.
24 organization = "$org"
25
26 # The organizational unit of the subject.
27 unit = "$unit"
28
29 # The locality of the subject.
30 # locality =
31
32 # The state of the certificate owner.
33 state = "$state"
34
35 # The country of the subject. Two letter code.
36 country = $country
37
38 # The common name of the certificate owner.
39 cn = "$commonname"
40
41 # A user id of the certificate owner.
42 #uid = "clauper"
43
44 # If the supported DN OIDs are not adequate you can set
45 # any OID here.
46 # For example set the X.520 Title and the X.520 Pseudonym
47 # by using OID and string pairs.
48 #dn_oid = "2.5.4.12" "Dr." "2.5.4.65" "jackal"
49
50 # This is deprecated and should not be used in new
51 # certificates.
52 # pkcs9_email = "none\@none.org"
53
54 # The serial number of the certificate
55 serial = $timestr
56
57 # In how many days, counting from today, this certificate will expire.
58 expiration_days = 700
59
60 # X.509 v3 extensions
61
62 # A dnsname in case of a WWW server.
63 #dns_name = "www.none.org"
64
65 # An IP address in case of a server.
66 #ip_address = "192.168.1.1"
67
68 # An email in case of a person
69 email = "$email"
70
71 # An URL that has CRLs (certificate revocation lists)
72 # available. Needed in CA certificates.
73 #crl_dist_points = "http://www.getcrl.crl/getcrl/"
74
75 # Whether this is a CA certificate or not
76 #ca
77
78 # Whether this certificate will be used for a TLS client
79 tls_www_client
80
81 # Whether this certificate will be used for a TLS server
82 tls_www_server
83
84 # Whether this certificate will be used to sign data (needed
85 # in TLS DHE ciphersuites).
86 signing_key
87
88 # Whether this certificate will be used to encrypt data (needed
89 # in TLS RSA ciphersuites). Note that it is prefered to use different
90 # keys for encryption and signing.
91 encryption_key
92
93 # Whether this key will be used to sign other certificates.
94 cert_signing_key
95
96 # Whether this key will be used to sign CRLs.
97 crl_signing_key
98
99 # Whether this key will be used to sign code.
100 code_signing_key
101
102 # Whether this key will be used to sign OCSP data.
103 ocsp_signing_key
104
105 # Whether this key will be used for time stamping.
106 time_stamping_key
107 __END__
108 close(FH);
109 system("certtool --generate-privkey --outfile key.pem");
110 system("certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem --template certtool.template");
111 unlink("certtool.template");
112 }
113
114 1;