]> Raphaƫl G. Git Repositories - acme/blob - gencert
Support prod parameter
[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 #XXX: debug
14 use Data::Dumper;
15
16 # Init prod
17 my $prod = 0;
18
19 # Strip and enable prod
20 @ARGV = map { if ($_ eq '-p') { $prod = 1; (); } else { $_; } } @ARGV;
21
22 # Show usage
23 if (scalar(@ARGV) < 2) {
24 print "Usage: $0 user\@example.com www.example.com [example.com] [...]\n";
25 exit EXIT_FAILURE;
26 }
27
28 # Create new object
29 my $acme = acme->new(shift @ARGV, @ARGV);
30
31 # Prepare environement
32 $acme->prepare($prod);
33
34 # Generate required keys
35 $acme->genKeys();
36
37 # Generate csr
38 $acme->genCsr();
39
40 # Directory
41 $acme->directory($prod);
42
43 # Register
44 $acme->register();
45
46 # Authorize
47 $acme->authorize($prod);
48
49 # Issue
50 $acme->issue();
51
52 # Exit with success
53 exit EXIT_SUCCESS;
54