diff options
author | Patrick Spek <p.spek@tyil.nl> | 2022-04-25 14:38:22 +0200 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2022-04-25 14:38:22 +0200 |
commit | e177232fb815a0ce4d4c9f9894f76c038f819302 (patch) | |
tree | 5f347b736dfc16edbb323fc1016eda21ef96403d /playbooks.d/webserver-nginx/playbook.bash | |
parent | b8f5d5769068ee6e34fa1c82a740a6d16d9836ad (diff) |
Set customizable nginx user/group
Diffstat (limited to 'playbooks.d/webserver-nginx/playbook.bash')
-rw-r--r-- | playbooks.d/webserver-nginx/playbook.bash | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/playbooks.d/webserver-nginx/playbook.bash b/playbooks.d/webserver-nginx/playbook.bash index 85c38be..b436018 100644 --- a/playbooks.d/webserver-nginx/playbook.bash +++ b/playbooks.d/webserver-nginx/playbook.bash @@ -5,14 +5,14 @@ playbook_add() info "webserver/add" "Installing packages" pkg install certbot nginx - info "webserver/add" "Create www user" - groupadd www + info "webserver/add" "Create nginx user account" + groupadd "$(config "nginx.group")" useradd \ --home-dir /var/www \ - --gid www \ + --gid "$(config "nginx.group")" \ --system \ --shell /sbin/nologin \ - www + "$(config "nginx.user")" info "webserver/add" "Cleaning up whatever the package manager did" rm -frv -- "$(config "fs.etcdir")/nginx" @@ -47,6 +47,7 @@ playbook_sync() notice "webserver/sync" "Updating nginx.conf" file_template "nginx.conf" \ etc="$(config "fs.etcdir")" \ + user="$(config "nginx.user")" \ > "$(config "fs.etcdir")/nginx/nginx.conf" notice "webserver/sync" "Updating mime.types" @@ -83,7 +84,7 @@ playbook_sync() done notice "webserver/sync" "Set nginx permissions to www user" - chown -R www:www "$(config "fs.etcdir")/nginx" + chown -R "$(config "nginx.user"):$(config "nginx.group")" "$(config "fs.etcdir")/nginx" notice "webserver/sync" "Renewing Let's Encrypt certificates" certbot renew --no-random-sleep-on-renew |