Cleanup.
This commit is contained in:
1 parent
34dd900a6b
commit
42d8b68f86
1 file changed
+6
-7
+6
-7
@@ -13,25 +13,25 @@ our $VERSION = 1.00;
|
|||||||
my $bin = $Bin;
|
my $bin = $Bin;
|
||||||
|
|
||||||
# Get the name of the network this cert is for.
|
# Get the name of the network this cert is for.
|
||||||
print "Network Name: ";
|
print 'Network Name: ';
|
||||||
my $net = <STDIN>;
|
my $net = <STDIN>;
|
||||||
$net =~ s/(\r|\n)//g;
|
$net =~ s/(\r|\n)//gxsm;
|
||||||
say q{};
|
say q{};
|
||||||
|
|
||||||
# Generate key and cert.
|
# Generate key and cert.
|
||||||
system 'openssl req -nodes -newkey rsa:2048 -keyout '.$bin.'/../etc/'.$net.'.key -x509 -days 3650 -out '.$bin.'/../etc/'.$net.'.cert';
|
system 'openssl req -nodes -newkey rsa:2048 -keyout '.$bin.'/../etc/'.$net.'.key -x509 -days 3650 -out '.$bin.'/../etc/'.$net.'.cert';
|
||||||
chmod 400, "$bin/../etc/$net.key";
|
chmod 0400, "$bin/../etc/$net.key";
|
||||||
|
|
||||||
# Get the fingerprint.
|
# Get the fingerprint.
|
||||||
my $fpr = `openssl x509 -noout -fingerprint -text < $bin/../etc/$net.cert`;
|
my $fpr = `openssl x509 -noout -fingerprint -text < $bin/../etc/$net.cert`;
|
||||||
my $fp;
|
my $fp;
|
||||||
while ($fpr =~ s/(.*\n)//) {
|
while ($fpr =~ s/(.*\n)//) {
|
||||||
my $line = $1;
|
my $line = $1;
|
||||||
$line =~ s/(\r|\n)//g;
|
$line =~ s/(\r|\n)//gsm;
|
||||||
|
|
||||||
if ($line =~ m/^SHA1 Fingerprint/sm) {
|
if ($line =~ m/^SHA1 Fingerprint/sm) {
|
||||||
my $sfp = substr($line, 17);
|
my $sfp = substr $line, 17;
|
||||||
$sfp =~ s/://gsm;
|
$sfp =~ s/://gxsm;
|
||||||
|
|
||||||
$fp = $sfp;
|
$fp = $sfp;
|
||||||
}
|
}
|
||||||
@@ -41,4 +41,3 @@ while ($fpr =~ s/(.*\n)//) {
|
|||||||
say 'Done. Fingerprint: '.$fp;
|
say 'Done. Fingerprint: '.$fp;
|
||||||
|
|
||||||
# vim: set ai sw=4 ts=4:
|
# vim: set ai sw=4 ts=4:
|
||||||
|
|
||||||
Reference in new issue
Block a user