|
|
|
@ -3,46 +3,47 @@ source /etc/os-release
|
|
|
|
|
|
|
|
|
|
# Create system users
|
|
|
|
|
useradd -U -r -s /usr/sbin/nologin nginx
|
|
|
|
|
useradd -U -r -s /usr/sbin/nologin php-niver
|
|
|
|
|
useradd -U -r -s /usr/sbin/nologin php-errors
|
|
|
|
|
useradd -U -r -s /usr/sbin/nologin niver
|
|
|
|
|
useradd -U -r -s /usr/sbin/nologin sftpgo
|
|
|
|
|
|
|
|
|
|
# Set proper permissions
|
|
|
|
|
|
|
|
|
|
chown -R knot:knot /var/lib/knot/confdb
|
|
|
|
|
chmod -R u=rwX,g=rwX,o= /var/lib/knot/confdb
|
|
|
|
|
usermod -aG knot php-niver
|
|
|
|
|
usermod -aG knot niver
|
|
|
|
|
|
|
|
|
|
chown -R knot:knot /var/log/knot
|
|
|
|
|
chmod -R 700 /var/log/knot
|
|
|
|
|
chmod -R u=rwX,g=,o= /var/log/knot
|
|
|
|
|
|
|
|
|
|
chown -R php-niver:knot /srv/ns
|
|
|
|
|
chmod -R 770 /srv/ns
|
|
|
|
|
chown -R niver:knot /srv/niver/ns
|
|
|
|
|
chmod -R u=rwX,g=rwX,o= /srv/niver/ns
|
|
|
|
|
chown -R niver:knot /srv/niver/reg
|
|
|
|
|
chmod -R u=rwX,g=rwX,o= /srv/niver/reg
|
|
|
|
|
|
|
|
|
|
chown -R php-niver:php-niver /etc/nginx/ht
|
|
|
|
|
chown -R niver:nginx /srv/niver/nginx
|
|
|
|
|
chmod -R u=rwX,g=rX,o= /srv/niver/nginx
|
|
|
|
|
|
|
|
|
|
chown -R sftpgo:sftpgo /etc/sftpgo
|
|
|
|
|
chmod -R u=rX,g=rX,o=rX /etc/sftpgo
|
|
|
|
|
chmod u=r,g=,o= /etc/sftpgo/ed25519
|
|
|
|
|
|
|
|
|
|
chown -R php-niver:sftpgo /srv/ht
|
|
|
|
|
chmod -R u=rwX,g=rwX,o=rX /srv/ht
|
|
|
|
|
chown -R niver:sftpgo /srv/niver/ht
|
|
|
|
|
chmod -R u=rwX,g=rwX,o=rX /srv/niver/ht
|
|
|
|
|
|
|
|
|
|
if [[ $ID = "debian" ]]; then
|
|
|
|
|
chown -R php-niver:debian-tor /etc/tor
|
|
|
|
|
chown -R niver:debian-tor /srv/niver/tor-config
|
|
|
|
|
chown -R debian-tor:debian-tor /srv/niver/tor-keys
|
|
|
|
|
else
|
|
|
|
|
chown -R php-niver:tor /etc/tor
|
|
|
|
|
chown -R niver:tor /srv/niver/tor-config
|
|
|
|
|
chown -R tor:tor /srv/niver/tor-keys
|
|
|
|
|
fi
|
|
|
|
|
chmod -R u=rwX,g=rX,o= /etc/tor
|
|
|
|
|
chmod -R u=rwX,g=rX,o= /srv/niver/tor-config
|
|
|
|
|
chmod -R u=rwX,g=,o= /srv/niver/tor-keys
|
|
|
|
|
|
|
|
|
|
chmod u=rX,g=rX,o=rX /srv/php
|
|
|
|
|
|
|
|
|
|
chown -R php-errors:nginx /srv/php/errors
|
|
|
|
|
chmod -R u=rX,g=rX,o= /srv/php/errors
|
|
|
|
|
|
|
|
|
|
chown -R php-niver:nginx /srv/php/niver
|
|
|
|
|
chmod -R u=rX,g=rX,o=X /srv/php/niver
|
|
|
|
|
chmod -R u=rwX,g=,o= /srv/php/niver/db
|
|
|
|
|
chown -R niver:nginx /srv/niver/core /srv/niver/errors
|
|
|
|
|
chmod -R u=rX,g=rX,o= /srv/niver/core /srv/niver/errors
|
|
|
|
|
chown -R niver:niver /srv/niver/core/db
|
|
|
|
|
chmod -R u=rwX,g=,o= /srv/niver/core/db
|
|
|
|
|
|
|
|
|
|
# Load configuration in Knot database
|
|
|
|
|
sudo -u knot knotc conf-import /etc/knot/knot.conf
|
|
|
|
@ -73,8 +74,8 @@ if [[ $ID = "debian" ]]; then
|
|
|
|
|
sed -i 's/User tor/User debian-tor/' /etc/tor/torrc
|
|
|
|
|
sed -i 's/reload tor/reload tor@default/' /etc/sudoers.d/niver
|
|
|
|
|
sed -i 's/ALL=(tor)/ALL=(debian-tor)/' /etc/sudoers.d/niver
|
|
|
|
|
sed -i 's/tor_service = "tor"/tor_service = "tor@default"/' /srv/php/niver/config.ini
|
|
|
|
|
sed -i 's/tor_user = "tor"/tor_user = "debian-tor"/' /srv/php/niver/config.ini
|
|
|
|
|
sed -i 's/tor_service = "tor"/tor_service = "tor@default"/' /srv/niver/core/config.ini
|
|
|
|
|
sed -i 's/tor_user = "tor"/tor_user = "debian-tor"/' /srv/niver/core/config.ini
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Start SystemD services at startup
|
|
|
|
|