]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Add support for generating a certificate signing request to genssl.
authorPeter Powell <petpow@saberuk.com>
Mon, 6 Mar 2017 01:04:40 +0000 (01:04 +0000)
committerPeter Powell <petpow@saberuk.com>
Fri, 17 Mar 2017 15:52:25 +0000 (15:52 +0000)
tools/genssl

index 189311c1a054b325da3c2a215da248d4fe1333e8..e4d5bf1f40b11190cb4351963b0829bd528d3ceb 100755 (executable)
@@ -119,6 +119,7 @@ __GNUTLS_END__
        close($tmp);
        $status ||= system "$certtool --generate-privkey $sec_param --outfile key.pem";
        $status ||= system "$certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem --template $tmp";
+       $status ||= system "$certtool --generate-request --load-privkey key.pem --outfile csr.pem --template $tmp";
        $status ||= system "$certtool --generate-dh-params $sec_param --outfile dhparams.pem";
        $dercert = `$certtool --certificate-info --infile cert.pem --outder` unless $status;
 } elsif ($tool eq 'openssl') {
@@ -131,9 +132,12 @@ $organization
 $unit
 $common_name
 $email
+.
+$organization
 __OPENSSL_END__
        close($tmp);
        $status ||= system "cat $tmp | openssl req -x509 -nodes -newkey rsa:2048 -keyout key.pem -out cert.pem -days $days 2>/dev/null";
+       $status ||= system "cat $tmp | openssl req -new -nodes -key key.pem -out csr.pem 2>/dev/null";
        $status ||= system 'openssl dhparam -out dhparams.pem 2048';
        $dercert = `openssl x509 -in cert.pem -outform DER` unless $status;
 }
@@ -147,6 +151,6 @@ if (defined $dercert && eval 'use Digest::SHA; 1') {
        my $hash = Digest::SHA->new(256);
        $hash->add($dercert);
        say '';
-       say 'Add this TLSA record to your domain for DANE support:';
+       say 'If you are using the self-signed certificate then add this TLSA record to your domain for DANE support:';
        say "_6697._tcp." . $common_name . " TLSA 3 0 1 " . $hash->hexdigest;
 }