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