Commit 463baa94 authored by Jamie Nguyen's avatar Jamie Nguyen
Browse files

Cleanup ACME challenge files

parent 3f2b445f
......@@ -4,8 +4,9 @@
# symbiosis-ssl - Manage and generate SSL certificates
#
# SYNOPSIS
# symbiosis-ssl [ --threshold days ] [ --no-generate ] [ --no-rollover ] [ --select set ] [ --list ]
# [ --prefix prefix ] [ --verbose ] [ --manual ] [ --help ] [ domain domain ... ]
# symbiosis-ssl [ --threshold days ] [ --no-generate ] [ --no-rollover ] [ --select set ]
# [ --list ] [ --prefix prefix ] [ --verbose ] [ --debug ] [ --manual ] [ --help ]
# [ domain domain ... ]
#
# OPTIONS
# --force Re-generate certificates, and roll over to the new set even
......@@ -27,7 +28,9 @@
#
# --manual Show the manual for this script
#
# --verbose Show debugging information.
# --verbose Show verbose information.
#
# --debug Show debugging information.
#
# USAGE
#
......@@ -60,6 +63,7 @@ opts = GetoptLong.new(
[ '--help', '-h', GetoptLong::NO_ARGUMENT ],
[ '--manual', '-m', GetoptLong::NO_ARGUMENT ],
[ '--verbose', '-v', GetoptLong::NO_ARGUMENT ],
[ '--debug', '-d', GetoptLong::NO_ARGUMENT ],
[ '--force', '-f', GetoptLong::NO_ARGUMENT ],
[ '--list', '-l', GetoptLong::NO_ARGUMENT ],
[ '--threshold', '-t', GetoptLong::REQUIRED_ARGUMENT ],
......@@ -71,6 +75,7 @@ opts = GetoptLong.new(
manual = help = false
$VERBOSE = false
$DEBUG = false
prefix = "/srv"
do_list = do_generate = do_rollover = nil
rollover_to = nil
......@@ -103,6 +108,8 @@ opts.each do |opt,arg|
do_list = true
when '--verbose'
$VERBOSE = true
when '--debug'
$DEBUG = true
end
end
......
......@@ -130,18 +130,17 @@ module Symbiosis
#
authorisation = do_with_nonce_debounce{ self.client.authorize(domain: name) }
challenge = do_with_nonce_debounce{ authorisation.http01 }
challenge_directory = File.join(self.docroot, File.dirname(challenge.filename))
mkdir_p(File.join(self.docroot, File.dirname(challenge.filename)))
set_param(File.basename(challenge.filename),
challenge.file_content,
File.join(self.docroot, File.dirname(challenge.filename)))
set_param(File.basename(challenge.filename), challenge.file_content, challenge_directory)
vs = nil # Record the verify status
if do_with_nonce_debounce{ challenge.request_verification }
puts "\tRequesting verification for #{name} from #{endpoint}" if $VERBOSE
vs = nil # Record the verify status
60.times do
vs = do_with_nonce_debounce { challenge.verify_status }
break unless vs == "pending"
......@@ -150,7 +149,7 @@ module Symbiosis
if vs == "valid"
puts "\tSuccessfully verified #{name}" if $VERBOSE
return true
break
end
if $VERBOSE
......@@ -159,7 +158,13 @@ module Symbiosis
end
end
false
set_param(File.basename(challenge.filename), false, challenge_directory) if not $DEBUG
if vs == "valid"
return true
else
return false
end
end
def acme_certificate(request = self.request)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment