Skip to content

Commit 73e0e77

Browse files
author
Fonic
committed
Release ipfilter-v4.3
Release ipfilter-v4.3: - add ipfilter.service and ipfilter.timer for system service setup (Linux with systemd only) - add instructions for system service setup to README.md - overhaul ipfilter.conf (comments only, no changes to configuration items) - split SCREENSHOT.png into SCREENSHOT1.png and SCREENSHOT2.png (GitHub only) - rename 'Windows Runtime Environments.md' to WINDOWS.md (KISS) - apply other minor changes to README.md (URLs, wording, formatting)
1 parent c57b652 commit 73e0e77

File tree

10 files changed

+223
-62
lines changed

10 files changed

+223
-62
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## Changelog for v4.3 release
2+
3+
Changes:
4+
- added `ipfilter.service` and `ipfilter.timer` for system service setup (Linux with systemd only)
5+
- added instructions for system service setup to `README.md`
6+
- overhauled `ipfilter.conf` (comments only, no changes to configuration items)
7+
- split `SCREENSHOT.png` into `SCREENSHOT1.png` and `SCREENSHOT2.png` (GitHub only)
8+
- renamed `Windows Runtime Environments.md` to `WINDOWS.md` (KISS)
9+
- applied other minor changes to `README.md` (URLs, wording, formatting)
10+
111
## Changelog for v4.2 release
212

313
Changes:
@@ -70,4 +80,4 @@ Initial release
7080

7181
##
7282

73-
_Last updated: 07/22/23_
83+
_Last updated: 08/25/23_

README.md

Lines changed: 81 additions & 36 deletions
Large diffs are not rendered by default.

SCREENSHOT.png

-296 KB
Binary file not shown.

SCREENSHOT1.png

150 KB
Loading

SCREENSHOT2.png

140 KB
Loading

Windows Runtime Environments.md renamed to WINDOWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,4 @@ Refer to [Microsoft Learn](https://learn.microsoft.com/en-us/) articles _[Instal
8181

8282
##
8383

84-
_Last updated: 08/13/23_
84+
_Last updated: 08/25/23_

ipfilter.conf

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
# ------------------------------------------------------------------------------
44
# -
5-
# IP Filter Updater & Generator -
5+
# IP Filter Updater & Generator (ipfilter) -
66
# -
77
# Created by Fonic (https://github.com/fonic) -
8-
# Date: 04/15/19 - 08/10/23 -
8+
# Date: 04/15/19 - 08/25/23 -
99
# -
1010
# ------------------------------------------------------------------------------
1111

@@ -16,7 +16,7 @@
1616
VERBOSE_OUTPUT="false"
1717

1818
# Path of file to log output to (folder + filename)
19-
# NOTE: ${SCRIPT_DIR}: directory of 'ipfilter.sh' script, ${SCRIPT_NAME}: filename of 'ipfilter.sh' script without extension
19+
# NOTE: ${SCRIPT_DIR}: directory where 'ipfilter.sh' is stored, ${SCRIPT_NAME}: name of file 'ipfilter.sh' without extension
2020
# Format: String
2121
# Example: LOG_FILE="/var/log/ipfilter.log"
2222
# Default: LOG_FILE="${SCRIPT_DIR}/${SCRIPT_NAME}.log"
@@ -37,58 +37,59 @@ LOG_COLORS="false"
3737

3838
# Options to pass to curl when downloading files
3939
# NOTE: To debug download issues, temporarily remove option '--fail' and check contents of downloaded files for server messages
40-
# Format: Bash array of strings
40+
# Format: Array of strings
4141
# Example: CURL_OPTS=("--fail" "--location" "--silent" "--show-error" "--retry" "8" "--connect-timeout" "120" "--proxy" "<protocol>://<host>:<port>")
4242
# Default: CURL_OPTS=("--fail" "--location" "--silent" "--show-error" "--retry" "2" "--connect-timeout" "60")
4343
CURL_OPTS=("--fail" "--location" "--silent" "--show-error" "--retry" "2" "--connect-timeout" "60")
4444

4545
# Options to pass to wget when downloading files
4646
# NOTE: wget is used only if curl is not available; do not add option '--quiet' here as this will also suppress error messages
47-
# Format: Bash array of strings
47+
# Format: Array of strings
4848
# Example: WGET_OPTS=("--no-verbose" "--tries=9" "--timeout=120" "--execute" "use_proxy=yes" "--execute" "http_proxy=<host>:<port>")
4949
# Default: WGET_OPTS=("--no-verbose" "--tries=3" "--timeout=60")
5050
WGET_OPTS=("--no-verbose" "--tries=3" "--timeout=60")
5151

52-
# List of blocklists to download from I-Blocklist (https://www.iblocklist.com/lists)
53-
# NOTE: For possible ids, inspect link targets on page 'https://www.iblocklist.com/lists', e.g.
54-
# 'level1' -> 'https://www.iblocklist.com/list?list=ydxerpxkpcfqjaybcssw' -> id is 'ydxerpxkpcfqjaybcssw'
55-
# Format: Bash dictionary of name-id-pairs (string-string-pairs)
52+
# List of blocklists to download from I-Blocklist (https://www.iblocklist.com)
53+
# NOTE: To identify valid ids, inspect hyperlink targets or column 'Update URL' on this web page: https://www.iblocklist.com/lists
54+
# e.g. 'level1' -> 'https://www.iblocklist.com/list?list=ydxerpxkpcfqjaybcssw' -> id is 'ydxerpxkpcfqjaybcssw' -> ["level1"]="ydxerpxkpcfqjaybcssw"
55+
# Format: Array of name-id-pairs (i.e. string-string-pairs)
5656
# Example: IBL_LISTS=(["badpeers"]="cwworuawihqvocglcoss" ["adservers"]="zhogegszwduurnvsyhdf")
5757
# Default: IBL_LISTS=(["level1"]="ydxerpxkpcfqjaybcssw" ["level2"]="gyisgnzbhppbvsphucsw" ["level3"]="uwnukjqktoggdknzrhgh")
5858
IBL_LISTS=(["level1"]="ydxerpxkpcfqjaybcssw" ["level2"]="gyisgnzbhppbvsphucsw" ["level3"]="uwnukjqktoggdknzrhgh")
5959

60-
# License key to use to download GeoLite2 country blocks database
61-
# NOTE: See 'https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/' for details
62-
# License key is required in order to use the GeoLite2 feature
60+
# License key to use to download GeoLite2 country blocks database (https://dev.maxmind.com/geoip)
61+
# NOTE: A valid license key is required to use the GeoLite2 feature, see URL below for details:
62+
# https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/
6363
# Format: String
6464
# Example: GL2_LICENSE="1a2b3c4d5e6f7g8h"
6565
# Default: GL2_LICENSE=""
6666
GL2_LICENSE=""
6767

68-
# List of countries to block using GeoLite2 country blocks
69-
# NOTE: For a list of country names, download ZIP archive from URL below and inspect file 'geolite2-country-locations-en.csv':
70-
# 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&license_key=<your-gl2-license-key>&suffix=zip'
71-
# Format: Bash array of strings
72-
# Example: GL2_COUNTRIES=("Tomorrowland" "Middle-earth")
68+
# List of countries to block using GeoLite2 country blocks (https://dev.maxmind.com/geoip)
69+
# NOTE: For a list of valid country names, download ZIP archive from URL below and inspect file 'geolite2-country-locations-en.csv':
70+
# https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&license_key=<your-gl2-license-key>&suffix=zip
71+
# Format: Array of strings
72+
# Example: GL2_COUNTRIES=("Tomorrowland" "Soldier Island" "Wonderland")
7373
# Default: GL2_COUNTRIES=()
7474
GL2_COUNTRIES=()
7575

76-
# IP protocol versions to process for GeoLite2 country blocks
77-
# Format: Bash array of strings
76+
# IP protocol versions to process for GeoLite2 country blocks (https://dev.maxmind.com/geoip)
77+
# NOTE: Only few applications actually support and recognize IPv6 ranges in .p2p files
78+
# Format: Array of strings
7879
# Example: GL2_IPVERS=("IPv4") | GL2_IPVERS=("IPv6") | GL2_IPVERS=("IPv4" "IPv6")
7980
# Default: GL2_IPVERS=("IPv4")
8081
GL2_IPVERS=("IPv4")
8182

8283
# Path to install final output file to (folder + filename)
83-
# NOTE: ${SCRIPT_DIR}: directory of 'ipfilter.sh' script, ${SCRIPT_NAME}: filename of 'ipfilter.sh' script without extension
84-
# Correct file extension will be determined automatically, there is no need to modify this when changing COMP_TYPE
84+
# NOTE: ${SCRIPT_DIR}: directory where 'ipfilter.sh' is stored, ${SCRIPT_NAME}: name of file 'ipfilter.sh' without extension
85+
# Correct file extension will be determined automatically, there is no need to modify this when changing 'COMP_TYPE'
8586
# Format: String
8687
# Example: INSTALL_DST="/tmp/blocklist.p2p"
8788
# Default: INSTALL_DST="${SCRIPT_DIR}/${SCRIPT_NAME}.p2p"
8889
INSTALL_DST="${SCRIPT_DIR}/${SCRIPT_NAME}.p2p"
8990

9091
# Type of compression to apply to final output file (in-place)
91-
# NOTE: Correct file extension will be determined automatically, there is no need to modify INSTALL_DST when changing this
92+
# NOTE: Correct file extension will be determined automatically, there is no need to modify 'INSTALL_DST' when changing this
9293
# Format: String
9394
# Example: COMP_TYPE="none" | COMP_TYPE="gzip" | COMP_TYPE="bzip2" | COMP_TYPE="xz" | COMP_TYPE="zip"
9495
# Default: COMP_TYPE="none"

ipfilter.service

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# /etc/systemd/system/ipfilter.service
2+
3+
# ------------------------------------------------------------------------------
4+
# -
5+
# IP Filter Updater & Generator (ipfilter) -
6+
# -
7+
# Created by Fonic (https://github.com/fonic) -
8+
# Date: 04/15/19 - 08/25/23 -
9+
# -
10+
# For detailed information regarding systemd units, see: -
11+
# man systemd.exec, man systemd.unit, man systemd.service -
12+
# -
13+
# Run the following command after applying changes to this file: -
14+
# $ systemctl daemon-reload -
15+
# -
16+
# ------------------------------------------------------------------------------
17+
18+
# NOTE:
19+
#
20+
# - Replace all '%{...}' tokens with appropriate values, then copy or move this
21+
# file to folder '/etc/systemd/system' and run the following command to make
22+
# systemd recognize the newly added service (mandatory):
23+
# $ systemctl daemon-reload
24+
#
25+
# - To have IP Filter send desktop notifications informing about success/failure
26+
# of update runs, enable the 'ExecStart=...' line containing '--notify' and
27+
# disable the other one (optional, recommended for use on desktop machines)
28+
#
29+
# - To restart applications that use the generated '.p2p' file after it has been
30+
# successfully generated/updated by IP Filter, edit and enable one or more of
31+
# the 'ExecStartPost=[+]...' lines (optional)
32+
33+
[Unit]
34+
Description=IP Filter Updater & Generator
35+
Wants=network-online.target
36+
After=local-fs.target network-online.target nss-lookup.target
37+
38+
[Service]
39+
Type=oneshot
40+
41+
User=%{USER}
42+
Group=%{GROUP}
43+
44+
WorkingDirectory=%{HOME}
45+
#ExecStart=%{HOME}/ipfilter.sh --notify
46+
ExecStart=%{HOME}/ipfilter.sh
47+
StandardOutput=file:%{HOME}/ipfilter.stdout.log
48+
StandardError=file:%{HOME}/ipfilter.stderr.log
49+
50+
# Restart applications that use the generated '.p2p' after it has been success-
51+
# fully updated by IP Filter (add a '+' after 'ExecStartPost=' if the specified
52+
# command requires root privileges)
53+
#ExecStartPost=+/usr/bin/systemctl restart appname.service
54+
#ExecStartPost=+/path/to/root/app/executable --restart
55+
#ExecStartPost=/path/to/user/app/executable --restart
56+
57+
# Allow up to 15min for an IP Filter run to complete (this prevents the job from
58+
# hanging indefinitely if something goes wrong; when the timeout is exceeded, IP
59+
# Filter receives SIGTERM and should shut down gracefully)
60+
TimeoutStartSec=900
61+
62+
[Install]
63+
WantedBy=multi-user.target

ipfilter.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
# ------------------------------------------------------------------------------
44
# -
5-
# IP Filter Updater & Generator -
5+
# IP Filter Updater & Generator (ipfilter) -
66
# -
77
# Created by Fonic (https://github.com/fonic) -
8-
# Date: 04/15/19 - 08/10/23 -
8+
# Date: 04/15/19 - 08/25/23 -
99
# -
1010
# ------------------------------------------------------------------------------
1111

ipfilter.timer

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# /etc/systemd/system/ipfilter.timer
2+
3+
# ------------------------------------------------------------------------------
4+
# -
5+
# IP Filter Updater & Generator (ipfilter) -
6+
# -
7+
# Created by Fonic (https://github.com/fonic) -
8+
# Date: 04/15/19 - 08/25/23 -
9+
# -
10+
# For detailed information regarding systemd units, see: -
11+
# man systemd.exec, man systemd.unit, man systemd.service, man systemd.timer -
12+
# -
13+
# Run the following command after applying changes to this file: -
14+
# $ systemctl daemon-reload -
15+
# -
16+
# ------------------------------------------------------------------------------
17+
18+
# NOTE:
19+
#
20+
# - Copy or move this file to folder '/etc/systemd/system' and run the following
21+
# command to make systemd recognize the newly added timer (mandatory):
22+
# $ systemctl daemon-reload
23+
#
24+
# - Items 'OnCalendar', 'RandomizedDelaySec' and 'Persistent' may be customized
25+
# to fit the specific use case (optional)
26+
27+
[Unit]
28+
Description=Timer for IP Filter Updater & Generator
29+
30+
[Timer]
31+
# Run IP Filter on every day of every month of every year at 03:00am within a
32+
# 30min window (i.e. run at a randomly chosen time between 03:00am and 03:30am)
33+
OnCalendar=*-*-* 03:00:00
34+
RandomizedDelaySec=1800
35+
36+
# Save last time timer was triggered and trigger immediately if a run has been
37+
# missed (e.g. due to system being offline during the time when the timer would
38+
# have normally been triggered)
39+
Persistent=true
40+
41+
[Install]
42+
WantedBy=timers.target

0 commit comments

Comments
 (0)