Runtime Permission Requirements for clmBot
When clmBot performs automatic certificate renewal, it needs read/write access to the target certificate files and must reload or restart the corresponding middleware services after the update. This document describes the recommended minimal permission configuration for various middleware scenarios.
The middleware reload / restart commands are defined in the config.yaml field of servers[].after_script. Users can adjust them based on their actual environment. clmBot does not require long-term operation under high-privilege accounts such as root or Administrator.
Principle of Least Privilege
It is recommended to run clmBot with a dedicated system account (e.g., clmbot) and follow these principles:
- Grant this account only the permissions needed to read the clmBot configuration, log directories, and target certificate installation points.
- Grant write permissions only to the certificate files, private key files, and their containing directories managed by clmBot.
- Allow only confirmed middleware reload / restart commands to be executed; do not grant
NOPASSWD: ALLor full root permissions. before_scriptandafter_scriptmust undergo manual review, and the permissions required in scripts should be granted on a per-item basis.
Not recommended practices:
- Let clmBot run persistently as
rootorAdministrator. - Grant clmBot full access to the middleware configuration directory, certificate directory, or system service control permissions.
- Grant
bash,powershell.exe, andsystemctlunrestricted execution permissions.
Permission Requirements for Each Middleware
nginx
clmBot requires the following permissions:
- Read/write permissions on certificate directories: Read and write access to the directories containing the target certificate file (
.crt), the CA chain file (optional), and the private key file (.key), so that new certificates can be written and the.bakbackup can be created. - Execute the reload command:
after_scriptgenerates the following script by default to reload nginx after certificate updates:
nginx -t && nginx -s reload
Least-privilege recommendations:
- Only open the target certificate directory; do not grant read/write permissions to the entire
/etc/nginx. - Use sudoers to grant precise authorization for
nginx -tandnginx -s reload; do not grant a full root shell.
Apache HTTP Server
clmBot requires the following permissions:
- Read/write permissions for the certificate directory: Read/write access to the directories containing
SSLCertificateFile,SSLCertificateChainFile, andSSLCertificateKeyFile. - Execution permission for the service restart command:
after_scriptgenerates one of the following scripts by default (depending on the distribution):
systemctl restart httpd.service
systemctl restart apache2.service
Minimum authorization recommendations:
- Only open the target certificate directory; do not grant access to the entire Apache configuration directory.
- Via sudoers, grant
restartpermissions only to the Apache service name actually used on the current system.
Tomcat
clmBot requires the following permissions:
- Read/write permissions on certificate directories: Read/write access to the directory containing PEM certificate/private key files or the JKS keystore file.
- Execute stop and start scripts:
after_scriptgenerates the following scripts by default:
export JAVA_HOME="<java_home>" && "<catalina_base>/bin/shutdown.sh" && "<catalina_base>/bin/startup.sh"
Minimum authorization recommendations:
- Prioritize placing clmBot and Tomcat in the same business group, granting only read/write permissions for the target keystore or certificate directory.
- Only allow execution of
shutdown.shandstartup.shfor the corresponding Tomcat instance, without granting access to the entire/optdirectory. - In multi-instance Tomcat environments, authorization should be split per instance.
IIS
IIS scenarios rely on Windows PowerShell scripts to import PFX and update HTTPS bindings, requiring administrator privileges.
clmBot requires the following permissions:
- Run under an administrator account: Execute
powershell.exe -NoProfile -ExecutionPolicy Bypassto import the temporary PFX and update IIS site bindings. - Read/write permissions for the certificate directory: For creating and cleaning up temporary PFX files.
Minimum authorization recommendations:
- Use a dedicated Windows service account, granting only the permissions needed to manage the target IIS site bindings.
- PowerShell execution policy and module permissions should be reviewed separately according to the host security baseline.
Example Linux sudoers configuration
The following example only illustrates the authorization granularity; adjust the actual paths according to the target host.
nginx:
clmbot ALL=(root) NOPASSWD: /usr/sbin/nginx -t
clmbot ALL=(root) NOPASSWD: /usr/sbin/nginx -s reload
Apache:
clmbot ALL=(root) NOPASSWD: /bin/systemctl restart apache2.service
Tomcat:
clmbot ALL=(tomcat) NOPASSWD: /opt/apache-tomcat/bin/shutdown.sh
clmbot ALL=(tomcat) NOPASSWD: /opt/apache-tomcat/bin/startup.sh
Certificate Inventory Permission Example:
chown -R root:clmbot /etc/ssl/example
chmod 0750 /etc/ssl/example
chmod 0640 /etc/ssl/example/site.crt /etc/ssl/example/ca.crt
chmod 0640 /etc/ssl/example/site.key
To allow clmBot to write to and back up the above files, you can use ACL for precise authorization:
setfacl -m u:clmbot:rwx /etc/ssl/example
setfacl -m u:clmbot:rw- /etc/ssl/example/site.crt
setfacl -m u:clmbot:rw- /etc/ssl/example/ca.crt
setfacl -m u:clmbot:rw- /etc/ssl/example/site.key
Pre-Launch Permission Checklist
Before deploying clmBot, it is recommended to verify the following permission configurations item by item.
- Whether clmBot runs with a dedicated account, rather than
rootor an administrator. - Whether
config.yamlallows read and write access only to necessary accounts. - Whether the certificate file pointed to by each
servers[].formathas only the required read and write permissions enabled. - Whether the directory containing certificate files allows creation and cleanup of
.bakbackup files. - Whether
before_scriptandafter_scripthave been manually audited. - Whether sudoers contains only exact commands, rather than
ALL,bash, or the fullsystemctl. - Whether the reload or restart permissions for nginx / Apache / Tomcat cover only the target instances.
- Whether the service mode (
clm-bot server) listening address and port comply with the host firewall policy.