d3vilh / openvpn-ui

Web User Interface for OpenVPN
MIT License
258 stars 57 forks source link

install script #26

Closed dinger1986 closed 8 months ago

dinger1986 commented 1 year ago

I wondered if an install script would be useful? I am sure thats something I could easily get my head around if you were interested? For people not running docker

dinger1986 commented 1 year ago

Sorry I meant for the server side

dinger1986 commented 1 year ago

Lol it even says that! Sorry

d3vilh commented 1 year ago

For people not running docker

During building process, you have to install lot of dependencies on your environment which you'll don't need in the future (BeeGo and Bee for example). That is why build process use docker for temp containers. As result you have packed binary application.

I can create tarballs for x86-64, arm-64v8 and arm-32v6. So you can uncompress and run it with your own OpenVPN environment without containers.

Will it fit?

dinger1986 commented 1 year ago

Yes tarballs would be amazing. I'll write an install script.

Thanks so much for doing MFA as well, I'm happy to help you with this in anyway I can.

We have always used openvpn for clients and use an old ui so need to update anyways and would be nice to get MFA implemented as well.

d3vilh commented 11 months ago

tarball with binaries for Debian x86_64 is attached to the release.

dinger1986 commented 11 months ago

brilliant, thanks! Shall get on building an install script

dinger1986 commented 11 months ago

just reopening this to keep it neat, I dont think I have missed anything but ran a test today Ran the following commands:

sudo mkdir /opt/openvpn-ui
sudo chown manager:manager /opt/openvpn-ui/
cd /opt/openvpn-ui/

sudo apt install openvpn

wget https://github.com/d3vilh/openvpn-ui/releases/download/0.9.3/openvpn-ui.Bullseye.x86_64.tar.gz

tar -xf openvpn-ui.Bullseye.x86_64.tar.gz

Now when I do ./openvpn-ui I get ./openvpn-ui: cannot execute: required file not found

Any ideas what file it means? Ill keep looking in the mean time

d3vilh commented 11 months ago

just reopening this to keep it neat, I dont think I have missed anything but ran a test today Ran the following commands:

It seems precompiled binary lack of some libs. I'll give it a try tomorrow.

dinger1986 commented 11 months ago

Thank you! I'd love to get it up and running. If there's any dependencies would be good to know and I'll get a script written up

dinger1986 commented 9 months ago

hi, sorry to be "that" guy, but just giving this a wee bump, Im really wanting to get an install script written and all working and happy to document stuff but want to get it working first :)

d3vilh commented 9 months ago

Hi @dinger1986, Merry Christmas! :)

If you don't mind to have all the dependencies installed on your system, then yes it can be automated. The issue with TGZ is it looks for those dependencies, which are currently absent in environment, but were on the place, when binaries was build.

The solution is to install dependencies and then build the binaries. In short, you need to install golang on the target system, then the dependant go packages and then finally build qrencode and openvpn-ui.

The including all the dependencies inside the Go binary won't work well as:

Generally, automation install script is in the plan, but still I don't promise anything.

It is a bit boring task honestly, maybe @permanutry can help with it to become the major part of "credits" :D

dinger1986 commented 9 months ago

And a very merry Christmas to you!

Builds are fine, can do it later on. If there's deps for the compiled tgz can install them as well.

dinger1986 commented 9 months ago

I'm going to try and work out the dependencies, compiling as part of the install process is totally fine as long as the dependencies are easy enough to work out.

If you have your usual build environment and a list that would make it easier but if not I'll try my best to figure it out.

d3vilh commented 9 months ago

Hey @dinger1986, Happy New Year!

Here is it the drafted standalone-install.sh script version.

Script will install all the dependencies (but golang) and build all the necessary binaries (qrencode and openvpn-ui).

You still need to have Go 1.25 to be installed in the system, here is example for Debian x86:

wget https://golang.org/dl/go1.21.5.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.21.5.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
echo "export PATH=$PATH:$(go env GOPATH)/bin" >> ~/.bashrc
source ~/.bashrc

Before application starting you have to create db directory and pass OPENVPN_ADMIN_USERNAME + OPENVPN_ADMIN_PASSWORD to local user env settings. Then login with your user and password and go to Configuration > OpenVPN UI to set OpenVPN and EasyRSA ConfigPaths.

Please carefully check the log below it has all the necessary commands.

Here is installation and start log:

philipp@bookworm64:~/build/openvpn-ui/build$ go version
go version go1.21.5 linux/amd64
philipp@bookworm64:~/build/openvpn-ui/build$ uname -a
Linux bookworm64 6.1.0-16-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.67-1 (2023-12-12) x86_64 GNU/Linux
philipp@bookworm64:~/build/openvpn-ui/build$ ./standalone-install.sh
This script will install OpenVPN-UI and all the dependencies on your local environment. No containers will be used.
THIS SCRIPT IS IN DEVELOPMENT AND NOT READY FOR ANY USE.
Do you want to continue? (y/n)y
Updating current enviroment with apt-get update
Hit:1 http://deb.debian.org/debian bookworm InRelease
Get:2 http://security.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:3 http://deb.debian.org/debian bookworm-updates InRelease [52.1 kB]
Get:4 http://security.debian.org/debian-security bookworm-security/main Sources [72.3 kB]
Get:5 http://security.debian.org/debian-security bookworm-security/main amd64 Packages [134 kB]
Get:6 http://security.debian.org/debian-security bookworm-security/main Translation-en [79.8 kB]
Get:7 http://deb.debian.org/debian bookworm-updates/main Sources.diff/Index [9483 B]
Get:8 http://deb.debian.org/debian bookworm-updates/main amd64 Packages.diff/Index [9483 B]
Get:9 http://deb.debian.org/debian bookworm-updates/main Translation-en.diff/Index [9483 B]
Get:10 http://deb.debian.org/debian bookworm-updates/main Sources T-2023-12-29-1403.39-F-2023-12-26-1404.09.pdiff [1422 B]
Get:11 http://deb.debian.org/debian bookworm-updates/main amd64 Packages T-2023-12-29-1403.39-F-2023-12-26-1404.09.pdiff [2069 B]
Get:10 http://deb.debian.org/debian bookworm-updates/main Sources T-2023-12-29-1403.39-F-2023-12-26-1404.09.pdiff [1422 B]
Get:11 http://deb.debian.org/debian bookworm-updates/main amd64 Packages T-2023-12-29-1403.39-F-2023-12-26-1404.09.pdiff [2069 B]
Get:12 http://deb.debian.org/debian bookworm-updates/main Translation-en T-2023-12-29-1403.39-F-2023-12-26-1404.09.pdiff [1113 B]
Get:12 http://deb.debian.org/debian bookworm-updates/main Translation-en T-2023-12-29-1403.39-F-2023-12-26-1404.09.pdiff [1113 B]
Fetched 419 kB in 6s (68.0 kB/s)
Reading package lists... Done
W: Skipping acquire of configured file 'testing/binary-amd64/Packages' as repository 'http://deb.debian.org/debian bookworm InRelease' doesn't have the component 'testing' (component misspelt in sources.list?)
W: Skipping acquire of configured file 'testing/i18n/Translation-en' as repository 'http://deb.debian.org/debian bookworm InRelease' doesn't have the component 'testing' (component misspelt in sources.list?)
Installing dependencies (go bee sed gcc)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
sed is already the newest version (4.9-1).
gcc is already the newest version (4:12.2.0-3).
gcc set to manually installed.
git is already the newest version (1:2.39.2-1.1).
The following package was automatically installed and is no longer required:
  linux-image-6.1.0-10-amd64
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  libccid libcurl4 libjq1 liboath0 libonig5 libpcsclite1 musl musl-dev opensc opensc-pkcs11 pcscd
Suggested packages:
  pcmciautils
Recommended packages:
  linux-musl-dev
The following NEW packages will be installed:
  curl easy-rsa jq libccid libcurl4 libjq1 liboath0 libonig5 libpcsclite1 musl musl-dev musl-tools oathtool opensc opensc-pkcs11
  pcscd
0 upgraded, 16 newly installed, 0 to remove and 2 not upgraded.
Need to get 4165 kB of archives.
After this operation, 12.5 MB of additional disk space will be used.
Get:1 http://security.debian.org/debian-security bookworm-security/main amd64 libcurl4 amd64 7.88.1-10+deb12u5 [390 kB]
Get:2 http://deb.debian.org/debian bookworm/main amd64 libccid amd64 1.5.2-1 [367 kB]
Get:3 http://security.debian.org/debian-security bookworm-security/main amd64 curl amd64 7.88.1-10+deb12u5 [315 kB]
Get:4 http://deb.debian.org/debian bookworm/main amd64 libpcsclite1 amd64 1.9.9-2 [49.7 kB]
Get:5 http://deb.debian.org/debian bookworm/main amd64 pcscd amd64 1.9.9-2 [89.7 kB]
Get:6 http://deb.debian.org/debian bookworm/main amd64 easy-rsa all 3.1.0-1 [54.8 kB]
Get:7 http://deb.debian.org/debian bookworm/main amd64 libonig5 amd64 6.9.8-1 [188 kB]
Get:8 http://deb.debian.org/debian bookworm/main amd64 libjq1 amd64 1.6-2.1 [135 kB]
Get:9 http://deb.debian.org/debian bookworm/main amd64 jq amd64 1.6-2.1 [64.9 kB]
Get:10 http://deb.debian.org/debian bookworm/main amd64 liboath0 amd64 2.6.7-3.1 [105 kB]
Get:11 http://deb.debian.org/debian bookworm/main amd64 musl amd64 1.2.3-1 [406 kB]
Get:12 http://deb.debian.org/debian bookworm/main amd64 musl-dev amd64 1.2.3-1 [587 kB]
Get:13 http://deb.debian.org/debian bookworm/main amd64 musl-tools amd64 1.2.3-1 [42.3 kB]
Get:14 http://deb.debian.org/debian bookworm/main amd64 oathtool amd64 2.6.7-3.1 [85.2 kB]
Get:15 http://deb.debian.org/debian bookworm/main amd64 opensc-pkcs11 amd64 0.23.0-0.3+deb12u1 [914 kB]
Get:16 http://deb.debian.org/debian bookworm/main amd64 opensc amd64 0.23.0-0.3+deb12u1 [371 kB]
Fetched 4165 kB in 12s (361 kB/s)
Selecting previously unselected package libccid.
(Reading database ... 73069 files and directories currently installed.)
Preparing to unpack .../00-libccid_1.5.2-1_amd64.deb ...
Unpacking libccid (1.5.2-1) ...
Selecting previously unselected package libpcsclite1:amd64.
Preparing to unpack .../01-libpcsclite1_1.9.9-2_amd64.deb ...
Unpacking libpcsclite1:amd64 (1.9.9-2) ...
Selecting previously unselected package pcscd.
Preparing to unpack .../02-pcscd_1.9.9-2_amd64.deb ...
Unpacking pcscd (1.9.9-2) ...
Selecting previously unselected package libcurl4:amd64.
Preparing to unpack .../03-libcurl4_7.88.1-10+deb12u5_amd64.deb ...
Unpacking libcurl4:amd64 (7.88.1-10+deb12u5) ...
Selecting previously unselected package curl.
Preparing to unpack .../04-curl_7.88.1-10+deb12u5_amd64.deb ...
Unpacking curl (7.88.1-10+deb12u5) ...
Selecting previously unselected package easy-rsa.
Preparing to unpack .../05-easy-rsa_3.1.0-1_all.deb ...
Unpacking easy-rsa (3.1.0-1) ...
Selecting previously unselected package libonig5:amd64.
Preparing to unpack .../06-libonig5_6.9.8-1_amd64.deb ...
Unpacking libonig5:amd64 (6.9.8-1) ...
Selecting previously unselected package libjq1:amd64.
Preparing to unpack .../07-libjq1_1.6-2.1_amd64.deb ...
Unpacking libjq1:amd64 (1.6-2.1) ...
Selecting previously unselected package jq.
Preparing to unpack .../08-jq_1.6-2.1_amd64.deb ...
Unpacking jq (1.6-2.1) ...
Selecting previously unselected package liboath0:amd64.
Preparing to unpack .../09-liboath0_2.6.7-3.1_amd64.deb ...
Unpacking liboath0:amd64 (2.6.7-3.1) ...
Selecting previously unselected package musl:amd64.
Preparing to unpack .../10-musl_1.2.3-1_amd64.deb ...
Unpacking musl:amd64 (1.2.3-1) ...
Selecting previously unselected package musl-dev:amd64.
Preparing to unpack .../11-musl-dev_1.2.3-1_amd64.deb ...
Unpacking musl-dev:amd64 (1.2.3-1) ...
Selecting previously unselected package musl-tools.
Preparing to unpack .../12-musl-tools_1.2.3-1_amd64.deb ...
Unpacking musl-tools (1.2.3-1) ...
Selecting previously unselected package oathtool.
Preparing to unpack .../13-oathtool_2.6.7-3.1_amd64.deb ...
Unpacking oathtool (2.6.7-3.1) ...
Selecting previously unselected package opensc-pkcs11:amd64.
Preparing to unpack .../14-opensc-pkcs11_0.23.0-0.3+deb12u1_amd64.deb ...
Unpacking opensc-pkcs11:amd64 (0.23.0-0.3+deb12u1) ...
Selecting previously unselected package opensc.
Preparing to unpack .../15-opensc_0.23.0-0.3+deb12u1_amd64.deb ...
Unpacking opensc (0.23.0-0.3+deb12u1) ...
Setting up liboath0:amd64 (2.6.7-3.1) ...
Setting up libccid (1.5.2-1) ...
Setting up oathtool (2.6.7-3.1) ...
Setting up opensc-pkcs11:amd64 (0.23.0-0.3+deb12u1) ...
Setting up libpcsclite1:amd64 (1.9.9-2) ...
Setting up musl:amd64 (1.2.3-1) ...
Setting up libcurl4:amd64 (7.88.1-10+deb12u5) ...
Setting up curl (7.88.1-10+deb12u5) ...
Setting up easy-rsa (3.1.0-1) ...
Setting up libonig5:amd64 (6.9.8-1) ...
Setting up libjq1:amd64 (1.6-2.1) ...
Setting up opensc (0.23.0-0.3+deb12u1) ...
Setting up pcscd (1.9.9-2) ...
Created symlink /etc/systemd/system/sockets.target.wants/pcscd.socket → /lib/systemd/system/pcscd.socket.
pcscd.service is a disabled or a static unit, not starting it.
Setting up musl-dev:amd64 (1.2.3-1) ...
Setting up jq (1.6-2.1) ...
Setting up musl-tools (1.2.3-1) ...
Processing triggers for libc-bin (2.36-9+deb12u3) ...
Processing triggers for man-db (2.11.2-2) ...
Processing triggers for mailcap (3.70+nmu1) ...
Scanning processes...
Scanning linux images...

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
Downloading all go modules (go mod download)
Installing BeeGo v2
go: downloading github.com/beego/bee v1.10.1-0.20201214090852-8eb7a2dfaff7
go: downloading github.com/beego/bee/v2 v2.0.2-0.20230830024958-01d397161933
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading github.com/fsnotify/fsnotify v1.4.9
go: downloading github.com/go-delve/delve v1.20.2
go: downloading github.com/gorilla/websocket v1.4.2
go: downloading github.com/beego/beego/v2 v2.1.0
go: downloading github.com/go-sql-driver/mysql v1.7.0
go: downloading github.com/lib/pq v1.10.5
go: downloading golang.org/x/tools v0.1.12
go: downloading github.com/flosch/pongo2 v0.0.0-20200529170236-5abacdfa4915
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pelletier/go-toml v1.9.2
go: downloading github.com/smartwalle/pongo2render v1.0.1
go: downloading github.com/spf13/viper v1.7.0
go: downloading golang.org/x/sys v0.6.0
go: downloading github.com/cosiner/argv v0.1.0
go: downloading github.com/derekparker/trie v0.0.0-20221213183930-4c74548207f4
go: downloading github.com/go-delve/liner v1.2.3-0.20220127212407-d32d89dd2a5d
go: downloading github.com/mattn/go-isatty v0.0.3
go: downloading github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18
go: downloading github.com/hashicorp/golang-lru v0.5.4
go: downloading github.com/prometheus/client_golang v1.15.1
go: downloading golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd
go: downloading google.golang.org/protobuf v1.30.0
go: downloading github.com/hashicorp/hcl v1.0.0
go: downloading github.com/magiconair/properties v1.8.1
go: downloading github.com/spf13/afero v1.1.2
go: downloading github.com/spf13/cast v1.3.0
go: downloading github.com/spf13/jwalterweatherman v1.0.0
go: downloading github.com/spf13/pflag v1.0.5
go: downloading github.com/subosito/gotenv v1.2.0
go: downloading gopkg.in/ini.v1 v1.51.0
go: downloading go.starlark.net v0.0.0-20220816155156-cfacd8902214
go: downloading github.com/mattn/go-runewidth v0.0.13
go: downloading github.com/sirupsen/logrus v1.6.0
go: downloading github.com/google/go-dap v0.7.0
go: downloading golang.org/x/arch v0.0.0-20190927153633-4e8777c89be4
go: downloading github.com/prometheus/client_model v0.3.0
go: downloading github.com/prometheus/common v0.42.0
go: downloading golang.org/x/net v0.7.0
go: downloading golang.org/x/text v0.7.0
go: downloading github.com/rivo/uniseg v0.2.0
go: downloading github.com/cilium/ebpf v0.7.0
go: downloading golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4
go: downloading github.com/prometheus/procfs v0.9.0
go: downloading github.com/golang/protobuf v1.5.3
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.4
Clonning qrencode into build directory
Cloning into 'qrencode'...
remote: Enumerating objects: 35, done.
remote: Counting objects: 100% (35/35), done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 35 (delta 8), reused 31 (delta 8), pack-reused 0
Receiving objects: 100% (35/35), 26.88 KiB | 103.00 KiB/s, done.
Resolving deltas: 100% (8/8), done.
2024/01/03 22:09:04 INFO     ▶ 0001 Getting bee latest version...
2024/01/03 22:09:05 INFO     ▶ 0002 Your bee are up to date
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v2.1.0

├── GoVersion : go1.21.5
├── GOOS      : linux
├── GOARCH    : amd64
├── NumCPU    : 4
├── GOPATH    :
├── GOROOT    : /usr/local/go
├── Compiler  : gc
└── Date      : Wednesday, 3 Jan 2024
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v2.1.0
2024/01/03 22:09:06 INFO     ▶ 0001 Packaging application on '/home/philipp/build/openvpn-ui'...
2024/01/03 22:09:06 INFO     ▶ 0002 Building application (openvpn-ui)...
2024/01/03 22:09:06 INFO     ▶ 0003 Using: GOOS=linux GOARCH=amd64
2024/01/03 22:15:50 SUCCESS  ▶ 0004 Build Successful!
2024/01/03 22:15:50 INFO     ▶ 0005 Writing to output: /home/philipp/build/openvpn-ui/openvpn-ui.tar.gz
2024/01/03 22:15:50 INFO     ▶ 0006 Excluding relpath prefix: .
2024/01/03 22:15:50 INFO     ▶ 0007 Excluding relpath suffix: .go:.DS_Store:.tmp:go.mod:go.sum
2024/01/03 22:15:50 INFO     ▶ 0008 Excluding filename regex: `^vendor|^ace.tar.bz2|^data.db|^build|^README.md|^docs`
2024/01/03 22:15:58 SUCCESS  ▶ 0009 Application packed!
Building qrencode
Moving qrencode to GOPATH
All done.

philipp@bookworm64:~/build/openvpn-ui/build$ cd ../
philipp@bookworm64:~/build/openvpn-ui$ mkdir ~openvpn-ui && mv openvpn-ui.tar.gz ~openvpn-ui
philipp@bookworm64:~/build/openvpn-ui$ cd ~openvpn-ui && tar -xzf openvpn-ui.tar.gz
philipp@bookworm64:~/openvpn-ui$ mkdir db 
philipp@bookworm64:~/openvpn-ui$ sudo mkdir /etc/openvpn/config
philipp@bookworm64:~/openvpn-ui$ export OPENVPN_ADMIN_USERNAME=admin
philipp@bookworm64:~/openvpn-ui$ export OPENVPN_ADMIN_PASSWORD=gagaZush
philipp@bookworm64:~/openvpn-ui$ sudo ./openvpn-ui
Config file: conf/app.conf
create table `user`
    -- --------------------------------------------------
    --  Table Structure for `github.com/d3vilh/openvpn-ui/models.User`
    -- --------------------------------------------------
    CREATE TABLE IF NOT EXISTS `user` (
        `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT,
        `login` varchar(64) NOT NULL DEFAULT ''  UNIQUE,
        `is_admin` bool NOT NULL DEFAULT false ,
        `name` varchar(64) NOT NULL DEFAULT ''  UNIQUE,
        `email` varchar(64) NOT NULL DEFAULT ''  UNIQUE,
        `password` varchar(32) NOT NULL DEFAULT '' ,
        `lastlogintime` datetime,
        `created` datetime NOT NULL,
        `updated` datetime NOT NULL
    );

create table `settings`
    -- --------------------------------------------------
    --  Table Structure for `github.com/d3vilh/openvpn-ui/models.Settings`
    -- --------------------------------------------------
    CREATE TABLE IF NOT EXISTS `settings` (
        `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT,
        `profile` varchar(64) NOT NULL DEFAULT ''  UNIQUE,
        `m_i_address` varchar(64) NOT NULL DEFAULT ''  UNIQUE,
        `m_i_network` varchar(64) NOT NULL DEFAULT ''  UNIQUE,
        `o_v_config_path` varchar(64) NOT NULL DEFAULT ''  UNIQUE,
        `easy_r_s_a_path` varchar(64) NOT NULL DEFAULT ''  UNIQUE,
        `created` datetime NOT NULL,
        `updated` datetime NOT NULL
    );

create table `o_v_config`
    -- --------------------------------------------------
    --  Table Structure for `github.com/d3vilh/openvpn-ui/models.OVConfig`
    -- --------------------------------------------------
    CREATE TABLE IF NOT EXISTS `o_v_config` (
        `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT,
        `profile` varchar(64) NOT NULL DEFAULT ''  UNIQUE,
        `func_mode` integer NOT NULL DEFAULT 0 ,
        `management` varchar(255) NOT NULL DEFAULT '' ,
        `script_security` varchar(255) NOT NULL DEFAULT '' ,
        `user_pass_verify` varchar(255) NOT NULL DEFAULT '' ,
        `device` varchar(255) NOT NULL DEFAULT '' ,
        `port` integer NOT NULL DEFAULT 0 ,
        `proto` varchar(255) NOT NULL DEFAULT '' ,
        `o_v_config_topology` varchar(255) NOT NULL DEFAULT '' ,
        `keepalive` varchar(255) NOT NULL DEFAULT '' ,
        `max_clients` integer NOT NULL DEFAULT 0 ,
        `o_v_config_user` varchar(255) NOT NULL DEFAULT '' ,
        `o_v_config_group` varchar(255) NOT NULL DEFAULT '' ,
        `o_v_config_client_config_dir` varchar(255) NOT NULL DEFAULT '' ,
        `ifconfig_pool_persist` varchar(255) NOT NULL DEFAULT '' ,
        `ca` varchar(255) NOT NULL DEFAULT '' ,
        `cert` varchar(255) NOT NULL DEFAULT '' ,
        `key` varchar(255) NOT NULL DEFAULT '' ,
        `crl` varchar(255) NOT NULL DEFAULT '' ,
        `dh` varchar(255) NOT NULL DEFAULT '' ,
        `t_l_s_control_channel` varchar(255) NOT NULL DEFAULT '' ,
        `t_l_s_min_version` varchar(255) NOT NULL DEFAULT '' ,
        `t_l_s_remote_cert` varchar(255) NOT NULL DEFAULT '' ,
        `cipher` varchar(255) NOT NULL DEFAULT '' ,
        `o_v_config_ncp_ciphers` varchar(255) NOT NULL DEFAULT '' ,
        `auth` varchar(255) NOT NULL DEFAULT '' ,
        `server` varchar(255) NOT NULL DEFAULT '' ,
        `route` varchar(255) NOT NULL DEFAULT '' ,
        `push_route` varchar(255) NOT NULL DEFAULT '' ,
        `d_n_s_server1` varchar(255) NOT NULL DEFAULT '' ,
        `d_n_s_server2` varchar(255) NOT NULL DEFAULT '' ,
        `redirect_g_w` varchar(255) NOT NULL DEFAULT '' ,
        `o_v_config_logfile` varchar(255) NOT NULL DEFAULT '' ,
        `o_v_config_log_verbose` integer NOT NULL DEFAULT 0 ,
        `o_v_config_status_log` varchar(255) NOT NULL DEFAULT '' ,
        `o_v_config_status_log_version` integer NOT NULL DEFAULT 0 ,
        `custom_opt_one` varchar(255) NOT NULL DEFAULT '' ,
        `custom_opt_two` varchar(255) NOT NULL DEFAULT '' ,
        `custom_opt_three` varchar(255) NOT NULL DEFAULT ''
    );

create table `o_v_client_config`
    -- --------------------------------------------------
    --  Table Structure for `github.com/d3vilh/openvpn-ui/models.OVClientConfig`
    -- --------------------------------------------------
    CREATE TABLE IF NOT EXISTS `o_v_client_config` (
        `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT,
        `profile` varchar(64) NOT NULL DEFAULT ''  UNIQUE,
        `func_mode` integer NOT NULL DEFAULT 0 ,
        `device` varchar(255) NOT NULL DEFAULT '' ,
        `server_address` varchar(255) NOT NULL DEFAULT '' ,
        `port` integer NOT NULL DEFAULT 0 ,
        `resolve_retry` varchar(255) NOT NULL DEFAULT '' ,
        `o_v_client_user` varchar(255) NOT NULL DEFAULT '' ,
        `o_v_client_group` varchar(255) NOT NULL DEFAULT '' ,
        `persist_tun` varchar(255) NOT NULL DEFAULT '' ,
        `persist_key` varchar(255) NOT NULL DEFAULT '' ,
        `remote_cert_t_l_s` varchar(255) NOT NULL DEFAULT '' ,
        `open_vpn_server_port` varchar(255) NOT NULL DEFAULT '' ,
        `proto` varchar(255) NOT NULL DEFAULT '' ,
        `ca` varchar(255) NOT NULL DEFAULT '' ,
        `cert` varchar(255) NOT NULL DEFAULT '' ,
        `key` varchar(255) NOT NULL DEFAULT '' ,
        `ta` varchar(255) NOT NULL DEFAULT '' ,
        `cipher` varchar(255) NOT NULL DEFAULT '' ,
        `redirect_gateway` varchar(255) NOT NULL DEFAULT '' ,
        `auth` varchar(255) NOT NULL DEFAULT '' ,
        `auth_no_cache` varchar(255) NOT NULL DEFAULT '' ,
        `tls_client` varchar(255) NOT NULL DEFAULT '' ,
        `verbose` varchar(255) NOT NULL DEFAULT '' ,
        `auth_user_pass` varchar(255) NOT NULL DEFAULT '' ,
        `t_f_a_issuer` varchar(255) NOT NULL DEFAULT '' ,
        `custom_conf_one` varchar(255) NOT NULL DEFAULT '' ,
        `custom_conf_two` varchar(255) NOT NULL DEFAULT '' ,
        `custom_conf_three` varchar(255) NOT NULL DEFAULT ''
    );

create table `easy_r_s_a_config`
    -- --------------------------------------------------
    --  Table Structure for `github.com/d3vilh/openvpn-ui/models.EasyRSAConfig`
    -- --------------------------------------------------
    CREATE TABLE IF NOT EXISTS `easy_r_s_a_config` (
        `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT,
        `profile` varchar(64) NOT NULL DEFAULT ''  UNIQUE,
        `easy_r_s_a_d_n` varchar(255) NOT NULL DEFAULT '' ,
        `easy_r_s_a_req_country` varchar(255) NOT NULL DEFAULT '' ,
        `easy_r_s_a_req_province` varchar(255) NOT NULL DEFAULT '' ,
        `easy_r_s_a_req_city` varchar(255) NOT NULL DEFAULT '' ,
        `easy_r_s_a_req_org` varchar(255) NOT NULL DEFAULT '' ,
        `easy_r_s_a_req_email` varchar(255) NOT NULL DEFAULT '' ,
        `easy_r_s_a_req_ou` varchar(255) NOT NULL DEFAULT '' ,
        `easy_r_s_a_req_cn` varchar(255) NOT NULL DEFAULT '' ,
        `easy_r_s_a_key_size` integer NOT NULL DEFAULT 0 ,
        `easy_r_s_a_ca_expire` integer NOT NULL DEFAULT 0 ,
        `easy_r_s_a_cert_expire` integer NOT NULL DEFAULT 0 ,
        `easy_r_s_a_cert_renew` integer NOT NULL DEFAULT 0 ,
        `easy_r_s_a_crl_days` integer NOT NULL DEFAULT 0
    );

[ORM]2024/01/03 22:47:13  -[Queries/default] - [  OK / db.QueryRow /     0.5ms] - [SELECT `id`, `login`, `is_admin`, `name`, `email`, `password`, `lastlogintime`, `created`, `updated` FROM `user` WHERE `name` = ? ] - `Administrator`
[ORM]2024/01/03 22:47:13  -[Queries/default] - [  OK /     db.Exec /     9.4ms] - [INSERT INTO `user` (`id`, `login`, `is_admin`, `name`, `email`, `password`, `lastlogintime`, `created`, `updated`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)] - `1`, ``, `true`, `Administrator`, `root@localhost`, `$s2$16384$8$1$+PpYc9cyOLuM86FAUd+XIugQ$iorM4HYwsChNj7/e4oIVM+P23I/sbVNJiW6SgHqqI14=`, `<nil>`, `2024-01-03 20:47:13.435200282 +0000 UTC`, `2024-01-03 20:47:13.435214248 +0000 UTC`
2024/01/03 22:47:13.445 [I] [models.go:64]  Default admin account created
[ORM]2024/01/03 22:47:13  -[Queries/default] - [  OK / db.QueryRow /     0.5ms] - [SELECT `id`, `profile`, `m_i_address`, `m_i_network`, `o_v_config_path`, `easy_r_s_a_path`, `created`, `updated` FROM `settings` WHERE `profile` = ? ] - `default`
[ORM]2024/01/03 22:47:13  -[Queries/default] - [  OK /     db.Exec /     6.3ms] - [INSERT INTO `settings` (`profile`, `m_i_address`, `m_i_network`, `o_v_config_path`, `easy_r_s_a_path`, `created`, `updated`) VALUES (?, ?, ?, ?, ?, ?, ?)] - `default`, `openvpn:2080`, `tcp`, `./openvpn`, `./easy-rsa`, `2024-01-03 20:47:13.446863531 +0000 UTC`, `2024-01-03 20:47:13.44687638 +0000 UTC`
2024/01/03 22:47:13.453 [I] [models.go:104]  New settings profile created
[ORM]2024/01/03 22:47:13  -[Queries/default] - [  OK / db.QueryRow /     1.4ms] - [SELECT `id`, `profile`, `func_mode`, `management`, `script_security`, `user_pass_verify`, `device`, `port`, `proto`, `o_v_config_topology`, `keepalive`, `max_clients`, `o_v_config_user`, `o_v_config_group`, `o_v_config_client_config_dir`, `ifconfig_pool_persist`, `ca`, `cert`, `key`, `crl`, `dh`, `t_l_s_control_channel`, `t_l_s_min_version`, `t_l_s_remote_cert`, `cipher`, `o_v_config_ncp_ciphers`, `auth`, `server`, `route`, `push_route`, `d_n_s_server1`, `d_n_s_server2`, `redirect_g_w`, `o_v_config_logfile`, `o_v_config_log_verbose`, `o_v_config_status_log`, `o_v_config_status_log_version`, `custom_opt_one`, `custom_opt_two`, `custom_opt_three` FROM `o_v_config` WHERE `profile` = ? ] - `default`
[ORM]2024/01/03 22:47:13  -[Queries/default] - [  OK /     db.Exec /     6.1ms] - [INSERT INTO `o_v_config` (`profile`, `func_mode`, `management`, `script_security`, `user_pass_verify`, `device`, `port`, `proto`, `o_v_config_topology`, `keepalive`, `max_clients`, `o_v_config_user`, `o_v_config_group`, `o_v_config_client_config_dir`, `ifconfig_pool_persist`, `ca`, `cert`, `key`, `crl`, `dh`, `t_l_s_control_channel`, `t_l_s_min_version`, `t_l_s_remote_cert`, `cipher`, `o_v_config_ncp_ciphers`, `auth`, `server`, `route`, `push_route`, `d_n_s_server1`, `d_n_s_server2`, `redirect_g_w`, `o_v_config_logfile`, `o_v_config_log_verbose`, `o_v_config_status_log`, `o_v_config_status_log_version`, `custom_opt_one`, `custom_opt_two`, `custom_opt_three`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] - `default`, `0`, `openvpn:2080 tcp`, ``, ``, `tun`, `1194`, `udp`, `subnet`, `10 120`, `100`, `nobody`, `nogroup`, `/etc/openvpn/staticclients`, `pki/ipp.txt`, `pki/ca.crt`, `pki/issued/server.crt`, `pki/private/server.key`, `pki/crl.pem`, `pki/dh.pem`, `tls-crypt pki/ta.key`, `tls-version-min 1.2`, `remote-cert-tls client`, `AES-256-GCM`, `AES-256-GCM:AES-192-GCM:AES-128-GCM`, `SHA512`, `server 10.0.70.0 255.255.255.0`, `route 10.0.71.0 255.255.255.0`, `push "route 10.0.60.0 255.255.255.0"`, `push "dhcp-option DNS 8.8.8.8"`, `push "dhcp-option DNS 1.0.0.1"`, `push "redirect-gateway def1 bypass-dhcp"`, `/var/log/openvpn/openvpn.log`, `3`, `/var/log/openvpn/openvpn-status.log`, `2`, `# Custom Option One`, `# Custom Option Two
# client-to-client`, `# Custom Option Three
# push "route 0.0.0.0 255.255.255.255 net_gateway"
# push block-outside-dns`
2024/01/03 22:47:13.463 [I] [models.go:161]  New settings profile created
2024/01/03 22:47:13.464 [E] [models.go:168]  open openvpn/config/server.conf: no such file or directory
[ORM]2024/01/03 22:47:13  -[Queries/default] - [  OK / db.QueryRow /     1.1ms] - [SELECT `id`, `profile`, `func_mode`, `device`, `server_address`, `port`, `resolve_retry`, `o_v_client_user`, `o_v_client_group`, `persist_tun`, `persist_key`, `remote_cert_t_l_s`, `open_vpn_server_port`, `proto`, `ca`, `cert`, `key`, `ta`, `cipher`, `redirect_gateway`, `auth`, `auth_no_cache`, `tls_client`, `verbose`, `auth_user_pass`, `t_f_a_issuer`, `custom_conf_one`, `custom_conf_two`, `custom_conf_three` FROM `o_v_client_config` WHERE `profile` = ? ] - `default`
[ORM]2024/01/03 22:47:13  -[Queries/default] - [  OK /     db.Exec /     5.7ms] - [INSERT INTO `o_v_client_config` (`profile`, `func_mode`, `device`, `server_address`, `port`, `resolve_retry`, `o_v_client_user`, `o_v_client_group`, `persist_tun`, `persist_key`, `remote_cert_t_l_s`, `open_vpn_server_port`, `proto`, `ca`, `cert`, `key`, `ta`, `cipher`, `redirect_gateway`, `auth`, `auth_no_cache`, `tls_client`, `verbose`, `auth_user_pass`, `t_f_a_issuer`, `custom_conf_one`, `custom_conf_two`, `custom_conf_three`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] - `default`, `0`, `tun`, `127.0.0.1`, `1194`, `resolv-retry infinite`, `nobody`, `nogroup`, `persist-tun`, `persist-key`, `remote-cert-tls server`, `1194`, `udp`, ``, ``, ``, ``, `AES-256-GCM`, `redirect-gateway def1`, `SHA512`, `auth-nocache`, `tls-client`, `3`, ``, `MFA%20OpenVPN-UI`, `#Custom Option One`, `#Custom Option Two`, `#Custom Option Three`
2024/01/03 22:47:13.473 [I] [models.go:208]  New settings profile created
2024/01/03 22:47:13.474 [E] [models.go:215]  open openvpn/config/client.conf: no such file or directory
[ORM]2024/01/03 22:47:13  -[Queries/default] - [  OK / db.QueryRow /     0.3ms] - [SELECT `id`, `profile`, `easy_r_s_a_d_n`, `easy_r_s_a_req_country`, `easy_r_s_a_req_province`, `easy_r_s_a_req_city`, `easy_r_s_a_req_org`, `easy_r_s_a_req_email`, `easy_r_s_a_req_ou`, `easy_r_s_a_req_cn`, `easy_r_s_a_key_size`, `easy_r_s_a_ca_expire`, `easy_r_s_a_cert_expire`, `easy_r_s_a_cert_renew`, `easy_r_s_a_crl_days` FROM `easy_r_s_a_config` WHERE `profile` = ? ] - `default`
[ORM]2024/01/03 22:47:13  -[Queries/default] - [  OK /     db.Exec /     5.1ms] - [INSERT INTO `easy_r_s_a_config` (`profile`, `easy_r_s_a_d_n`, `easy_r_s_a_req_country`, `easy_r_s_a_req_province`, `easy_r_s_a_req_city`, `easy_r_s_a_req_org`, `easy_r_s_a_req_email`, `easy_r_s_a_req_ou`, `easy_r_s_a_req_cn`, `easy_r_s_a_key_size`, `easy_r_s_a_ca_expire`, `easy_r_s_a_cert_expire`, `easy_r_s_a_cert_renew`, `easy_r_s_a_crl_days`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] - `default`, `org`, `UA`, `KY`, `Kyiv`, `SweetHome`, `sweet@home.net`, `MyOrganizationalUnit`, `server`, `2048`, `3650`, `825`, `30`, `180`
2024/01/03 22:47:13.481 [I] [models.go:245]  New settings profile created
2024/01/03 22:47:13.482 [E] [models.go:252]  open easy-rsa/pki/vars: no such file or directory
2024/01/03 22:47:13.571 [I] [server.go:280]  http server Running on http://:8080
2024/01/03 22:47:13.572 [D] [admin.go:87]  now we don't start tasks here, if you use task module, please invoke task.StartTask, or task will not be executed
2024/01/03 22:47:13.573 [I] [admin.go:93]  Admin server Running on :8088
2024/01/03 22:47:13.573 [I] [server.go:280]  http server Running on http://:8088
^C
philipp@bookworm64:~/openvpn-ui$

Edit: To disable Admin server modify options below in conf/app.conf accordingly.

RunMode = prod
EnableAdmin = false
dinger1986 commented 9 months ago

nice! let me play with it, I will add automation etc where I can, once I have it working I can at least play more.

Happy new year and thank you!

d3vilh commented 8 months ago

I did a test of slightly updated version for standalone-install.sh on x86_64 Debian Bookworm VM and it works fine. Closing this issue.

dinger1986 commented 8 months ago

great thanks!

Sorry I had meant to feed back and say it was working fine, I have also started writing a full script to install openvpn etc as well but havent completed it, I will PR once done.