X-Git-Url: https://git.rapsys.eu/acme/blobdiff_plain/107df9a9faca7078d45c623ece51f818ecb29a38..e714f0566d12b8ad35c9e3768ed6a6f0f5236a9f:/letsconf?ds=sidebyside diff --git a/letsconf b/letsconf index 869c90b..cc0f077 100755 --- a/letsconf +++ b/letsconf @@ -48,59 +48,58 @@ my $prod = 0; # Strip and enable debug for (my $i = 0; $i <= $#ARGV; $i++) { # Match redhat types - if ($ARGV[$i] =~ /^(?:(\-d|\-\-redhat)(?:=([^-][a-zA-Z0-9_\.,-]+))?)$/) { + if ($ARGV[$i] =~ /^(?:(\-r|\-\-redhat)(?:=([^-][a-zA-Z0-9_\.,-]+))?)$/) { if (defined($2)) { - push(@redhat, split(',', $2)); + push(@redhat, [split(',', $2)]); # Extract next parameter } elsif(defined($ARGV[$i+1]) && $ARGV[$i+1] =~ /^([^-][a-zA-Z0-9_\.,-]+)$/) { - push(@redhat, split(',', $1)); + push(@redhat, [split(',', $1)]); $i++; # Set default } else { - push(@redhat, ('example.com')); + push(@redhat, ['www.example.com','example.com','...']); } # Match debian types - } elsif ($ARGV[$i] =~ /^(?:(\-r|\-\-debian)(?:=([^-][a-zA-Z0-9_\.,-]+))?)$/) { + } elsif ($ARGV[$i] =~ /^(?:(\-d|\-\-debian)(?:=([^-][a-zA-Z0-9_\.,-]+))?)$/) { if (defined($2)) { - push(@debian, split(',', $2)); + push(@debian, [split(',', $2)]); # Extract next parameter } elsif(defined($ARGV[$i+1]) && $ARGV[$i+1] =~ /^([^-][a-zA-Z0-9_\.,-]+)$/) { - push(@debian, split(',', $1)); + push(@debian, [split(',', $1)]); $i++; # Set default } else { - push(@debian, ('example.com')); + push(@debian, ['www.example.com','example.com','...']); } } } # Show usage if (scalar(@ARGV) < 1) { - print "Usage: $0 [(-d|--debian)[=example.com[,...]] [(-r|--redhat)[=example.com[,...]]] [...]\n"; + print "Usage: $0 [(-d|--debian)[=example.com[,...]] [(-r|--redhat)[=example.com[,...]]] [...] > /etc/acmepl/config\n"; exit EXIT_FAILURE; } # Append redhat style examples -foreach my $key (@redhat) { +for my $key (@redhat) { + my $domain = shift @{$key}; + my @domains = $key; tie(%{$root{certificates}[$#{$root{certificates}}+1]}, 'Tie::IxHash', ( # Public cert #XXX: required - cert => '/etc/pki/tls/certs/'.$key.'.pem', + cert => '/etc/pki/tls/certs/'.$domain.'.pem', # Private key #XXX: required - key => '/etc/pki/tls/private/'.$key.'.pem', + key => '/etc/pki/tls/private/'.$domain.'.pem', # Mail address #XXX: required - mail => 'webmaster@'.$key, + mail => 'webmaster@'.$domain, # Root domain #XXX: required - domain => 'www.'.$key, + domain => $domain, # Domain list #XXX: required - domains => [ - $key, - '...' - ], + domains => @domains, # Production certificate #XXX: optional #XXX: set to 1 for production @@ -109,26 +108,25 @@ foreach my $key (@redhat) { } # Append debian style examples -foreach my $key (@debian) { +for my $key (@debian) { + my $domain = shift @{$key}; + my @domains = $key; tie(%{$root{certificates}[$#{$root{certificates}}+1]}, 'Tie::IxHash', ( # Public cert #XXX: required - cert => '/etc/ssl/certs/'.$key.'.crt', + cert => '/etc/ssl/certs/'.$domain.'.crt', # Private key #XXX: required - key => '/etc/ssl/private/'.$key.'.key', + key => '/etc/ssl/private/'.$domain.'.key', # Mail address #XXX: required - mail => 'webmaster@'.$key, + mail => 'webmaster@'.$domain, # Root domain #XXX: required - domain => 'www.'.$key, + domain => $domain, # Domain list #XXX: required - domains => [ - $key, - '...' - ], + domains => @domains, # Production certificate #XXX: optional #XXX: set to 1 for production