openvpn-status-web 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .DS_Store
2
+ *.lock
3
+ pkg/*
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.0.0
5
+ - 1.9.3
6
+ - 1.8.7
7
+
8
+ gemfile:
9
+ - Gemfile
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,187 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
data/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # openvpn-status-web
2
+
3
+ Small (another word for naive in this case, it's simple and serves my needs) [rack](http://rack.github.com/) app
4
+ providing the information the [OpenVPN](http://openvpn.net/index.php/open-source.html) server collects in it's status file
5
+ especially including a list of currently connected clients (common name, remote address, traffic, ...).
6
+ It comes with a Debian 6 compatible init.d file.
7
+
8
+ It lacks:
9
+
10
+ * authentication
11
+ * caching (parses file on each request, page does auto-refresh every minute as OpenVPN updates the status file these often)
12
+ * management interface support
13
+ * *possibly more...*
14
+
15
+ ## License
16
+
17
+ openvpn-statsu-web is licensed under the Apache License, Version 2.0. See LICENSE for more information.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,4 @@
1
+
2
+ require 'openvpn-status-web'
3
+
4
+ OpenVPNStatusWeb::Daemon.run!
@@ -0,0 +1,14 @@
1
+ OpenVPN CLIENT LIST
2
+ Updated,Sun Jan 1 23:42:00 2012
3
+ Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since
4
+ foo,1.2.3.4:1234,11811160064,4194304,Sun Jan 1 23:42:00 2012
5
+ bar,1.2.3.5:1235,512,2048,Sun Jan 1 23:42:00 2012
6
+ ROUTING TABLE
7
+ Virtual Address,Common Name,Real Address,Last Ref
8
+ 192.168.0.0/24,foo,1.2.3.4:1234,Sun Jan 1 23:42:00 2012
9
+ 192.168.66.2,bar,1.2.3.5:1235,Sun Jan 1 23:42:00 2012
10
+ 192.168.66.3,foo,1.2.3.4:1234,Sun Jan 1 23:42:00 2012
11
+ 2001:db8:0:0::1000,bar,1.2.3.5:1235,Sun Jan 1 23:42:00 2012
12
+ GLOBAL STATS
13
+ Max bcast/mcast queue length,42
14
+ END
@@ -0,0 +1,12 @@
1
+ TITLE,OpenVPN 2.1_rc15 mipsel-unknown-linux-gnu [SSL] [LZO1] [EPOLL] built on Mar 27 2009
2
+ TIME,Sun Jan 1 23:42:00 2012,1238702330
3
+ HEADER,CLIENT_LIST,Common Name,Real Address,Virtual Address,Bytes Received,Bytes Sent,Connected Since,Connected Since (time_t)
4
+ CLIENT_LIST,foo,1.2.3.4:1234,11811160064,4194304,Sun Jan 1 23:42:00 2012,1238702330
5
+ CLIENT_LIST,bar,1.2.3.5:1235,512,2048,Sun Jan 1 23:42:00 2012,1238702330
6
+ HEADER,ROUTING_TABLE,Virtual Address,Common Name,Real Address,Last Ref,Last Ref (time_t)
7
+ ROUTING_TABLE,192.168.0.0/24,foo,1.2.3.4:1234,Sun Jan 1 23:42:00 2012,1238702330
8
+ ROUTING_TABLE,192.168.66.2,bar,1.2.3.5:1235,Sun Jan 1 23:42:00 2012,1238702330
9
+ ROUTING_TABLE,192.168.66.3,foo,1.2.3.4:1234,Sun Jan 1 23:42:00 2012,1238702330
10
+ ROUTING_TABLE,2001:db8:0:0::1000,bar,1.2.3.5:1235,Sun Jan 1 23:42:00 2012,1238702330
11
+ GLOBAL_STATS,Max bcast/mcast queue length,42
12
+ END
@@ -0,0 +1,12 @@
1
+ TITLE OpenVPN 2.1_rc15 mipsel-unknown-linux-gnu [SSL] [LZO1] [EPOLL] built on Mar 27 2009
2
+ TIME Sun Jan 1 23:42:00 2012 1238702330
3
+ HEADER CLIENT_LIST Common Name Real Address Virtual Address Bytes Received Bytes Sent Connected Since Connected Since (time_t)
4
+ CLIENT_LIST foo 1.2.3.4:1234 11811160064 4194304 Sun Jan 1 23:42:00 2012 1238702330
5
+ CLIENT_LIST bar 1.2.3.5:1235 512 2048 Sun Jan 1 23:42:00 2012 1238702330
6
+ HEADER ROUTING_TABLE Virtual Address Common Name Real Address Last Ref Last Ref (time_t)
7
+ ROUTING_TABLE 192.168.0.0/24 foo 1.2.3.4:1234 Sun Jan 1 23:42:00 2012 1238702330
8
+ ROUTING_TABLE 192.168.66.2 bar 1.2.3.5:1235 Sun Jan 1 23:42:00 2012 1238702330
9
+ ROUTING_TABLE 192.168.66.3 foo 1.2.3.4:1234 Sun Jan 1 23:42:00 2012 1238702330
10
+ ROUTING_TABLE 2001:db8:0:0::1000 bar 1.2.3.5:1235 Sun Jan 1 23:42:00 2012 1238702330
11
+ GLOBAL_STATS Max bcast/mcast queue length 42
12
+ END
@@ -0,0 +1,48 @@
1
+ #! /bin/sh
2
+ ### BEGIN INIT INFO
3
+ # Provides: openvpn-status-web
4
+ # Required-Start: $remote_fs $syslog
5
+ # Required-Stop: $remote_fs $syslog
6
+ # Default-Start: 2 3 4 5
7
+ # Default-Stop: 0 1 6
8
+ # Short-Description: Handle openvpn-status-web
9
+ ### END INIT INFO
10
+
11
+ # your ruby interpreter
12
+ DAEMON="/usr/bin/ruby"
13
+
14
+ # some unique name identifying your VPN
15
+ VPN_NAME="vpn.example.org"
16
+
17
+ # path to the OpenVPN status log file
18
+ STATUS_PATH="/var/log/openvpn-status.log"
19
+
20
+ # host and port for this daemon to listen on
21
+ HOST="127.0.0.1"
22
+ PORT="3000"
23
+
24
+ DAEMON_OPTS="/opt/openvpn-status-web/status.rb $VPN_NAME $STATUS_PATH $HOST $PORT"
25
+
26
+ test -x $DAEMON || exit 0
27
+
28
+ . /lib/lsb/init-functions
29
+
30
+ case "$1" in
31
+ start)
32
+ log_daemon_msg "Starting openvpn-web-status for $VPN_NAME" "openvpn-web-status"
33
+ start-stop-daemon --start --quiet --oknodo --make-pidfile --pidfile "/var/run/$VPN_NAME.pid" --background --exec $DAEMON -- $DAEMON_OPTS
34
+ ;;
35
+ stop)
36
+ log_daemon_msg "Stopping openvpn-web-status for $VPN_NAME" "openvpn-web-status"
37
+ start-stop-daemon --stop --quiet --oknodo --pidfile "/var/run/$VPN_NAME.pid"
38
+ ;;
39
+ restart|force-reload)
40
+ log_daemon_msg "Restarting openvpn-web-status for $VPN_NAME" "openvpn-web-status"
41
+ start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile "/var/run/$VPN_NAME.pid"
42
+ start-stop-daemon --start --quiet --oknodo --make-pidfile --pidfile "/var/run/$VPN_NAME.pid" --background --exec $DAEMON -- $DAEMON_OPTS
43
+ ;;
44
+ *)
45
+ echo "Usage: $0 {start|stop|restart|force-reload}" >&2
46
+ exit 1
47
+ ;;
48
+ esac
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'etc'
4
+ require 'logger'
5
+ require 'ipaddr'
6
+ require 'yaml'
7
+ require 'rack'
8
+ require 'metriks'
9
+
10
+ require 'openvpn-status-web/int_patch'
11
+ require 'openvpn-status-web/version'
12
+
13
+ module OpenVPNStatusWeb
14
+ def self.logger
15
+ @logger
16
+ end
17
+
18
+ def self.logger=(logger)
19
+ @logger = logger
20
+ end
21
+
22
+ class LogFormatter
23
+ def call(lvl, time, progname, msg)
24
+ "[%s] %-5s %s\n" % [Time.now.strftime('%Y-%m-%d %H:%M:%S'), lvl, msg.to_s]
25
+ end
26
+ end
27
+
28
+ class Daemon
29
+ def initialize(name, file)
30
+ @name = name
31
+ @file = file
32
+ end
33
+
34
+ def call(env)
35
+ main_tmpl = read_template(File.join(File.dirname(__FILE__), 'openvpn-status-web/main.html.erb'))
36
+ # variables for template
37
+ name = @name
38
+ client_list, routing_table, global_stats = read_status_log(@file)
39
+
40
+ html = main_tmpl.result(binding)
41
+ [200, {"Content-Type" => "text/html"}, [html]]
42
+ end
43
+
44
+ def read_template(file)
45
+ text = File.open(file, 'rb') do |f| f.read end
46
+
47
+ ERB.new(text)
48
+ end
49
+
50
+ def read_status_log(file)
51
+ text = File.open(file, 'rb') do |f| f.read end
52
+
53
+ current_section = :none
54
+ client_list = []
55
+ routing_table = []
56
+ global_stats = []
57
+
58
+ text.lines.each do |line|
59
+ (current_section = :cl; next) if line == "OpenVPN CLIENT LIST\n"
60
+ (current_section = :rt; next) if line == "ROUTING TABLE\n"
61
+ (current_section = :gs; next) if line == "GLOBAL STATS\n"
62
+ (current_section = :end; next) if line == "END\n"
63
+
64
+ case current_section
65
+ when :cl then client_list << line.strip.split(',')
66
+ when :rt then routing_table << line.strip.split(',')
67
+ when :gs then global_stats << line.strip.split(',')
68
+ end
69
+ end
70
+
71
+ [client_list[2..-1], routing_table[1..-1], global_stats]
72
+ end
73
+
74
+ def self.run!
75
+ if ARGV.length != 4
76
+ puts "Usage: openvpn-status-web vpn-name status-log listen-host listen-port"
77
+ exit 1
78
+ end
79
+
80
+ OpenVPNStatusWeb.logger = Logger.new(STDOUT)
81
+
82
+ OpenVPNStatusWeb.logger.progname = "openvpn-status-web"
83
+ OpenVPNStatusWeb.logger.formatter = LogFormatter.new
84
+
85
+ OpenVPNStatusWeb.logger.info "Starting..."
86
+
87
+ Signal.trap('INT') do
88
+ OpenVPNStatusWeb.logger.info "Quitting..."
89
+ Rack::Handler::WEBrick.shutdown
90
+ end
91
+
92
+ app = Daemon.new(ARGV[0], ARGV[1])
93
+ Rack::Handler::WEBrick.run app, :Host => ARGV[2], :Port => ARGV[3]
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,16 @@
1
+
2
+ class Integer
3
+ def as_bytes
4
+ return "1 Byte" if self == 1
5
+
6
+ label = ["Bytes", "KiB", "MiB", "GiB", "TiB"]
7
+ i = 0
8
+ num = self.to_f
9
+ while num >= 1024 do
10
+ num = num / 1024
11
+ i += 1
12
+ end
13
+
14
+ "#{format('%.2f', num)} #{label[i]}"
15
+ end
16
+ end
@@ -0,0 +1,108 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="refresh" content="60">
6
+ <title>OpenVPN Status</title>
7
+ <style type="text/css">
8
+ table {
9
+ border-collapse: collapse;
10
+ }
11
+ h1 {
12
+ font-size: 24px;
13
+ }
14
+ h2 {
15
+ font-size: 16px;
16
+ font-weight: normal;
17
+ margin-top: 20px;
18
+ margin-bottom: 10px;
19
+ }
20
+ div {
21
+ margin-left: 15px;
22
+ }
23
+ td {
24
+ margin: 0px;
25
+ }
26
+ td.first {
27
+ padding: 0px 6px 0px 0px;
28
+ }
29
+ td.middle {
30
+ padding: 0px 6px 0px 6px;
31
+ border-left: 1px solid #ccc;
32
+ border-right: 1px solid #ccc;
33
+ }
34
+ td.last {
35
+ padding: 0px 0px 0px 6px;
36
+ }
37
+ thead {
38
+ font-weight: bold;
39
+ border-bottom: 1px solid #ccc;
40
+ }
41
+ </style>
42
+ </head>
43
+ <body>
44
+
45
+ <h1>OpenVPN Status for <%= name %></h1>
46
+
47
+ <h2>Client List</h2>
48
+ <div>
49
+ <table>
50
+ <thead>
51
+ <td class="first">Common Name</td>
52
+ <td class="middle">Real Address</td>
53
+ <td class="middle">Data Received</td>
54
+ <td class="middle">Data Sent</td>
55
+ <td class="last">Connected Since</td>
56
+ </thead>
57
+ <tbody>
58
+ <% client_list.each do |client| %>
59
+ <tr>
60
+ <td class="first"><%= client[0] %></td>
61
+ <td class="middle"><%= client[1] %></td>
62
+ <td class="middle"><%= client[2].to_i.as_bytes %></td>
63
+ <td class="middle"><%= client[3].to_i.as_bytes %></td>
64
+ <td class="last"><%= client[4] %></td>
65
+ </tr>
66
+ <% end %>
67
+ </tbody>
68
+ </table>
69
+ </div>
70
+
71
+ <h2>Routing Table</h2>
72
+ <div>
73
+ <table>
74
+ <thead>
75
+ <td class="first">Virtual Address</td>
76
+ <td class="middle">Common Name</td>
77
+ <td class="middle">Real Address</td>
78
+ <td class="last">Last Ref</td>
79
+ </thead>
80
+ <tbody>
81
+ <% routing_table.each do |e| %>
82
+ <tr>
83
+ <td class="first"><%= e[0] %></td>
84
+ <td class="middle"><%= e[1] %></td>
85
+ <td class="middle"><%= e[2] %></td>
86
+ <td class="last"><%= e[3] %></td>
87
+ </tr>
88
+ <% end %>
89
+ </tbody>
90
+ </table>
91
+ </div>
92
+
93
+ <h2>Global Stats</h2>
94
+ <div>
95
+ <table>
96
+ <tbody>
97
+ <% global_stats.each do |e| %>
98
+ <tr>
99
+ <td><%= e[0] %>:</td>
100
+ <td><%= e[1] %></td>
101
+ </tr>
102
+ <% end %>
103
+ </tbody>
104
+ </table>
105
+ </div>
106
+
107
+ </body>
108
+ </html>
@@ -0,0 +1,4 @@
1
+
2
+ module OpenVPNStatusWeb
3
+ VERSION = "0.0.1"
4
+ end
@@ -0,0 +1,31 @@
1
+
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+
4
+ require 'openvpn-status-web/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = 'openvpn-status-web'
8
+ s.version = OpenVPNStatusWeb::VERSION
9
+ s.summary = 'openvpn-status-web'
10
+ s.description = 'Small Rack application that parses and serves the OpenVPN status file.'
11
+ s.author = 'Christian Nicolai'
12
+ s.email = 'chrnicolai@gmail.com'
13
+ s.license = 'Apache License Version 2.0'
14
+ s.homepage = 'https://github.com/cmur2/openvpn-status-web'
15
+
16
+ s.files = `git ls-files`.split($/)
17
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
18
+
19
+ s.require_paths = ['lib']
20
+
21
+ s.executables = ['openvpn-status-web']
22
+
23
+ s.add_runtime_dependency 'rack'
24
+ s.add_runtime_dependency 'json'
25
+ s.add_runtime_dependency 'metriks'
26
+
27
+ s.add_development_dependency 'bundler', '~> 1.3'
28
+ s.add_development_dependency 'rake'
29
+ s.add_development_dependency 'rspec'
30
+ s.add_development_dependency 'rack-test'
31
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: openvpn-status-web
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Christian Nicolai
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-05-03 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rack
16
+ requirement: &70153082865000 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70153082865000
25
+ - !ruby/object:Gem::Dependency
26
+ name: json
27
+ requirement: &70153082864580 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70153082864580
36
+ - !ruby/object:Gem::Dependency
37
+ name: metriks
38
+ requirement: &70153082864160 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70153082864160
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: &70153082863660 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70153082863660
58
+ - !ruby/object:Gem::Dependency
59
+ name: rake
60
+ requirement: &70153082863240 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70153082863240
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: &70153082862780 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70153082862780
80
+ - !ruby/object:Gem::Dependency
81
+ name: rack-test
82
+ requirement: &70153082862360 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *70153082862360
91
+ description: Small Rack application that parses and serves the OpenVPN status file.
92
+ email: chrnicolai@gmail.com
93
+ executables:
94
+ - openvpn-status-web
95
+ extensions: []
96
+ extra_rdoc_files: []
97
+ files:
98
+ - .gitignore
99
+ - .travis.yml
100
+ - Gemfile
101
+ - LICENSE
102
+ - README.md
103
+ - Rakefile
104
+ - bin/openvpn-status-web
105
+ - examples/status.v1
106
+ - examples/status.v2
107
+ - examples/status.v3
108
+ - init.d/openvpn-status-web
109
+ - lib/openvpn-status-web.rb
110
+ - lib/openvpn-status-web/int_patch.rb
111
+ - lib/openvpn-status-web/main.html.erb
112
+ - lib/openvpn-status-web/version.rb
113
+ - openvpn-status-web.gemspec
114
+ homepage: https://github.com/cmur2/openvpn-status-web
115
+ licenses:
116
+ - Apache License Version 2.0
117
+ post_install_message:
118
+ rdoc_options: []
119
+ require_paths:
120
+ - lib
121
+ required_ruby_version: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ! '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ! '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubyforge_project:
135
+ rubygems_version: 1.8.6
136
+ signing_key:
137
+ specification_version: 3
138
+ summary: openvpn-status-web
139
+ test_files: []