Skip to content

Commit 7e14ae0

Browse files
authored
Merge pull request #74 from d3vilh/dev
Dev
2 parents a996f05 + 1130052 commit 7e14ae0

File tree

287 files changed

+15971
-15830
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

287 files changed

+15971
-15830
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ openvpn/
44
easy-rsa/pki/vars
55
easy-rsa/easy-rsa.vars
66
openvpn-ui.Bullseye.x86_64.tar.gz
7+
easy-rsa/pki/index.txt

build/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
FROM DEFINE-YOUR-ARCH
55
LABEL maintainer="Mr.Philipp <[email protected]>"
6-
LABEL version="0.9.5.2"
6+
LABEL version="0.9.5.3"
77
WORKDIR /opt
88
EXPOSE 8080/tcp
99

build/build.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ case $ARCH in
1010
PLATFORM="linux/arm/v5"
1111
#UIIMAGE="FROM arm32v5/debian:stable-slim"
1212
UIIMAGE="FROM arm32v6/alpine" #moving to unstable because it has easy-rsa v3.1.6 which supports cert renewal
13-
BEEIMAGE="FROM arm32v5/golang:1.21.5-bookworm"
13+
BEEIMAGE="FROM arm32v5/golang:1.21-bookworm"
1414
;;
1515
armv7*)
1616
PLATFORM="linux/arm/v7"
1717
#UIIMAGE="FROM arm32v7/debian:stable-slim"
1818
UIIMAGE="FROM arm32v7/alpine" #moving to unstable because it has easy-rsa v3.1.6 which supports cert renewal
19-
BEEIMAGE="FROM arm32v7/golang:1.21.5"
19+
BEEIMAGE="FROM arm32v7/golang:1.22.3-bookworm"
2020
;;
2121
aarch64*)
2222
PLATFORM="linux/arm64/v8"
2323
#UIIMAGE="FROM arm64v8/debian:stable-slim"
2424
UIIMAGE="FROM arm64v8/alpine" #moving to unstable because it has easy-rsa v3.1.6 which supports cert renewal
25-
BEEIMAGE="FROM golang:1.21.5-bookworm"
25+
BEEIMAGE="FROM golang:1.22.3-bookworm"
2626
;;
2727
*)
2828
PLATFORM="linux/amd64"
2929
#UIIMAGE="FROM debian:stable-slim"
3030
UIIMAGE="FROM alpine" #moving to unstable because it has easy-rsa v3.1.6 which supports cert renewal
31-
BEEIMAGE="FROM golang:1.21.5-bookworm"
31+
BEEIMAGE="FROM golang:1.22.3-bookworm"
3232
;;
3333
esac
3434

build/go.mod

+17-18
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,38 @@
11
module github.com/d3vilh/openvpn-ui
22

3-
go 1.21.1
3+
go 1.22.3
44

55
require (
6-
github.com/beego/beego/v2 v2.1.4
7-
github.com/cloudfoundry/gosigar v1.3.39
6+
github.com/beego/beego/v2 v2.2.1
7+
github.com/cloudfoundry/gosigar v1.3.58
88
github.com/d3vilh/openvpn-server-config v0.3.5
9-
github.com/go-ldap/ldap/v3 v3.4.6
10-
github.com/mattn/go-sqlite3 v1.14.19
9+
github.com/go-ldap/ldap/v3 v3.4.8
10+
github.com/mattn/go-sqlite3 v1.14.22
1111
gopkg.in/hlandau/passlib.v1 v1.0.11
1212
)
1313

1414
require (
1515
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
1616
github.com/beorn7/perks v1.0.1 // indirect
17-
github.com/cespare/xxhash/v2 v2.2.0 // indirect
18-
github.com/go-asn1-ber/asn1-ber v1.5.5 // indirect
19-
github.com/google/uuid v1.5.0 // indirect
17+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
18+
github.com/go-asn1-ber/asn1-ber v1.5.7 // indirect
19+
github.com/google/uuid v1.6.0 // indirect
2020
github.com/hashicorp/golang-lru v1.0.2 // indirect
2121
github.com/kr/text v0.2.0 // indirect
22-
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
2322
github.com/mitchellh/mapstructure v1.5.0 // indirect
2423
github.com/pkg/errors v0.9.1 // indirect
25-
github.com/prometheus/client_golang v1.17.0 // indirect
26-
github.com/prometheus/client_model v0.5.0 // indirect
27-
github.com/prometheus/common v0.45.0 // indirect
28-
github.com/prometheus/procfs v0.12.0 // indirect
24+
github.com/prometheus/client_golang v1.19.1 // indirect
25+
github.com/prometheus/client_model v0.6.1 // indirect
26+
github.com/prometheus/common v0.53.0 // indirect
27+
github.com/prometheus/procfs v0.14.0 // indirect
2928
github.com/shiena/ansicolor v0.0.0-20230509054315-a9deabde6e02 // indirect
3029
github.com/sirupsen/logrus v1.9.3 // indirect
3130
github.com/valyala/bytebufferpool v1.0.0 // indirect
32-
golang.org/x/crypto v0.17.0 // indirect
33-
golang.org/x/net v0.19.0 // indirect
34-
golang.org/x/sys v0.15.0 // indirect
35-
golang.org/x/text v0.14.0 // indirect
36-
google.golang.org/protobuf v1.32.0 // indirect
31+
golang.org/x/crypto v0.23.0 // indirect
32+
golang.org/x/net v0.25.0 // indirect
33+
golang.org/x/sys v0.20.0 // indirect
34+
golang.org/x/text v0.15.0 // indirect
35+
google.golang.org/protobuf v1.34.1 // indirect
3736
gopkg.in/hlandau/easymetric.v1 v1.0.0 // indirect
3837
gopkg.in/hlandau/measurable.v1 v1.0.1 // indirect
3938
gopkg.in/yaml.v3 v3.0.1 // indirect

build/go.sum

+93-48
Large diffs are not rendered by default.

conf/easyrsa-vars.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ set_var EASYRSA_CA_EXPIRE {{ .EasyRSACaExpire }}
1111
set_var EASYRSA_CERT_EXPIRE {{ .EasyRSACertExpire }}
1212
set_var EASYRSA_CERT_RENEW {{ .EasyRSACertRenew }}
1313
set_var EASYRSA_CRL_DAYS {{ .EasyRSACrlDays }}
14-
# Auto generated by OpenVPN-UI v.0.9.5.2
14+
# Auto generated by OpenVPN-UI v.0.9.5.3

conf/openvpn-client-config.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ verb {{ .Verbose }}
3030
<tls-crypt>
3131
{{ .Ta }}
3232
</tls-crypt>
33-
# Auto generated by OpenVPN-UI v.0.9.5.2
33+
# Auto generated by OpenVPN-UI v.0.9.5.3

conf/openvpn-server-config.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ status-version {{ .OVConfigStatusLogVersion }}
5353
{{ .CustomOptTwo }}
5454
{{ .CustomOptThree }}
5555

56-
# Auto generated by OpenVPN-UI v.0.9.5.2
56+
# Auto generated by OpenVPN-UI v.0.9.5.3

controllers/certificates.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package controllers
33
import (
44
"bytes"
55
"fmt"
6-
"io/ioutil"
76
"os"
87
"path/filepath"
98
"strconv"
@@ -95,7 +94,7 @@ func (c *CertificatesController) DisplayImage() {
9594
logs.Info("Image path: %s", imagePath)
9695

9796
// Check if the image file exists
98-
data, err := ioutil.ReadFile(imagePath)
97+
data, err := os.ReadFile(imagePath)
9998
if err != nil {
10099
c.Ctx.Output.SetStatus(404)
101100
c.Ctx.WriteString("Image not found")

controllers/profile.go

+58-6
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func (c *ProfileController) Post() {
8989
if _, err := o.Update(c.Userinfo); err != nil {
9090
flash.Error(err.Error())
9191
} else {
92-
flash.Success("Profile has been updated")
92+
flash.Success("Profile has been updated!")
9393
}
9494
flash.Store(&c.Controller)
9595
c.List()
@@ -159,7 +159,7 @@ func (c *ProfileController) Create() {
159159
var existingUser models.User
160160
err := o.QueryTable("user").Filter("Login", user.Login).One(&existingUser)
161161
if err == nil {
162-
flash.Warning("User with login \"" + user.Login + "\" is already exists")
162+
flash.Warning("User with login \"" + user.Login + "\" is already exists!")
163163
flash.Store(&c.Controller)
164164
logs.Info("User already exists:", user.Login)
165165
c.List()
@@ -193,8 +193,8 @@ func (c *ProfileController) Create() {
193193
newUser.Password = hash
194194
if created, _, err := o.ReadOrCreate(&newUser, "Name"); err == nil {
195195
if created {
196-
logs.Info("New user with login \"" + user.Login + "\" created successfully")
197-
flash.Success("New user with login \"" + user.Login + "\" created successfully")
196+
logs.Info("New user with login \"" + user.Login + "\" created successfully.")
197+
flash.Success("New user with login \"" + user.Login + "\" created successfully.")
198198
flash.Store(&c.Controller)
199199
} else {
200200
logs.Debug(newUser)
@@ -232,14 +232,66 @@ func (c *ProfileController) DeleteUser() {
232232

233233
o := orm.NewOrm()
234234
user := models.User{Id: int64(id)}
235+
236+
// Read the user first to populate the Login field before deleting it from the database
237+
err = o.Read(&user)
238+
if err != nil {
239+
logs.Error("Failed to get user:", err)
240+
return
241+
}
242+
235243
if _, err := o.Delete(&user); err != nil {
236244
logs.Error("Failed to delete user \""+user.Login+"\" profile:", err)
237245
flash.Error("Failed to delete user \"" + user.Login + "\" profile")
238246
return
239247
}
240248

241-
logs.Info("Deleted user profile with ID", id)
242-
flash.Success("User \"" + user.Login + "\" deleted successfully")
249+
logs.Info("New user with login \""+user.Login+"\" deleted successfully. It had user ID: ", id)
250+
flash.Success("User \"" + user.Login + "\" deleted successfully.")
251+
flash.Store(&c.Controller)
252+
c.List()
253+
}
254+
255+
// @router /profile/edit/:key [post]
256+
func (c *ProfileController) EditUser() {
257+
c.TplName = "profile.html"
258+
flash := web.NewFlash()
259+
id, err := c.GetInt(":key")
260+
if err != nil {
261+
logs.Error("Failed to get user ID:", err)
262+
return
263+
}
264+
265+
o := orm.NewOrm()
266+
user := models.User{Id: int64(id)}
267+
if err := o.Read(&user); err != nil {
268+
logs.Error("Failed to read user \""+user.Name+"\" profile:", err)
269+
flash.Error("Failed to read user \"" + user.Name + "\" profile")
270+
return
271+
}
272+
273+
// Updating form "username" and "email" fields
274+
username := c.GetString("name")
275+
email := c.GetString("email")
276+
277+
user.Name = username
278+
user.Email = email
279+
280+
if username != "" {
281+
user.Name = username
282+
}
283+
if email != "" {
284+
user.Email = email
285+
}
286+
287+
if _, err := o.Update(&user); err != nil {
288+
logs.Error("Failed to update user \""+user.Name+"\" profile:", err)
289+
flash.Error("Failed to update user \"" + user.Name + "\" profile")
290+
return
291+
}
292+
293+
logs.Info("Updated user profile with ID", id)
294+
flash.Success("User \"" + user.Name + "\" updated successfully")
243295
flash.Store(&c.Controller)
244296
c.List()
245297
}

go.mod

+18-20
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,38 @@
11
module github.com/d3vilh/openvpn-ui
22

3-
go 1.21.5
3+
go 1.22.3
44

55
require (
6-
github.com/beego/beego/v2 v2.1.6
7-
github.com/cloudfoundry/gosigar v1.3.51
6+
github.com/beego/beego/v2 v2.2.1
7+
github.com/cloudfoundry/gosigar v1.3.58
88
github.com/d3vilh/openvpn-server-config v0.3.5
9-
github.com/go-ldap/ldap/v3 v3.4.6
9+
github.com/go-ldap/ldap/v3 v3.4.8
1010
github.com/mattn/go-sqlite3 v1.14.22
1111
gopkg.in/hlandau/passlib.v1 v1.0.11
1212
)
1313

1414
require (
1515
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
1616
github.com/beorn7/perks v1.0.1 // indirect
17-
github.com/cespare/xxhash/v2 v2.2.0 // indirect
18-
github.com/go-asn1-ber/asn1-ber v1.5.5 // indirect
19-
github.com/golang/protobuf v1.5.3 // indirect
20-
github.com/google/uuid v1.3.1 // indirect
21-
github.com/hashicorp/golang-lru v0.5.4 // indirect
17+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
18+
github.com/go-asn1-ber/asn1-ber v1.5.7 // indirect
19+
github.com/google/uuid v1.6.0 // indirect
20+
github.com/hashicorp/golang-lru v1.0.2 // indirect
2221
github.com/kr/text v0.2.0 // indirect
23-
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
2422
github.com/mitchellh/mapstructure v1.5.0 // indirect
2523
github.com/pkg/errors v0.9.1 // indirect
26-
github.com/prometheus/client_golang v1.16.0 // indirect
27-
github.com/prometheus/client_model v0.3.0 // indirect
28-
github.com/prometheus/common v0.42.0 // indirect
29-
github.com/prometheus/procfs v0.10.1 // indirect
30-
github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 // indirect
24+
github.com/prometheus/client_golang v1.19.1 // indirect
25+
github.com/prometheus/client_model v0.6.1 // indirect
26+
github.com/prometheus/common v0.53.0 // indirect
27+
github.com/prometheus/procfs v0.14.0 // indirect
28+
github.com/shiena/ansicolor v0.0.0-20230509054315-a9deabde6e02 // indirect
3129
github.com/sirupsen/logrus v1.9.3 // indirect
3230
github.com/valyala/bytebufferpool v1.0.0 // indirect
33-
golang.org/x/crypto v0.21.0 // indirect
34-
golang.org/x/net v0.22.0 // indirect
35-
golang.org/x/sys v0.18.0 // indirect
36-
golang.org/x/text v0.14.0 // indirect
37-
google.golang.org/protobuf v1.30.0 // indirect
31+
golang.org/x/crypto v0.23.0 // indirect
32+
golang.org/x/net v0.25.0 // indirect
33+
golang.org/x/sys v0.20.0 // indirect
34+
golang.org/x/text v0.15.0 // indirect
35+
google.golang.org/protobuf v1.34.1 // indirect
3836
gopkg.in/hlandau/easymetric.v1 v1.0.0 // indirect
3937
gopkg.in/hlandau/measurable.v1 v1.0.1 // indirect
4038
gopkg.in/yaml.v3 v3.0.1 // indirect

0 commit comments

Comments
 (0)