Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the DNS-01 challenge #7

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: Remove old CoreDNS configuration file
To prevent `assert( token )` from failing for persistent volumes
(certificate renewal or other option changes), remove the file each time
the pre-hook is run.
Rijul-A committed Mar 19, 2022
commit d21e92c6e77b5ca4e32c6f12a355ba19b0d3556c
4 changes: 3 additions & 1 deletion certbot-coredns/common.py
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ def email_to_rname( email ):
# note that CoreDNS only reloads the file if serial of SOA changes
# this is why we rewrite the entire file with new timestamp
# even when we are updating / adding just a single record
def write_or_update_master_file( token = "" ):
def write_or_update_master_file( token = "", delete = False ):
master_file_content = """\
; Zone: SNIKKET.{domain}.

@@ -46,6 +46,8 @@ def write_or_update_master_file( token = "" ):
domain = os.environ[ "SNIKKET_TWEAK_XMPP_DOMAIN" ]
master_file_path = "/snikket/coredns/db.snikket.{}".format( domain )
if os.path.exists( master_file_path ):
if delete:
os.remove( master_file_path )
with open( master_file_path, "r" ) as f:
existing_master_file_content = f.read()
existing_last_line = existing_master_file_content.strip(). \
2 changes: 1 addition & 1 deletion certbot-coredns/pre.py
Original file line number Diff line number Diff line change
@@ -102,7 +102,7 @@ def main():
print( "[PreHook] Running for domain {}".format( domain ) )
validate_a_or_aaaa_record( domain )
validate_cname_record( domain )
write_or_update_master_file()
write_or_update_master_file( delete = True )
write_core_file( domain )
print( "[PreHook] Starting DNS server" )
with open( "/dev/null", "w" ) as devnull: