Git Product home page Git Product logo

ipaddressexpress's Introduction

IpAddressExpress logo

Open issues Build Status

Why use IpAddressExpress?

Compared to shell scripts for figuring out the public IPv4 address IpAddressExpress will
securely and more reliable detect the current public IPv4 address than using a single public ip service. It's more secure because it does not require to trust a single server and uses HTTPS for tamper protection. What makes IpAddressExpress more secure is, that it requires consensus between two randomly selected public IPv4 address web services. Because of this it's not possible for a single public IPv4 address service to fool the program incorrectly thinking the public ip address has been changed. And by using multiple public IPv4 address services the current public IPv4 can still be discovered after some time even when one or more public IPv4 services are down. IpAddressExpress is written in C so it executes fast and efficiently.

How IpAddressExpress detects public IPv4 address change?

IpAddressExpress randomly selects a HTTPS public IPv4 address service from a list of known HTTPS public IPv4 address services for figuring out the public IPv4 address. It then compares the result with the previous result to detect if the public IPv4 address has changed. If change is detected from previous request, the change is confirmed with another randomly selected public IPv4 address HTTPS service so if one public IPv4 HTTPS service is lying, the lie is detected. If the public IPv4 address is valid and is different from last run the posthook command is executed with the new IPv4 address as a commandline argument.

Flowchart

A flowchart to explain how IpAddressExpress works: flowchart IpAddressExpress

Compiling IpAddressExpress from source

Install the required packages.

sudo apt-get install build-essential libcurl4-openssl-dev libsqlite3-dev git-core

Get the IpAddressExpress sourcecode in the current folder with:

cd /opt
git clone https://github.com/D9ping/IpAddressExpress.git

Then compile the program:

cd IpAddressExpress/
make

Use of IpAddressExpress

To use IpAddressExpress for check public IPv4 address change of a server and update the dynamic DNS entries with a shell script. Do the following:

  1. Run crontab -e to edit your crontab.
  2. Add the following line to run IpAddressExpress every 10 minutes as current user.
*/10 * * * * /opt/IpAddressExpress/ipaddressexpress --posthook "/bin/sh /opt/IpAddressExpress/update_ip_dns.sh"

Edit the update_ip_dns.sh example shell script with your code for updating your dynamic DNS entries.

Questions and Answers

Why not just trust one good public IP service for updating the (Dynamic) DNS?

You could do that but you are putting a lot of trust on one public IP address service that could technically hijack your domain record that you are automatically updating. By using IpAddressExpress you don't have to fully trust one public IP address service as lies or an errors from one public IP address service are spotted by using consensus with an other randomly selected public IP address service. This makes for example fooling your server on a dynamic public IPv4 address into thinking incorrectly it needs to update dynamic DNS records almost impossible.

Why not ask my router for my public IP address?

Good question. Well technically you could get the public IPv4 address from your router. But sadly every router manufacturer has a different webinterface for providing this information via their webinterface. And often the information is secured by a login screen. IpAddressExpress does not rely on the router and there fautures to provide the public IP address and because of this it just works for everyone where there is internet access.

What is the maximum downtime for my server could have if my public IP address changes?

It depends on how often you run the ipaddressexpress program for detecting your public ip change. Also note that if a public ip address service lies to you it will take an extra publicipchangedetector run longer. And if you are using IpAddressExpress for DDNS then it also depends on how long the DNS entries that needs to change are cached by the DNS servers for the old DNS records to be removed from cache.

Should i run IpAddressExpress as often as possible?

No, please be conservative on how often you run ipaddressexpress. Several public ip services are already serving a lot of requests. They don't like it you use too much bandwidth and they will ban/drop you or may send you a http error itstead of your public ip address if you are making too many requests too quickly.

Does IpAddressExpress makes two request on execution?

No, it only make 1 http request if the previous public ip address from last run is known.

What about IPv6?

There is no need to support IPv6 as a IPv6 is often a internet routable address.

How do i get the current public IPv4 address from commandline?

Run ipaddressexpress with the -showip argument to always print the current public ip address.

What command-line arguments can i use?

Run ipaddressexpress with the -h command-line argument for help on all the possible command-line arguments to use.

Does IpAddressExpress need root rights?

No, IpAddressExpress can just run fine as a lower privilege user as long as it can read and write to the sqlite database file. The sqlite database file stores all ipservice IpAddressExpress can use and the information of the the last used ipservice. etc.

Are all the pubic ip service's hardcoded in the application?

All the services that are used are stored in a SQLite database file. If the SQLite database file exists you can remove, disable or add any public ip services with standard SQL. If the SQLite database file does not exist then the SQLite database file is created and about 20 public ip services are added to the database file by default to use.

ipaddressexpress's People

Contributors

d9ping avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

ipaddressexpress's Issues

Get last date & time IpAddressExpress has been runned succesfully

Make the possible to print the last date and time IpAddressExpress was run.

Is your feature request related to a problem? Please describe.
Usefull for bash scripts.

Describe the solution you'd like
Launching IpAddressExpress with -lastrun will print the last time IpAddressExpress has succesfully run(exit code: 0)

Describe alternatives you've considered
DIY by the script

Additional context
It will require IpAddressExpress to write last run date and time to sqlite database.

Ip service priorities

Is your feature request related to a problem? Please describe.
Some https/http ip services can handle a lot less traffic than others. It could be a reliability improvement if they are less often chosen instead of giving all ip service an equal chance to be chosen.

Describe the solution you'd like
Added a priority value field to all ip services in the database. All ip services that want to be less chosen have a higher value.

Describe alternatives you've considered
We could also consider making a higher priority value for an http/https ip service choose more often instead of a lower priority value.

Configure how long a ipservice should be disabled

Make it possible to configure with a command-line argument, how long a temporary disabled ipservice should be disabled. (due to a temporary issue with ipservice, e.g. website unreachable.)
Currently 14400 seconds or 4 hours.

Support checking robots.txt

IpAddressExpress should check robots.txt file on the webserver of the ipservice to make sure the configured ipservice does allow IpAddressExpress to make request to it.
If IpAddressExpress figures out that robots.txt contains:

User-agent: IpAddressExpress
Disallow: /

It should disable the ipservice to be used in the database.
robots.txt should be checked once every week for every ipservice and at startup of IpAddressExpress.

Print date and time with error messages

Is your feature request related to a problem? Please describe.
Output date and time, useful for redirection program output to log file to see when it happened.

Describe the solution you'd like
Output date and time in ISO8601 format for every error message.(stderr)

Describe alternatives you've considered
It could also be possible to add a --logfile argument with a path to the log file to be created/appended.
That will always use date and time for every line written to the log file.

Project name

Is your feature request related to a problem? Please describe.
I need a better name for this project. Currently it's still the working name.

Describe the solution you'd like
Anyone reading this could help me provide a new name for this software.

Describe alternatives you've considered

  • IPUnbelief;
  • IpAddressExpress;
  • ConsensusIpUpdater (CIU for short. Ddns updating does not have to be the only use);
  • Some Greek mythological figures or others

Confirming with a third ip service

Add a option for a mode where the public ip change is always confirmed by use of a third ip service. This option will not be used by default as this it is unlike two properly randomly selected ip services are both abused/hacked out of the default list of 20 ip services and on about the same time.

Get public ip address by use of special DNS

Make it possible to get the public ip address by use of a DNS service. Like the special myip.opendns.com dns request that returns the public ip adres if using opendns dns server(208.67.222.222).
Look if there are other DNS servers offering something like this too.

Floating point exception when no ipservices available

Describe the bug
Floating point exception is throw when all configured ipservices are disabled or deleted from the SQLite database.

Expected behavior
A error message should be showed that there are no ipservices.

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.