From 13dda10ff7bc420acc04bc106b5b4596f8463fdc Mon Sep 17 00:00:00 2001 From: Olivier Ferrand Date: Tue, 14 Dec 2021 11:26:44 +0100 Subject: [PATCH 1/2] Adding systemd & logrotate --- etc/cpeguesser | 10 ++++++++++ etc/systemd/system/cpeguesser.service | 11 +++++++++++ etc/systemd/system/cpeguesser.timer | 9 +++++++++ etc/systemd/system/cpeweb.service | 18 ++++++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 etc/cpeguesser create mode 100644 etc/systemd/system/cpeguesser.service create mode 100644 etc/systemd/system/cpeguesser.timer create mode 100644 etc/systemd/system/cpeweb.service diff --git a/etc/cpeguesser b/etc/cpeguesser new file mode 100644 index 0000000..9d7f5bf --- /dev/null +++ b/etc/cpeguesser @@ -0,0 +1,10 @@ +/var/log/cpe*.log { + daily + missingok + rotate 14 + compress + delaycompress + notifempty + copytruncate + create 0640 root root +} diff --git a/etc/systemd/system/cpeguesser.service b/etc/systemd/system/cpeguesser.service new file mode 100644 index 0000000..864af38 --- /dev/null +++ b/etc/systemd/system/cpeguesser.service @@ -0,0 +1,11 @@ +[Unit] +Description=circl dot lu CPE guesser service +Documentation=https://github.com/cve-search/cpe-guesser + +[Service] +WorkingDirectory=$(INSTALLDIR)/bin +ExecStart=python3 import.py -d -u +User=$(CPE_USER) +Type=oneshot +StandardOutput=append:/var/log/cpeguesser_message.log +StandardError=append:/var/log/cpeguesser_error.log diff --git a/etc/systemd/system/cpeguesser.timer b/etc/systemd/system/cpeguesser.timer new file mode 100644 index 0000000..66ee76e --- /dev/null +++ b/etc/systemd/system/cpeguesser.timer @@ -0,0 +1,9 @@ +[Unit] +Description=circl dot lu CPE guesser service trigger timer + +[Timer] +Unit=cpeguesser.service +OnCalendar=*-*-* 0/12:00:00 + +[Install] +WantedBy=timers.target diff --git a/etc/systemd/system/cpeweb.service b/etc/systemd/system/cpeweb.service new file mode 100644 index 0000000..be636d5 --- /dev/null +++ b/etc/systemd/system/cpeweb.service @@ -0,0 +1,18 @@ +[Unit] +Description=circl dot lu CPE guesser service +#Requires=mongodb.service redis-server.service +Documentation=https://github.com/cve-search/cpe-guesser +after=network.target + +[Service] +WorkingDirectory=$(INSTALLDIR)/bin +ExecStart=python3 server.py +User=$(CPE_USER) +Group=$(CPE_USER) +Type=simple +Restart=always +StandardOutput=append:/var/log/cpeweb_message.log +StandardError=append:/var/log/cpeweb_error.log + +[Install] +WantedBy=multi-user.target From 95cf01a94979218a7624d3566cf9e5552f7b881d Mon Sep 17 00:00:00 2001 From: Olivier Ferrand Date: Tue, 14 Dec 2021 11:27:15 +0100 Subject: [PATCH 2/2] Adding systemd & logrotate --- etc/{ => logrotate.d}/cpeguesser | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename etc/{ => logrotate.d}/cpeguesser (100%) diff --git a/etc/cpeguesser b/etc/logrotate.d/cpeguesser similarity index 100% rename from etc/cpeguesser rename to etc/logrotate.d/cpeguesser