1
0
Fork 0
mirror of https://github.com/librenms/docker.git synced 2026-08-02 14:52:28 +00:00

Review data permissions

Remove usermod/groupmod (Issue #38)
This commit is contained in:
CrazyMax 2019-09-14 23:02:43 +02:00
parent 177b486e84
commit ce51083aaf
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
5 changed files with 20 additions and 8 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 896 B

After

Width:  |  Height:  |  Size: 956 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 897 B

After

Width:  |  Height:  |  Size: 956 B

Before After
Before After

View file

@ -1,5 +1,10 @@
# Changelog
## 1.55-RC2 (2019/09/14)
* Review data permissions
* Remove usermod/groupmod (Issue #38)
## 1.55-RC1 (2019/09/04)
* LibreNMS 1.55

View file

@ -105,6 +105,8 @@ It's a fork of [CrazyMax's LibreNMS Docker image repository](https://github.com/
* `/data` : Contains configuration, rrd database, logs, additional Monitoring plugins, additional syslog-ng config files
> :warning: Note that the volume should be owned by the user/group with the specified `PUID` and `PGID`. If you dont give the volume correct permissions, the container may not start.
### Ports
* `80` : HTTP port

View file

@ -74,11 +74,12 @@ sed -i -e "s|date\.timezone.*|date\.timezone = ${TZ}|" /etc/php7/php.ini \
# Change librenms UID / GID
echo "Checking if librenms UID / GID has changed..."
if [ $(id -u librenms) != ${PUID} ]; then
usermod -u ${PUID} librenms
if [ -n "${PGID}" ] && [ "${PGID}" != "`id -g librenms`" ]; then
sed -i -e "s/^librenms:\([^:]*\):[0-9]*/librenms:\1:${PGID}/" /etc/group
sed -i -e "s/^librenms:\([^:]*\):\([0-9]*\):[0-9]*/librenms:\1:\2:${PGID}/" /etc/passwd
fi
if [ $(id -g librenms) != ${PGID} ]; then
groupmod -g ${PGID} librenms
if [ -n "${PUID}" ] && [ "${PUID}" != "`id -u librenms`" ]; then
sed -i -e "s/^librenms:\([^:]*\):[0-9]*:\([0-9]*\)/librenms:\1:${PUID}:\2/" /etc/passwd
fi
# PHP
@ -213,8 +214,11 @@ fi
# Fix perms
echo "Fixing permissions..."
chown -R librenms. ${DATA_PATH} \
${LIBRENMS_PATH}/config.d \
chown librenms. ${DATA_PATH}/config \
${DATA_PATH}/logs \
${DATA_PATH}/monitoring-plugins \
${DATA_PATH}/rrd
chown -R librenms. ${LIBRENMS_PATH}/config.d \
${LIBRENMS_PATH}/bootstrap \
${LIBRENMS_PATH}/storage
chmod ug+rw ${DATA_PATH}/logs \
@ -263,7 +267,7 @@ if [ "$SIDECAR_CRON" = "1" ]; then
# Add crontab
cat ${LIBRENMS_PATH}/librenms.nonroot.cron > ${CRONTAB_PATH}/librenms
sed -i -e "s/ librenms //" ${CRONTAB_PATH}/librenms
if [ $LIBRENMS_CRON_DISCOVERY_ENABLE != true ]; then
sed -i "/discovery.php/d" ${CRONTAB_PATH}/librenms
fi
@ -306,7 +310,8 @@ elif [ "$SIDECAR_SYSLOGNG" = "1" ]; then
# Init
rm /etc/supervisord/cron.conf /etc/supervisord/nginx.conf /etc/supervisord/php.conf /etc/supervisord/snmpd.conf
mkdir -p ${DATA_PATH}/syslog-ng /run/syslog-ng
chown -R librenms. ${DATA_PATH}/syslog-ng /run/syslog-ng
chown librenms. ${DATA_PATH}/syslog-ng
chown -R librenms. /run/syslog-ng
else
# Init
rm /etc/supervisord/cron.conf /etc/supervisord/syslog-ng.conf