Skip to content

Instantly share code, notes, and snippets.

@nneul
Created January 28, 2016 21:44
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nneul/76a38010313f55db0f7a to your computer and use it in GitHub Desktop.
Save nneul/76a38010313f55db0f7a to your computer and use it in GitHub Desktop.
sample hook for letsencrypt.sh
#!/usr/bin/perl
my $i = 0;
my $info = "Arguments:\n";
my ( $action, $name, $challenge, $auth ) = @ARGV;
foreach my $arg (@ARGV) {
$i++;
$info .= "\t$i: $arg\n";
}
$info .= "\n\n";
print $info;
if ( $action eq "deploy_challenge" ) {
my $shortname = $name;
$shortname =~ s|\S+\.\S+$||;
if ( $shortname ne "" )
{
$shortname = "." . $shortname;
}
print "Create a DNS TXT record named: _acme-challenge.$name\n";
print "with a low/zero TTL and this values:\n";
print " _acme-challenge.$name. 60 TXT \"$auth\"\n";
print "or\n";
print " _acme-challenge$shortname 60 TXT \"$auth\"\n";
print "\n\n";
print "Hit enter when completed...\n";
my $dummy = <STDIN>;
print "\nok, proceeding.\n";
}
elsif ( $action eq "clean_challenge" ) {
print "Not doing anything to clean challenges.\n";
exit;
}
elsif ( $action eq "deploy_cert" ) {
print "Install the above mentioned certs into your server as needed.\n";
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment