|
1 | | -# Rsync - Docker mod for openssh-server |
| 1 | +# IPINFO 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 downloads the `ipinfo_lite.mmdb` database under `/config/geoip2db`, the database is updated daily. |
4 | 4 |
|
5 | | -In openssh-server docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:openssh-server-rsync` |
| 5 | +**This mod should not be enabled together with swag-maxmind or swag-dbip mods.** |
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 | +Follow these steps to enable the ipinfo mod: |
8 | 8 |
|
9 | | -# Mod creation instructions |
| 9 | +1. Sign up and aquire an ipinfo token here: https://ipinfo.io/signup |
| 10 | +2. In the container's docker arguments, set the following environment variables: |
| 11 | + - `IPINFO_TOKEN=<token>` with your token. |
| 12 | +3. In the container's docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:swag-ipinfo` |
| 13 | + |
| 14 | + If adding multiple mods, enter them in an array separated by `|`, such as `DOCKER_MODS=linuxserver/mods:swag-ipinfo|linuxserver/mods:swag-mod2` |
| 15 | +4. Recreate the container to apply the changes. |
| 16 | +5. Add the following line to `/config/nginx/nginx.conf` under the `http` section: |
| 17 | + |
| 18 | + ```nginx |
| 19 | + include /config/nginx/ipinfo.conf; |
| 20 | + ``` |
| 21 | +6. Edit `/config/nginx/ipinfo.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 | + } |
10 | 28 |
|
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 | | -* After all init scripts and services are created, run `find ./ -path "./.git" -prune -o \( -name "run" -o -name "finish" -o -name "check" \) -not -perm -u=x,g=x,o=x -print -exec chmod +x {} +` to fix permissions. |
15 | | -* Edit this readme with pertinent info, delete these instructions. |
16 | | -* Finally edit the `.github/workflows/BuildImage.yml`. Customize the vars for `BASEIMAGE` and `MODNAME`. Set the versioning logic and `MULTI_ARCH` if needed. |
17 | | -* 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. |
18 | | -* Submit PR against the branch created by the team. |
| 29 | + map $geoip2_data_country_iso_code $geo-blacklist { |
| 30 | + default yes; |
| 31 | + US no; |
| 32 | + } |
| 33 | + ``` |
| 34 | +7. Use the definitions in the following way: |
| 35 | + ```nginx |
| 36 | + server { |
| 37 | + listen 443 ssl; |
| 38 | + listen [::]:443 ssl; |
19 | 39 |
|
| 40 | + server_name some-app.*; |
| 41 | + include /config/nginx/ssl.conf; |
| 42 | + client_max_body_size 0; |
20 | 43 |
|
21 | | -## Tips and tricks |
| 44 | + if ($lan-ip = yes) { set $geo-whitelist yes; } |
| 45 | + if ($geo-whitelist = no) { return 404; } |
22 | 46 |
|
23 | | -* Some images have helpers built in, these images are currently: |
24 | | - * [Openvscode-server](https://github.com/linuxserver/docker-openvscode-server/pull/10/files) |
25 | | - * [Code-server](https://github.com/linuxserver/docker-code-server/pull/95) |
| 47 | + location / { |
| 48 | + ``` |
| 49 | + Or for blacklist with both some countries and continents: |
| 50 | + ```nginx |
| 51 | + server { |
| 52 | + listen 443 ssl; |
| 53 | + listen [::]:443 ssl; |
| 54 | +
|
| 55 | + server_name some-app.*; |
| 56 | + include /config/nginx/ssl.conf; |
| 57 | + client_max_body_size 0; |
| 58 | +
|
| 59 | + if ($lan-ip = yes) { set $geo-blacklist yes; } |
| 60 | + if ($geo-blacklist = no) { return 404; } |
| 61 | + if ($continent-blacklist = no) { return 404; } |
| 62 | +
|
| 63 | + location / { |
| 64 | + ``` |
| 65 | +8. Restart the container to apply the changes. |
0 commit comments