Skip to content

Commit

Permalink
Merge pull request #44 from d3vilh/dev
Browse files Browse the repository at this point in the history
Dev2main 0.9.4.1
  • Loading branch information
d3vilh committed Dec 26, 2023
2 parents cebd606 + fafb7b7 commit c7db47e
Show file tree
Hide file tree
Showing 437 changed files with 11,339 additions and 4,959 deletions.
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 <[email protected]>"
LABEL version="0.9.4"
LABEL version="0.9.4.1"
WORKDIR /opt
EXPOSE 8080/tcp

Expand Down
7 changes: 3 additions & 4 deletions build/Dockerfile-beego
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ FROM DEFINE-YOUR-ARCH

LABEL maintainer="Mr.Philipp <[email protected]>"

# Set the working directory to /tmp1
WORKDIR /tmp1
# Set the working directory to /beego and installing dependencies
WORKDIR /beego
RUN apt-get update && apt-get install git musl-tools -y

# Enable go modules
Expand All @@ -21,10 +21,9 @@ RUN go mod download
# Install the beego and bee packages
RUN go install github.com/beego/bee/v2@develop

# qrencode build
# Setting working directory to /app and getting qrencode from github
WORKDIR /app
RUN git clone https://github.com/d3vilh/qrencode
#RUN cd qrencode && go build -o qrencode main.go && chmod +x qrencode

# Set the working directory to /
WORKDIR /
4 changes: 2 additions & 2 deletions build/assets/genclient.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ cd $EASY_RSA
# Generate certificates
if [[ -z $CERT_PASS ]]; then
echo 'Without password...'
./easyrsa --batch --req-cn="$CERT_NAME" --days="$EASYRSA_CERT_EXPIRE" --req-email="$EASYRSA_REQ_EMAIL" gen-req "$CERT_NAME" nopass subject="/C=$EASYRSA_REQ_COUNTRY/ST=$EASYRSA_REQ_PROVINCE/L=$EASYRSA_REQ_CITY/O=$EASYRSA_REQ_ORG/OU=$EASYRSA_REQ_OU"
./easyrsa --batch --req-cn="$CERT_NAME" --days="$EASYRSA_CERT_EXPIRE" --req-email="$EASYRSA_REQ_EMAIL" gen-req "$CERT_NAME" nopass subject="/C=$EASYRSA_REQ_COUNTRY/ST=$EASYRSA_REQ_PROVINCE/L=\"$EASYRSA_REQ_CITY\"/O=\"$EASYRSA_REQ_ORG\"/OU=\"$EASYRSA_REQ_OU\""
else
echo 'With password...'
# See https://stackoverflow.com/questions/4294689/how-to-generate-an-openssl-key-using-a-passphrase-from-the-command-line
# ... and https://stackoverflow.com/questions/22415601/using-easy-rsa-how-to-automate-client-server-creation-process
# ... and https://github.com/OpenVPN/easy-rsa/blob/master/doc/EasyRSA-Advanced.md
(echo -e '\n') | ./easyrsa --batch --req-cn="$CERT_NAME" --days="$EASYRSA_CERT_EXPIRE" --req-email="$EASYRSA_REQ_EMAIL" --passin=pass:${CERT_PASS} --passout=pass:${CERT_PASS} gen-req "$CERT_NAME" subject="/C=$EASYRSA_REQ_COUNTRY/ST=$EASYRSA_REQ_PROVINCE/L=$EASYRSA_REQ_CITY/O=$EASYRSA_REQ_ORG/OU=$EASYRSA_REQ_OU"
(echo -e '\n') | ./easyrsa --batch --req-cn="$CERT_NAME" --days="$EASYRSA_CERT_EXPIRE" --req-email="$EASYRSA_REQ_EMAIL" --passin=pass:${CERT_PASS} --passout=pass:${CERT_PASS} gen-req "$CERT_NAME" subject="/C=$EASYRSA_REQ_COUNTRY/ST=$EASYRSA_REQ_PROVINCE/L=\"$EASYRSA_REQ_CITY\"/O=\"$EASYRSA_REQ_ORG\"/OU=\"$EASYRSA_REQ_OU\""
fi

# Sign request
Expand Down
29 changes: 18 additions & 11 deletions build/build_openvpn-ui.sh → build/build.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
# VERSION 1.2 by [email protected] aka Mr. Philipp
# based on [email protected] script - https://github.com/bugsyb/openvpn-web-ui-docker-build/blob/a791ea279deaf9459fd4a2049a0fdb2fe222e37a/build_openvpn-ui.sh
set -e
# VERSION 1.3 by [email protected] aka Mr. Philipp. Thanks [email protected] for all the efforts ;)
set -e # Exit immediately if a command exits with a non-zero status. Set -x option for debugging

# Determine the machine architecture
# Define the machine architecture
# PLATFORM="linux/amd64" # arm64v8 = "linux/arm64/v8", arm32v5 - "linux/arm/v5", arm32v7 - "linux/arm/v7", amd64 - "linux/amd64"
ARCH=$(uname -m)
case $ARCH in
Expand Down Expand Up @@ -47,24 +45,33 @@ printf "Dockerfiles updated \n\033[1;34mBuilding Golang and Bee enviroment.\033[
# Build golang & bee environment
docker build --platform=$PLATFORM -f Dockerfile-beego -t local/beego-v8 -t local/beego-v8:latest .
printf "\033[1;34mBuilding OpenVPN-UI and qrencode binaries.\033[0m\n"
./openvpn-ui-pack2.sh

# Run a beego-v8 container to build qrencode and execute bee pack
time docker run \
-v "$PWD/../":/go/src/github.com/d3vilh/openvpn-ui \
-e GO111MODULE='auto' \
-e CGO_ENABLED=1 \
--rm \
-w /usr/src/myapp \
local/beego-v8 \
sh -c "cd /go/src/github.com/d3vilh/openvpn-ui/ && go env -w GOFLAGS="-buildvcs=false" && bee version && CGO_ENABLED=1 CC=musl-gcc bee pack -exr='^vendor|^ace.tar.bz2|^data.db|^build|^README.md|^docs' && cd /app/qrencode && go build -o qrencode main.go && chmod +x /app/qrencode/qrencode && cp -p /app/qrencode/qrencode /go/src/github.com/d3vilh/openvpn-ui/"
printf "OpenVPN-UI and qrencode were built \n\033[1;34mBuilding OpenVPN-UI image.\033[0m\n"

# Build OpenVPN-UI image
PKGFILE="openvpn-ui.tar.gz"
QRFILE="qrencode"
cp -f ../$PKGFILE ./
UIFILE="openvpn-ui.tar.gz"
cp -f ../$QRFILE ./
cp -f ../$UIFILE ./

# Build openvpn-ui image
docker build -t local/openvpn-ui .
rm -f $PKGFILE; rm -f $(basename $PKGFILE); #rm -f $QRFILE;
rm -f $UIFILE; rm -f $(basename $UIFILE); #rm -f $QRFILE;
printf "\033[1;34mAll done.\033[0m\n"

# Benchmarking the end time record
end_time=$(date +%s)

# Calculate the execution time in seconds
execution_time=$((end_time - start_time))

# Calculate the execution time in minutes and seconds
minutes=$((execution_time / 60))
seconds=$((execution_time % 60))
Expand Down
34 changes: 16 additions & 18 deletions build/go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module github.com/d3vilh/openvpn-ui

go 1.21
go 1.21.1

require (
github.com/beego/beego/v2 v2.1.1
github.com/cloudfoundry/gosigar v1.3.27
github.com/d3vilh/openvpn-server-config v0.3.4
github.com/beego/beego/v2 v2.1.4
github.com/cloudfoundry/gosigar v1.3.39
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.17
github.com/mattn/go-sqlite3 v1.14.19
gopkg.in/hlandau/passlib.v1 v1.0.11
)

Expand All @@ -16,26 +16,24 @@ require (
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/google/uuid v1.5.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/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.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.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/shiena/ansicolor v0.0.0-20230509054315-a9deabde6e02 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/protobuf v1.31.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
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 c7db47e

Please sign in to comment.