-
Notifications
You must be signed in to change notification settings - Fork 6
Don't delete existing challenges to support wildcard certificates #11
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
base: master
Are you sure you want to change the base?
Don't delete existing challenges to support wildcard certificates #11
Conversation
21e77b1 to
8692114
Compare
8692114 to
50dbe71
Compare
|
@fogs |
fogs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Ruben,
Thanks for submitting your PR. I have added some comments to it, please have a look!
Keep up the good work,
fogs
| # The domain name (CN or subject alternative name) being | ||
| # validated. | ||
| # - TOKEN_FILENAME | ||
| # The name of the file is irrelevant for the DNS challenge, yet still provided |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that spaces at the end of the line are crap, sorry for my poor code quality!
But can we please have a separate commit when removing those?
| # Remove old txt token | ||
| gcloud dns record-sets transaction start --zone $zonename | ||
| gcloud dns record-sets transaction remove --name $existingName --type TXT --ttl $existingTtl --zone $zonename -- "$existingRrdata" | ||
| gcloud dns record-sets transaction execute --zone $zonename --format='value(id)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to perform a transaction execute here and a transaction start in line 59? Or can we also handle that all in one transaction?
| if [ "$existingName" == "_acme-challenge.$DOMAIN." ]; then | ||
| gcloud dns record-sets transaction remove --name $existingName --type TXT --ttl $existingTtl --zone $zonename -- "$existingRrdata" | ||
| # Remove old txt token | ||
| gcloud dns record-sets transaction start --zone $zonename |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this transaction start pulled into the IF statement?
| # nsresult comes with the TXT RR in double quotes - remove those | ||
| nsresult=${nsresult//$'"'/''} | ||
| until [[ "$nsresult" = "$TOKEN_VALUE" ]]; do | ||
| until [[ "$nsresult" == *"$TOKEN_VALUE"* ]]; do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference between the old version and the new? Won't * expand in bash?
|
|
||
| gcloud dns record-sets transaction remove --name $existingName --type TXT --ttl $existingTtl --zone $zonename -- "$existingRrdata" | ||
| gcloud dns record-sets transaction execute --zone $zonename | ||
| existingRecord=`gcloud dns record-sets list --name "_acme-challenge.$DOMAIN." --type TXT --zone $zonename --format='value(name,rrdatas,ttl)'` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why rrdatas instead of the previously used rrdatas[0]?
| # Remove all record | ||
| gcloud dns record-sets transaction start --zone $zonename | ||
| stringify=${existingRrdata[@]} | ||
| stringify=${stringify// /"\" \""} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is adding another tool requirement to the script - is there no way we can do that in bash? Also, please name variables according to what is in there instead of naming them after the command you got the data from.
While generating a wildcard certificate 2 challenges will be deployed for the same domain.
One challenge is deployed to verify
domain.tldand one is deployed for*.domain.tld. Both however will be deployed to the domein_acme_challenge.domain.tldThis fix makes it possible for multiple challenges to exist at the same time for the same domain.
This PR closes issue #8
PS: I'm not fluent in bash so feedback is always welcome.