Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,9 @@ deb: | dist
build-deb/usr/lib/snclient \
build-deb/usr/bin \
build-deb/lib/systemd/system \
build-deb/lib/sysusers.d \
build-deb/lib/tmpfiles.d \
build-deb/etc/sudoers.d \
build-deb/etc/logrotate.d \
build-deb/usr/share/doc/snclient \
build-deb/usr/share/doc/snclient \
Expand All @@ -467,6 +470,9 @@ deb: | dist
cp ./dist/snclient.ini ./dist/server.crt ./dist/server.key ./dist/cacert.pem ./build-deb/etc/snclient
cp -p ./dist/snclient build-deb/usr/bin/snclient
cp ./packaging/snclient.service build-deb/lib/systemd/system/
cp ./packaging/snclient.sysusers build-deb/lib/sysusers.d/snclient.conf
cp ./packaging/snclient.tmpfiles build-deb/lib/tmpfiles.d/snclient.conf
cp ./packaging/snclient.sudoers build-deb/etc/sudoers.d/snclient
cp ./packaging/snclient.logrotate build-deb/etc/logrotate.d/snclient
cp Changes build-deb/usr/share/doc/snclient/Changes
dch --empty --create --newversion "$(VERSION)" --package "snclient" -D "UNRELEASED" --urgency "low" -c build-deb/usr/share/doc/snclient/changelog "new upstream release"
Expand All @@ -484,6 +490,8 @@ deb: | dist
chmod 755 \
build-deb/usr/bin/snclient \
build-deb/usr/lib/snclient/node_exporter
chmod 0750 build-deb/etc/sudoers.d
chmod 0440 build-deb/etc/sudoers.d/snclient

cp -p dist/snclient.1 build-deb/usr/share/man/man1/snclient.1
gzip -n -9 build-deb/usr/share/man/man1/snclient.1
Expand All @@ -497,6 +505,9 @@ deb: | dist
rpm: | dist
rm -rf snclient-$(VERSION)
cp ./packaging/snclient.service dist/
cp ./packaging/snclient.sysusers dist/
cp ./packaging/snclient.tmpfiles dist/
cp ./packaging/snclient.sudoers dist/
cp ./packaging/snclient.spec dist/
sed -i dist/snclient.spec -e 's|^Version: .*|Version: $(VERSION)|'
sed -i dist/snclient.spec -e 's|^BuildArch: .*|BuildArch: $(RPM_ARCH)|'
Expand Down
1 change: 1 addition & 0 deletions packaging/debian/conffiles
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/etc/snclient/server.key
/etc/snclient/cacert.pem
/etc/logrotate.d/snclient
/etc/sudoers.d/snclient
2 changes: 1 addition & 1 deletion packaging/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Version: UNSET
Section: net
Priority: optional
Architecture: UNSET
Depends: logrotate
Depends: logrotate, systemd
Standards-Version: 3.9.8
Suggests: monitoring-plugins-basic
Maintainer: Sven Nierlein <sven@consol.de>
Expand Down
6 changes: 6 additions & 0 deletions packaging/debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ case "$1" in
/etc/snclient/server.crt \
/etc/snclient/cacert.pem \
|| :
if [ -x "/usr/bin/systemd-sysusers" ]; then
systemd-sysusers
fi
if [ -x "/usr/bin/systemd-tmpfiles" ]; then
systemd-tmpfiles --create
fi
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper unmask snclient.service
if deb-systemd-helper --quiet was-enabled snclient.service; then
Expand Down
6 changes: 3 additions & 3 deletions packaging/snclient.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ After=network.target

[Service]
Type=simple
User=root
User=snclient
Group=snclient

Restart=on-failure
RestartSec=10

WorkingDirectory=/
WorkingDirectory=/var/lib/snclient
ExecStart=/usr/bin/snclient --config=/etc/snclient/snclient.ini
ExecStartPre=/bin/mkdir -p /var/log/snclient
ExecReload=/bin/kill -HUP $MAINPID

[Install]
Expand Down
20 changes: 19 additions & 1 deletion packaging/snclient.spec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ URL: https://github.com/Consol-Monitoring/snclient/
Source0: snclient-%{version}.tar.gz
Group: Applications/System
Summary: Monitoring Agent
Requires: logrotate
Requires: logrotate, systemd

%description
SNClient (Secure Naemon Client) is a general purpose monitoring agent designed
Expand Down Expand Up @@ -41,6 +41,15 @@ It supports Prometheus, NRPE and a REST API HTTP(s) protocol to run checks.
%{__mkdir_p} -m 0755 %{buildroot}/lib/systemd/system
%{__install} -D -m 0644 -p snclient.service %{buildroot}/lib/systemd/system/snclient.service

%{__mkdir_p} -m 0755 %{buildroot}/lib/sysusers.d
%{__install} -D -m 0644 -p snclient.sysusers %{buildroot}/lib/sysusers.d/snclient.conf

%{__mkdir_p} -m 0755 %{buildroot}/lib/tmpfiles.d
%{__install} -D -m 0644 -p snclient.tmpfiles %{buildroot}/lib/tmpfiles.d/snclient.conf

%{__mkdir_p} -m 0755 %{buildroot}/etc/sudoers.d
%{__install} -D -m 0440 -p snclient.sudoers %{buildroot}/etc/sudoers.d/snclient

%{__mkdir_p} -m 0755 %{buildroot}/usr/share/snclient
%{__install} -D -m 0644 -p README.md LICENSE %{buildroot}/usr/share/snclient

Expand All @@ -57,11 +66,17 @@ gzip -n -9 %{buildroot}/usr/share/man/man8/snclient.8
case "$*" in
1)
# First installation
# create user and files/folders
systemd-sysusers
systemd-tmpfiles --create
# start service
systemctl --system daemon-reload >/dev/null || true
systemctl enable snclient.service >/dev/null || true
systemctl start snclient.service >/dev/null || true
;;
2)
# Post upgrade permissions fix
systemd-tmpfiles --create
# Upgrading
systemctl --system daemon-reload >/dev/null || true
systemctl try-restart snclient.service >/dev/null || true
Expand Down Expand Up @@ -106,8 +121,11 @@ exit 0
%attr(0755,root,root) /usr/bin/snclient
%attr(0755,root,root) /usr/lib/snclient/node_exporter
%attr(0644,root,root) /lib/systemd/system/snclient.service
%attr(0644,root,root) /lib/sysusers.d/snclient.conf
%attr(0644,root,root) /lib/tmpfiles.d/snclient.conf
%dir %config(noreplace) /etc/snclient
%config(noreplace) %attr(0600,root,root) /etc/snclient/snclient.ini
%config(noreplace) %attr(0440,root,root) /etc/sudoers.d/snclient
%config(noreplace) %attr(0600,root,root) /etc/snclient/server.key
%config(noreplace) %attr(0600,root,root) /etc/snclient/server.crt
%config(noreplace) %attr(0600,root,root) /etc/snclient/cacert.pem
Expand Down
1 change: 1 addition & 0 deletions packaging/snclient.sudoers
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Defaults:snclient !requiretty
2 changes: 2 additions & 0 deletions packaging/snclient.sysusers
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
g snclient - -
u snclient - "Secure Naemon Client" /var/lib/snclient
7 changes: 7 additions & 0 deletions packaging/snclient.tmpfiles
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
d /etc/snclient 0755 snclient snclient - -
Z /etc/snclient - snclient snclient - -

d /var/lib/snclient 0750 snclient snclient - -
Z /var/lib/snclient - snclient snclient - -

d /var/log/snclient 0750 snclient snclient - -
Loading