X-Git-Url: https://git.rapsys.eu/acme/blobdiff_plain/d23d5963bf50f434805243743d67fb3c39c916cf..8232cc7e880b10720e10a634f70fbc1578960bff:/letscert diff --git a/letscert b/letscert new file mode 100755 index 0000000..ff77f24 --- /dev/null +++ b/letscert @@ -0,0 +1,57 @@ +#! /usr/bin/perl + +# Best practice +use strict; +use warnings; + +# Load acme +use acme; + +# Load POSIX +use POSIX qw(EXIT_SUCCESS EXIT_FAILURE); + +# Init debug +my $debug = 0; + +# Init prod +my $prod = 0; + +# Strip and enable debug +@ARGV = map { if ($_ eq '-d') { $debug = 1; (); } else { $_; } } @ARGV; + +# Strip and enable prod +@ARGV = map { if ($_ eq '-p') { $prod = 1; (); } else { $_; } } @ARGV; + +# Show usage +if (scalar(@ARGV) < 2) { + print "Usage: $0 user\@example.com www.example.com [example.com] [...]\n"; + exit EXIT_FAILURE; +} + +# Create new object +my $acme = acme->new(shift @ARGV, $debug, $prod, @ARGV); + +# Prepare environement +$acme->prepare(); + +# Generate required keys +$acme->genKeys(); + +# Generate csr +$acme->genCsr(); + +# Directory +$acme->directory(); + +# Register +$acme->register(); + +# Authorize +$acme->authorize(); + +# Issue +$acme->issue(); + +# Exit with success +exit EXIT_SUCCESS; +