ip-wrangler 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50080e463e7d3a360d4376c0fecbc3b5c1793a9c
4
- data.tar.gz: 382884d4b28641f19d00be8eed3180af9d8e28c1
3
+ metadata.gz: 810e91e9fe68e1da3839f2aac5b49cb76c239963
4
+ data.tar.gz: 21042e195f821f83e08dcef4194a28ade84c7a24
5
5
  SHA512:
6
- metadata.gz: 8cb5a20e02220e89a5720bc6df8514d78151effda458eb33715d6079d927c6dca24e5c36ac9e3d8e7c54390f071b3ff38620535aaa3249a77ec79e1615ca0c9e
7
- data.tar.gz: 8ba4ad2bd27f2a26e41556f410895da3d52053647ab9a0f8b005acf3c1e61a9a998edb7191489765cdf34ebda50d32bfd44fa5afe144da2f90e05dbe359407a4
6
+ metadata.gz: 17cc276c7bf20e6bb9aa6a3ff9820df4f3022b0ee5fea0b0375ad6a92b2afc2e8ea76cedaa4cd66c56a7816395a12aa91d0c2bd6335a0c22af4c13baca1460b2
7
+ data.tar.gz: e69b73cefb033ddef3554b6629a83522fae80228b069bbe756f00f781a2abd4c924fb802c3b2a58e3b18621fedf740a80eb0d5caba01c113cd3d3052823a2b70
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.1
data/DOCS.md ADDED
@@ -0,0 +1,113 @@
1
+ # Flow - API
2
+
3
+ ## get `/nat/port`
4
+
5
+ * `get_nat_ports` on NAT
6
+ * `select_nat_port` on DB
7
+ * replace `public_ip` with `ext_ip`
8
+
9
+ ## get `/nat/port/<private_ip>`
10
+
11
+ * `get_nat_ports` on NAT by `private_ip`
12
+ * `select_nat_port` on DB by `private_ip`
13
+ * replace `public_ip` with `ext_ip`
14
+
15
+ ## get `/nat/ip`
16
+
17
+ * `get_nat_ips` on NAT
18
+ * `select_nat_ip` on DB
19
+
20
+ ## get `/nat/ip/<private_ip>`
21
+
22
+ * `get_nat_ips` on NAT by `private_ip`
23
+ * `select_nat_ip` on DB by `private_ip`
24
+
25
+ ## post `/nat/port/<private_ip>/<private_port>/<protocol>`
26
+
27
+ * `lock_port` on NAT by `private_ip, private_port, protocol`
28
+ * `select_nat_port` on DB by `private_ip, private_port, protocol`
29
+ * check if empty
30
+ * `find_port` on NAT by `private_ip, private_port, protocol`
31
+ * `get_first_empty_nat_port` from DB for protocol `protocol`
32
+ * check if `not_used_port` and if `not_exists_nat_port`
33
+ * `insert_nat_port` to DB
34
+ * `append_nat_port` to IpTables
35
+ * else return exists
36
+
37
+ ## post `/nat/port/<private_ip>/<private_port>`
38
+
39
+ The same as for **post** `/nat/port/<private_ip>/<private_port>/<protocol>` for
40
+ both `tcp` and `udp` protocols.
41
+
42
+ ## post `/nat/ip/<private_ip>`
43
+
44
+ * `lock_ip` on NAT by `private_ip`
45
+ * `select_nat_ip` on DB by `private_ip`
46
+ * check if empty
47
+ * `find_ip` on NAT by `private_ip`
48
+ * `get_first_empty_nat_ip` on DB
49
+ * check if `not_used_ip` and if `not_exists_nat_ip`
50
+ * `insert_nat_ip` to DB
51
+ * `append_nat_ip` to IpTables
52
+ * else return exists
53
+
54
+ ## delete `/nat/port/<private_ip>/<private_port>/<protocol>`
55
+
56
+ * `release_port` on NAT by `private_ip, private_port, protocol`
57
+ * for each `select_nat_port` on DB:
58
+ * `delete_nat_port` on IpTables
59
+ * `delete_nat_port` on DB by `private_ip, private_port, protocol`
60
+
61
+ ## delete `/nat/port/<private_ip>/<private_port>`
62
+
63
+ The same as for **delete** `/nat/port/<private_ip>/<private_port>/<protocol>` for
64
+ both `tcp` and `udp` protocols.
65
+
66
+ ## delete `/nat/port/<private_ip>`
67
+
68
+ The same as for **delete** `/nat/port/<private_ip>/<private_port>/<protocol>` for
69
+ both for all mappings.
70
+
71
+ ## delete `/nat/ip/<private_ip>/<private_port>`
72
+
73
+ * `release_ip` on NAT by `private_ip, public_ip`
74
+ * for each `select_nat_ip` on DB:
75
+ * `delete_nat_ip` on IpTables
76
+
77
+ ## delete `/nat/ip/<private_ip>`
78
+
79
+ The same as for **delete** `/nat/ip/<private_ip>/<private_port>` for all mappings.
80
+
81
+ # Flow - Old API
82
+
83
+ ## get `/`
84
+
85
+ Return `IptWr REST Endpoint!`
86
+
87
+ ## get `/dnat`
88
+
89
+ * `get_nat_ports` on NAT
90
+ * `select_nat_port` on DB
91
+ * replace `public_ip` with `ext_ip`
92
+
93
+ ## get `/dnat/<ip>`
94
+
95
+ * `get_nat_ports` on NAT by `ip`
96
+ * `select_nat_port` on DB by `ip`
97
+ * replace `public_ip` with `ext_ip`
98
+
99
+ ## post `/dnat/<ip>` with JSON body
100
+
101
+ * for each port in JSON body: `lock_port`; see **post** `/nat/port/`
102
+
103
+ ## delete `/dnat/<ip>/<port>/<proto>`
104
+
105
+ The same as **delete** `/nat/port/<private_ip>/<private_port>/<protocol>`.
106
+
107
+ ## delete `/dnat/<ip>/<port>`
108
+
109
+ The same as **delete** `/nat/port/<private_ip>/<private_port>`.
110
+
111
+ ## delete `/dnat/<ip>`
112
+
113
+ The same as **delete** `/nat/port/<private_ip>`.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ip-wrangler (0.1.0)
4
+ ip-wrangler (0.1.2)
5
5
  json (~> 1.8)
6
6
  sequel (~> 4.19)
7
7
  sinatra (~> 1.4)
@@ -11,24 +11,24 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- daemons (1.1.9)
15
- eventmachine (1.0.6)
14
+ daemons (1.2.2)
15
+ eventmachine (1.0.7)
16
16
  json (1.8.2)
17
17
  rack (1.6.0)
18
18
  rack-protection (1.5.3)
19
19
  rack
20
20
  rake (10.4.2)
21
- sequel (4.19.0)
22
- sinatra (1.4.5)
21
+ sequel (4.21.0)
22
+ sinatra (1.4.6)
23
23
  rack (~> 1.4)
24
24
  rack-protection (~> 1.4)
25
- tilt (~> 1.3, >= 1.3.4)
25
+ tilt (>= 1.3, < 3)
26
26
  sqlite3 (1.3.10)
27
27
  thin (1.6.3)
28
28
  daemons (~> 1.0, >= 1.0.9)
29
29
  eventmachine (~> 1.0)
30
30
  rack (~> 1.0)
31
- tilt (1.4.1)
31
+ tilt (2.0.1)
32
32
 
33
33
  PLATFORMS
34
34
  ruby
data/README.md CHANGED
@@ -45,6 +45,8 @@ Install `ruby` and `bundler` (as root, **optional**):
45
45
  popd
46
46
  popd
47
47
 
48
+ > **Note!** You can use *rbenv* or *rvm* if you don't want to install ruby globally.
49
+
48
50
  Install this software:
49
51
 
50
52
  gem install ip-wrangler
@@ -88,7 +90,9 @@ To clean rules created by `ipwrangler` in `iptables`:
88
90
 
89
91
  ip-wrangler-clean <iptables_chain_name|maybe:IPT_WR>
90
92
 
91
- You can use *init.d* scripts to start and stop *migratio* automatic. Check [`initd.md`](support/initd.md)
93
+ You can use *init.d* scripts to start and stop *migratio* automatic.
94
+ Plase check [`initd.md`](support/initd.md). Be aware that service will
95
+ run as `root`. You can change it by modifing [script](support/initd/ip-wrangler).
92
96
 
93
97
  ### Log'n'roll
94
98
 
@@ -173,6 +177,10 @@ Deleting:
173
177
  * `DELETE /dnat/<private_ip>/<private_port>` - delete NAT port for specified IP
174
178
  * `DELETE /dnat/<private_ip>` - delete any NAT port for specified IP
175
179
 
180
+ ## Flow
181
+
182
+ More information in [docs](DOCS.md).
183
+
176
184
  ## Contributing
177
185
 
178
186
  1. Fork it!
@@ -1,3 +1,3 @@
1
1
  module IpWrangler
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
data/support/initd.md CHANGED
@@ -20,3 +20,5 @@ Set values to:
20
20
  * database file: `/etc/ip-wrangler/ip-wrangler.db`
21
21
 
22
22
  Update your `initd` configuration to enable start and stop service. `ip-wrangler` will started by `root`.
23
+
24
+ Remeber about *logrotate* settings. Please check section [Log'n'roll](https://github.com/dice-cyfronet/ip-wrangler#lognroll).
@@ -0,0 +1,18 @@
1
+ [Unit]
2
+ Description=IP-Wrangler Service
3
+
4
+ [Service]
5
+ Type=forking
6
+ User=ip-wrangler
7
+ Group=ip-wrangler
8
+ PermissionsStartOnly=true
9
+ Environment="GEM_PATH=/usr/share/gems"
10
+ ExecStartPre=/usr/bin/mkdir -p /var/run/ip-wrangler
11
+ ExecStartPre=/usr/bin/chown -R ip-wrangler:ip-wrangler /var/run/ip-wrangler
12
+ ExecStart=/usr/bin/ip-wrangler-start -c /etc/ip-wrangler.yml -P /var/run/ip-wrangler/ip-wrangler.pid
13
+ ExecStop=/usr/bin/ip-wrangler-stop -P /var/run/ip-wrangler/ip-wrangler.pid
14
+ PIDFile=/var/run/ip-wrangler/ip-wrangler.pid
15
+
16
+ [Install]
17
+ WantedBy=multi-user.target
18
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ip-wrangler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paweł Suder
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-02-12 00:00:00.000000000 Z
13
+ date: 2015-04-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sinatra
@@ -132,7 +132,9 @@ files:
132
132
  - ".gitignore"
133
133
  - ".hound.yml"
134
134
  - ".rubocop.yml"
135
+ - ".ruby-version"
135
136
  - CHANGELOG
137
+ - DOCS.md
136
138
  - Gemfile
137
139
  - Gemfile.lock
138
140
  - LICENSE.txt
@@ -161,6 +163,7 @@ files:
161
163
  - lib/ip_wrangler/version.rb
162
164
  - support/initd.md
163
165
  - support/initd/ip-wrangler
166
+ - support/systemd/ip-wrangler.service
164
167
  homepage: https://github.com/dice-cyfronet/ip-wrangler
165
168
  licenses:
166
169
  - MIT
@@ -181,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
184
  version: '0'
182
185
  requirements: []
183
186
  rubyforge_project:
184
- rubygems_version: 2.2.2
187
+ rubygems_version: 2.4.5
185
188
  signing_key:
186
189
  specification_version: 4
187
190
  summary: Service is responsible for managing DNAT rules in iptables nat table