mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-22 01:22:00 +00:00
Change confluent to run as non-root and harden systemd
This mitigates a great deal of risk compared to prior behavior.
This commit is contained in:
parent
968efe719a
commit
0d5fa7a98a
@ -52,6 +52,15 @@ cat INSTALLED_FILES
|
||||
if [ -x /usr/bin/systemctl ]; then /usr/bin/systemctl try-restart confluent >& /dev/null; fi
|
||||
true
|
||||
|
||||
%pre
|
||||
getent group confluent > /dev/null || /usr/sbin/groupadd -r confluent
|
||||
getent passwd confluent > /dev/null || /usr/sbin/useradd -r -g confluent -d /var/lib/confluent -s /sbin/nologin confluent
|
||||
mkdir -p /etc/confluent
|
||||
mkdir -p /var/lib/confluent
|
||||
mkdir -p /var/run/confluent
|
||||
mkdir -p /var/log/confluent
|
||||
chown -R confluent:confluent /etc/confluent /var/lib/confluent /var/run/confluent /var/log/confluent
|
||||
|
||||
%post
|
||||
sysctl -p /usr/lib/sysctl.d/confluent.conf >& /dev/null
|
||||
if [ -x /usr/bin/systemctl ]; then /usr/bin/systemctl try-restart confluent >& /dev/null; fi
|
||||
|
@ -1,6 +1,7 @@
|
||||
# IBM(c) 2015 Apache 2.0
|
||||
# Lenovo(c) 2020 Apache 2.0
|
||||
[Unit]
|
||||
Description=Confluent hardware manager
|
||||
Description=Confluent hardware manager
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
@ -9,6 +10,13 @@ ExecStart=/opt/confluent/bin/confluent
|
||||
ExecStop=/opt/confluent/bin/confetty shutdown /
|
||||
Restart=on-failure
|
||||
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||
User=confluent
|
||||
Group=confluent
|
||||
DevicePolicy=closed
|
||||
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
||||
PrivateDevices=true
|
||||
ProtectControlGroups=true
|
||||
ProtectSystem=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
Loading…
Reference in New Issue
Block a user