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