Fix postinst to properly chown privkeys

This commit is contained in:
Jason Rhinelander 2021-09-13 17:43:48 -03:00
parent 26851becfd
commit 177ae7fd2e
2 changed files with 3 additions and 2 deletions

View File

@ -21,7 +21,6 @@ sudo curl -so /etc/apt/trusted.gpg.d/oxen.gpg https://deb.oxen.io/pub.gpg
echo "deb https://deb.oxen.io $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/oxen.list
sudo apt update
sudo apt install session-open-group-server
sudo chown _loki /var/lib/session-open-group-server -R
```
### Step 2: Add a room

View File

@ -21,12 +21,14 @@ if [ "$1" = configure ]; then
# Generate the key pair if needed
if ! [ -f $SOGS/x25519_private_key.pem ]; then
openssl genpkey -algorithm x25519 -out $SOGS/x25519_private_key.pem
chown _loki $SOGS/x25519_private_key.pem
rm -f $SOGS/x25519_public_key.pem
fi
if ! [ -f $SOGS/x25519_public_key.pem ]; then
openssl pkey -in $SOGS/x25519_private_key.pem -pubout -out $SOGS/x25519_public_key.pem
chown _loki $SOGS/x25519_public_key.pem
fi
# Set permissions
su -s /bin/sh _loki -c "test -O $SOGS && test -G $SOGS" || \
chown _loki:_loki $SOGS
fi
fi