Code Monkey home page Code Monkey logo

dynroute's Introduction

  __                                        __
 /\ \                                      /\ \__
 \_\ \  __  __    ___   _ __   ___   __  __\ \ ,_\    __
 /'_` \/\ \/\ \ /' _ `\/\`'__\/ __`\/\ \/\ \\ \ \/  /'__`\
/\ \L\ \ \ \_\ \/\ \/\ \ \ \//\ \L\ \ \ \_\ \\ \ \_/\  __/
\ \___,_\/`____ \ \_\ \_\ \_\\ \____/\ \____/ \ \__\ \____\
 \/__,_ /`/___/> \/_/\/_/\/_/ \/___/  \/___/   \/__/\/____/
            /\___/
            \/__/

Node.js command line tool for dynamically updating your domain's dns to your current ip using Amazon Route53.

dynroute -h

Usage: dynroute [options]

Options:
   -d, --domain          Domain(s) to update [required] (you can specify multiple domains, ex: -d ro.domain.com -d en.domain.com)
   -z, --zone            Route 53 Zone ID that the domain lives in [default: searches all zones for domain]
   -ttl, --ttl           Time To Leave (in seconds) [default: 60]
   -t, --time            How frequently to check for IP update [default: 60]
   -o, --once            Check for IP update ONLY ONCE and exit [default: false]
   -g, --growl           Display growl notification after IP update [default: false]
   -aws, --awskeys       The path for the config file containing AWS credentials [default ~/.awsrc]
   -ipserv, --ipserver   Resp: { ip: "YOUR_IP_HERE" } [default https://api.ipify.org?format=json]
   -dbg, --debug         Print debugging info
   -v, --version         Print version and exit

Installation

$ npm install -g dynroute

Usage

  • Create a hosted zone for your domain in Route53, in case you don't already have one.
  • Update your domain's nameservers with the ones provided by Route53 (for that hosted zone).
  • Put your credentials into a config file such as ~/.awsrc (used by default)
[credentials]
accessKeyId     = AAAAAAAAAAAAAAAAAAAA
secretAccessKey = bbbbbbbbbbbbbbbbbbbbbLwccccembeMdddddI4e

Note that you might want to create another AWS user has CRUD rights for Route53 and use that instead of the admin account. Here's a sample AWS user policy:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "route53:ListHostedZones",
                "route53:ListResourceRecordSets",
                "route53:ChangeResourceRecordSets",
                "route53:CreateHostedZone",
                "route53domains:*"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

Update now & exit

dynroute -d home.mydomain.com --once

Leave script open to check for updated every X seconds

dynroute -d home.mydomain.com

By default the script will check every 60 seconds if your ip updated, but you can customize that:

dynroute -d home.mydomain.com --time 120

Growl

You can setup Growl notifications to let you know when your IP has been updated for your domain.

Ex:

dynroute -d localhost.mydomain.com --growl

What if the record doesn't exist for that domain?

If there is no A record for that hosted zone that matches your request the script will automatically create one.

Contributors

License

(The MIT License)

Copyright (c) 2012 Alexandru Vlăduţu <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

dynroute's People

Contributors

alessioalex avatar hazanjon avatar tesfaldet avatar tfe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dynroute's Issues

Sample aws user policy

Hopefully people won't use their admin account for every operation on aws. Would appreciate if you can update the readme.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "route53:ListHostedZones",
                "route53:ListResourceRecordSets",
                "route53:ChangeResourceRecordSets",
                "route53:CreateHostedZone",
                "route53domains:*"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

Erroring when running with -dbg

If I turn dbg option on, I get the below error. Without the debug option, everything works fine.

shell> dynroute -d some.domain.com -o -dbg

/volume1/@appstore/node/lib/node_modules/dynroute/dynroute.js:109
if (domain.indexOf(zone.name) > -1) {
^
TypeError: Object true has no method 'indexOf'
at updateDns.zoneId (/volume1/@appstore/node/lib/node_modules/dynroute/dynroute.js:109:26)
at Array.forEach (native)
at iterate (/volume1/@appstore/node/lib/node_modules/dynroute/dynroute.js:108:25)
at hostedZones.forEach.rootZone (/volume1/@appstore/node/lib/node_modules/dynroute/dynroute.js:99:15)
at process._tickCallback (node.js:415:13)

util.js library is attempting to self-reference .exit() function

there are a couple of instance of

util.exit(errMsg);

which are actually referencing the built-in util library, but I think the intention is to reference the .exit() function defined in the module itself.

A fix would be to do something like this:

var ns = {};

ns.exit = function(s){
   //...
};

ns.otherFunction = function(){
   //...
   if (err){ 
      ns.exit("got an error"); 
   }
};

module.exports = ns;

Update default IP server... again

It seems that http://ip-address.herokuapp.com/ip.json is no longer available, but there is a new service at https://api.ipify.org?format=json with the same result format (info here; it claims to be here for a while). You may want to update the default.

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.