Compare commits

...

81 Commits

Author SHA1 Message Date
Christian Nicolai cc0de6f563
docs: remove Depfu badge 2024-05-16 21:42:48 +02:00
Christian Nicolai 9933baed66
gems: update Renovate configuration 2024-05-16 21:39:08 +02:00
dependabot[bot] 6f106dd8ea gems: update rubocop-rspec requirement from ~> 2.26.1 to ~> 2.29.2
Updates the requirements on [rubocop-rspec](https://github.com/rubocop/rubocop-rspec) to permit the latest version.
- [Release notes](https://github.com/rubocop/rubocop-rspec/releases)
- [Changelog](https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-rspec/compare/v2.26.1...v2.29.2)

---
updated-dependencies:
- dependency-name: rubocop-rspec
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-16 21:37:40 +02:00
dependabot[bot] e17c5bef2d gems: update rubocop requirement from ~> 1.61.0 to ~> 1.63.5
Updates the requirements on [rubocop](https://github.com/rubocop/rubocop) to permit the latest version.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.61.0...v1.63.5)

---
updated-dependencies:
- dependency-name: rubocop
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-16 21:37:20 +02:00
Christian Nicolai a65bf15ab3
gems: disable Depfu for Dependabot since PR creation fails 2024-05-16 21:34:21 +02:00
renovate[bot] 85791c1b74 docker: update alpine Docker tag to v3.19 2024-03-03 11:31:17 +01:00
renovate[bot] 5162bdaa8a ci: update actions/checkout action to v4 2024-03-03 11:31:01 +01:00
depfu[bot] 4ead5d4972 gems: update rubocop to version 1.61.0 2024-03-03 11:30:47 +01:00
cn d75cf2aade gem: add Ruby 3.3 support, drop Ruby 2.7 due to EOL 2024-03-03 11:28:40 +01:00
Christian Nicolai 88b41c8998
project: add renovate config 2024-03-03 11:13:31 +01:00
depfu[bot] 6d3d6e8242 gems: update rubocop to version 1.60.0 2024-01-16 11:27:22 +01:00
depfu[bot] 45e9fb95cb gems: update rubocop-rspec to version 2.26.1 2024-01-06 23:17:28 +01:00
depfu[bot] 8d9aac329f gems: update rubocop to version 1.59.0 2023-12-12 15:16:50 +01:00
depfu[bot] d2f0de2d8a gems: update solargraph to version 0.50.0 2023-12-09 10:17:28 +01:00
depfu[bot] a330744dde gems: update rubocop to version 1.58.0 2023-12-02 21:48:04 +01:00
depfu[bot] 932c733203 gems: update rubocop-rspec to version 2.25.0 2023-10-28 13:35:16 +02:00
depfu[bot] c640431eda gems: update rubocop to version 1.57.0 2023-10-12 15:42:19 +02:00
cn b3c776a09d gem: fix rubocop warning by disabling redundant cop 2023-09-28 12:14:32 +02:00
depfu[bot] 38375fbdf7 gems: update rubocop-rspec to version 2.24.0 2023-09-09 17:22:16 +02:00
depfu[bot] fc25d49719 gems: update rubocop to version 1.56.0 2023-08-10 11:08:13 +02:00
depfu[bot] 0322f9c97d gems: update rubocop-rspec to version 2.23.0 2023-07-31 19:28:02 +02:00
depfu[bot] 35d78740a7 gems: update rubocop to version 1.55.0 2023-07-26 20:14:14 +02:00
depfu[bot] 097f3ea988 gems: update rubocop to version 1.54.0 2023-07-02 13:22:29 +02:00
depfu[bot] cb8698b80f gems: update rubocop to version 1.53.0 2023-06-24 16:23:20 +02:00
depfu[bot] 90ec76a503 gems: update rubocop to version 1.52.0 2023-06-04 12:02:04 +02:00
depfu[bot] 2f02388799 gems: update rubocop to version 1.51.0 2023-05-14 12:48:10 +02:00
depfu[bot] 9d80258a8f gems: update rubocop-rspec to version 2.22.0 2023-05-07 21:46:11 +02:00
depfu[bot] a189922123 gems: update rubocop-rspec to version 2.21.0 2023-05-06 14:59:28 +02:00
depfu[bot] 9a795fe2f9 gems: update rubocop-rspec to version 2.20.0 2023-04-19 13:17:43 +02:00
depfu[bot] 4df29aded8 gems: update rubocop to version 1.50.0 2023-04-12 11:55:17 +02:00
depfu[bot] 0182d784ce gems: update solargraph to version 0.49.0 2023-04-11 09:38:53 +02:00
depfu[bot] b3a5bbb244 gems: update rubocop to version 1.49.0 2023-04-04 11:59:50 +02:00
cn 184e0c2a9b gem: fix rubocop warning 2023-03-07 22:56:27 +01:00
depfu[bot] 91a414c9c4 gems: update rubocop-rspec to version 2.19.0 2023-03-07 22:56:27 +01:00
depfu[bot] b8f7390ddc gems: update rubocop to version 1.48.0 2023-03-07 13:59:17 +01:00
depfu[bot] 3d6bb9c662 gems: update rubocop to version 1.47.0 2023-03-02 15:12:23 +01:00
depfu[bot] 89ac867f6e gems: update rubocop to version 1.46.0 2023-02-23 22:31:45 +01:00
Christian Nicolai 8e2ac7e677
docs: add example docker-compose usage 2023-02-16 16:00:18 +01:00
depfu[bot] 4a5e258a86 gems: update rubocop to version 1.45.1 2023-02-09 20:58:30 +01:00
depfu[bot] 1237f144d5 gems: update rubocop to version 1.44.0 2023-01-24 15:20:52 +01:00
cn 65a65081ae gem: release 3.4.0 2023-01-20 14:57:35 +01:00
cn 194137adc8 gem: add Ruby 3.2 support 2023-01-20 14:55:36 +01:00
cn ee06f65e81 gems: add constraint for rackup version 2023-01-19 16:36:35 +01:00
depfu[bot] 075922e484 gems: update rubocop-rspec to version 2.18.0 2023-01-17 14:01:47 +01:00
depfu[bot] 9ece1e125b gems: update rubocop-rspec to version 2.17.0 2023-01-14 20:15:19 +01:00
depfu[bot] ba50185f44 gems: update rubocop to version 1.43.0 2023-01-11 13:54:46 +01:00
depfu[bot] d57e8b7d2e gems: update rubocop to version 1.42.0 2023-01-02 19:30:53 +01:00
depfu[bot] 2d77c0efee gems: update rubocop to version 1.41.0 2022-12-21 14:30:56 +01:00
depfu[bot] 4f6725825a gems: update solargraph to version 0.48.0 2022-12-20 12:28:50 +01:00
depfu[bot] 8af23da209 gems: update rubocop-rspec to version 2.16.0 2022-12-14 14:35:12 +01:00
depfu[bot] 78d4c3c8cb gems: update rubocop to version 1.40.0 2022-12-09 22:25:28 +01:00
depfu[bot] 39f570ec48 gems: update rubocop to version 1.39.0 2022-11-15 10:20:02 +01:00
depfu[bot] 1eb6202a8f gems: update rubocop-rspec to version 2.15.0 2022-11-04 23:39:42 +01:00
depfu[bot] a329966bc5 gems: update rubocop to version 1.38.0 2022-11-02 10:59:06 +01:00
depfu[bot] 575516bd27 gems: update rubocop-rspec to version 2.14.1 2022-10-25 11:53:40 +02:00
depfu[bot] af253c61f0 gems: update rubocop to version 1.37.0 2022-10-21 12:49:20 +02:00
depfu[bot] a804f842df gems: update solargraph to version 0.47.0 2022-09-26 21:23:32 +02:00
Christian Nicolai 648b4d94b6 gem: release 3.3.0 2022-09-16 06:48:21 +02:00
depfu[bot] 117f70e2e3 gems: update rack to version 3.0.0 2022-09-15 21:41:54 +02:00
depfu[bot] 1e0444a71d gems: update rubocop-rspec to version 2.13.1 2022-09-13 21:03:28 +02:00
depfu[bot] 20c6c9176a gems: update rubocop to version 1.36.0 2022-09-02 12:36:16 +02:00
depfu[bot] a0ad379b00 gems: update solargraph to version 0.46.0 2022-08-23 15:10:14 +02:00
depfu[bot] d8f4931657 gems: update rubocop to version 1.35.0 2022-08-13 19:24:55 +02:00
depfu[bot] 6676f47c97 gems: update rubocop to version 1.34.1 2022-08-10 16:35:06 +02:00
depfu[bot] 811b928403 gems: update rubocop to version 1.33.0 2022-08-05 14:09:34 +02:00
depfu[bot] f4a48b8ce0 gems: update rubocop to version 1.32.0 2022-07-22 15:49:47 +02:00
depfu[bot] f985ec1c12 gems: update rubocop-rspec to version 2.12.0 2022-07-03 14:28:49 +02:00
depfu[bot] 3d10b7d128 gems: update rubocop to version 1.31.0 2022-06-28 11:02:32 +02:00
depfu[bot] 27876c7f12 gems: update solargraph to version 0.45.0 2022-05-28 17:03:37 +02:00
depfu[bot] 9d584ceb71 gems: update rubocop to version 1.30.0 2022-05-28 17:01:23 +02:00
depfu[bot] 1996f1d9b9 gems: update rubocop-rspec to version 2.11.1 2022-05-22 19:08:44 +02:00
depfu[bot] f342b07495 gems: update rubocop to version 1.29.0 2022-05-08 16:59:25 +02:00
cn 557a328336 gem: drop support for Rubies < 2.7 2022-05-08 16:56:46 +02:00
cn 057d243db8 gem: make intention of ENV.fetch clear with explicit default value 2022-04-22 21:35:26 +02:00
depfu[bot] e3a06fdf6c gems: update rubocop to version 1.28.1 2022-04-22 21:35:26 +02:00
depfu[bot] bfe39adaf8 gems: update rubocop-rspec to version 2.10.0 2022-04-20 10:50:18 +02:00
depfu[bot] 9159a53cce gems: update rubocop to version 1.27.0 2022-04-09 11:59:16 +02:00
depfu[bot] 51825eb2da gems: update rubocop to version 1.26.0 2022-03-10 20:44:34 +01:00
depfu[bot] 280e2b9ae1 gems: update rubocop-rspec to version 2.9.0 2022-03-01 14:07:18 +01:00
depfu[bot] 6d56db855f gems: update rubocop-rspec to version 2.8.0 2022-01-25 13:36:48 +01:00
depfu[bot] 0b782b7dd3 gems: update rubocop to version 1.25.0 2022-01-19 11:38:45 +01:00
12 changed files with 113 additions and 27 deletions

13
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,13 @@
---
version: 2
updates:
- package-ecosystem: "bundler"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: "gems"
labels: ["dependabot"]
open-pull-requests-limit: 10
pull-request-branch-name:
separator: "-"

42
.github/renovate.json5 vendored Normal file
View File

@ -0,0 +1,42 @@
{
extends: [
"config:recommended",
":dependencyDashboard",
":prHourlyLimitNone",
":prConcurrentLimitNone",
":label(dependency-upgrade)",
],
schedule: ["before 8am on thursday"],
branchPrefix: "renovate-",
dependencyDashboardHeader: "View repository job log [here](https://app.renovatebot.com/dashboard#github/cmur2/dyndnsd).",
separateMinorPatch: true,
commitMessagePrefix: "project: ",
commitMessageAction: "update",
commitMessageTopic: "{{depName}}",
commitMessageExtra: "to {{#if isSingleVersion}}v{{{newVersion}}}{{else}}{{{newValue}}}{{/if}}",
packageRules: [
// Ruby dependencies are managed by dependabot (previously depfu, until PR creation failed)
{
matchManagers: ["bundler"],
enabled: false,
},
// Commit message formats
{
matchDatasources: ["docker"],
commitMessagePrefix: "docker: ",
},
{
matchManagers: ["github-actions"],
commitMessagePrefix: "ci: ",
},
],
customManagers: [
{
customType: "regex",
fileMatch: ["\.rb$", "^Rakefile$"],
matchStrings: [
"renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)\\s.*_version = '(?<currentValue>.*)'\\s"
]
},
],
}

View File

@ -16,13 +16,12 @@ jobs:
strategy:
matrix:
ruby-version:
- '2.5'
- '2.6'
- '2.7'
- '3.0'
- '3.1'
- '3.2'
- '3.3'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:

View File

@ -3,9 +3,12 @@ require:
- rubocop-rspec
AllCops:
TargetRubyVersion: '2.5'
TargetRubyVersion: 3.0'
NewCops: enable
Gemspec/DevelopmentDependencies:
EnforcedStyle: gemspec
Gemspec/RequireMFA:
Enabled: false
@ -98,6 +101,9 @@ RSpec/ExampleLength:
Max: 10
RSpec/FilePath:
Enabled: false
RSpec/SpecFilePathFormat:
CustomTransform:
OpenVPNStatusWeb: openvpn-status-web

View File

@ -1,6 +1,6 @@
# openvpn-status-web
![ci](https://github.com/cmur2/openvpn-status-web/workflows/ci/badge.svg) [![Depfu](https://badges.depfu.com/badges/c264e2f70f2a19c43f880ddcb4a12ba8/overview.svg)](https://depfu.com/github/cmur2/openvpn-status-web?project_id=6194)
![ci](https://github.com/cmur2/openvpn-status-web/workflows/ci/badge.svg)
## Description
@ -61,7 +61,31 @@ If the information exposed is important to you serve it via the VPN or use a web
There is a [Dockerfile](docs/Dockerfile) that can be used to build a Docker image for running openvpn-status-web.
The [Debian 6 init script](docs/debian-init-openvpn-status-web) assumes that openvpn-status-web is installed into the system ruby (no RVM support) and the config.yaml is at `/opt/openvpn-status-web/config.yaml`. Modify to your needs.
This can for example be used with `docker-compose` via:
```yaml
version: "2.4"
services:
openvpn-status-web:
image: your-selfbuilt-docker-image
user: root # needed since the default status files are chmod 600
volumes:
- /path/to/host/config.yml:/etc/openvpn-status-web/config.yml:ro
- /run/openvpn-server:/run/openvpn-server
ports:
- "8080:8080"
```
The `/path/to/host/config.yml` could be:
```yaml
host: "0.0.0.0"
port: "8080"
vpns:
my-cool-vpn: # the following depends on your setup
version: 2
status_file: "/run/openvpn-server/status-my-cool-vpn.log"
```
## License

View File

@ -1,8 +1,8 @@
FROM alpine:3.13
FROM alpine:3.19
EXPOSE 8080
ENV VERSION=3.2.1
ENV VERSION=3.4.0
RUN apk --no-cache add openssl ca-certificates && \
apk --no-cache add ruby ruby-etc ruby-webrick && \

View File

@ -7,9 +7,10 @@ require 'logger'
require 'ipaddr'
require 'yaml'
require 'rack'
require 'rackup'
require 'erb'
require 'metriks'
require 'better_errors' if ENV['RACK_ENV'] == 'development'
require 'better_errors' if ENV.fetch('RACK_ENV', nil) == 'development'
require 'openvpn-status-web/status'
require 'openvpn-status-web/parser/v1'
@ -128,21 +129,21 @@ module OpenVPNStatusWeb
# configure rack
app = Daemon.new(config['vpns'])
if ENV['RACK_ENV'] == 'development'
if ENV.fetch('RACK_ENV', nil) == 'development'
app = BetterErrors::Middleware.new(app)
BetterErrors.application_root = File.expand_path(__dir__)
end
Signal.trap('INT') do
OpenVPNStatusWeb.logger.info 'Quitting...'
Rack::Handler::WEBrick.shutdown
Rackup::Handler::WEBrick.shutdown
end
Signal.trap('TERM') do
OpenVPNStatusWeb.logger.info 'Quitting...'
Rack::Handler::WEBrick.shutdown
Rackup::Handler::WEBrick.shutdown
end
Rack::Handler::WEBrick.run app, Host: config['host'], Port: config['port']
Rackup::Handler::WEBrick.run app, Host: config['host'], Port: config['port']
end
end
end

View File

@ -13,10 +13,10 @@ module OpenVPNStatusWeb
text.lines.each do |line|
parts = line.strip.split(sep)
status.client_list_headers = parts[2..-1] if parts[0] == 'HEADER' && parts[1] == 'CLIENT_LIST'
status.client_list << parse_client(parts[1..-1], status.client_list_headers) if parts[0] == 'CLIENT_LIST'
status.routing_table_headers = parts[2..-1] if parts[0] == 'HEADER' && parts[1] == 'ROUTING_TABLE'
status.routing_table << parse_route(parts[1..-1], status.routing_table_headers) if parts[0] == 'ROUTING_TABLE'
status.client_list_headers = parts[2..] if parts[0] == 'HEADER' && parts[1] == 'CLIENT_LIST'
status.client_list << parse_client(parts[1..], status.client_list_headers) if parts[0] == 'CLIENT_LIST'
status.routing_table_headers = parts[2..] if parts[0] == 'HEADER' && parts[1] == 'ROUTING_TABLE'
status.routing_table << parse_route(parts[1..], status.routing_table_headers) if parts[0] == 'ROUTING_TABLE'
status.global_stats << parse_global(parts[1..2]) if parts[0] == 'GLOBAL_STATS'
end

View File

@ -27,9 +27,9 @@ module OpenVPNStatusWeb
status = Status.new
status.client_list_headers = ['Common Name', 'Real Address', 'Data Received', 'Data Sent', 'Connected Since']
status.client_list = client_list[2..-1].map { |client| parse_client(client) }
status.client_list = client_list[2..].map { |client| parse_client(client) }
status.routing_table_headers = ['Virtual Address', 'Common Name', 'Real Address', 'Last Ref']
status.routing_table = routing_table[1..-1].map { |route| parse_route(route) }
status.routing_table = routing_table[1..].map { |route| parse_route(route) }
status.global_stats = global_stats.map { |global| parse_global(global) }
status
end

View File

@ -1,5 +1,5 @@
# frozen_string_literal: true
module OpenVPNStatusWeb
VERSION = '3.2.1'
VERSION = '3.4.0'
end

View File

@ -24,10 +24,11 @@ Gem::Specification.new do |s|
s.executables = ['openvpn-status-web']
s.extra_rdoc_files = Dir['README.md', 'LICENSE']
s.required_ruby_version = '>= 2.5'
s.required_ruby_version = '>= 3.0'
s.add_runtime_dependency 'metriks'
s.add_runtime_dependency 'rack', '~> 2.0'
s.add_runtime_dependency 'rack', '~> 3.0'
s.add_runtime_dependency 'rackup', '~> 2'
s.add_runtime_dependency 'webrick', '>= 1.6.1'
s.add_development_dependency 'better_errors'
@ -37,8 +38,8 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rack-test'
s.add_development_dependency 'rake'
s.add_development_dependency 'rspec'
s.add_development_dependency 'rubocop', '~> 1.24.0'
s.add_development_dependency 'rubocop', '~> 1.63.5'
s.add_development_dependency 'rubocop-rake', '~> 0.6.0'
s.add_development_dependency 'rubocop-rspec', '~> 2.7.0'
s.add_development_dependency 'solargraph', '~> 0.44.0'
s.add_development_dependency 'rubocop-rspec', '~> 2.29.2'
s.add_development_dependency 'solargraph', '~> 0.50.0'
end

View File

@ -7,7 +7,7 @@ describe OpenVPNStatusWeb::Parser::ModernStateless do
2 => status_v2,
3 => status_v3
}.each do |version, status|
context "for status-version #{version}" do
context "when status-version #{version}" do
context 'with client list' do
it 'parses common names' do
expect(status.client_list.map { |client| client[0] }).to eq(%w[foo bar])