Skip to content

Commit 4b20fdb

Browse files
authored
Merge branch 'develop' into develop
2 parents a6a86b0 + 04c75a3 commit 4b20fdb

File tree

23 files changed

+336
-30
lines changed

23 files changed

+336
-30
lines changed

.github/workflows/python/github.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,20 @@ def __init__(self):
3131

3232
def get_reviews(self):
3333
""" Get a list of reviews on a Github pull request as json object """
34-
reviews = self.session.get(self.api + 'repos/{}/pulls/{}/reviews'.format(self.github_repository, self.pr_id))
34+
reviews = self.session.get(self.api + f'repos/{self.github_repository}/pulls/{self.pr_id}/reviews')
3535
reviews.raise_for_status()
3636
return reviews.json()
3737

3838
def update_review(self, review_id, body):
3939
""" Update a review given by `review_id` and set its body to `body` """
4040
payload = {'body': body}
41-
resp = self.session.put(self.api + 'repos/{}/pulls/{}/reviews/{}'.format(self.github_repository, self.pr_id, review_id), json=payload)
41+
resp = self.session.put(self.api + f'repos/{self.github_repository}/pulls/{self.pr_id}/reviews/{review_id}', json=payload)
4242
resp.raise_for_status()
4343
return resp.json()
4444

4545
def post_review(self, body):
4646
""" Post a pull request review containing `body` and requesting changes """
4747
payload = {'body': body, 'event': "REQUEST_CHANGES"}
48-
resp = self.session.post(self.api + 'repos/{}/pulls/{}/reviews'.format(self.github_repository, self.pr_id), json=payload)
48+
resp = self.session.post(self.api + f'repos/{self.github_repository}/pulls/{self.pr_id}/reviews', json=payload)
4949
resp.raise_for_status()
5050
return resp.json()

.github/workflows/python/pycodestyle_comment.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def style_error_format(style_error_list) -> str:
3434
""" Format the list of pycodestyle errors and return them a one string. """
3535
ret = ''
3636
for error in style_error_list:
37-
ret += '* {}\n'.format(error)
37+
ret += f'* {error}\n'
3838
return ret
3939

4040

@@ -45,7 +45,7 @@ def style_error_format(style_error_list) -> str:
4545
style_errors = list_style_errors()
4646

4747
if style_errors:
48-
print("Found {} errors.".format(len(style_errors)))
48+
print(f"Found {len(style_errors)} errors.")
4949

5050
gh = github.Github()
5151

.github/workflows/scripts/setup-full.sh

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# SPDX-FileCopyrightText: 2020 Birger Schacht
2+
# SPDX-FileCopyrightText: 2020 Birger Schacht, 2024 Institute for Common Good Technology
33
# SPDX-License-Identifier: AGPL-3.0-or-later
44

55
set -x
@@ -14,6 +14,14 @@ echo -e '-XX:+DisableExplicitGC\n-Djdk.io.permissionsUseCanonicalPath=true\n-Dlo
1414
sudo chown -R elasticsearch:elasticsearch /etc/default/elasticsearch
1515
sudo systemctl start elasticsearch
1616

17+
sudo apt update
18+
if [ $python_version == '3.8' ]; then
19+
# for pymssql there are no wheels for 3.8 https://github.com/certtools/intelmq/issues/2539
20+
DEBIAN_FRONTEND="noninteractive" sudo -E apt install -y build-essential freetds-dev libssl-dev libkrb5-dev
21+
fi
22+
# for psql (used below)
23+
DEBIAN_FRONTEND="noninteractive" sudo -E apt install -y postgresql-client-14
24+
1725
# Install the dependencies of all the bots
1826
pip install wheel
1927
for file in intelmq/bots/*/*/REQUIREMENTS.txt; do
@@ -30,7 +38,16 @@ done
3038
# Setup sudo and install intelmq
3139
sudo sed -i '/^Defaults\tsecure_path.*$/ d' /etc/sudoers
3240
sudo pip install .
33-
sudo intelmqsetup --skip-ownership
41+
42+
intelmq_user_exists=$(getent passwd intelmq ||:)
43+
if [[ "$UID" -eq '0' && -z "$intelmq_user_exists" ]]; then
44+
# create an unprivileged user, if currently running as root. Otherwise dropping privileges won't work
45+
groupadd -r intelmq
46+
useradd -r -d /var/lib/intelmq/ -c "user running intelmq" -g intelmq -s /bin/bash intelmq
47+
sudo intelmqsetup
48+
else
49+
sudo intelmqsetup --skip-ownership
50+
fi
3451

3552
# Initialize the postgres database
3653
intelmq_psql_initdb

.github/workflows/unittests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
21+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
2222
type: ['full', 'basic']
2323

2424
services:
@@ -59,6 +59,7 @@ jobs:
5959
PGPORT: 5432
6060
PGUSER: intelmq
6161
PGPASSWORD: intelmq
62+
python_version: ${{ matrix.python-version }}
6263
run: bash .github/workflows/scripts/setup-full.sh
6364

6465
- name: Install test dependencies

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
### Configuration
1313

1414
### Core
15+
- Python 3.8 or newer is required (PR#2541 by Sebastian Wagner).
1516

1617
### Development
1718

@@ -30,15 +31,25 @@
3031
- Fix to avoid schema download if not configured #2530.
3132

3233
#### Experts
34+
- `intelmq.bots.experts.securitytxt`:
35+
- Added new bot (PR#2538 by Frank Westers and Sebastian Wagner)
3336
- `intelmq.bots.experts.misp`: Use `PyMISP` class instead of deprecated `ExpandedPyMISP` (PR#2532 by Radek Vyhnal)
3437

3538
#### Outputs
39+
- `intelmq.bots.outputs.cif3.output`:
40+
- The requirement can only be installed on Python version < 3.12.
41+
- Add a check on the Python version and exit if incompatible.
42+
- Add a deprecation warning (PR#2544 by Sebastian Wagner)
3643

3744
### Documentation
3845

3946
### Packaging
4047

4148
### Tests
49+
- Install build dependencies for `pymssql` on Python 3.8 as there are no wheels available for this Python version (PR#2542 by Sebastian Wagner).
50+
- Install `psql` explicitly for workflow support on other platforms such as act (PR#2542 by Sebastian Wagner).
51+
- Create intelmq user & group if running privileged to allow dropping privileges (PR#2542 by Sebastian Wagner).
52+
- `intelmq.tests.lib.test_pipeline.TestAmqp.test_acknowledge`: Also skip on Python 3.11 besides on 3.8 when running on CI (PR#2542 by Sebastian Wagner).
4253

4354
### Tools
4455

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ codespell:
1919

2020
test:
2121
pytest --no-cov -v intelmq/tests/ && echo "Success!"
22+
23+
codestyle:
24+
pycodestyle intelmq/{bots,lib,bin}

NEWS.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ Please refer to the change log for a full list of changes.
1414
---------------------------------
1515

1616
### Requirements
17+
Python 3.8 or newer is required.
18+
19+
## Bots
20+
#### CIF 3 API
21+
The CIF 3 API Output bot is not compatible with Python version greater or equal to 3.12 and will be removed in the future due to lack of maintenance.
22+
See https://lists.cert.at/pipermail/intelmq-users/2024-December/000474.html for more information.
1723

1824
### Tools
1925

@@ -36,7 +42,7 @@ No changes are required by administrators.
3642
----------------------------------
3743

3844
### Documentation
39-
The documentation is now available at [docs.intelmq.org](https://docs.intelmq.org/). Documentation has been updated and restructured into User, Administrator and Developer Guide. It provides modern look with various quality of life improvements. Big thanks to to @gethvi.
45+
The documentation is now available at [docs.intelmq.org](https://docs.intelmq.org/). Documentation has been updated and restructured into User, Administrator and Developer Guide. It provides modern look with various quality of life improvements. Big thanks to to @gethvi.
4046
We now have a slick, modern mkdocs based documentation. Please do check it out!
4147

4248

@@ -55,7 +61,7 @@ Shadowserver adds new scans on a nearly weekly basis. IntelMQ's release cycle an
5561
We therefore (thanks to @eslif2) move the shadowserver reports collector and parser to a new, dynamic system. It can:
5662

5763
- fetch the shadowserver schema from shadowserver (https://interchange.shadowserver.org/intelmq/v1/schema)
58-
- dynamically collect new reports (see also https://docs.intelmq.org/latest/user/bots/?h=shadow#shadowserver-reports-api)
64+
- dynamically collect new reports (see also https://docs.intelmq.org/latest/user/bots/?h=shadow#shadowserver-reports-api)
5965
- parse the new reports
6066

6167
**Note well**: if your IntelMQ system runs in an airgapped environment or if it may only reach out to specific IPs/sites, you should read the notes here:
@@ -86,7 +92,7 @@ Quite a few changes (thanks to Kamil, @gethvi) on AMQP
8692
### General changes and bug fixes
8793

8894
Digital Trust Center fixed a bug where the config was loaded twice in intelmqctl which created quite some speedups. Thanks!
89-
This speeds up IntelMQ API calls.
95+
This speeds up IntelMQ API calls.
9096

9197
### Data Format
9298

contrib/example-extension-package/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
entry_point = '.'.join(file.with_suffix('').parts)
2929
file = Path(str(file).replace('intelmq/bots', 'mybots/bots'))
3030
module = '.'.join(file.with_suffix('').parts)
31-
BOTS.append('{0} = {1}:BOT.run'.format(entry_point, module))
31+
BOTS.append(f'{entry_point} = {module}:BOT.run')
3232

3333
setup(
3434
name='intelmq-example-extension',

docs/dev/release.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ These apply to all projects:
3030

3131
- `intelmq/version.py`: Update the version.
3232

33-
Eventually adapt the default log levels if necessary. Should be INFO for stable releases.
34-
3533
### IntelMQ API
3634

3735
- `intelmq_api/version.py`: Update the version.

docs/user/bots.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3524,6 +3524,56 @@ to true.
35243524
(optional, boolean) Query for IPs at `https://stat.ripe.net/data/maxmind-geo-lite/data.json?resource=%s`. Defaults to
35253525
true.
35263526

3527+
---
3528+
3529+
### SecurityTXT <div id="intelmq.bots.experts.securitytxt.expert" />
3530+
3531+
SecurityTXT is an initiative to standardize how websites publish their abuse contact information.
3532+
It is standardized in [RFC 9116 "A File Format to Aid in Security Vulnerability Disclosure"](https://datatracker.ietf.org/doc/rfc9116/).
3533+
Refer to the linked document RFC for more information on `security.txt`.
3534+
This bot looks for `security.txt` files on a URL or IP, retrieves the primary contact information out of it and adds this to the event.
3535+
3536+
**Requirements**
3537+
3538+
To use this bot, you need to install the required dependencies:
3539+
3540+
```bash
3541+
pip3 install -r intelmq/bots/experts/securitytxt/REQUIREMENTS.txt
3542+
```
3543+
3544+
**Module:** `intelmq.bots.experts.securitytxt.expert`
3545+
3546+
**Parameters**
3547+
3548+
**`url_field`**
3549+
3550+
The field in the event that contains the URL/IP on which to look for the the security.txt file. Default: `source.reverse_dns`
3551+
3552+
**`contact_field`**
3553+
3554+
The field in the event in which to put the found contact details. Default: `source.abuse_contact`
3555+
3556+
**`only_email_address`** (bool)
3557+
3558+
Contact details can be web URLs or email addresses. When this value is set to True, it only selects email addresses as contact information.
3559+
Default: `true`
3560+
3561+
**`overwrite`** (bool)
3562+
3563+
Boolean indicating whether to override existing data in contact_field.
3564+
Default: `true`
3565+
3566+
**`check_expired`** (bool)
3567+
3568+
Boolean indicating whether to check if the security.txt has expired according to its own expiry date.
3569+
Default: `false`
3570+
3571+
**`check_canonical`** (bool)
3572+
3573+
Boolean indicating whether to check if the url is contained in the list of canonical urls.
3574+
Default: `false`
3575+
3576+
35273577
---
35283578

35293579
### Sieve <div id="intelmq.bots.experts.sieve.expert" />

0 commit comments

Comments
 (0)