Repository navigation
Closed
Labels
P3Priority 3RIoTRelates to integration with cloud providers, hypervisors, API-based services, etc.State-Modulebugbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone
Description
Description of Issue/Question
Execution of salt.states.acme.cert with renew parameter always reports about renewed certificate, even when certificate is not changed:
ID: my_cert
Function: acme.cert
Name: domain.tld
Result: True
Comment: Certificate domain.tld renewed.
Started: 17:38:31.068335
Duration: 6203.158 ms
Changes:
----------
new:
----------
...
not_after:
1509594480
not_before:
1501818480
...
old:
----------
...
not_after:
1509594480
not_before:
1501818480
...
Setup
my_cert:
acme.cert:
- name: domain.tld
- email: [email protected]
- webroot: /var/lib/letsencrypt/
- renew: 20Versions Report
$ salt-ssh --versions-report
Salt Version:
Salt: 2017.7.0
Dependency Versions:
cffi: 1.10.0
cherrypy: 8.9.1
dateutil: 2.6.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.9.6
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: 0.26.0
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.8
mysql-python: Not Installed
pycparser: 2.18
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.13 (default, Jul 21 2017, 03:24:34)
python-gnupg: Not Installed
PyYAML: 3.12
PyZMQ: 16.0.2
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.1
ZMQ: 4.2.2
System Versions:
dist:
locale: UTF-8
machine: x86_64
release: 4.12.3-1-ARCH
system: Linux
version: Not Installed
Reacted by Joseph Wensley and oarmstrong
Metadata
Metadata
Assignees
Labels
P3Priority 3RIoTRelates to integration with cloud providers, hypervisors, API-based services, etc.State-Modulebugbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around
Activity
Ch3LL commentedon Aug 8, 2017
Seems the acme state module it checks to see
res['result']is None hereSeems your result is returning True if you look at the module here you can see it returns True if it was able to check the perms of the cert file correctly.
I'm guessing this state would always return changes regardless of having renew set or not. Seems we need to add some more logic here
oarmstrong commentedon Nov 20, 2017
I hit this and as it seems to have been silent for some time I'm looking at it now. I'll update this comment with findings as I go to prevent multiple notifications going out.
I believe the issue to be here, as the
certbotcommand is run with the--quietargument there never is any stdout. Presumably with the correct set of arguments we would be able to see this output and thus determine whether the run actually did anything.Looks like bf8f373 is the commit that added
--quiet. I'll try using the--non-interactiveoption instead which should also have the same effect that that commit had.0e99a59 has already resolved this. It doesn't appear to be released though despite being before the 2017.7.2 tag? There is still, however, a related issue about running this state in test mode that it always returns as unchanged.
oarmstrong commentedon Nov 20, 2017
That above PR fixes the issue I mentioned in my final comment above. It does not close this issue.
However, the commit 0e99a59 does appear to fix this issue and as such it can probably be closed.
Ch3LL commentedon Nov 22, 2017
ping @xuhcc can you give that a try and report back?
xuhcc commentedon Nov 22, 2017
@Ch3LL
Latest salt is throwning error during execution:
I tried to reconstruct the exact command and found that certbot asks for user input and this causes a salt failure (after 0e99a59):
I think that
--non-interactiveflag should be used as @oarmstrong suggested.oarmstrong commentedon Nov 23, 2017
For some reason it was definitely the addition of
--quietwhich caused this issue and the commit that reverted that resolved this for me. I do agree though that adding--non-interactiveis probably a decent safety as there's no reason we should ever be in an interactive mode.The only concern is if
--non-interactiveselects a particular option for these prompt by default instead of exiting. I'm concerned by adding the flag we may be changing functionality in more ways than I'd be able to test in a reasonable time period.But, I definitely don't hit this after my patch, even without that extra flag and an identical state. There may be something deeper at work here.
Edit: fuck. I checked out my source and I was using
--non-interactive, which I must have added during my testing at some point. Well I'll send a PR with that patch and we'll see what the maintainers make of whether it has too much potential for regressions.oarmstrong commentedon Nov 23, 2017
@xuhcc can you test with my patch? My fork is at https://github.com/oarmstrong/salt if you want to just pull that.
xuhcc commentedon Nov 25, 2017
@oarmstrong
Thanks! Now certificate renewal works as expected.
Fix acme.cert to run certbot non-interactively
Fix acme state to correctly return on test
xuhcc commentedon Oct 27, 2018
The problem appeared again in 2018.3.3.
Ch3LL commentedon Oct 30, 2018
@xuhcc can you please open a new issues with the details of the issue
xuhcc commentedon Oct 30, 2018
Done #50310
Fix acme state to correctly return on test
Fix acme state to correctly return on test