Skip to content

Commit

Permalink
Merge pull request #74 from d3vilh/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
d3vilh authored May 25, 2024
2 parents a996f05 + 1130052 commit 7e14ae0
Show file tree
Hide file tree
Showing 287 changed files with 15,971 additions and 15,830 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ openvpn/
easy-rsa/pki/vars
easy-rsa/easy-rsa.vars
openvpn-ui.Bullseye.x86_64.tar.gz
easy-rsa/pki/index.txt
2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

FROM DEFINE-YOUR-ARCH
LABEL maintainer="Mr.Philipp <d3vilh@github.com>"
LABEL version="0.9.5.2"
LABEL version="0.9.5.3"
WORKDIR /opt
EXPOSE 8080/tcp

Expand Down
8 changes: 4 additions & 4 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ case $ARCH in
PLATFORM="linux/arm/v5"
#UIIMAGE="FROM arm32v5/debian:stable-slim"
UIIMAGE="FROM arm32v6/alpine" #moving to unstable because it has easy-rsa v3.1.6 which supports cert renewal
BEEIMAGE="FROM arm32v5/golang:1.21.5-bookworm"
BEEIMAGE="FROM arm32v5/golang:1.21-bookworm"
;;
armv7*)
PLATFORM="linux/arm/v7"
#UIIMAGE="FROM arm32v7/debian:stable-slim"
UIIMAGE="FROM arm32v7/alpine" #moving to unstable because it has easy-rsa v3.1.6 which supports cert renewal
BEEIMAGE="FROM arm32v7/golang:1.21.5"
BEEIMAGE="FROM arm32v7/golang:1.22.3-bookworm"
;;
aarch64*)
PLATFORM="linux/arm64/v8"
#UIIMAGE="FROM arm64v8/debian:stable-slim"
UIIMAGE="FROM arm64v8/alpine" #moving to unstable because it has easy-rsa v3.1.6 which supports cert renewal
BEEIMAGE="FROM golang:1.21.5-bookworm"
BEEIMAGE="FROM golang:1.22.3-bookworm"
;;
*)
PLATFORM="linux/amd64"
#UIIMAGE="FROM debian:stable-slim"
UIIMAGE="FROM alpine" #moving to unstable because it has easy-rsa v3.1.6 which supports cert renewal
BEEIMAGE="FROM golang:1.21.5-bookworm"
BEEIMAGE="FROM golang:1.22.3-bookworm"
;;
esac

Expand Down
35 changes: 17 additions & 18 deletions build/go.mod
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
module github.com/d3vilh/openvpn-ui

go 1.21.1
go 1.22.3

require (
github.com/beego/beego/v2 v2.1.4
github.com/cloudfoundry/gosigar v1.3.39
github.com/beego/beego/v2 v2.2.1
github.com/cloudfoundry/gosigar v1.3.58
github.com/d3vilh/openvpn-server-config v0.3.5
github.com/go-ldap/ldap/v3 v3.4.6
github.com/mattn/go-sqlite3 v1.14.19
github.com/go-ldap/ldap/v3 v3.4.8
github.com/mattn/go-sqlite3 v1.14.22
gopkg.in/hlandau/passlib.v1 v1.0.11
)

require (
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.5 // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.7 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/prometheus/client_golang v1.19.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.53.0 // indirect
github.com/prometheus/procfs v0.14.0 // indirect
github.com/shiena/ansicolor v0.0.0-20230509054315-a9deabde6e02 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/hlandau/easymetric.v1 v1.0.0 // indirect
gopkg.in/hlandau/measurable.v1 v1.0.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
141 changes: 93 additions & 48 deletions build/go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion conf/easyrsa-vars.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ set_var EASYRSA_CA_EXPIRE {{ .EasyRSACaExpire }}
set_var EASYRSA_CERT_EXPIRE {{ .EasyRSACertExpire }}
set_var EASYRSA_CERT_RENEW {{ .EasyRSACertRenew }}
set_var EASYRSA_CRL_DAYS {{ .EasyRSACrlDays }}
# Auto generated by OpenVPN-UI v.0.9.5.2
# Auto generated by OpenVPN-UI v.0.9.5.3
2 changes: 1 addition & 1 deletion conf/openvpn-client-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ verb {{ .Verbose }}
<tls-crypt>
{{ .Ta }}
</tls-crypt>
# Auto generated by OpenVPN-UI v.0.9.5.2
# Auto generated by OpenVPN-UI v.0.9.5.3
2 changes: 1 addition & 1 deletion conf/openvpn-server-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ status-version {{ .OVConfigStatusLogVersion }}
{{ .CustomOptTwo }}
{{ .CustomOptThree }}

# Auto generated by OpenVPN-UI v.0.9.5.2
# Auto generated by OpenVPN-UI v.0.9.5.3
3 changes: 1 addition & 2 deletions controllers/certificates.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package controllers
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -95,7 +94,7 @@ func (c *CertificatesController) DisplayImage() {
logs.Info("Image path: %s", imagePath)

// Check if the image file exists
data, err := ioutil.ReadFile(imagePath)
data, err := os.ReadFile(imagePath)
if err != nil {
c.Ctx.Output.SetStatus(404)
c.Ctx.WriteString("Image not found")
Expand Down
64 changes: 58 additions & 6 deletions controllers/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (c *ProfileController) Post() {
if _, err := o.Update(c.Userinfo); err != nil {
flash.Error(err.Error())
} else {
flash.Success("Profile has been updated")
flash.Success("Profile has been updated!")
}
flash.Store(&c.Controller)
c.List()
Expand Down Expand Up @@ -159,7 +159,7 @@ func (c *ProfileController) Create() {
var existingUser models.User
err := o.QueryTable("user").Filter("Login", user.Login).One(&existingUser)
if err == nil {
flash.Warning("User with login \"" + user.Login + "\" is already exists")
flash.Warning("User with login \"" + user.Login + "\" is already exists!")
flash.Store(&c.Controller)
logs.Info("User already exists:", user.Login)
c.List()
Expand Down Expand Up @@ -193,8 +193,8 @@ func (c *ProfileController) Create() {
newUser.Password = hash
if created, _, err := o.ReadOrCreate(&newUser, "Name"); err == nil {
if created {
logs.Info("New user with login \"" + user.Login + "\" created successfully")
flash.Success("New user with login \"" + user.Login + "\" created successfully")
logs.Info("New user with login \"" + user.Login + "\" created successfully.")
flash.Success("New user with login \"" + user.Login + "\" created successfully.")
flash.Store(&c.Controller)
} else {
logs.Debug(newUser)
Expand Down Expand Up @@ -232,14 +232,66 @@ func (c *ProfileController) DeleteUser() {

o := orm.NewOrm()
user := models.User{Id: int64(id)}

// Read the user first to populate the Login field before deleting it from the database
err = o.Read(&user)
if err != nil {
logs.Error("Failed to get user:", err)
return
}

if _, err := o.Delete(&user); err != nil {
logs.Error("Failed to delete user \""+user.Login+"\" profile:", err)
flash.Error("Failed to delete user \"" + user.Login + "\" profile")
return
}

logs.Info("Deleted user profile with ID", id)
flash.Success("User \"" + user.Login + "\" deleted successfully")
logs.Info("New user with login \""+user.Login+"\" deleted successfully. It had user ID: ", id)
flash.Success("User \"" + user.Login + "\" deleted successfully.")
flash.Store(&c.Controller)
c.List()
}

// @router /profile/edit/:key [post]
func (c *ProfileController) EditUser() {
c.TplName = "profile.html"
flash := web.NewFlash()
id, err := c.GetInt(":key")
if err != nil {
logs.Error("Failed to get user ID:", err)
return
}

o := orm.NewOrm()
user := models.User{Id: int64(id)}
if err := o.Read(&user); err != nil {
logs.Error("Failed to read user \""+user.Name+"\" profile:", err)
flash.Error("Failed to read user \"" + user.Name + "\" profile")
return
}

// Updating form "username" and "email" fields
username := c.GetString("name")
email := c.GetString("email")

user.Name = username
user.Email = email

if username != "" {
user.Name = username
}
if email != "" {
user.Email = email
}

if _, err := o.Update(&user); err != nil {
logs.Error("Failed to update user \""+user.Name+"\" profile:", err)
flash.Error("Failed to update user \"" + user.Name + "\" profile")
return
}

logs.Info("Updated user profile with ID", id)
flash.Success("User \"" + user.Name + "\" updated successfully")
flash.Store(&c.Controller)
c.List()
}
38 changes: 18 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
module github.com/d3vilh/openvpn-ui

go 1.21.5
go 1.22.3

require (
github.com/beego/beego/v2 v2.1.6
github.com/cloudfoundry/gosigar v1.3.51
github.com/beego/beego/v2 v2.2.1
github.com/cloudfoundry/gosigar v1.3.58
github.com/d3vilh/openvpn-server-config v0.3.5
github.com/go-ldap/ldap/v3 v3.4.6
github.com/go-ldap/ldap/v3 v3.4.8
github.com/mattn/go-sqlite3 v1.14.22
gopkg.in/hlandau/passlib.v1 v1.0.11
)

require (
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.5 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.7 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 // indirect
github.com/prometheus/client_golang v1.19.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.53.0 // indirect
github.com/prometheus/procfs v0.14.0 // indirect
github.com/shiena/ansicolor v0.0.0-20230509054315-a9deabde6e02 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/hlandau/easymetric.v1 v1.0.0 // indirect
gopkg.in/hlandau/measurable.v1 v1.0.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit 7e14ae0

Please sign in to comment.