]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - tools/genssl
Prevent users from sending an empty TAGMSG.
[user/henk/code/inspircd.git] / tools / genssl
index b824f4ebe5d7fede3e4160c404ffb9fd4bfc9b15..9c6cc3804ec2e1c65e696c4c6876832779fa3e50 100755 (executable)
@@ -2,9 +2,7 @@
 #
 # InspIRCd -- Internet Relay Chat Daemon
 #
-#   Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
-#   Copyright (C) 2007 Craig Edwards <craigedwards@brainbox.cc>
-#   Copyright (C) 2013 Peter Powell <petpow@saberuk.com>
+#   Copyright (C) 2013-2017 Sadie Powell <sadie@witchery.services>
 #
 # This file is part of InspIRCd.  InspIRCd is free software: you can
 # redistribute it and/or modify it under the terms of the GNU General Public
@@ -45,7 +43,7 @@ sub prompt($$) {
 }
 
 if ($#ARGV != 0 || $ARGV[0] !~ /^(?:auto|gnutls|openssl)$/i) {
-       say 'Syntax: genssl <auto|gnutls|openssl>';
+       say STDERR "Usage: $0 <auto|gnutls|openssl>";
        exit 1;
 }
 
@@ -119,6 +117,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 +130,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 +149,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;
 }