Skip to content

Commit

Permalink
deb package: add grafana-agent user to adm and systemd-journal groups
Browse files Browse the repository at this point in the history
  • Loading branch information
rfratto committed Jul 22, 2021
1 parent 1a880a3 commit 8b059e5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packaging/deb/control/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ case "$1" in
groupadd -r "$GRAFANA_AGENT_GROUP"
fi
if ! getent passwd "$GRAFANA_AGENT_USER" > /dev/null 2>&1 ; then
useradd -m -r -g grafana-agent -d /var/lib/grafana-agent -s /sbin/nologin -c "grafana-agent user" grafana-agent
useradd -m -r -g "$GRAFANA_AGENT_GROUP" -d /var/lib/grafana-agent -s /sbin/nologin -c "grafana-agent user" "$GRAFANA_AGENT_USER"
fi

# Add grafana agent user to groups used for reading logs.
if ! getent group adm > /dev/null 2>&1 ; then
usermod -a -G adm "$GRAFANA_AGENT_USER"
fi
if ! getent group systemd-journal > /dev/null 2>&1 ; then
usermod -a -G systemd-journal "$GRAFANA_AGENT_USER"
fi

chmod 640 /etc/grafana-agent.yaml
Expand Down

0 comments on commit 8b059e5

Please sign in to comment.