SteveLTN / https-portal

A fully automated HTTPS server powered by Nginx, Let's Encrypt and Docker.
MIT License
4.42k stars 296 forks source link

Get rid of 4095 byte limit per environment variable #260

Closed MarcelWaldvogel closed 3 years ago

MarcelWaldvogel commented 3 years ago

Only the first 4095 of DOMAINS (or any other environment variable) will be used, truncating the rest, causing weird problems.

After double-checking all the ruby code that it that nothing limited the length of ENV['DOMAINS'] and successfully running the ruby code from within docker exec, I tracked this down to with-contenv from s6-overlay, thanks to the cronjob just firing while I was looking for the reasons. So it was clear that /etc/cron_env.sh was the culprit.

with-contenv only copyies the first 4095 bytes of an environment variable (see also s6-overlay Changelog and justc-envdir README).

The fix is easy: Just upgrade to s6-overlay of at least 2.0.0.0. It seems to be running fine on two machines for me (one of them being the one with the long list of DOMAINS).

BTW1: As executing /bin/bash from the docker exec yields the right environment, is the environment reading process really necessary?

BTW2: Maybe it is worthwhile to look at upgrading the other dependencies.

SteveLTN commented 3 years ago

Hi, to answer your question:

1) The environment reading process is for cron jobs. This is the only way I managed to have the cron jobs reading the environment. Manually running the commands works just from bash, but when running in cron they just don't see any environment variables.

2) Yep, I should have a look at some time.

SteveLTN commented 3 years ago

1.17.2 was released.