jwlc 0.0.38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/jwlc.rb +90 -0
- metadata +58 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8cf376c487ebb2f2fb3aa738c80de659a7ad5889
|
4
|
+
data.tar.gz: 0ee7fefb4e18af987063a43a35e599be02a5f06b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 635f360909addb0da96a9d3f050bef0c0ece4830843af4a404b362cf608cf05353f2a6d9eb3509327d873aca99980ebd0b88ebc5ea538742cb946f18a6671047
|
7
|
+
data.tar.gz: 9f8a56a14229a9f3666045c6ecc0638fc9f6ae934c71ab664a5fdb5d1dc912ddfdccddfe92371aa32cc441d7201c0fd2e5636019b67fd1e0797108ce24ce8c95
|
data/lib/jwlc.rb
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'jwlc'
|
2
|
+
|
3
|
+
class Auth
|
4
|
+
# Authenticate a Guest user to a Juniper Networks Wireless LAN controller implemented as a Ruby method. All this does is send the RADIUS CoA packet
|
5
|
+
# to authenticate the user. You need to create a web portal to authencate the user (if required) prior to passing this RADIUS CoA message to the WLC.
|
6
|
+
#
|
7
|
+
# Example Login:
|
8
|
+
# >> Auth.login('10.0.0.100','web-portal-Guest','xx:xx:xx:xx:xx:xx','Guest',' ','testing123', 8)
|
9
|
+
# => Successfully authenticated user with MAC Address xx:xx:xx:xx:xx:xx
|
10
|
+
#
|
11
|
+
# Arguments:
|
12
|
+
# 1) Wireless LAN Controller address: (IP Address)
|
13
|
+
# 2) Authenticating users MAC Address (String)
|
14
|
+
# 3) Name of SSID being used (String)
|
15
|
+
# 4) Radius Shared secret (String)
|
16
|
+
# 5) Name of new ACL or ' ' (String)
|
17
|
+
# 6) Number of hours until logout (Integer)
|
18
|
+
#
|
19
|
+
# Example Logout:
|
20
|
+
# >> Auth.logout('10.0.0.100','Guest','xx:xx:xx:xx:xx:xx','testing123')
|
21
|
+
# => Logged out user xx:xx:xx:xx:xx:xx....bye bye
|
22
|
+
#
|
23
|
+
# Arguments:
|
24
|
+
# 1) Wireless LAN Controller address: (IP Address)
|
25
|
+
# 2) Authenticating users MAC Address (String)
|
26
|
+
# 3) Name of SSID being used (String)
|
27
|
+
# 4) Radius Shared secret (String)
|
28
|
+
#
|
29
|
+
#
|
30
|
+
# In order for this method to correctly function the WLC needs to be appropriatly configured with a
|
31
|
+
# suitable RADIUS DAC entry for the server (that originates this CoA request and a user needs to be
|
32
|
+
# in an unauthenticated state on the WLC.
|
33
|
+
#
|
34
|
+
# On the WLC configure the following entries for your Guest SSID once configured to ensure the server
|
35
|
+
# inititing this method is permitted to send RADIUS CoA.
|
36
|
+
#
|
37
|
+
#
|
38
|
+
# set service-profile Guest ssid-name Guest
|
39
|
+
# set service-profile Guest ssid-type clear
|
40
|
+
# set service-profile Guest auth-fallthru web-portal
|
41
|
+
# set service-profile Guest web-portal-form http://10.0.0.99:8080/guestportal <- Note, you need to create this portal :)
|
42
|
+
# set service-profile Guest web-portal-acl portalacl
|
43
|
+
#
|
44
|
+
# set radius dac ruby-dac-server address 10.0.0.99 key testing123
|
45
|
+
# set authorization dynamic ssid Guest ruby-dac-server
|
46
|
+
#
|
47
|
+
# You are required to have the freeradius dictionary files located in /usr/share/freeradius.
|
48
|
+
# Freeradius doesn't need to be operational, just the dictionary files are used.
|
49
|
+
#
|
50
|
+
|
51
|
+
def self.login(var1, var2, var3, var4, var5, var6)
|
52
|
+
dict = Radiustar::Dictionary.new('/usr/share/freeradius/')
|
53
|
+
|
54
|
+
loginpacket = {
|
55
|
+
'NAS-IP-Address' => var1,
|
56
|
+
'NAS-Identifier' => 'Trapeze',
|
57
|
+
'Event-Timestamp' => Time.now.to_i,
|
58
|
+
'User-Name' => 'web-portal-' + var3,
|
59
|
+
'Calling-Station-Id' => var2,
|
60
|
+
'Trapeze/Trapeze-CoA-Username' => var3,
|
61
|
+
'Session-Timeout' => (var6 * 3600),
|
62
|
+
'Filter-Id' => var5
|
63
|
+
}
|
64
|
+
|
65
|
+
req = Radiustar::Request.new(var1 + ':3799', { :dict => dict })
|
66
|
+
coa = req.coa_request(var4, loginpacket)
|
67
|
+
puts "Successfully authenticated user with MAC Address #{var2}. #{var6} hours remaining..."
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
def self.logout(var1, var2, var3, var4)
|
73
|
+
dict = Radiustar::Dictionary.new('/usr/share/freeradius/')
|
74
|
+
|
75
|
+
logoutpacket = {
|
76
|
+
'NAS-IP-Address' => var1,
|
77
|
+
'NAS-Identifier' => 'Trapeze',
|
78
|
+
'Event-Timestamp' => Time.now.to_i,
|
79
|
+
'User-Name' => var3,
|
80
|
+
'Calling-Station-Id' => var2,
|
81
|
+
'Session-Timeout' => 1
|
82
|
+
}
|
83
|
+
|
84
|
+
req = Radiustar::Request.new(var1 + ':3799', { :dict => dict })
|
85
|
+
coa = req.coa_request(var4, logoutpacket)
|
86
|
+
puts "Logged out user #{var2}....bye bye"
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jwlc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.38
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Francois Prowse
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: radiustar
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: AUthentcate to Juniper WLC Controller externally
|
28
|
+
email: fprowse@juniper.net
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- lib/jwlc.rb
|
34
|
+
homepage: http://rubygems.org/gems/wlc-auth
|
35
|
+
licenses:
|
36
|
+
- MIT
|
37
|
+
metadata: {}
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
requirements: []
|
53
|
+
rubyforge_project:
|
54
|
+
rubygems_version: 2.1.10
|
55
|
+
signing_key:
|
56
|
+
specification_version: 4
|
57
|
+
summary: Juniper Wireless LAN Controller RADIUS COA Authentication
|
58
|
+
test_files: []
|