mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 21:18:13 -05:00
step down from host root LUID
This commit is contained in:
parent
ecb490e8a8
commit
95b25246f1
@ -1,18 +1,26 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
NOUSER=`id -u bitwarden > /dev/null 2>&1; echo $?`
|
USERNAME="bitwarden"
|
||||||
|
NOUSER=`id -u $USERNAME > /dev/null 2>&1; echo $?`
|
||||||
LUID=${LOCAL_UID:-999}
|
LUID=${LOCAL_UID:-999}
|
||||||
if [ $NOUSER == 0 ] && [ `id -u bitwarden` != $LUID ]
|
|
||||||
|
# Step down from host root
|
||||||
|
if [ $LUID == 0 ]
|
||||||
then
|
then
|
||||||
usermod -u $LUID bitwarden
|
LUID=999
|
||||||
elif [ $NOUSER == 1 ]
|
|
||||||
then
|
|
||||||
useradd -r -u $LUID -g bitwarden bitwarden
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chown -R bitwarden:bitwarden /app
|
if [ $NOUSER == 0 ] && [ `id -u $USERNAME` != $LUID ]
|
||||||
|
then
|
||||||
|
usermod -u $LUID $USERNAME
|
||||||
|
elif [ $NOUSER == 1 ]
|
||||||
|
then
|
||||||
|
useradd -r -u $LUID -g $USERNAME $USERNAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
chown -R $USERNAME:$USERNAME /app
|
||||||
mkdir -p /etc/bitwarden/core
|
mkdir -p /etc/bitwarden/core
|
||||||
mkdir -p /etc/bitwarden/logs
|
mkdir -p /etc/bitwarden/logs
|
||||||
chown -R bitwarden:bitwarden /etc/bitwarden
|
chown -R $USERNAME:$USERNAME /etc/bitwarden
|
||||||
|
|
||||||
gosu bitwarden:bitwarden dotnet /app/Admin.dll
|
gosu $USERNAME:$USERNAME dotnet /app/Admin.dll
|
||||||
|
@ -1,22 +1,30 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
NOUSER=`id -u bitwarden > /dev/null 2>&1; echo $?`
|
USERNAME="bitwarden"
|
||||||
|
NOUSER=`id -u $USERNAME > /dev/null 2>&1; echo $?`
|
||||||
LUID=${LOCAL_UID:-999}
|
LUID=${LOCAL_UID:-999}
|
||||||
if [ $NOUSER == 0 ] && [ `id -u bitwarden` != $LUID ]
|
|
||||||
|
# Step down from host root
|
||||||
|
if [ $LUID == 0 ]
|
||||||
then
|
then
|
||||||
usermod -u $LUID bitwarden
|
LUID=999
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $NOUSER == 0 ] && [ `id -u $USERNAME` != $LUID ]
|
||||||
|
then
|
||||||
|
usermod -u $LUID $USERNAME
|
||||||
elif [ $NOUSER == 1 ]
|
elif [ $NOUSER == 1 ]
|
||||||
then
|
then
|
||||||
useradd -r -u $LUID -g bitwarden bitwarden
|
useradd -r -u $LUID -g $USERNAME $USERNAME
|
||||||
fi
|
fi
|
||||||
|
|
||||||
touch /var/log/cron.log
|
touch /var/log/cron.log
|
||||||
chown bitwarden:bitwarden /var/log/cron.log
|
chown $USERNAME:$USERNAME /var/log/cron.log
|
||||||
chown -R bitwarden:bitwarden /app
|
chown -R $USERNAME:$USERNAME /app
|
||||||
chown -R bitwarden:bitwarden /jobs
|
chown -R $USERNAME:$USERNAME /jobs
|
||||||
mkdir -p /etc/bitwarden/core
|
mkdir -p /etc/bitwarden/core
|
||||||
mkdir -p /etc/bitwarden/logs
|
mkdir -p /etc/bitwarden/logs
|
||||||
chown -R bitwarden:bitwarden /etc/bitwarden
|
chown -R $USERNAME:$USERNAME /etc/bitwarden
|
||||||
|
|
||||||
env >> /etc/environment
|
env >> /etc/environment
|
||||||
cron
|
cron
|
||||||
|
@ -1,17 +1,25 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
NOUSER=`id -u bitwarden > /dev/null 2>&1; echo $?`
|
USERNAME="bitwarden"
|
||||||
|
NOUSER=`id -u $USERNAME > /dev/null 2>&1; echo $?`
|
||||||
LUID=${LOCAL_UID:-999}
|
LUID=${LOCAL_UID:-999}
|
||||||
if [ $NOUSER == 0 ] && [ `id -u bitwarden` != $LUID ]
|
|
||||||
|
# Step down from host root
|
||||||
|
if [ $LUID == 0 ]
|
||||||
then
|
then
|
||||||
usermod -u $LUID bitwarden
|
LUID=999
|
||||||
elif [ $NOUSER == 1 ]
|
|
||||||
then
|
|
||||||
useradd -r -u $LUID -g bitwarden bitwarden
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chown -R bitwarden:bitwarden /app
|
if [ $NOUSER == 0 ] && [ `id -u $USERNAME` != $LUID ]
|
||||||
chown -R bitwarden:bitwarden /etc/iconserver
|
then
|
||||||
|
usermod -u $LUID $USERNAME
|
||||||
|
elif [ $NOUSER == 1 ]
|
||||||
|
then
|
||||||
|
useradd -r -u $LUID -g $USERNAME $USERNAME
|
||||||
|
fi
|
||||||
|
|
||||||
gosu bitwarden:bitwarden /etc/iconserver/iconserver &
|
chown -R $USERNAME:$USERNAME /app
|
||||||
gosu bitwarden:bitwarden dotnet /app/Icons.dll iconsSettings:bestIconBaseUrl=http://localhost:8080
|
chown -R $USERNAME:$USERNAME /etc/iconserver
|
||||||
|
|
||||||
|
gosu $USERNAME:$USERNAME /etc/iconserver/iconserver &
|
||||||
|
gosu $USERNAME:$USERNAME dotnet /app/Icons.dll iconsSettings:bestIconBaseUrl=http://localhost:8080
|
||||||
|
@ -1,21 +1,29 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
NOUSER=`id -u bitwarden > /dev/null 2>&1; echo $?`
|
USERNAME="bitwarden"
|
||||||
|
NOUSER=`id -u $USERNAME > /dev/null 2>&1; echo $?`
|
||||||
LUID=${LOCAL_UID:-999}
|
LUID=${LOCAL_UID:-999}
|
||||||
if [ $NOUSER == 0 ] && [ `id -u bitwarden` != $LUID ]
|
|
||||||
|
# Step down from host root
|
||||||
|
if [ $LUID == 0 ]
|
||||||
then
|
then
|
||||||
usermod -u $LUID bitwarden
|
LUID=999
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $NOUSER == 0 ] && [ `id -u $USERNAME` != $LUID ]
|
||||||
|
then
|
||||||
|
usermod -u $LUID $USERNAME
|
||||||
elif [ $NOUSER == 1 ]
|
elif [ $NOUSER == 1 ]
|
||||||
then
|
then
|
||||||
useradd -r -u $LUID -g bitwarden bitwarden
|
useradd -r -u $LUID -g $USERNAME $USERNAME
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p /etc/bitwarden/identity
|
mkdir -p /etc/bitwarden/identity
|
||||||
mkdir -p /etc/bitwarden/core
|
mkdir -p /etc/bitwarden/core
|
||||||
mkdir -p /etc/bitwarden/logs
|
mkdir -p /etc/bitwarden/logs
|
||||||
chown -R bitwarden:bitwarden /etc/bitwarden
|
chown -R $USERNAME:$USERNAME /etc/bitwarden
|
||||||
|
|
||||||
cp /etc/bitwarden/identity/identity.pfx /app/identity.pfx
|
cp /etc/bitwarden/identity/identity.pfx /app/identity.pfx
|
||||||
chown -R bitwarden:bitwarden /app
|
chown -R $USERNAME:$USERNAME /app
|
||||||
|
|
||||||
gosu bitwarden:bitwarden dotnet /app/Identity.dll
|
gosu $USERNAME:$USERNAME dotnet /app/Identity.dll
|
||||||
|
@ -1,18 +1,26 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
NOUSER=`id -u bitwarden > /dev/null 2>&1; echo $?`
|
USERNAME="bitwarden"
|
||||||
|
NOUSER=`id -u $USERNAME > /dev/null 2>&1; echo $?`
|
||||||
LUID=${LOCAL_UID:-999}
|
LUID=${LOCAL_UID:-999}
|
||||||
if [ $NOUSER == 0 ] && [ `id -u bitwarden` != $LUID ]
|
|
||||||
|
# Step down from host root
|
||||||
|
if [ $LUID == 0 ]
|
||||||
then
|
then
|
||||||
usermod -u $LUID bitwarden
|
LUID=999
|
||||||
elif [ $NOUSER == 1 ]
|
|
||||||
then
|
|
||||||
useradd -r -u $LUID -g bitwarden bitwarden
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chown -R bitwarden:bitwarden /bitwarden_server
|
if [ $NOUSER == 0 ] && [ `id -u $USERNAME` != $LUID ]
|
||||||
mkdir -p /etc/bitwarden/core/attachments
|
then
|
||||||
chown -R bitwarden:bitwarden /etc/bitwarden
|
usermod -u $LUID $USERNAME
|
||||||
|
elif [ $NOUSER == 1 ]
|
||||||
|
then
|
||||||
|
useradd -r -u $LUID -g $USERNAME $USERNAME
|
||||||
|
fi
|
||||||
|
|
||||||
gosu bitwarden:bitwarden dotnet /bitwarden_server/Server.dll \
|
chown -R $USERNAME:$USERNAME /bitwarden_server
|
||||||
|
mkdir -p /etc/bitwarden/core/attachments
|
||||||
|
chown -R $USERNAME:$USERNAME /etc/bitwarden
|
||||||
|
|
||||||
|
gosu $USERNAME:$USERNAME dotnet /bitwarden_server/Server.dll \
|
||||||
/contentRoot=/etc/bitwarden/core/attachments /webRoot=. /serveUnknown=true
|
/contentRoot=/etc/bitwarden/core/attachments /webRoot=. /serveUnknown=true
|
||||||
|
@ -1,25 +1,33 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
NOUSER=`id -u bitwarden > /dev/null 2>&1; echo $?`
|
USERNAME="bitwarden"
|
||||||
|
NOUSER=`id -u $USERNAME > /dev/null 2>&1; echo $?`
|
||||||
LUID=${LOCAL_UID:-999}
|
LUID=${LOCAL_UID:-999}
|
||||||
if [ $NOUSER == 0 ] && [ `id -u bitwarden` != $LUID ]
|
|
||||||
|
# Step down from host root
|
||||||
|
if [ $LUID == 0 ]
|
||||||
then
|
then
|
||||||
usermod -u $LUID bitwarden
|
LUID=999
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $NOUSER == 0 ] && [ `id -u $USERNAME` != $LUID ]
|
||||||
|
then
|
||||||
|
usermod -u $LUID $USERNAME
|
||||||
elif [ $NOUSER == 1 ]
|
elif [ $NOUSER == 1 ]
|
||||||
then
|
then
|
||||||
useradd -r -u $LUID -g bitwarden bitwarden
|
useradd -r -u $LUID -g $USERNAME $USERNAME
|
||||||
fi
|
fi
|
||||||
|
|
||||||
touch /var/log/cron.log
|
touch /var/log/cron.log
|
||||||
chown bitwarden:bitwarden /var/log/cron.log
|
chown $USERNAME:$USERNAME /var/log/cron.log
|
||||||
mkdir -p /etc/bitwarden/mssql/backups
|
mkdir -p /etc/bitwarden/mssql/backups
|
||||||
chown -R bitwarden:bitwarden /etc/bitwarden
|
chown -R $USERNAME:$USERNAME /etc/bitwarden
|
||||||
mkdir -p /var/opt/mssql/data
|
mkdir -p /var/opt/mssql/data
|
||||||
chown -R bitwarden:bitwarden /var/opt/mssql
|
chown -R $USERNAME:$USERNAME /var/opt/mssql
|
||||||
chown bitwarden:bitwarden /backup-db.sh
|
chown $USERNAME:$USERNAME /backup-db.sh
|
||||||
chown bitwarden:bitwarden /backup-db.sql
|
chown $USERNAME:$USERNAME /backup-db.sql
|
||||||
|
|
||||||
env >> /etc/environment
|
env >> /etc/environment
|
||||||
cron
|
cron
|
||||||
|
|
||||||
gosu bitwarden:bitwarden /opt/mssql/bin/sqlservr
|
gosu $USERNAME:$USERNAME /opt/mssql/bin/sqlservr
|
||||||
|
@ -1,24 +1,32 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
NOUSER=`id -u bitwarden > /dev/null 2>&1; echo $?`
|
USERNAME="bitwarden"
|
||||||
|
NOUSER=`id -u $USERNAME > /dev/null 2>&1; echo $?`
|
||||||
LUID=${LOCAL_UID:-999}
|
LUID=${LOCAL_UID:-999}
|
||||||
if [ $NOUSER == 0 ] && [ `id -u bitwarden` != $LUID ]
|
|
||||||
|
# Step down from host root
|
||||||
|
if [ $LUID == 0 ]
|
||||||
then
|
then
|
||||||
usermod -u $LUID bitwarden
|
LUID=999
|
||||||
elif [ $NOUSER == 1 ]
|
|
||||||
then
|
|
||||||
useradd -r -u $LUID -g bitwarden bitwarden
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chown -R bitwarden:bitwarden /etc/bitwarden
|
if [ $NOUSER == 0 ] && [ `id -u $USERNAME` != $LUID ]
|
||||||
|
then
|
||||||
|
usermod -u $LUID $USERNAME
|
||||||
|
elif [ $NOUSER == 1 ]
|
||||||
|
then
|
||||||
|
useradd -r -u $LUID -g $USERNAME $USERNAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
chown -R $USERNAME:$USERNAME /etc/bitwarden
|
||||||
cp /etc/bitwarden/nginx/default.conf /etc/nginx/conf.d/default.conf
|
cp /etc/bitwarden/nginx/default.conf /etc/nginx/conf.d/default.conf
|
||||||
mkdir -p /etc/letsencrypt
|
mkdir -p /etc/letsencrypt
|
||||||
chown -R bitwarden:bitwarden /etc/letsencrypt
|
chown -R $USERNAME:$USERNAME /etc/letsencrypt
|
||||||
mkdir -p /etc/ssl
|
mkdir -p /etc/ssl
|
||||||
chown -R bitwarden:bitwarden /etc/ssl
|
chown -R $USERNAME:$USERNAME /etc/ssl
|
||||||
touch /var/run/nginx.pid
|
touch /var/run/nginx.pid
|
||||||
chown -R bitwarden:bitwarden /var/run/nginx.pid
|
chown -R $USERNAME:$USERNAME /var/run/nginx.pid
|
||||||
chown -R bitwarden:bitwarden /var/cache/nginx
|
chown -R $USERNAME:$USERNAME /var/cache/nginx
|
||||||
chown -R bitwarden:bitwarden /var/log/nginx
|
chown -R $USERNAME:$USERNAME /var/log/nginx
|
||||||
|
|
||||||
gosu bitwarden:bitwarden nginx -g 'daemon off;'
|
gosu $USERNAME:$USERNAME nginx -g 'daemon off;'
|
||||||
|
@ -1,22 +1,30 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
NOUSER=`id -u bitwarden > /dev/null 2>&1; echo $?`
|
USERNAME="bitwarden"
|
||||||
|
NOUSER=`id -u $USERNAME > /dev/null 2>&1; echo $?`
|
||||||
LUID=${LOCAL_UID:-999}
|
LUID=${LOCAL_UID:-999}
|
||||||
if [ $NOUSER == 0 ] && [ `id -u bitwarden` != $LUID ]
|
|
||||||
|
# Step down from host root
|
||||||
|
if [ $LUID == 0 ]
|
||||||
then
|
then
|
||||||
usermod -u $LUID bitwarden
|
LUID=999
|
||||||
elif [ $NOUSER == 1 ]
|
|
||||||
then
|
|
||||||
useradd -r -u $LUID -g bitwarden bitwarden
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chown -R bitwarden:bitwarden /app
|
if [ $NOUSER == 0 ] && [ `id -u $USERNAME` != $LUID ]
|
||||||
|
then
|
||||||
|
usermod -u $LUID $USERNAME
|
||||||
|
elif [ $NOUSER == 1 ]
|
||||||
|
then
|
||||||
|
useradd -r -u $LUID -g $USERNAME $USERNAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
chown -R $USERNAME:$USERNAME /app
|
||||||
mkdir -p /bitwarden/env
|
mkdir -p /bitwarden/env
|
||||||
mkdir -p /bitwarden/docker
|
mkdir -p /bitwarden/docker
|
||||||
mkdir -p /bitwarden/ssl
|
mkdir -p /bitwarden/ssl
|
||||||
mkdir -p /bitwarden/letsencrypt
|
mkdir -p /bitwarden/letsencrypt
|
||||||
mkdir -p /bitwarden/identity
|
mkdir -p /bitwarden/identity
|
||||||
mkdir -p /bitwarden/nginx
|
mkdir -p /bitwarden/nginx
|
||||||
chown -R bitwarden:bitwarden /bitwarden
|
chown -R $USERNAME:$USERNAME /bitwarden
|
||||||
|
|
||||||
exec gosu bitwarden:bitwarden "$@"
|
exec gosu $USERNAME:$USERNAME "$@"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user