Configuration and updates
Automatic updates and service reloads
Understand update-certificate, script review, .bak backups, service reloads, and success, failure, and rollback logs.
This page describes the complete clmbot certificate-update workflow: the update command, pre- and post-update scripts, backups, service reloads, and log review.
The update-certificate command
./clm-bot-linux-amd64 update-certificate
The command performs these steps in order:
- Check: ask the upstream whether a new certificate is available.
- Retrieve: download the new certificate to the server.
- Back up: copy the old certificate to a
.bakfile in the certificate directory before replacement. - Replace: write the new certificate to paths defined by
servers[]inconfig.yaml. - Reload: run
after_script, such as a service reload, to activate the new certificate.
If no certificate is available, the command exits normally without changing files. Run it manually or periodically through a Scheduled pull task.
Review requirements for before_script and after_script
before_scriptruns before certificate replacement for preparation.after_scriptruns after replacement and usually contains a middleware reload or restart command, such asnginx -t && nginx -s reload.
Required review rules:
- Review every line manually before enabling a script.
- Scripts run with the privileges of the clmbot account. Grant elevated commands through exact sudoers rules. See Least privilege.
- Do not allow unrestricted
bash,powershell.exe, or completesystemctlaccess. - Do not place plaintext credentials in a script.
Certificate backups and rollback
- Before each replacement, clmbot stores the old certificate as a
.bakfile. The runtime account needs permission to create and remove.bakfiles in the certificate directory. - If the new certificate causes a service problem, restore the old file manually from
.bakand reload the service. - The public documentation defines a manual
.bakrecovery process. Do not assume that the program performs an automatic rollback.
Service reloads
after_script reloads the service. See Least privilege for recommended commands and exact authorization patterns:
- Nginx:
nginx -t && nginx -s reload. - Apache:
systemctl restart httpd.serviceorsystemctl restart apache2.service, depending on the distribution. - Tomcat: run
shutdown.shandstartup.shfor the target instance. - IIS: use a PowerShell script to import PFX and update the HTTPS binding.
Success, failure, and rollback logs
- Scheduled-task examples append output to
update.login the runtime directory with>> update.log. - Inspect logs regularly to confirm whether a certificate was found, replacement succeeded, and
after_scriptcompleted. - When an update fails, inspect the error first and work through Troubleshooting.
- Log format may change by release. Evaluate the exit status, terminal output, and service checks together.
- Logs may contain hostnames, paths, and other sensitive information. Sanitize them before sharing. See Security.
Related pages
- Scheduled pull: run updates automatically
- Least privilege: authorize scripts and reload commands
- Troubleshooting: investigate update and reload failures
