Skip to content

Commit 69ab409

Browse files
committed
Add autostart package
adds a systemd timer and service and a shell script to call `intelmqctl start` on system boot and every five minutes raise debian compat level 10 for better and automatic dh-systemd support https://wiki.debian.org/Teams/pkg-systemd/Packaging#Using_debhelper_with_dh_systemd
1 parent c35a284 commit 69ab409

File tree

8 files changed

+64
-5
lines changed

8 files changed

+64
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Please refer to the [NEWS](NEWS.md) for a list of changes which have an affect o
5555
### Packaging
5656
- Replace `/opt/intelmq` example paths in bots with variable `VAR_STATE_PATH` for correct paths in LSB-path setups like with packages (PR#2587 by Sebastian Wagner).
5757
- New deb-package `intelmq-contrib` with all `contrib/` scripts and documentation (PR#2614 by Sebastian Wagner).
58+
- New deb-package `intelmq-autostart` containing systemd services and timers to start all enabled IntelMQ bots at boot and periodically (PR#2638 by Sebastian Wagner).
5859

5960
### Tests
6061
- `intelmq.tests.lib.test_pipeline.TestAmqp.test_acknowledge`: Skip on all Python versions when running on CI (PR#2602 by Sebastian Wagner).
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[Unit]
2+
Description=Periodically start all enabled IntelMQ bots
3+
4+
[Timer]
5+
# run every 5 minutes
6+
OnUnitActiveSec=5minutes
7+
Unit=intelmq-start.service
8+
Persistent=true
9+
10+
[Install]
11+
WantedBy=multi-user.target timers.target
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[Unit]
2+
Description=Start all enabled IntelMQ bots
3+
After=network.target
4+
# will be replaced by valkey in next distribution versions
5+
Requires=redis-server.service
6+
7+
[Service]
8+
# oneshot does not work as it stops the remaining processes
9+
Type=simple
10+
ExecStart=/usr/bin/intelmq-start.sh
11+
User=intelmq
12+
Group=intelmq
13+
RemainAfterExit=yes
14+
KillMode=process
15+
16+
[Install]
17+
WantedBy=multi-user.target

contrib/autostart/intelmq-start.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
# suppress stdout output. Errors go to stderr and are kept
4+
5+
if [ "$UID" -eq 0 ]; then
6+
sudo -u intelmq intelmqctl start > /dev/null
7+
else
8+
nohup intelmqctl start > /dev/null
9+
fi

debian/compat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9
1+
10

debian/control

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,20 @@ Description: Contributed scripts for IntelMQ
9191
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
9292
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
9393
SOFTWARE.
94+
95+
Package: intelmq-autostart
96+
Architecture: all
97+
Depends: intelmq,
98+
${misc:Depends},
99+
${python3:Depends}
100+
Suggests:
101+
Description: Automatic start for all IntelMQ bots
102+
FIXME
103+
.
104+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
105+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
106+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
107+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
108+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
109+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
110+
SOFTWARE.

debian/intelmq-autostart.install

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
contrib/autostart/intelmq-periodic-start.timer /lib/systemd/system/
2+
contrib/autostart/intelmq-start.service /lib/systemd/system/
3+
contrib/autostart/intelmq-start.sh /usr/bin/

docs/admin/configuration/intelmq.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,11 @@ Usually, this configuration doesn't need any change. It is mostly maintained by
383383
}
384384
```
385385

386+
## Automatic start
386387

388+
By default the operating system does not start any IntelMQ bots by itself, they must be started by `intelmqctl start`.
387389

390+
In order to automatically start all enabled bots by default, you can either setup your own job scheduling or use a shorthand:
388391

389-
390-
391-
392-
392+
In a package-installation, you can install the package `intelmq-autostart`.
393+
It calls `intelmqctl start` on system boot after the message queue Redis/Valkey is available and then every five minutes.

0 commit comments

Comments
 (0)