X-Git-Url: https://git.rapsys.eu/acme/blobdiff_plain/e714f0566d12b8ad35c9e3768ed6a6f0f5236a9f..707fca91ce64b098f3bc55721f630b6822d48bd8:/acmecert diff --git a/acmecert b/acmecert new file mode 100755 index 0000000..f8694cb --- /dev/null +++ b/acmecert @@ -0,0 +1,71 @@ +#! /usr/bin/perl + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) 2016 - 2017 Raphaël Gertz + +# 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;