dping 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +22 -0
- data/bin/dping +33 -0
- metadata +68 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1ba5dc4a450516dd09fbbdffa962618fb1760900
|
4
|
+
data.tar.gz: 6c0c2f461f8e76757e8184fc3ae04fee96353dbc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d0ad915a0cb04e48c7960e02499f1e596230038a9b6223c1bce87b5a83126bcd352304f2943ffb3ae2e6fb788840c78f12e95b69afc32ec6aa2e06dcb7276bcc
|
7
|
+
data.tar.gz: 67e9f39dc4d85356fd1b45d1f92f328c0ccc4c4f464eeb97804ce286cd7fbef6938ed53b550cd49f08cc36c1e0a42ce99db9fcd43c219e87f5c176997f2f991d
|
data/README.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# dping
|
2
|
+
|
3
|
+
Minimal Ruby script that updates an AWS Route53 record with the local host's outward facing IP address. Useful for a dynamic DNS type setup.
|
4
|
+
|
5
|
+
Install with:
|
6
|
+
|
7
|
+
```
|
8
|
+
gem install dping
|
9
|
+
```
|
10
|
+
|
11
|
+
Create `~/.aws-credentials-master` with something like the following:
|
12
|
+
|
13
|
+
```
|
14
|
+
AWSAccessKeyId=<key>
|
15
|
+
AWSSecretKey=<secret>
|
16
|
+
```
|
17
|
+
|
18
|
+
Then run from the command line:
|
19
|
+
|
20
|
+
```
|
21
|
+
dping home.example.com
|
22
|
+
```
|
data/bin/dping
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "fog"
|
4
|
+
|
5
|
+
target_name = ARGV.first
|
6
|
+
abort("Usage: dping <domain>") unless target_name
|
7
|
+
|
8
|
+
pairs = File.read(ENV["HOME"] + "/.aws-credentials-master").split.map { |l|
|
9
|
+
l.split("=").map { |v| v.strip }
|
10
|
+
}
|
11
|
+
conf = Hash[pairs]
|
12
|
+
|
13
|
+
id = conf["AWSAccessKeyId"] or abort("Need AWSAccessKeyId")
|
14
|
+
secret = conf["AWSSecretKey"] or abort("Need AWSSecretKey")
|
15
|
+
|
16
|
+
dns = Fog::DNS.new({
|
17
|
+
:provider => 'AWS',
|
18
|
+
:aws_access_key_id => id,
|
19
|
+
:aws_secret_access_key => secret
|
20
|
+
})
|
21
|
+
|
22
|
+
# get the zone by stripping the subdomain
|
23
|
+
target_domain = target_name.split(".").reverse[0, 2].reverse.join(".")
|
24
|
+
|
25
|
+
ip = Excon.get("https://icanhazip.com", expects: 200).body.strip
|
26
|
+
|
27
|
+
zone = dns.zones.detect { |z| z.domain =~ /#{target_domain}\.?/ }
|
28
|
+
abort("Zone not found") unless zone
|
29
|
+
|
30
|
+
record = zone.records.detect { |r| r.name =~ /#{target_name}\.?/ }
|
31
|
+
abort("Record not found") unless record
|
32
|
+
|
33
|
+
record.modify(value: [ip])
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dping
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brandur
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: fog
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.23'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.23.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.23'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.23.0
|
33
|
+
description:
|
34
|
+
email: brandur@mutelight.org
|
35
|
+
executables:
|
36
|
+
- dping
|
37
|
+
extensions: []
|
38
|
+
extra_rdoc_files: []
|
39
|
+
files:
|
40
|
+
- README.md
|
41
|
+
- bin/dping
|
42
|
+
homepage: https://github.com/brandur/hutils
|
43
|
+
licenses:
|
44
|
+
- MIT
|
45
|
+
metadata: {}
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options: []
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
requirements: []
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 2.2.2
|
63
|
+
signing_key:
|
64
|
+
specification_version: 4
|
65
|
+
summary: Minimal Ruby script that updates an AWS Route53 record with the local host's
|
66
|
+
outward facing IP address.
|
67
|
+
test_files: []
|
68
|
+
has_rdoc:
|