Skip to content
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

certificates are removed each hour #288

Closed
richardbrinkman opened this issue Nov 24, 2017 · 10 comments
Closed

certificates are removed each hour #288

richardbrinkman opened this issue Nov 24, 2017 · 10 comments
Assignees
Labels
kind/bug Issue reporting a bug

Comments

@richardbrinkman
Copy link

After the update of pull request #287 the docker-letsencrypt-nginx-proxy-companion container tries to remove all certs each hour by an rm -rf /etc/nginx/certs.

The corresponding log:

nginx_letsencrypt_1  | 2017-11-24T02:00:51.465837646Z rm: can't remove '/etc/nginx/certs': Resource busy
nginx_letsencrypt_1  | 2017-11-24T02:00:51.466698138Z rm: can't remove '/etc/nginx/certs': Resource busy
nginx_letsencrypt_1  | 2017-11-24T02:00:51.467441543Z rm: can't remove '/etc/nginx/certs': Resource busy
nginx_letsencrypt_1  | 2017-11-24T02:00:51.468107700Z rm: can't remove '/etc/nginx/certs': Resource busy
nginx_letsencrypt_1  | 2017-11-24T02:00:51.468902502Z rm: can't remove '/etc/nginx/certs': Resource busy
nginx_letsencrypt_1  | 2017-11-24T02:00:51.469662416Z rm: can't remove '/etc/nginx/certs': Resource busy

The only place where I see an rm -rf in the sourcecode is in app/letsencrypt_service. Apparently the base_domain, hosts_array_expanded, hosts_array and/or host_varname variable is set incorrectly.

@buchdag
Copy link
Member

buchdag commented Nov 24, 2017

I'm not witnessing this behaviour on any of my running container. I'm doing additional tests right now. It's true that we have a couple of dangerous rm -rf with unchecked variables that need to be secured, I'll work on that asap.

In the meantime please pull and use
jrcs/letsencrypt-nginx-proxy-companion:v1.6
or
jrcs/letsencrypt-nginx-proxy-companion:stable

@buchdag
Copy link
Member

buchdag commented Nov 24, 2017

I think I found why you are experiencing this. Do you happen to have a trailing comma on one of your LETSENCRYPT_HOST value, like LETSENCRYPT_HOST=example.com, ?

@philipp65
Copy link

Hi,

I think I'm experiencing the same with the result

Creating/renewal xxx.yyy.zz certificates... (xxx.yyy.zz)
2017-11-24 11:34:14,210:INFO:simp_le:1538: Retrieving Let's Encrypt latest Terms of Service.
2017-11-24 11:34:16,281:INFO:simp_le:1356: Generating new account key
ACME server returned an error: urn:acme:error:rateLimited :: There were too many requests of a given type :: Error creating new registration :: too many registrations for this IP

I'm also having trailing commas in my docker-compose.yml

I rolled back to jrcs/letsencrypt-nginx-proxy-companion:stable but ofc letsencrypt doesn't allow new registrations for my IP.

Any suggestions?

Kind regards

@buchdag
Copy link
Member

buchdag commented Nov 24, 2017

Did you have a working setup with a trailing comma before ? I ask because as @brainyron found in #254 , a trailing comma on LETSENCRYPT_HOST would not work even before recent commits.

The letsencrypt registration rate limit will cool down in 3 hours: https://letsencrypt.org/docs/rate-limits/

I'm afraid there isn't much you can do before that short of getting a new account key from another IP Address and transferring it back to each of your domain folders in /etc/nginx/certs.

@philipp65
Copy link

philipp65 commented Nov 24, 2017

I'm working with trailing commas on LETSENCRYPT_HOST since ever, but like this

  xxx.me:
    build: ./xxx.me
    container_name: xxx.me
    restart: always
    expose:
      - 80
      - 443
    volumes:
      - /srv/docker/xxx.me/data:/var/www/html
      - /srv/docker/xxx.me/config/default:/etc/nginx/sites-available/default
    environment:
      - VIRTUAL_HOST=xxx.me, www.xxx.me
      - LETSENCRYPT_HOST=xxx.me, www.xxx.me
      - LETSENCRYPT_EMAIL=office@xxx.me

I can survive 3 hours without SSL, since it's just some development stuff like GitLab CE and minor websites.

@buchdag
Copy link
Member

buchdag commented Nov 24, 2017

Oh, I meant trailing comma at the very end of variable like LETSENCRYPT_HOST=xxx.me, www.xxx.me,

@philipp65
Copy link

Oh OK sorry my bad, never tried that

@buchdag
Copy link
Member

buchdag commented Nov 24, 2017

So what's broken appears to be comma separated host lists with spaces in between, I'll have a look into that.

Sorry for the regression. :\

buchdag added a commit that referenced this issue Nov 24, 2017
Incorrect trimming did lead to empty domains being created on space separated domains
or with comma trailed LETSENCRYPT_HOST environment variable. This in turns led to the
container being caught in an endless loop trying to delete /etc/nginx/certs #254 #288
@buchdag buchdag added the kind/bug Issue reporting a bug label Nov 24, 2017
buchdag added a commit that referenced this issue Nov 24, 2017
Incorrect trimming did lead to empty domains being created on space separated domains
or with comma trailed LETSENCRYPT_HOST environment variable. This in turns led to the
container being caught in an endless loop trying to delete /etc/nginx/certs #254 #288
@buchdag
Copy link
Member

buchdag commented Nov 24, 2017

Fixed by 4085f64 / #289

@buchdag buchdag closed this as completed Nov 24, 2017
@richardbrinkman
Copy link
Author

Thanks for the very fast fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Issue reporting a bug
Projects
None yet
Development

No branches or pull requests

3 participants