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

Please allow custom CA naming from PKI configuration via Caddyfile #4435

Closed
tgelite opened this issue Nov 24, 2021 · 2 comments · Fixed by #4450
Closed

Please allow custom CA naming from PKI configuration via Caddyfile #4435

tgelite opened this issue Nov 24, 2021 · 2 comments · Fixed by #4450
Labels
feature ⚙️ New feature or request
Milestone

Comments

@tgelite
Copy link

tgelite commented Nov 24, 2021

It would be >really< useful to be able to configure custom root CA naming (subject dn string) via the Caddyfile.

Today we have to do something like this in our setup scripts to handle this:

CA_CN_ID=$(cat /sys/class/net/eth0/address | sha1sum | awk '{print $1}')
curl -X POST \
 --url http://localhost:2019/config/apps/pki \
 -H 'Content-Type: application/json' \
 --data "{
      \"certificate_authorities\": {
        \"local\":{
          \"install_trust\": true,
          \"root_common_name\": \"Custom Local Root CA - $CA_CN_ID\",
          \"intermediate_common_name\": \"Custom Intermediate CA\",
          \"name\": \"Custom CA\"
        }
      }
    }"

It would be far easier to use SED on our default Caddyfile that we use, that we bring in via API ahead of that API config with:

HEADERS=(-H 'Content-Type: application/json')
OPTIONS=(-X POST)
URL="localhost:2019/load"
CONF="$(caddy adapt --config /home/pi/elite-pi/elite-caddy/Caddyfile)" 
curl "${OPTIONS[@]}" "${URL}" "${HEADERS[@]}" --data "${CONF}" 
@francislavoie
Copy link
Member

Feel free to try it out! #4450

@mholt
Copy link
Member

mholt commented Dec 13, 2021

@tgelite Does the proposed PR work for your needs? I would like its utility to be verified before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature ⚙️ New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants