Update DNS A/AAAA records with your current external IP address using the netcup DNS API.
Go to file
2024-12-09 11:19:51 +01:00
.run feat: add .idea run config 2024-12-09 11:06:48 +01:00
cfg feat: AAAA records and json configuration 2023-03-29 10:51:05 +02:00
cron.d chore: renamed dependency exec-notify 2023-06-16 13:50:55 +02:00
packaging docs: add TODO 2023-06-28 12:05:51 +02:00
src/netcup_dns feat: inform about skipped cfg files 2024-12-09 11:06:18 +01:00
.gitignore add shell.nix and update README 2023-09-28 17:12:10 +02:00
LICENSE feat: license, cronjob, requirements and packaging 2023-03-28 16:37:55 +02:00
Makefile feat: update makefile (Arch Linux installation) 2023-06-16 14:07:53 +02:00
pyproject.toml packaging: pyproject.toml and setup.cfg 2024-08-15 21:01:24 +02:00
README.md docs: README 2024-12-09 11:19:51 +01:00
requirements.txt feat: license, cronjob, requirements and packaging 2023-03-28 16:37:55 +02:00
setup.cfg v0.2.4 2024-12-09 11:07:47 +01:00
shell.nix add shell.nix and update README 2023-09-28 17:12:10 +02:00

netcup-dns

Update DNS A/AAAA records with your current external IP address using the netcup DNS API.

Installation

Install release from PyPI (https://pypi.org/project/netcup-dns/):

pip install netcup-dns

Install release from TestPyPI (https://test.pypi.org/project/netcup-dns/):

pip install -i https://test.pypi.org/simple/ netcup-dns

Build and install on Arch Linux:

make

Build and install with pip:

make install-pip

Configuration

For each netcup customer, create a .json configuration file inside /etc/netcup-dpns.

There is an example configuration.

Usage

usage: netcup-dns [-h] [--config-directory CFG_DIR]
                  [--cache-directory CACHE_DIR]
                  [--cache-validity-seconds CACHE_VALIDITY_SECONDS]

Update DNS A/AAAA records with your current external IP address using the
netcup DNS API.

options:
  -h, --help            show this help message and exit
  --config-directory CFG_DIR
                        Path to directory where `.json` config files reside.
  --cache-directory CACHE_DIR
                        Path to cache directory. Retrieved and updated DNS
                        records are cached there.
  --cache-validity-seconds CACHE_VALIDITY_SECONDS
                        Value in seconds for how long cached DNS records are
                        valid. Set to `0` to disable caching.

TODOs

API backend:

Alternative external IP detection:

def external_ip_upnp():
    """
    https://stackoverflow.com/a/41385033

    Didn't work for me. Even after double checking fritz.box settings:

    fritz.box > Heimnetz > Netzwerk > Statusinformationen über UPnP übertragen
    """
    import miniupnpc
    u = miniupnpc.UPnP()
    u.discoverdelay = 1000
    u.discover()
    u.selectigd()
    print('external ip address: {}'.format(u.externalipaddress()))