kereis / traefik-certs-dumper

Dumps Let's Encrypt certificates of a specified domain which Traefik stores in acme.json.
Apache License 2.0
129 stars 24 forks source link

Ownership, permissions and container restart fix #11

Closed pwatk closed 4 years ago

pwatk commented 4 years ago

I'm submitting these three commits for review.

  1. Fix UID/GID changes only being applied to the first file encountered.
  2. Give read permissions to OVERRIDE_GID for all files.
  3. Fix containers being restarted on every run.
kereis commented 4 years ago

Looks pretty straight forward to me. I'll give it a shot as soon as I can. Thank you in advance. :)

pwatk commented 4 years ago

I only use one domain so when I said all files I meant cert.pem and key.pem. The command looks for any .pem files in the output directory though.

The issue I had was only cert.pem was having it’s ownership changed.

Given that cert.pem comes alphabetically before key.pem I deduced that the find command was stopping after the first file it encountered.

Adding a while loop to the find command fixed this for me.

pwatk commented 4 years ago

Sorry I miss read your question.

I added chmod g+r to the find command so the group permission is changed to read at the same time as the files ownership.

Ultimately this means that key.pem allows read access to the $OVERRIDE_GID group as well as cert.pem.

kereis commented 4 years ago

Sorry I miss read your question.

I added chmod g+r to the find command so the group permission is changed to read at the same time as the files ownership.

Ultimately this means that key.pem allows read access to the $OVERRIDE_GID group as well as cert.pem.

I only use one domain so when I said all files I meant cert.pem and key.pem. The command looks for any .pem files in the output directory though.

The issue I had was only cert.pem was having it’s ownership changed.

Given that cert.pem comes alphabetically before key.pem I deduced that the find command was stopping after the first file it encountered.

Adding a while loop to the find command fixed this for me.

Ah, yeah. Makes sense now. 👍 Well, as mentioned above, everything seemed to work fine. I'm merging the changes now and I'll create a new release later on. Thank you for your contribution. :)

pwatk commented 4 years ago

Thank you.