1 # +------------------------------------+
2 # | Inspire Internet Relay Chat Daemon |
3 # +------------------------------------+
5 # InspIRCd: (C) 2002-2010 InspIRCd Development Team
6 # See: http://wiki.inspircd.org/Credits
8 # This program is free but copyrighted software; see
9 # the file COPYING for details.
11 # ---------------------------------------------------
13 package make::gnutlscert;
18 use warnings FATAL => qw(all);
20 use Exporter 'import';
22 our @EXPORT = qw(make_gnutls_cert);
25 sub make_gnutls_cert()
27 open (FH, ">certtool.template");
29 my $org = promptstring_s("Please enter the organization name", "My IRC Network");
30 my $unit = promptstring_s("Please enter the unit Name", "Server Admins");
31 my $state = promptstring_s("Pleae enter your state (two letter code)", "CA");
32 my $country = promptstring_s("Please enter your country", "Oompa Loompa Land");
33 my $commonname = promptstring_s("Please enter the certificate common name (hostname)", "irc.mynetwork.com");
34 my $email = promptstring_s("Please enter a contact email address", "oompa\@loompa.com");
36 # X.509 Certificate options
40 # The organization of the subject.
43 # The organizational unit of the subject.
46 # The locality of the subject.
49 # The state of the certificate owner.
52 # The country of the subject. Two letter code.
55 # The common name of the certificate owner.
58 # A user id of the certificate owner.
61 # If the supported DN OIDs are not adequate you can set
63 # For example set the X.520 Title and the X.520 Pseudonym
64 # by using OID and string pairs.
65 #dn_oid = "2.5.4.12" "Dr." "2.5.4.65" "jackal"
67 # This is deprecated and should not be used in new
69 # pkcs9_email = "none\@none.org"
71 # The serial number of the certificate
74 # In how many days, counting from today, this certificate will expire.
79 # A dnsname in case of a WWW server.
80 #dns_name = "www.none.org"
82 # An IP address in case of a server.
83 #ip_address = "192.168.1.1"
85 # An email in case of a person
88 # An URL that has CRLs (certificate revocation lists)
89 # available. Needed in CA certificates.
90 #crl_dist_points = "http://www.getcrl.crl/getcrl/"
92 # Whether this is a CA certificate or not
95 # Whether this certificate will be used for a TLS client
98 # Whether this certificate will be used for a TLS server
101 # Whether this certificate will be used to sign data (needed
102 # in TLS DHE ciphersuites).
105 # Whether this certificate will be used to encrypt data (needed
106 # in TLS RSA ciphersuites). Note that it is prefered to use different
107 # keys for encryption and signing.
110 # Whether this key will be used to sign other certificates.
113 # Whether this key will be used to sign CRLs.
116 # Whether this key will be used to sign code.
119 # Whether this key will be used to sign OCSP data.
122 # Whether this key will be used for time stamping.
126 if ( (my $status = system("certtool --generate-privkey --outfile key.pem")) ne 0) { return 1; }
127 if ( (my $status = system("certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem --template certtool.template")) ne 0) { return 1; }
128 unlink("certtool.template");