GitXplorerGitXplorer
a

ip-change-notification

public
0 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
339fff2f9f99cbda2edcee4a9bf12530278fbad1

Update gitignore.

aavsolatorio committed 4 years ago
Unverified
def60959c2012731e31b32323fd3f968bb893b6a

Update checker script.

aavsolatorio committed 4 years ago
Unverified
489a8cb880adc6ceee555dde166dec2cdc921898

Add ip info at the start.

aavsolatorio committed 6 years ago
Unverified
0d416af71e7df8f108ff715711d8b02cb39c6202

Update linode host updater to update multiple hosts in linode_host_data.dict

aavsolatorio committed 8 years ago
Unverified
776881dfd1865ddba341936aff5d21a7d071369d

Actually support a legit DDNS setup using linode!

committed 8 years ago
Unverified
876ad9e12601391dfe501b7878160459194d3c48

Make cleaner logs.

aavsolatorio committed 8 years ago

README

The README file for this repository.

ip-change-notification

This module is designed to keep track of the current public ip address of a server by sending an e-mail to your designated recipient (set in the credentials file below).

If you don't have a DDNS setup, this can help you connect to, for example, a server at home via the ip address (with proper firewall/ports setup of course!).

Specifically, this can also be used in raspberry pi's if you want to access it remotely!

Requirements

  • Install the required python modules: the enum module is used which is not a standard python library.
$ cd ./src
$ pip install -r requirements.txt
  • Create credential file: this service needs a pickled file called personal_email_creds.dict containing your gmail credentials (name, passwd, and recipient email address). This part is not secure, so make sure that nobody gets access to this file! A utility script is available to assist you in creating this file.
$ cd ./src/utils
$ python generate_credentials.py

Running automatically

For this to serve its purpose, this script should run automatically on startup or whenever it's not running! This is done by installing the entry I placed in the crontab.entry file into your server's crontab.

An assumption here is that the project is in your home directory. You can just simply make a symbolic link from the actual project location to your home directory.

Additional features

I added a feature that updates an html file in a remote server (with static public IP) running an http service. Having this, aside from receiving an e-mail when the IP changes, you can view the current IP by checking the updated page. See update_remote_server method inside the public_ip_checker.py script. This requires proper ssh configuration to the remote server. You can use a utility script I wrote to create/add the ssh config file if you have a remote server.

$ cd ./src/utils
$ python setup_remote_server_config.py

Debugging notes

In case the service is not running, make sure that the lock file (/tmp/public_ip_checker.py.lock) is not present. I made a mechanism that will automatically remove this lock during ungraceful shutdown of the service. I might have missed handling all scenario so this lock might persist which will result to the service to not run automatically the next it's suppose to run.