GithubHelp home page GithubHelp logo

dy-fi-updater's Introduction

dy-fi-updater

This is a script for updating dynamic DNS in https://dy.fi/. While IPv4 updating can be done with a one-liner, this script supports IPv6, MX, multiple domains, even multiple accounts. Also the IP address is checked before updating, so that the script may be safely used as often as necessary without flooding the service.

Configuration

Create dy-fi-updater.conf as valid JSON.

{
	"ipv4": true,
	"ipv6": true,
	"mx": "offline.dy.fi",
	"accounts": [
		{
			"email": "[email protected]",
			"password": "foo-bar-baz",
			"hosts": [
				{"hostname": "alpha-example.dy.fi"},
				{"hostname": "bravo-example.dy.fi"}
			]
		},
		{
			"email": "[email protected]",
			"password": "foo-bar-baz",
			"hosts": [
				{"hostname": "charlie-example.dy.fi"},
				{"hostname": "delta-example.dy.fi"}
			]
		}
	]
}

Usage with systemd

  • Install files (sh install.sh / does the trick, if not using a package manager).
  • Edit /etc/dy-fi-updater.conf (system) or ~/.config/dy-fi-updater.conf (user).
  • Optional security for system-wide usage:
    • chown the configuration and state to a dedicated user.
    • systemctl edit dy-fi-updater.service and add User=dedicated-user.
  • Enable dy-fi-updater.timer (system or user).
    • For single user, loginctl enable-linger might be useful.

Usage as stand-alone application

To run as a stand-alone application, simply start CLI.php.

php src/CLI.php -c dy-fi-updater.conf -s dy-fi-updater.state

Usage with PHP

<?php
# Use a PSR-4 autoloader

$conf_file = __DIR__ . "/dy-fi-updater.conf";
$state_file = __DIR__ . "/dy-fi-updater.state";

$conf = json_decode(file_get_contents($conf_file), true);
$conf["state"] = $state_file;

try {
	Metabolix\DyFiUpdater\Updater::runOnce($conf);
} catch (Metabolix\DyFiUpdater\Exception $e) {
	print_r($e->log);
	die($e->getMessage());
}

License

The Unlicense (Public Domain)

dy-fi-updater's People

Contributors

metabolix avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.