X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=tools%2Fgenssl;h=e4d5bf1f40b11190cb4351963b0829bd528d3ceb;hb=02497bfa999da26c19a92d8620c35bb97f1da711;hp=b824f4ebe5d7fede3e4160c404ffb9fd4bfc9b15;hpb=1d45a7264c01669a046e803d206dd3553fbc5c55;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/tools/genssl b/tools/genssl index b824f4ebe..e4d5bf1f4 100755 --- a/tools/genssl +++ b/tools/genssl @@ -45,7 +45,7 @@ sub prompt($$) { } if ($#ARGV != 0 || $ARGV[0] !~ /^(?:auto|gnutls|openssl)$/i) { - say 'Syntax: genssl '; + say STDERR "Usage: $0 "; exit 1; } @@ -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; }