Skip to content

Repository files navigation

No-IP Java DNS Updater

Donate Java CircleCI Known Vulnerabilities Code Size License

This is a Java DNS updater for No-IP, an alternative to DUC (DNS Update Client). This updater is using both Ipify and No-IP APIs to retrieve your current IP address and update your No-IP hostname. See: settings.json

Property Description
userName your No-IP username
password your No-IP password
hostName the hostname(s) (host.domain.com) or group(s) (group_name) to be updated
userAgent HTTP User-Agent to help No-IP identify your client
ipProtocol IP protocol to use: ipv4, ipv6, or dual (default)

Note: when making an update it's important to configure through the userAgent property an HTTP User-Agent in order to help No-IP identify different clients that access the system. Clients that don't supply a User-Agent risk being blocked from the system. Your user agent should be in the following format:

NameOfUpdateProgram/VersionNumber maintainercontact@domain.com

IP Protocol

The ipProtocol setting allows you to choose which IP address type to use when updating your No-IP hostname:

Value Ipify API Endpoint Description
ipv4 api.ipify.org IPv4 only
ipv6 api6.ipify.org IPv6 only
dual (default) api64.ipify.org Returns either IPv4 or IPv6 based on your network

Example settings.json:

{
	"userName": "your_username",
	"password": "your_password",
	"hostName": "yourhost.ddns.net",
	"userAgent": "MyApp/1.0 your@email.com",
	"ipProtocol": "dual"
}

You can also override this setting using the environment variable NOIP_IP_PROTOCOL:

export NOIP_IP_PROTOCOL=ipv6

Default: dual (automatically detects IPv4/IPv6)

Quick Start

One-liner to download, configure and execute:

Windows (PowerShell):

powershell -ExecutionPolicy Bypass -Command "Invoke-RestMethod -Uri 'https://raw.githubusercontent.com/davidecolombo/noip/master/Install.ps1' | Invoke-Expression"

Or download and run locally:

Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/davidecolombo/noip/master/Install.ps1' -OutFile Install.ps1
.\Install.ps1

Password Encryption (Optional)

For enhanced security, you can encrypt your password in the settings file instead of storing it as plaintext. The application uses AES-256 encryption with a master key that you provide at runtime.

Encrypting Your Password

Option 1: Using the CLI

java -jar noip.jar -encrypt "your_plaintext_password" -encryptor-key "your_master_key"

Option 2: Using the script (Windows)

.\Encrypt.ps1 -Password "your_plaintext_password" -Key "your_master_key"

This will output something like:

ENC(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)

Configuration File

Update your settings.json to use the encrypted password:

{
	"userName": "your_username",
	"password": "ENC(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...)",
	"hostName": "yourhost.ddns.net",
	"userAgent": "MyApp/1.0 your@email.com"
}

Running with Encrypted Password

Provide the master key at runtime using one of these methods (priority order):

1. CLI argument (highest priority)

java -jar noip.jar -settings settings.json -encryptor-key "your_master_key"

2. Environment variable

export NOIP_ENCRYPTOR_KEY="your_master_key"
java -jar noip.jar -settings settings.json

3. System property (lowest priority)

java -Dnoip.encryptor.key="your_master_key" -jar noip.jar -settings settings.json

Additional CLI Commands

  • Encrypt: -encrypt <password> - Encrypt a plaintext password
  • Decrypt: -decrypt <encrypted_value> - Decrypt an encrypted value to verify
  • Encryptor Key: -encryptor-key <key> - Specify the encryption key (highest priority)

Security Notes

  • The master key is never stored in the configuration file
  • If the password does not start with ENC(, it is treated as plaintext (backward compatible)
  • Keep your master key safe - without it, the encrypted password cannot be decrypted
  • On Unix systems, consider using a .env file loaded by your cron job to set the environment variable

Environment Variables

You can override settings from the JSON file using environment variables. Environment variables take precedence over file settings.

Variable Description Default
NOIP_USERNAME Override username -
NOIP_PASSWORD Override password (plaintext) -
NOIP_USER_AGENT Override user-agent NoIP-Java/1.0 no-reply@noip.local
NOIP_HOSTNAME Override hostname -
NOIP_IP_PROTOCOL Override IP protocol (ipv4, ipv6, dual) dual
NOIP_ENCRYPTOR_KEY Encryption key for encrypted passwords -

Example

export NOIP_USERNAME="myuser"
export NOIP_PASSWORD="mypass"
export NOIP_USER_AGENT="MyApp/1.0 my@email.com"
export NOIP_HOSTNAME="myhost.ddns.net"
export NOIP_IP_PROTOCOL="ipv6"
java -jar noip.jar -settings settings.json

Priority Order

For each setting, the priority is:

  1. Environment variable (highest)
  2. Encrypted password in file (for password only)
  3. Plaintext value in file (lowest)

For ipProtocol, the priority is:

  1. Environment variable (NOIP_IP_PROTOCOL)
  2. Value in settings file (dual by default)

Encryption Key Priority

The encryption key is resolved in this order:

  1. CLI argument (-encryptor-key)
  2. Environment variable (NOIP_ENCRYPTOR_KEY)
  3. System property (noip.encryptor.key)

Scheduling

Please note you may want to schedule the application execution in order to keep updated your dynamic DNS, and the simplest way on *NIX systems is probably using Cron. Example:

*/30 * * * * sudo NOIP_ENCRYPTOR_KEY="your_master_key" java -cp /home/user/noip.jar io.github.davidecolombo.noip.App -settings /home/user/settings.json > /home/user/noip-log.txt 2>&1

Example Output

Successful execution (IP unchanged - "nochg"):

Running No-IP updater with:
  Username: <username>
  Hostname: <hostname>

SLF4J(I): Connected with provider of type [ch.qos.logback.classic.spi.LogbackServiceProvider]
[main] INFO  u.o.l.s.context.SysOutOverSLF4J - Replaced standard System.out and System.err PrintStreams with SLF4JPrintStreams
[main] INFO  u.o.l.s.context.SysOutOverSLF4J - Redirected System.out and System.err to SLF4J for this context
[main] INFO  io.github.davidecolombo.noip.App - Starting No-IP update process with settings file: src\test\resources\settings.json
[main] INFO  i.g.d.noip.NoIpUpdater - No-IP configuration loaded and validated successfully
[main] INFO  i.g.d.noip.NoIpUpdater - Retrieving current IP address from Ipify API
[main] INFO  i.g.d.noip.NoIpUpdater - Retrieved IP address '<ip_address>' from Ipify in <time>ms
[main] INFO  i.g.d.noip.NoIpUpdater - Updating No-IP hostname '<hostname>' to IP address '<ip_address>'
[main] INFO  i.g.d.noip.NoIpUpdater - No-IP API request completed in <time>ms - HTTP status: 200 OK
[main] INFO  i.g.d.noip.NoIpUpdater - No-IP response for hostname '<hostname>': nochg <ip_address>
[main] WARN  io.github.davidecolombo.noip.App - No-IP update completed with status code: 1
[main] INFO  io.github.davidecolombo.noip.App - Application exiting with status code: 1

Exit Codes

Code Description
0 Success - IP address was updated
1 Success - IP address is already up to date (nochg)
2 Error - Invalid hostname
3 Error - Authentication failed (badauth)
-1 Error - Unexpected error

Or using a wrapper script that sets the environment variable:

About

This is a Java DNS updater for No-IP, an alternative to DUC (DNS Update Client). This updater is using both Ipify and No-IP APIs to retrieve your current IP address and update your No-IP hostname.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages