App-Acmeman
view release on metacpan or search on metacpan
macros for SSL-enabled sites (B<mod_macro> is needed). Finally, it will
create the directory B</var/www/acme>, which will be used for receiving
and serving ACME challenges. If another directory is preferred, it can
be specified as an argument to B<acmeman --setup>.
The tool will try to determine the layout of the Apache configuration
files and place the created file accordingly, so that it will be included
into the main configuration file. It will print the name of the created
file at the end of the run. You are advised to ensure that the file is
included and that the module B<mod_macro> is loaded prior to it. You
may also wish to revise B<httpd-letsencrypt.conf> and edit the paths to
SSL files configured there. By default, the directory F</etc/acme/I<DOMAIN>>
will be created for each domain name needing SSL, and two files will be placed
there: F<cert.pem>, containing the leaf and intermediate certificates for that
domain, and F<privkey.pem>, containing the private key for that domain.
The program will refuse to overwrite existing files B<httpd-letsencrypt.conf>,
unless given the B<--force> (B<-F>) option.
=head3 Configuring SSL
lib/App/Acmeman/Apache/Layout/slackware.pm view on Meta::CPAN
}
$self->run_commands;
}
sub add_command {
my ($self, $locus, $command, $text) = @_;
my $file = ($locus->filenames)[0];
my $line = ($locus->filelines($file))[0];
push @{$self->{_edits}{$file}}, { line => $line, command => $command, text => $text };
}
sub run_commands {
my ($self) = @_;
foreach my $file (keys %{$self->{_edits}}) {
$self->run_commands_for_file($file);
}
$self->apache_modules(undef);
}
sub run_commands_for_file {
my ($self, $file) = @_;
my @commands = sort { $a->{line} <=> $b->{line} } @{$self->{_edits}{$file}};
my $app = new Apache::Config::Preproc(
$file,
'-no-comment-grouping',
-expand => [ 'locus' ])
or do {
error("can't parse apache configuration file $file: $Apache::Admin::Config::ERROR");
return;
};
foreach my $node ($app->select) {
last if (!@commands);
my $line = ($node->locus->filelines(($node->locus->filenames)[0]))[0];
if ($commands[0]->{line} == $line) {
my $cmd = shift @commands;
$self->${\ $cmd->{command} }($app, $node, $cmd->{text});
}
}
if (@commands) {
error((0+@commands) . " left unmatched in edit queue for file $file");
error("$file left unchanged");
} else {
my $backup_name = backup_copy($app->filename, error => \my $error);
if ($backup_name) {
debug(1, "modifying ".$app->filename."; prior version saved in $backup_name");
} elsif ($error) {
error("can't backup ".$app->filename.": $error");
error("file left unchanged");
return;
}
( run in 0.641 second using v1.01-cache-2.11-cpan-de7293f3b23 )