rack-ip-authorizer 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +14 -6
- data/README.md +8 -13
- data/lib/rack/ip_authorizer.rb +2 -2
- data/lib/rack/version.rb +1 -1
- data/lib/rack-ip-authorizer.rb +1 -1
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NzI0ZjdhZTI1NTFmYTM0ODNiNzU5ZTgwN2VlZDdlYzBmMDE2NzZmZg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZjlhNjE3MWE4ZGI2YjM5YTdjZTFkOTA2MDNmYjYwZjIwYzdjOTQ1Mw==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ODllNWZhNWM4ZjgwYTM2MWZlZWY4NzdjMDY2ZTQwZGRjZDQwODk5ZTc5ODI1
|
10
|
+
OGUxNTA4ZTg1OTQzODZkMTRmZjhhYTFiNGIyM2RhN2FjNmVlNWYwYmJjZmU0
|
11
|
+
MWNkY2UzNTNlNzAwZjdhNDFiZTMwMDNjZDFhNDcxNGZmMjY3MTA=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NjM4YjFkYjllODE1Y2M4ZDhkNWU1YzA3ZmQ1Y2NmN2UwMGI1ODM0NTJhNjE5
|
14
|
+
M2JkYzYzOWM5NGY2ODM1MjQ0MGUyMmExOTJkMmU3MTQxN2Y2OGVjZGVlNDIw
|
15
|
+
Y2MzMmJjNTgxODgwZjdiYTg3YmMwMTRlYTQyMWEzOGEzYWQxOGQ=
|
data/README.md
CHANGED
@@ -20,28 +20,23 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
### Rails 3 apps
|
22
22
|
|
23
|
-
1. Create
|
24
|
-
|
23
|
+
1. Create an initializer defining the environment you want to watch (production by default), example:
|
24
|
+
```ruby
|
25
|
+
Rack::IpAuthorizer.env_to_check = ['staging','development']
|
26
|
+
```
|
27
|
+
2. Create a file named "ip_authorizations.yml" in config directory
|
28
|
+
3. Fill it with paths (keys) and IPs (values) see example below
|
25
29
|
|
26
30
|
```yaml
|
27
31
|
admin:
|
28
32
|
- 192.168.0.1
|
29
33
|
- 192.168.0.2
|
30
34
|
- 192.168.0.3
|
31
|
-
|
35
|
+
monitor:
|
32
36
|
- 192.168.0.1
|
33
37
|
- 192.168.0.2
|
34
38
|
```
|
35
|
-
|
36
|
-
### Environment filter
|
37
|
-
|
38
|
-
Create an initializer and add:
|
39
|
-
|
40
|
-
```ruby
|
41
|
-
Rack::IpAuthorizer.env_to_check = ['staging','development']
|
42
|
-
```
|
43
|
-
|
44
|
-
Based on the file names in 'config/environments' you can use any of them including Rails defaults.
|
39
|
+
4. According to this example, path to http://www.my-application.com/admin and http://www.my-application.com/monitor have access restricted by IP
|
45
40
|
|
46
41
|
## Contributing
|
47
42
|
|
data/lib/rack/ip_authorizer.rb
CHANGED
data/lib/rack/version.rb
CHANGED
data/lib/rack-ip-authorizer.rb
CHANGED
@@ -10,7 +10,7 @@ if defined? Rails
|
|
10
10
|
if File.exists?(path)
|
11
11
|
ip_authorizations_by_path = YAML.load_file(path)
|
12
12
|
else
|
13
|
-
raise
|
13
|
+
raise 'config/ip_authorizations.yml is missing'
|
14
14
|
end
|
15
15
|
app.config.middleware.insert_after(ActionDispatch::RemoteIp, Rack::IpAuthorizer, ip_authorizations_by_path)
|
16
16
|
}
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-ip-authorizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thibault El Zamek, Cédric Darné, Lionel Oto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - '>='
|
17
|
+
- - ! '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - '>='
|
24
|
+
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -42,14 +42,14 @@ dependencies:
|
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - '>='
|
45
|
+
- - ! '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - '>='
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
@@ -66,7 +66,8 @@ dependencies:
|
|
66
66
|
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.6.2
|
69
|
-
description: Basic Rack middleware for Rails 3 to authorize access to path by IP
|
69
|
+
description: Basic Rack middleware for Rails 3 to authorize access to path by IP using
|
70
|
+
YML config file
|
70
71
|
email:
|
71
72
|
- thibault.elzamek@c4mprod.com, cedric.darne@c4mprod.com, lionel.oto@c4mprod.com
|
72
73
|
executables: []
|
@@ -75,8 +76,8 @@ extra_rdoc_files: []
|
|
75
76
|
files:
|
76
77
|
- LICENSE.txt
|
77
78
|
- README.md
|
78
|
-
- lib/rack/version.rb
|
79
79
|
- lib/rack/ip_authorizer.rb
|
80
|
+
- lib/rack/version.rb
|
80
81
|
- lib/rack-ip-authorizer.rb
|
81
82
|
- spec/rake_ip_authorizer_spec.rb
|
82
83
|
homepage: https://github.com/c4mprod/rack-ip-authorizer
|
@@ -89,20 +90,19 @@ require_paths:
|
|
89
90
|
- lib
|
90
91
|
required_ruby_version: !ruby/object:Gem::Requirement
|
91
92
|
requirements:
|
92
|
-
- - '>='
|
93
|
+
- - ! '>='
|
93
94
|
- !ruby/object:Gem::Version
|
94
95
|
version: '0'
|
95
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
97
|
requirements:
|
97
|
-
- - '>='
|
98
|
+
- - ! '>='
|
98
99
|
- !ruby/object:Gem::Version
|
99
100
|
version: '0'
|
100
101
|
requirements: []
|
101
102
|
rubyforge_project:
|
102
|
-
rubygems_version: 2.
|
103
|
+
rubygems_version: 2.0.8
|
103
104
|
signing_key:
|
104
105
|
specification_version: 4
|
105
|
-
summary: Basic Rack middleware for Rails 3 to authorize access to path by IP
|
106
|
-
YML config file
|
106
|
+
summary: Basic Rack middleware for Rails 3 to authorize access to path by IP
|
107
107
|
test_files:
|
108
108
|
- spec/rake_ip_authorizer_spec.rb
|