-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Acme2 similar names #1628
base: dev
Are you sure you want to change the base?
Acme2 similar names #1628
Conversation
E.g. api.example.com previously also matched api-example.com
Hi, @ksperling The following 2 case can both grep successfully: root@localhost# echo "api.example.com" | grep "api.example.com"
api.example.com
root@localhost# echo "api-example.com" | grep "api.example.com"
api-example.com The reason is that the dot('.') in the grep expression is explained as a regExp wildcard char, so it matches any char. It seems that your code can not work for this case also. I think we need to think about another fix. Thanks. |
I'm not sure what you mean, the fact that "." is a regex meta character is exactly what my patch fixes by escaping each "." in the domain name as "\." before passing the string to |
@ksperling root@st:~# d=api.example.com
root@st:~# echo "api.example.com" | grep "^${d//./\.}"
api.example.com
root@st:~# echo "api-example.com" | grep "^${d//./\.}"
api-example.com
There is no difference. |
Ah, apologies, when I read your initial response on github somehow the markdown parser must have swallowed some of the backslashes. Just tried out your code, this seems to be a difference in behaviour between GNU grep and BSD grep:
I'll see what I can do to make this work with GNU grep as well... I had assumed escaping with backslash was defined by POSIX so didn't think to test multiple platforms. |
Actually the issue seem to be with the pattern replacement, not grep itself, the following works on both platforms (extra backslash in the replacement):
I'll amend the pull request. |
Could you please have a look at the updated PR? Cheers Karsten |
please merge the latest code. |
When using ACME2 with an order that contains multiple similar names (e.g. "api.example.com" and "api-example.com") the code that looks up the authorization state for a particular name can end up looking at the wrong entry due to the way
grep
was used without escaping the "." placeholder. I.e. the grep can end up returning multiple map entries:If one of these authorizations is valid while another is still pending, acme.sh will erroneously consider both of them valid, skip authorization, and then fail to issue the cert.
The dns_aws change is unrelated, but I found it while debugging this issue.