Skip to content

Commit c33c001

Browse files
sebixaaronkaplan
authored andcommitted
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 41f5c1b commit c33c001

File tree

9 files changed

+75
-5
lines changed

9 files changed

+75
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Please refer to the [NEWS](NEWS.md) for a list of changes which have an affect o
6161
### Packaging
6262
- 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).
6363
- New deb-package `intelmq-contrib` with all `contrib/` scripts and documentation (PR#2614 by Sebastian Wagner).
64+
- 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).
6465

6566
### Tests
6667
- `intelmq.tests.lib.test_pipeline.TestAmqp.test_acknowledge`: Skip on all Python versions when running on CI (PR#2602 by Sebastian Wagner).

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ test:
2222

2323
codestyle:
2424
pycodestyle intelmq/{bots,lib,bin}
25+
26+
licenses:
27+
reuse lint
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# SPDX-FileCopyrightText: 2025 Institute for Common Good Technology
2+
# SPDX-License-Identifier: AGPL-3.0-or-later
3+
4+
[Unit]
5+
Description=Periodically start all enabled IntelMQ bots
6+
7+
[Timer]
8+
# run every 5 minutes
9+
OnUnitActiveSec=5minutes
10+
Unit=intelmq-start.service
11+
Persistent=true
12+
13+
[Install]
14+
WantedBy=multi-user.target timers.target
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# SPDX-FileCopyrightText: 2025 Institute for Common Good Technology
2+
# SPDX-License-Identifier: AGPL-3.0-or-later
3+
4+
[Unit]
5+
Description=Start all enabled IntelMQ bots
6+
After=network.target
7+
# will be replaced by valkey in next distribution versions
8+
Requires=redis-server.service
9+
10+
[Service]
11+
# oneshot does not work as it stops the remaining processes
12+
Type=simple
13+
ExecStart=/usr/bin/intelmq-start.sh
14+
User=intelmq
15+
Group=intelmq
16+
RemainAfterExit=yes
17+
KillMode=process
18+
19+
[Install]
20+
WantedBy=multi-user.target

contrib/autostart/intelmq-start.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
# SPDX-FileCopyrightText: 2025 Institute for Common Good Technology
3+
# SPDX-License-Identifier: AGPL-3.0-or-later
4+
5+
# suppress stdout output. Errors go to stderr and are kept
6+
7+
if [ "$UID" -eq 0 ]; then
8+
sudo -u intelmq intelmqctl start > /dev/null
9+
else
10+
nohup intelmqctl start > /dev/null
11+
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
@@ -104,3 +104,20 @@ Description: Contributed scripts for IntelMQ
104104
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
105105
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
106106
SOFTWARE.
107+
108+
Package: intelmq-autostart
109+
Architecture: all
110+
Depends: intelmq,
111+
${misc:Depends},
112+
${python3:Depends}
113+
Suggests:
114+
Description: Automatic start for all IntelMQ bots
115+
FIXME
116+
.
117+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
118+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
119+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
120+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
121+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
122+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
123+
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
@@ -390,10 +390,11 @@ Usually, this configuration doesn't need any change. It is mostly maintained by
390390
}
391391
```
392392

393+
## Automatic start
393394

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

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

396-
397-
398-
399-
399+
In a package-installation, you can install the package `intelmq-autostart`.
400+
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)