From 78e02a6452c3f0903a5a3aa4a42ee49cce16b4a5 Mon Sep 17 00:00:00 2001 From: Julien Oculi Date: Wed, 17 Jul 2024 16:18:12 +0200 Subject: [PATCH] fix: ensure owner of installed/deployed files are `root` or targeted service --- caddy/_deploy.sh | 2 ++ deploy.sh | 3 +++ install.sh | 3 +++ portfolio_server/_install.sh | 2 ++ website/_install.sh | 2 ++ 5 files changed, 12 insertions(+) diff --git a/caddy/_deploy.sh b/caddy/_deploy.sh index e360c0d..080fc90 100644 --- a/caddy/_deploy.sh +++ b/caddy/_deploy.sh @@ -1,6 +1,8 @@ # Setup caddy config mkdir -p /etc/caddy cp -a ./caddy/caddy/. /etc/caddy/ +# Set directory owner +chown -R caddy:caddy /etc/caddy # Setup caddy service cp ./caddy/systemd/caddy.service /etc/systemd/system diff --git a/deploy.sh b/deploy.sh index 5420645..02dff1e 100644 --- a/deploy.sh +++ b/deploy.sh @@ -2,6 +2,9 @@ echo "[server_config] > Writting secrets to source files" source ./load_secrets.sh +# Make sure default owner of config files is root +chown -R root:root . + # Deploy services APPS=$@ diff --git a/install.sh b/install.sh index 84d3ce8..a4af70c 100644 --- a/install.sh +++ b/install.sh @@ -2,6 +2,9 @@ echo "[server_config] > Installing required utilities" source ./_requirements.sh +# Make sure default owner of config files is root +chown -R root:root . + # Install services APPS=$@ diff --git a/portfolio_server/_install.sh b/portfolio_server/_install.sh index 2076713..f8c8816 100644 --- a/portfolio_server/_install.sh +++ b/portfolio_server/_install.sh @@ -22,5 +22,7 @@ fi rm -rf /srv/portfolio # Create fs tree is missing mkdir -p /srv/portfolio +# Set directory owner +chown -R deno:deno /srv/portfolio # Clone website repo git clone -b main --depth 1 https://git.cohabit.fr/cohabit/portfolio_server.git /srv/portfolio diff --git a/website/_install.sh b/website/_install.sh index f2be832..0310f73 100644 --- a/website/_install.sh +++ b/website/_install.sh @@ -22,5 +22,7 @@ fi rm -rf /srv/www # Create fs structure mkdir -p /srv/www +# Set directory owner +chown -R deno:deno /srv/www # Clone website repo git clone -b main --depth 1 https://git.cohabit.fr/cohabit/website.git /srv/www