mirror of
https://github.com/flant/ovpn-admin.git
synced 2026-02-04 01:10:22 -08:00
Compare commits
5 Commits
59455217c2
...
de8b1f5414
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de8b1f5414 | ||
|
|
a7aab7cb6a | ||
|
|
3674d003c9 | ||
|
|
7134815ce6 | ||
|
|
213e1d7b0f |
23
README.md
23
README.md
@ -2,8 +2,6 @@
|
||||
|
||||
Simple web UI to manage OpenVPN users, their certificates & routes in Linux. While backend is written in Go, frontend is based on Vue.js.
|
||||
|
||||
Originally created in [Flant](https://flant.com/) for internal needs & used for years, then updated to be more modern and [publicly released](https://medium.com/flant-com/introducing-ovpn-admin-a-web-interface-to-manage-openvpn-users-d81705ad8f23) in March'21. Your contributions are welcome!
|
||||
|
||||
***DISCLAIMER!** This project was created for experienced users (system administrators) and private (e.g., protected by network policies) environments only. Thus, it is not implemented with security in mind (e.g., it doesn't strictly check all parameters passed by users, etc.). It also relies heavily on files and fails if required files aren't available.*
|
||||
|
||||
## Features
|
||||
@ -21,16 +19,16 @@ Originally created in [Flant](https://flant.com/) for internal needs & used for
|
||||
### Screenshots
|
||||
|
||||
Managing users in ovpn-admin:
|
||||

|
||||

|
||||
|
||||
An example of dashboard made using ovpn-admin metrics:
|
||||

|
||||

|
||||
|
||||
## Installation
|
||||
|
||||
### 1. Docker
|
||||
|
||||
There is a ready-to-use [docker-compose.yaml](https://github.com/flant/ovpn-admin/blob/master/docker-compose.yaml), so you can just change/add values you need and start it with [start.sh](https://github.com/flant/ovpn-admin/blob/master/start.sh).
|
||||
There is a ready-to-use [docker-compose.yaml](https://github.com/palark/ovpn-admin/blob/master/docker-compose.yaml), so you can just change/add values you need and start it with [start.sh](https://github.com/palark/ovpn-admin/blob/master/start.sh).
|
||||
|
||||
Requirements:
|
||||
You need [Docker](https://docs.docker.com/get-docker/) and [docker-compose](https://docs.docker.com/compose/install/) installed.
|
||||
@ -38,7 +36,7 @@ You need [Docker](https://docs.docker.com/get-docker/) and [docker-compose](http
|
||||
Commands to execute:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/flant/ovpn-admin.git
|
||||
git clone https://github.com/palark/ovpn-admin.git
|
||||
cd ovpn-admin
|
||||
./start.sh
|
||||
```
|
||||
@ -56,7 +54,7 @@ Requirements. You need Linux with the following components installed:
|
||||
Commands to execute:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/flant/ovpn-admin.git
|
||||
git clone https://github.com/palark/ovpn-admin.git
|
||||
cd ovpn-admin
|
||||
./bootstrap.sh
|
||||
./build.sh
|
||||
@ -67,7 +65,7 @@ cd ovpn-admin
|
||||
|
||||
### 3. Prebuilt binary
|
||||
|
||||
You can also download and use prebuilt binaries from the [releases](https://github.com/flant/ovpn-admin/releases/latest) page — just choose a relevant tar.gz file.
|
||||
You can also download and use prebuilt binaries from the [releases](https://github.com/palark/ovpn-admin/releases/latest) page — just choose a relevant tar.gz file.
|
||||
|
||||
|
||||
## Notes
|
||||
@ -172,6 +170,11 @@ Flags:
|
||||
--version show application version
|
||||
```
|
||||
|
||||
## Further information
|
||||
## Authors
|
||||
|
||||
Please feel free to use [issues](https://github.com/flant/ovpn-admin/issues) and [discussions](https://github.com/flant/ovpn-admin/discussions) to get help from maintainers & community.
|
||||
ovpn-admin was originally created in [Flant](https://github.com/flant/) and used internally for years.
|
||||
|
||||
In March 2021, it [went public](https://medium.com/flant-com/introducing-ovpn-admin-a-web-interface-to-manage-openvpn-users-d81705ad8f23) and was still developed in Flant.
|
||||
Namely, [@vitaliy-sn](https://github.com/vitaliy-sn) created its first version in Python, and [@pashcovich](https://github.com/pashcovich) rewrote it in Go.
|
||||
|
||||
In November 2024, this project was moved to [Palark](https://github.com/palark/), which is currently responsible for its maintenance and development.
|
||||
|
||||
11
helpers.go
11
helpers.go
@ -288,6 +288,17 @@ func extractFromArchive(archive, path string) error {
|
||||
log.Fatalf("extractFromArchive: Mkdir() failed: %s", err.Error())
|
||||
}
|
||||
case tar.TypeReg:
|
||||
s := strings.Split(header.Name, "/")
|
||||
dir := ""
|
||||
|
||||
for len(s) > 1 {
|
||||
dir, s = dir+"/"+s[0], s[1:]
|
||||
if _, err := os.Stat(path + dir); os.IsNotExist(err) {
|
||||
if err := os.Mkdir(path+dir, 0755); err != nil {
|
||||
log.Fatalf("extractFromArchive: Mkdir() subdir failed: %s", err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
outFile, err := os.Create(path + "/" + header.Name)
|
||||
if err != nil {
|
||||
log.Fatalf("extractFromArchive: Create() failed: %s", err.Error())
|
||||
|
||||
19
main.go
19
main.go
@ -9,11 +9,7 @@ import (
|
||||
"encoding/pem"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/google/uuid"
|
||||
"io/ioutil"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/rest"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
@ -25,6 +21,11 @@ import (
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/google/uuid"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/rest"
|
||||
|
||||
"github.com/gobuffalo/packr/v2"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
@ -520,6 +521,11 @@ func main() {
|
||||
ovpnAdmin.mgmtInterfaces[parts[0]] = parts[len(parts)-1]
|
||||
}
|
||||
|
||||
if ovpnAdmin.role == "slave" {
|
||||
ovpnAdmin.syncDataFromMaster()
|
||||
go ovpnAdmin.syncWithMaster()
|
||||
}
|
||||
|
||||
ovpnAdmin.mgmtSetTimeFormat()
|
||||
|
||||
ovpnAdmin.registerMetrics()
|
||||
@ -547,11 +553,6 @@ func main() {
|
||||
ovpnAdmin.modules = append(ovpnAdmin.modules, "ccd")
|
||||
}
|
||||
|
||||
if ovpnAdmin.role == "slave" {
|
||||
ovpnAdmin.syncDataFromMaster()
|
||||
go ovpnAdmin.syncWithMaster()
|
||||
}
|
||||
|
||||
ovpnAdmin.templates = packr.New("template", "./templates")
|
||||
|
||||
staticBox := packr.New("static", "./frontend/static")
|
||||
|
||||
@ -15,7 +15,7 @@ if [ -e "$SERVER_CERT" ]; then
|
||||
else
|
||||
if [ ${OVPN_ROLE:-"master"} = "slave" ]; then
|
||||
echo "Waiting for initial sync data from master"
|
||||
while [ $(wget -q localhost/api/sync/last/try -O - | wc -m) -lt 1 ]
|
||||
while [ $(wget -q localhost:${OVPN_LISTEN_PORT:-8080}/api/sync/last/try -O - | wc -m) -lt 1 ]
|
||||
do
|
||||
sleep 5
|
||||
done
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user