Skip to content

Commit

Permalink
Release ipfilter-v4.2
Browse files Browse the repository at this point in the history
Release ipfilter-v4.2:
- apply minor changes to console and log file output
- add comment regarding GeoLite2 license to configuration
- add screenshot with sample output (GitHub only)
- update and restructure README.md
  • Loading branch information
Fonic committed Aug 10, 2023
1 parent 975aa7c commit ceee7b4
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 38 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## Changelog for v4.2 release

Changes:
- applied minor changes to console and log file output
- added comment regarding GeoLite2 license to configuration
- added screenshot with sample output (GitHub only)
- updated and restructured `README.md`

## Changelog for v4.1 release

Changes:
Expand Down
75 changes: 42 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,45 @@ Windows users need to setup a suitable runtime environment. [Cygwin](https://www
Refer to the [releases](https://github.com/fonic/ipfilter/releases) section for downloads links. There is no installation required. Simply extract the downloaded archive to a folder of your choice.

## Configuration
Open `ipfilter.conf` in your favorite text editor and adjust the settings to your liking. Refer to embedded comments for details. Note that before changing any settings, it is recommended to run the script with *default settings* first to make sure it works as expected.
Open `ipfilter.conf` in your favorite text editor and adjust the settings to your liking. Refer to embedded comments for details. Note that before changing any settings, it is recommended to run the script with *default settings* first to make sure it works as expected. Refer to [this section](#configuration-options--defaults) for a listing of all configuration options and current defaults.

## Subscriptions
Using the [I-Blocklist](https://www.iblocklist.com/) feature does not require a subscription, as most of the provided lists are free to download. There are a few lists that are only available to subscribers, though. Non-free lists are currently untested - please open an [Issue](https://github.com/fonic/ipfilter/issues) if you have a subscription and want to help improving support for these lists.

Using the [GeoLite2](https://dev.maxmind.com/geoip/geoip2/geolite2/) feature requires a license key which can be obtained *free of charge* after [signing up](https://www.maxmind.com/en/geolite2/signup) (refer to [this blog post](https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/) for details).

## Usage
As settings are configured via `ipfilter.conf`, the script intentionally features only few command line options:
```
--==[ IP Filter Updater & Generator ]==--
Usage: ipfilter.sh [OPTIONS]
Options:
-n, --notify Send desktop notification to inform user
about success/failure (useful for cron)
-k, --keep-temp Do not remove temporary folder on exit
(useful for debugging)
-h, --help Display this help message
```

In most cases it should be sufficient to run the script without supplying any options:
```
$ cd ipfilter-vX.Y
$ ./ipfilter.sh
```

When running _non-interactively_ (e.g. via cron), you might want to supply option `-n/--notify` to send desktop notifications informing you about success/failure.

Note that *root privileges* are generally **not** required. Just make sure the configured `INSTALL_DST` points to a location writeable by the user running the script. The same applies to `LOG_FILE` if logging is enabled.

## Output & Logging

Output is sent to both console and log file `ipfilter.log`:

![Screenshot](https://raw.githubusercontent.com/fonic/ipfilter/master/SCREENSHOT.png)

## Configuration Options & Defaults

Configuration options and current defaults:
```sh
Expand All @@ -35,7 +73,7 @@ Configuration options and current defaults:
# IP Filter Updater & Generator -
# -
# Created by Fonic (https://github.com/fonic) -
# Date: 04/15/19 - 07/22/23 -
# Date: 04/15/19 - 08/10/23 -
# -
# ------------------------------------------------------------------------------

Expand Down Expand Up @@ -89,6 +127,7 @@ IBL_LISTS=(["level1"]="ydxerpxkpcfqjaybcssw" ["level2"]="gyisgnzbhppbvsphucsw" [

# License key to use to download GeoLite2 country blocks database
# NOTE: See 'https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/' for details
# License key is required in order to use the GeoLite2 feature
# Format: String
# Example: GL2_LICENSE="1a2b3c4d5e6f7g8h"
# Default: GL2_LICENSE=""
Expand Down Expand Up @@ -124,36 +163,6 @@ INSTALL_DST="${SCRIPT_DIR}/${SCRIPT_NAME}.p2p"
COMP_TYPE="none"
```

## Subscriptions
Using the [I-Blocklist](https://www.iblocklist.com/) feature does not require a subscription, as most of the provided lists are free to download. There are a few lists that are only available to subscribers, though. Non-free lists are currently untested - please open an [Issue](https://github.com/fonic/ipfilter/issues) if you have a subscription and want to help improving support for these lists.

Using the [GeoLite2](https://dev.maxmind.com/geoip/geoip2/geolite2/) feature requires a license key which can be obtained *free of charge* after [signing up](https://www.maxmind.com/en/geolite2/signup) (refer to [this blog post](https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/) for details).

## Usage
As settings are configured via `ipfilter.conf`, the script intentionally features only few command line options:
```
--==[ IP Filter Updater & Generator ]==--
Usage: ipfilter.sh [OPTIONS]
Options:
-n, --notify Send desktop notification to inform user
about success/failure (useful for cron)
-k, --keep-temp Do not remove temporary folder on exit
(useful for debugging)
-h, --help Display this help message
```

In most cases it should be sufficient to run the script without supplying any options:
```
$ cd ipfilter-vX.Y
$ ./ipfilter.sh
```

When running _non-interactively_ (e.g. via cron), you might want to supply option `-n/--notify` to send desktop notifications informing you about success/failure.

Note that *root privileges* are generally **not** required. Just make sure the configured `INSTALL_DST` points to a location writeable by the user running the script. The same applies to `LOG_FILE` if logging is enabled.

##

_Last updated: 08/09/23_
_Last updated: 08/10/23_
Binary file added SCREENSHOT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion ipfilter.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# IP Filter Updater & Generator -
# -
# Created by Fonic (https://github.com/fonic) -
# Date: 04/15/19 - 07/22/23 -
# Date: 04/15/19 - 08/10/23 -
# -
# ------------------------------------------------------------------------------

Expand Down Expand Up @@ -59,6 +59,7 @@ IBL_LISTS=(["level1"]="ydxerpxkpcfqjaybcssw" ["level2"]="gyisgnzbhppbvsphucsw" [

# License key to use to download GeoLite2 country blocks database
# NOTE: See 'https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/' for details
# License key is required in order to use the GeoLite2 feature
# Format: String
# Example: GL2_LICENSE="1a2b3c4d5e6f7g8h"
# Default: GL2_LICENSE=""
Expand Down
8 changes: 4 additions & 4 deletions ipfilter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# IP Filter Updater & Generator -
# -
# Created by Fonic (https://github.com/fonic) -
# Date: 04/15/19 - 07/22/23 -
# Date: 04/15/19 - 08/10/23 -
# -
# ------------------------------------------------------------------------------

Expand Down Expand Up @@ -511,7 +511,7 @@ if [[ "${NOTIFY_USER}" == "true" ]]; then
# WSL 'powershell.exe' is required and more fitting for Windows environments
# anyway
"windows"*|"linux-wsl") commands+=("powershell.exe"); ;;
*) print_error "Option '-n/--notify' not supported on platform / OS type '${PLATFORM}'"; result=1; ;;
*) print_error "Option '-n/--notify' is not supported on platform / OS type '${PLATFORM}'"; result=1; ;;
esac
fi
case "${COMP_TYPE}" in
Expand Down Expand Up @@ -629,7 +629,7 @@ if (( ${#GL2_COUNTRIES[@]} > 0 )) && [[ "${GL2_LICENSE}" != "" ]]; then
else
unzip -q -o -j -LL "${src}" '*.csv' -d "${dst}"
fi
[[ "${VERBOSE_OUTPUT}" == "true" ]] && print_normal "$(ls -l "${dst}"/*.csv | wc -l | awk '{ print $1 }') files"
[[ "${VERBOSE_OUTPUT}" == "true" ]] && print_normal "Extracted $(ls -l "${dst}"/*.csv | wc -l | awk '{ print $1 }') files"

# Parse country locations, generate dict country names -> ids (NOTE: using
# split_string here as it deals perfectly with quotes, separators in items
Expand All @@ -649,7 +649,7 @@ if (( ${#GL2_COUNTRIES[@]} > 0 )) && [[ "${GL2_LICENSE}" != "" ]]; then
country_ids["${continent_name,,}"]="${geoname_id}"
fi
done < <(tail -q -n +2 "${src}")
[[ "${VERBOSE_OUTPUT}" == "true" ]] && print_normal "${#country_ids[@]} countries"
[[ "${VERBOSE_OUTPUT}" == "true" ]] && print_normal "Found ${#country_ids[@]} countries"

# Parse country blocks, generate country blocklists (NOTE: most, probably
# only performance-critical part of script; awk call simplified for multi-
Expand Down

0 comments on commit ceee7b4

Please sign in to comment.