Skip to content

Resolve issues#10

Open
jbjonesjr wants to merge 5 commits intomasterfrom
arg_and_hook_cleanup
Open

Resolve issues#10
jbjonesjr wants to merge 5 commits intomasterfrom
arg_and_hook_cleanup

Conversation

@jbjonesjr
Copy link
Copy Markdown
Collaborator

The script is currently producing errors when calling the exit_hook, and has some unnecessary logic left over from previous testing.

This Pull Request will resolve the logical errors, and improve on the script in general to make it more maintainable in the future.

* add method comments
* simplify the hook script 
* better handle passed parameters
Comment thread dnsimple_hook.rb Outdated
#
# It iterates over DNSimple domains looking for a domain match
#
# Note: This verification fails if you own the domain `foo.com` and you attempt to verify `e-foo.com`
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The more I think about it, the less comfortable I am with this edge case. It can get the users into a situation where they add a TXT record into DNSimple that will never be verified by Let's Encrypt.

My suggestion is to first use a routine (maybe domain-name?) to split the challenge_fqdn into the domain and subdomain, and then only compare the domain to what is available in DNSimple for the auth token via an equality check.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are two issues with the original code. 1) it may not work creating a cert for a top-level domain and 2) your comment about string matching means we should rewrite this, e.g. using include will find 'foo.com' in 'nofoo.com'.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it may not work creating a cert for a top-level domain

Interesting. I didn't see that in my read through. Is that because of how we call the dnsimple api?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just haven't run through it and assume the string concatenation needs to be tightened up. I found a gem to pull out the domain and will update this tomorrow.

Comment thread dnsimple_hook.rb
account_id = account.data[0].id

domain_hash = find_domain(account_id, full_domain_name)
if domain_hash["domain_name"] != ""
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also want to double check that this if statement wasn't needed because of the way you are using a user auth token instead of an account auth token.

It works for me, but that means... nada.

@jbjonesjr
Copy link
Copy Markdown
Collaborator Author

Hope to have cycles to test this on Friday

@jbjonesjr
Copy link
Copy Markdown
Collaborator Author

SO.... how should i be installing these gems?

I cd'ed into the hooks/dnsimple directory, and ran bundle install --path vendor/bundle, but when i run the dehydrated script, the hook file complains about not being able to find the httparty gem...

what am i doing wrong here?

@jbjonesjr
Copy link
Copy Markdown
Collaborator Author

ok, so i went back and ran bundle install --system and I think it got me through it. That said, i had not vendoring my gems. Would be cool if we had a way around this?

* PublicSuffix should use parse, not domain
* fix an argument name mismatch
@jbjonesjr
Copy link
Copy Markdown
Collaborator Author

note, i didn't see your previous PR #12 , so the changes in eb70a6b are redundant. I guess if i really knew git well i'd force push that commit away or something

@osowskit
Copy link
Copy Markdown
Owner

SO.... how should i be installing these gems?

Not 100% on best practices. If you have a better way, feel free to fix it.

@osowskit
Copy link
Copy Markdown
Owner

I want to say this PR is on an older branch that is stale. Is this still relevant- sorry for the delayed reply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants