Coder Social home page Coder Social logo

cmur2 / openvpn-status-web Goto Github PK

View Code? Open in Web Editor NEW
13.0 4.0 1.0 125 KB

Small Rack (Ruby) application serving OpenVPN status file

Home Page: https://mycroba.se/mirror-redirect/openvpn-status-web

License: Apache License 2.0

Ruby 85.72% HTML 14.28%
ruby openvpn status vpn monitoring openvpn-status

openvpn-status-web's Introduction

openvpn-status-web

ci Depfu

Description

Small (another word for naive in this case, it's simple and serves my needs) Rack application providing the information an OpenVPN server collects in it's status file especially including a list of currently connected clients (common name, remote address, traffic, ...).

It lacks:

  • caching (parses file on each request, page does auto-refresh every minute as OpenVPN updates the status file these often by default)
  • management interface support
  • possibly more...

Usage

Install the gem:

gem install openvpn-status-web

Create a configuration file in YAML format somewhere:

# listen address and port
host: "0.0.0.0"
port: "8080"
# optional: drop priviliges in case you want to but you should give this user at least read access on the log files
user: "nobody"
group: "nogroup"
# logfile is optional, logs to STDOUT else
logfile: "openvpn-status-web.log"
# hash with each VPNs display name for humans as key and further config as value
vpns:
  My Small VPN:
    # the status file path and status file format version are required
    version: 1
    status_file: "/var/log/openvpn-status.log"
  My Other VPN:
    version: 3
    status_file: "/var/log/other-openvpn-status.log"

Your OpenVPN configuration should contain something like this:

# ...snip...
status /var/log/openvpn-status.log
status-version 1
# ...snip...

For more information about OpenVPN status file and version, see their man page. openvpn-status-web is able to parse all versions from 1 to 3.

Advanced topics

Authentication

If the information exposed is important to you serve it via the VPN or use a webserver as a proxy to handle SSL and/or HTTP authentication.

Startup

There is a Dockerfile that can be used to build a Docker image for running openvpn-status-web.

This can for example be used with docker-compose via:

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:

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

openvpn-status-web is licensed under the Apache License, Version 2.0. See LICENSE for more information.

openvpn-status-web's People

Contributors

cmur2 avatar depfu[bot] avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

shelvak

openvpn-status-web's Issues

Guide to install in docker

Hello,

I want to install this project in a Docker container. But it just does not want to work. What am I doing wrong?

This is how I proceeded:
Started Portainer. Click on Images. Click on Build a new image. Gave an arbitrary name. Pasted the code from the readme ( https://github.com/cmur2/openvpn-status-web/blob/master/docs/Dockerfile ) into the web editor. Clicked Build the image. Portainer then told me the following output:

Step 1/5 : FROM alpine:3.16



 ---> bfe296a52501

Step 2/5 : EXPOSE 8081



 ---> Running in b01041d6932f

Removing intermediate container b01041d6932f

 ---> 938a103cb94c

Step 3/5 : ENV VERSION=3.4.0



 ---> Running in c154992b692e

Removing intermediate container c154992b692e

 ---> e2cd76ffb532

Step 4/5 : RUN apk --no-cache add openssl ca-certificates &&     apk --no-cache add ruby ruby-etc ruby-webrick &&     apk --no-cache add --virtual .build-deps ruby-dev build-base tzdata &&     gem install --no-document openvpn-status-web -v ${VERSION} &&     cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime &&     apk del .build-deps



 ---> Running in 26fbe89152ff

fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz

fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz

(1/2) Installing ca-certificates (20220614-r0)

(2/2) Installing openssl (1.1.1t-r0)

Executing busybox-1.35.0-r17.trigger

Executing ca-certificates-20220614-r0.trigger

OK: 7 MiB in 16 packages

fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz

fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz

(1/10) Installing gmp (6.2.1-r2)

(2/10) Installing libffi (3.4.2-r1)

(3/10) Installing ncurses-terminfo-base (6.3_p20220521-r0)

(4/10) Installing ncurses-libs (6.3_p20220521-r0)

(5/10) Installing readline (8.1.2-r0)

(6/10) Installing libucontext (1.2-r0)

(7/10) Installing yaml (0.2.5-r0)

(8/10) Installing ruby-libs (3.1.3-r0)

(9/10) Installing ruby (3.1.3-r0)

(10/10) Installing ruby-webrick (1.7.0-r1)

Executing busybox-1.35.0-r17.trigger

OK: 24 MiB in 26 packages

fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz

fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz

(1/27) Upgrading musl (1.2.3-r1 -> 1.2.3-r2)

(2/27) Installing ruby-rdoc (3.1.3-r0)

(3/27) Installing libgcc (11.2.1_git20220219-r2)

(4/27) Installing libstdc++ (11.2.1_git20220219-r2)

(5/27) Installing libgmpxx (6.2.1-r2)

(6/27) Installing pkgconf (1.8.1-r0)

(7/27) Installing gmp-dev (6.2.1-r2)

(8/27) Installing libucontext-dev (1.2-r0)

(9/27) Installing ruby-dev (3.1.3-r0)

(10/27) Installing binutils (2.38-r3)

(11/27) Installing libmagic (5.41-r0)

(12/27) Installing file (5.41-r0)

(13/27) Installing libgomp (11.2.1_git20220219-r2)

(14/27) Installing libatomic (11.2.1_git20220219-r2)

(15/27) Installing isl22 (0.22-r0)

(16/27) Installing mpfr4 (4.1.0-r0)

(17/27) Installing mpc1 (1.2.1-r0)

(18/27) Installing gcc (11.2.1_git20220219-r2)

(19/27) Installing musl-dev (1.2.3-r2)

(20/27) Installing libc-dev (0.7.2-r3)

(21/27) Installing g++ (11.2.1_git20220219-r2)

(22/27) Installing make (4.3-r0)

(23/27) Installing fortify-headers (1.1-r1)

(24/27) Installing patch (2.7.6-r7)

(25/27) Installing build-base (0.5-r3)

(26/27) Installing tzdata (2022f-r1)

(27/27) Installing .build-deps (20230215.112714)

Executing busybox-1.35.0-r17.trigger

OK: 214 MiB in 52 packages

Successfully installed webrick-1.8.1
Successfully installed rack-3.0.4.1
Successfully installed rackup-2.1.0
Building native extensions. This could take a while...

Successfully installed hitimes-1.3.1
Building native extensions. This could take a while...

This gem has been deprecated and merged into Concurrent Ruby (http://concurrent-ruby.com).
Successfully installed atomic-1.1.101
Successfully installed avl_tree-1.2.1
Successfully installed metriks-0.9.9.8
Successfully installed openvpn-status-web-3.4.0
8 gems installed

WARNING: 

Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.16/main: No such file or directory

WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.16/community: No such file or directory

(1/26) Purging .build-deps (20230215.112714)
(2/26) Purging ruby-dev (3.1.3-r0)

(3/26) Purging ruby-rdoc (3.1.3-r0)

(4/26) Purging gmp-dev (6.2.1-r2)

(5/26) Purging libgmpxx (6.2.1-r2)
(6/26) Purging libucontext-dev (1.2-r0)

(7/26) Purging build-base (0.5-r3)
(8/26) Purging file (5.41-r0)
(9/26) Purging g++ (11.2.1_git20220219-r2)

(10/26) Purging gcc (11.2.1_git20220219-r2)

(11/26) Purging binutils (2.38-r3)

(12/26) Purging libatomic (11.2.1_git20220219-r2)
(13/26) Purging libgomp (11.2.1_git20220219-r2)
(14/26) Purging libstdc++ (11.2.1_git20220219-r2)

(15/26) Purging make (4.3-r0)
(16/26) Purging libc-dev (0.7.2-r3)
(17/26) Purging musl-dev (1.2.3-r2)

(18/26) Purging fortify-headers (1.1-r1)
(19/26) Purging patch (2.7.6-r7)
(20/26) Purging tzdata (2022f-r1)

(21/26) Purging libgcc (11.2.1_git20220219-r2)
(22/26) Purging pkgconf (1.8.1-r0)
(23/26) Purging libmagic (5.41-r0)

(24/26) Purging isl22 (0.22-r0)
(25/26) Purging mpc1 (1.2.1-r0)
(26/26) Purging mpfr4 (4.1.0-r0)

Executing busybox-1.35.0-r17.trigger

OK: 24 MiB in 26 packages

Removing intermediate container 26fbe89152ff

 ---> b2ab238b9594

Step 5/5 : ENTRYPOINT ["openvpn-status-web", "/etc/openvpn-status-web/config.yml"]



 ---> Running in 4a363c4597d8

Removing intermediate container 4a363c4597d8

 ---> 2527818aa81a

Successfully built 2527818aa81a

Successfully tagged ovpnweb:latest

Now I chose Containers in Portainer. Click "add Container". Typed in the image's name. Gave another arbitrary name to the container. And clicked deploy. After that the container gets deployed but imediatley stops. Log says:

Config file not found!

I am wondering about this, as I put the yml file in /etc/openvpn-status-web/config.yml

Dependency Dashboard

View repository job log here.

This repository currently has no open or pending branches.

Detected dependencies

bundler
Gemfile
dockerfile
docs/Dockerfile
  • alpine 3.19
github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • ruby/setup-ruby v1

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.