mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-03-01 21:57:38 +01:00
Preserve cert alias case #609
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @RinkAttendant6 on GitHub (Jun 9, 2023).
Issue
The certalias will always be lowercased regardless of how it was specified in domains.txt.
Input
domains.txt
Output
A directory named
vs-foo-httpis created to store files. Thealiasenvironment variable as mentioned in #907 will also contain the value in lowercase.Expected output
A directory named
vs-FOO-HTTP, and similarly thealiasvariable should contain the original case of the alias.Details
Initially this behaviour seems odd as the vast majority of Linux systems have case-sensitive filesystem as opposed to typical Windows filesystem usage, so I did some more investigation.
The code on https://github.com/dehydrated-io/dehydrated/blob/v0.7.1/dehydrated#L1674 transforms the entire file to lowercase before any other processing takes place (stripping comments/blank lines, etc.). This was originally added in
33f07fcc0bto fix #176, where there was an issue with case-sensitivity in the domain names with specific ACME servers (not sure which, since Let's Encrypt doesn't have this issue).Lowercasing the entire input rather than the domains seems overkill. Was it done for performance reasons to avoid repeatedly running
trorawkfor each line (around lines 1719, 1720)?For my use case, I am not too concerned with the name of the directory on the filesystem, but I am using the alias value to deploy the certs in the hook script. Specifically I followed this tutorial: https://community.f5.com/t5/technical-articles/automate-let-s-encrypt-certificates-on-big-ip/ta-p/293783/redirect_from_archived_page/true , but instead of having the F5_HTTP environment variable (where it would be constant for the entire script), I'm using the alias in domains.txt to specify the name of the virtual server that the each set of cert/chain/key should be deployed to. That name is case sensitive.
For now, I have added an extra function in my hook script to read domains.txt to find a non-comment line that ends with
> vs-foo-http, to get the original case (vs-FOO-HTTP)...(for anyone who might use it: the code isn't perfect, it assumes the existence of an explicitly stated alias and exactly one space after the
>, it's just an example)It works, and luckily for me it's only deploy_challenge and clean_challenge that requires it, but it's not the greatest to have to run that.
This tool is great, and I've definitely improved my skills in Bash scripting by reading through the code to understand some of what it is doing.