|
1 | | -# Rsync - Docker mod for openssh-server |
| 1 | +# Maxmind Docker mod for Nginx based images |
2 | 2 |
|
3 | | -This mod adds rsync to openssh-server, to be installed/updated during container start. |
| 3 | +This mod adds the maxmind database to nginx using the license key defined in the environment variable. |
4 | 4 |
|
5 | | -In openssh-server docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:openssh-server-rsync` |
| 5 | +This mod downloads the `GeoLite2-City.mmdb` database under `/config/geoip2db`, the database is updated weekly. |
6 | 6 |
|
7 | | -If adding multiple mods, enter them in an array separated by `|`, such as `DOCKER_MODS=linuxserver/mods:openssh-server-rsync|linuxserver/mods:openssh-server-mod2` |
| 7 | +**This mod should not be enabled together with the swag-dbip mod.** |
8 | 8 |
|
9 | | -# Mod creation instructions |
| 9 | +Follow these steps to enable the maxmind mod: |
10 | 10 |
|
11 | | -* Fork the repo, create a new branch based on the branch `template`. |
12 | | -* Edit the `Dockerfile` for the mod. `Dockerfile.complex` is only an example and included for reference; it should be deleted when done. |
13 | | -* Inspect the `root` folder contents. Edit, add and remove as necessary. |
14 | | -* Edit this readme with pertinent info, delete these instructions. |
15 | | -* Finally edit the `.github/workflows/BuildImage.yml`. Customize the build branch, and the vars for `BASEIMAGE` and `MODNAME`. |
16 | | -* Ask the team to create a new branch named `<baseimagename>-<modname>`. Baseimage should be the name of the image the mod will be applied to. The new branch will be based on the `template` branch. |
17 | | -* Submit PR against the branch created by the team. |
| 11 | +1. Acquire a maxmind license here: https://www.maxmind.com/en/geolite2/signup |
| 12 | +2. In the container's docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:swag-maxmind` |
| 13 | + |
| 14 | + If adding multiple mods, enter them in an array separated by `|`, such as `DOCKER_MODS=linuxserver/mods:swag-maxmind|linuxserver/mods:swag-mod2` |
| 15 | +3. In the container's docker arguments, set an environment variable `MAXMINDDB_LICENSE_KEY=<license-key>` with your license key. |
| 16 | +4. Add the following line to `/config/nginx/nginx.conf` under the `http` section: |
| 17 | + |
| 18 | + ```nginx |
| 19 | + include /config/nginx/maxmind.conf; |
| 20 | + ``` |
| 21 | +5. Edit `/config/nginx/maxmind.conf` and add countries to the blocklist / whitelist according to the comments, for example: |
| 22 | + |
| 23 | + ```nginx |
| 24 | + map $geoip2_data_country_iso_code $geo-whitelist { |
| 25 | + default no; |
| 26 | + UK yes; |
| 27 | + } |
| 28 | +
|
| 29 | + map $geoip2_data_country_iso_code $geo-blacklist { |
| 30 | + default yes; |
| 31 | + US no; |
| 32 | + } |
| 33 | + ``` |
| 34 | +6. Use the definitions in the following way: |
| 35 | + ```nginx |
| 36 | + server { |
| 37 | + listen 443 ssl; |
| 38 | + listen [::]:443 ssl; |
| 39 | +
|
| 40 | + server_name some-app.*; |
| 41 | + include /config/nginx/ssl.conf; |
| 42 | + client_max_body_size 0; |
| 43 | +
|
| 44 | + if ($lan-ip = yes) { set $geo-whitelist yes; } |
| 45 | + if ($geo-whitelist = no) { return 404; } |
| 46 | +
|
| 47 | + location / { |
| 48 | + ``` |
| 49 | +7. Recreate the container to apply the changes. |
0 commit comments