]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - make/opensslcert.pm
...because every now and again, i have to do a massive commit.
[user/henk/code/inspircd.git] / make / opensslcert.pm
1 #       +------------------------------------+
2 #       | Inspire Internet Relay Chat Daemon |
3 #       +------------------------------------+
4 #
5 #  InspIRCd: (C) 2002-2010 InspIRCd Development Team
6 # See: http://wiki.inspircd.org/Credits
7 #
8 # This program is free but copyrighted software; see
9 #      the file COPYING for details.
10 #
11 # ---------------------------------------------------
12
13 package make::opensslcert;
14
15 require 5.8.0;
16
17 use strict;
18 use warnings FATAL => qw(all);
19
20 use Exporter 'import';
21 use make::configure;
22 our @EXPORT = qw(make_openssl_cert);
23
24
25 sub make_openssl_cert()
26 {
27         open (FH, ">openssl.template");
28         my $org = promptstring_s("Please enter the organization name", "My IRC Network");
29         my $unit = promptstring_s("Please enter the unit Name", "Server Admins");
30         my $country = promptstring_s("Please enter your country (two letter code)", "US");
31         my $state = promptstring_s("Please enter your state or locality name", "Alaska");
32         my $city = promptstring_s("Please enter your city", "Factory Town");
33         my $email = promptstring_s("Please enter a contact email address", "oompa\@loompa.com");
34         my $commonname = promptstring_s("Please enter the common name (domain name) of the irc server", "example.inspircd.org");
35         print FH <<__END__;
36 $country
37 $state
38 $city
39 $org
40 $unit
41 $commonname
42 $email
43 __END__
44 close(FH);
45
46 my $time = promptstring_s("Please enter the number of days that this certificate is valid for","365");
47
48 system("cat openssl.template | openssl req -x509 -nodes -newkey rsa:1024 -keyout key.pem -out cert.pem -days $time 2>/dev/null");
49 system("openssl dhparam -out dhparams.pem 1024");
50 unlink("openssl.template");
51 }
52
53 1;