|
|
|
|
@ -2,8 +2,15 @@ package MJB::Web::Task::WildCardSSL; |
|
|
|
|
use Mojo::Base 'MJB::Web::Task', -signatures; |
|
|
|
|
use IPC::Run3; |
|
|
|
|
|
|
|
|
|
#== |
|
|
|
|
# This task creates a wildcard ssl certificate for a hosted domain. |
|
|
|
|
# |
|
|
|
|
# It is currently limited to supporting only linode for dns challenges, but should be |
|
|
|
|
# easy to expand to support other --dns- plugins. |
|
|
|
|
#== |
|
|
|
|
|
|
|
|
|
sub run ( $job, $hosted_domain_id ) { |
|
|
|
|
$job->note( _mds_template => 'build_static' ); |
|
|
|
|
$job->note( _mds_template => 'wildcard_ssl' ); |
|
|
|
|
|
|
|
|
|
my $domain = $job->app->db->hosted_domain( $hosted_domain_id ); |
|
|
|
|
|
|
|
|
|
@ -12,11 +19,15 @@ sub run ( $job, $hosted_domain_id ) { |
|
|
|
|
qw(sudo certbot certonly --dns-linode --dns-linode-credentials /etc/letsencrypt/.secrets/linode.ini -d ), '*.' . $domain->name, qw(--agree-tos --register-unsafely-without-email) |
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
$job->note( is_create_done => 1 ); |
|
|
|
|
|
|
|
|
|
# Push the SSL Certs to all hosts |
|
|
|
|
my $result_sync = $job->system_command( [ |
|
|
|
|
qw(sudo letsencrypt-cert-push) |
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
$job->note( is_sync_done => 1 ); |
|
|
|
|
|
|
|
|
|
$job->finish(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|