ipman

command module
v0.0.0-...-e994816 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

README

Mozilla Public License Go Report Card

ipman

Summary

IPman is a simple tool to automatically update DNS records (A and AAAA) based on the external local IPv4 and/or IPv6 address of the local machine. It uses ipify.com for the external address lookup and supports writing records to GoDaddy's DNS API. Both backend providers are modeled as interfaces to allow adding additional backends as needed in the future.

Installing

Users with a proper Go environment (1.8+ required) ...

go get -u github.com/leprechau/ipman

Developers that wish to take advantage of vendoring and other options ...

git clone https://github.com/leprechau/ipman.git
cd ipman
make

Usage

Summary
ahurt$ ipman --help
Usage: ipman [--version] [--help] <command> [<args>]

Available commands are:
    check     Return current external ip address of local machine.
    update    Update DNS registry with external ip address of local machine.
Check Options
Option Description
4 Get external IPv4 address if available.
6 Get external IPv6 address if available.
ipbe IP lookup backend (ipify or local) default: ipify
Update Options
Option Description
4 Get external IPv4 address if available.
6 Get external IPv6 address if available.
key The DNS API access key. May also be set via the IPMAN_DNS_KEY environment variable.
secret The DNS API access secret. May also be set by via the IPMAN_DNS_SECRET environment variable.
domain The DNS domain name. This value defaults to the domain portion of the local hostname.
name The DNS record name. This defaults to the domain root alias ("@").
ttl The DNS record ttl in seconds. This defaults to 600 seconds (5 minutes).
ipbe IP lookup backend (ipify or local). This defaults to ipify.
dnsbe DNS update backend (only godaddy currently). This defaults to godaddy.
Example
ahurt$ ./ipman update -4 -6 -key=YourAccessKey -secret=YourSuperSecretKey
2018/01/18 10:12:35 [IPv4] local/remote 67.187.109.252/67.187.109.252
2018/01/18 10:12:37 [IPv6] local/remote 2601:484:c000:5203:ec4:7aff:feb0:4068/2601:484:c000:5203:ec4:7aff:feb0:4068

The key and secret flags are optional when using environment variables. This will keep your keys from potentially showing up in the system process list. If Updates are required, the local address differs from the remote DNS record, the performed update will be printed.

Crontab (automatic updates)

To dynamically update your records in near real time you can crontab the utillity using something similar to the below in your local users crontab.

## ipman secrets for godaddy api
IPMAN_DNS_KEY=YourAccessKey
IPMAN_DNS_SECRET=YourSuperSecretKey

## check and possibly update dns entries every 30 minutes
*/30 * * * * /path/to/ipman update -4 -6 >/dev/null 2>&1

Please see the crontab documentation of your local system for more information.

Documentation

Overview

Package main initializes and starts ipman

Directories

Path Synopsis
command
check
Package check provides the check cli command
Package check provides the check cli command
update
Package update provides the update cli command
Package update provides the update cli command
Package common contains code shared between packages
Package common contains code shared between packages
dns
Package dns defines the DNS service backend interface
Package dns defines the DNS service backend interface
dns/godaddy
Package godaddy provides a DNS backend via the GoDaddy service
Package godaddy provides a DNS backend via the GoDaddy service
ip
Package ip defines the IP lookup backend interface
Package ip defines the IP lookup backend interface
ip/ipify
Package ipify provides an IP lookup backend via the ipify.org service
Package ipify provides an IP lookup backend via the ipify.org service
ip/local
Package local provides a machine local IP lookup backend
Package local provides a machine local IP lookup backend

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL