Skip to content

Commit d6c0903

Browse files
committed
Use canonical deploy identity for TLS staging
1 parent c331309 commit d6c0903

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

.github/workflows/mainnet-origin-tls-install.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ jobs:
9999
deploy_dir=/opt/lithoscan-mainnet
100100
active=/etc/nginx/sites-enabled/lithoscan.ai.conf
101101
upload_dir="$deploy_dir/tls-staging"
102+
current_user="$(id -un)"
102103
103104
actual_helper_sha="$(sha256sum "$helper" | cut -d' ' -f1)"
104105
echo "helper_sha256=$actual_helper_sha"
@@ -122,11 +123,11 @@ jobs:
122123
stat --format='tls_staging=%F owner=%U:%G mode=%a path=%n' "$upload_dir"
123124
test -d "$upload_dir" && test ! -L "$upload_dir" || { echo "TLS staging path is not a real directory" >&2; exit 1; }
124125
test "$(readlink -f "$upload_dir")" = "$upload_dir" || { echo "TLS staging path contains a symlink" >&2; exit 1; }
125-
test "$(stat -c %U "$upload_dir")" = "$USER" || { echo "TLS staging directory owner differs from deploy user" >&2; exit 1; }
126+
test "$(stat -c %U "$upload_dir")" = "$current_user" || { echo "TLS staging directory owner differs from deploy user" >&2; exit 1; }
126127
test "$(stat -c %a "$upload_dir")" = 700 || { echo "TLS staging directory must use mode 0700" >&2; exit 1; }
127128
else
128129
install -d -m 0700 "$upload_dir"
129-
echo "tls_staging=created owner=$USER mode=700 path=$upload_dir"
130+
echo "tls_staging=created owner=$current_user mode=700 path=$upload_dir"
130131
fi
131132
rm -f -- "$upload_dir/fullchain.pem" "$upload_dir/privkey.pem"
132133
REMOTE

0 commit comments

Comments
 (0)