]> Raphaƫl G. Git Repositories - acme/blob - gencert
Cleanup
[acme] / gencert
1 #! /usr/bin/perl
2
3 # Best practice
4 use strict;
5 use warnings;
6
7 # Load acme
8 use acme;
9
10 # Load POSIX
11 use POSIX qw(EXIT_SUCCESS EXIT_FAILURE);
12
13 # Init prod
14 my $prod = 0;
15
16 # Strip and enable prod
17 @ARGV = map { if ($_ eq '-p') { $prod = 1; (); } else { $_; } } @ARGV;
18
19 # Show usage
20 if (scalar(@ARGV) < 2) {
21 print "Usage: $0 user\@example.com www.example.com [example.com] [...]\n";
22 exit EXIT_FAILURE;
23 }
24
25 # Create new object
26 my $acme = acme->new(shift @ARGV, @ARGV);
27
28 # Prepare environement
29 $acme->prepare($prod);
30
31 # Generate required keys
32 $acme->genKeys();
33
34 # Generate csr
35 $acme->genCsr();
36
37 # Directory
38 $acme->directory($prod);
39
40 # Register
41 $acme->register();
42
43 # Authorize
44 $acme->authorize($prod);
45
46 # Issue
47 $acme->issue();
48
49 # Exit with success
50 exit EXIT_SUCCESS;
51