Closed adrsham closed 2 years ago
Thanks for this contribution. I'm not expert in the certificate management in XCP-ng, but if this is the recommended way to install certificates, we should probably put this method first, and only provide the older method for older (unsupported) versions of XCP-ng.
By the way, are you sure this was added in 8.2? If it was added earlier, then we should probably remove the old method completely from the docs.
Last comment: why mention only Let's Encrypt? Doesn't this work for any kind of certificates? And since Let's Encrypt requires a frequent renewal of the certs, must you re-do the command each time it's updated?
https://docs.citrix.com/en-us/citrix-hypervisor/hosts-pools.html#install-a-tls-certificate-on-your-server I am referring to this one, which looks like the recommended approach. At least better than overwriting /etc/xensource/xapi-ssl.pem
and restarting xapi.
I know this works for my host running 8.2.1, but I have not tried the same command for earlier versions, like 8.1.
That is a fair point, my intent was to suggest to the reader that they can use LetEncrypt to get a free/valid cert. However, yes, it should work for self signed certs or any other certificate.
As for the frequent renewal, yes, you would have to renew the certs every < 3 months and redo the command. Personally I have a cron job that uploads the certificate to my xcpng host automatically from a VM that only does LetsEncrypt certs, but maybe I am just a crazy person :D
I have a cron entry /usr/bin/certbot certonly -d <hostname> --deploy-hook deploy.sh
#deploy.sh
#!/bin/bash
ssh <ssh-user>@<xcpng-host> 'mkdir -p /home/<ssh-user>/ssl/live/<domain>'
ssh <ssh-user>@<xcpng-host> 'mkdir -p /home/<ssh-user>/ssl/archive/<domain>'
rsync -zrlv live/<domain>/ <ssh-user>@<xcpng-host>:/home/<ssh-user>/ssl/live/<domain>
rsync -zrlv archive/<domain>/ <ssh-user>@<xcpng-host>:/home/<ssh-user>/ssl/archive/<domain>
ssh <ssh-user>@<xcpng-host> 'sudo xe host-server-certificate-install certificate=/home/<ssh-user>/ssl/live/<domain>/cert.pem private-key=/home/<ssh-user>/ssl/live/<domain>/privkey.pem certificate-chain=/home/<ssh-user>/ssl/live/<domain>/chain.pem'
Why close the PR request? It's not merged yet because it raises questions and I have been busy, but it seems pertinent to mention this (probably) better way of installing certificates in the documentation.
Thanks for commenting, I thought there wasn't interest in the PR so closed it early :) Moved some things around based on your previous comment.
For my XCP-ng host (v 8.2.1), I am using
xe host-server-certificate-install
to load certificates from Let's Encrypt.Updating the guide here to reflect this option.
Signed-off-by: adrsham 7330099+adrsham@users.noreply.github.com