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

DietPi-LetsEncrypt | Initial Lighttpd-only support for multiple comma-separated domains #3728

Merged
merged 3 commits into from
Aug 24, 2020

Conversation

Ruben-VV
Copy link
Contributor

Fixed problem when entering multiple domains separated by commas

Status: Ready

Reference: #1622 (only fixed problem with multiple domains)

Commit list/description:

  • DietPi-LetsEncrypt | fixed problem with multiple domains separated by commas

Fixed problem when entering multiple domains separated by commas
@MichaIng
Copy link
Owner

Many thanks. I guess you tested it with Lighttpd? Since with Apache and Nginx, using multiple domains should lead to invalid config files:

Apache:

G_CONFIG_INJECT 'ServerName[[:blank:]]' "ServerName $LETSENCRYPT_DOMAIN" "$fp_defaultsite" '<VirtualHost'

Nginx:

G_CONFIG_INJECT 'server_name[[:blank:]]' "	server_name $LETSENCRYPT_DOMAIN;" "$fp_defaultsite" 'listen[[:blank:]]'

For Apache, it would be thinkable to use the first entry as "main" servername and add subsequent entries as ServerAlias. Not sure which works (best) with the Certbot Apache2 module.

On Nginx multiple names can be added space separated to via server_name directive, so the commas must be replaced then: https://nginx.org/en/docs/http/ngx_http_core_module.html#server_name

I'll see if I find time to add this, should be tested then and the information added to the input box.

Corrected the fix 4cf5f42. Only apply to Lighttpd.
@Ruben-VV
Copy link
Contributor Author

Many thanks. I guess you tested it with Lighttpd? Since with Apache and Nginx, using multiple domains should lead to invalid config files:

Apache:

G_CONFIG_INJECT 'ServerName[[:blank:]]' "ServerName $LETSENCRYPT_DOMAIN" "$fp_defaultsite" '<VirtualHost'

Nginx:

G_CONFIG_INJECT 'server_name[[:blank:]]' "	server_name $LETSENCRYPT_DOMAIN;" "$fp_defaultsite" 'listen[[:blank:]]'

For Apache, it would be thinkable to use the first entry as "main" servername and add subsequent entries as ServerAlias. Not sure which works (best) with the Certbot Apache2 module.

On Nginx multiple names can be added space separated to via server_name directive, so the commas must be replaced then: https://nginx.org/en/docs/http/ngx_http_core_module.html#server_name

I'll see if I find time to add this, should be tested then and the information added to the input box.

Yes, I tested it in Lighttpd and it work well.
I have made another change so that it only applies in Lighttpd

+ DietPi-LetsEncrypt: Add explanation about simple Lighttpd multi domain support, slight more explicit/clear string manipulation method
@MichaIng
Copy link
Owner

Okay, many thanks, I'll merge it as it does not hurt at all and simply works 👍. Full support including Apache2 and Nginx likely follows next version then, probably I can even add it during beta phase as method is clear already.

I slightly adjusted the method: ${var%%,*} more explicitly means to cut away the longest match from "," till end (${var%,*} would be shortest match). Its only to make it more definit what is meant since practically you code does the same, replaces the longest match by default.

@MichaIng MichaIng added this to the v6.32 milestone Aug 24, 2020
@MichaIng MichaIng changed the title fix multiple domains separated by commas DietPi-LetsEncrypt | Initial Lighttpd-only support for multiple comma-separated domains Aug 24, 2020
@MichaIng MichaIng linked an issue Aug 24, 2020 that may be closed by this pull request
@MichaIng MichaIng merged commit 7bef07c into MichaIng:dev Aug 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DietPi-LetsEncrypt | Support multiple domains
2 participants