Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

https interface for user management #648

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
gen https certificate if requested
  • Loading branch information
nanda committed Mar 30, 2021
commit 78084be3a20196299498dbcfddb6e2ad475c41f0
16 changes: 14 additions & 2 deletions bin/ovpn_genconfig
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,16 @@ process_extra_config() {
gen_lighttpd_config() {
read -p "https username:" http_user || return 1
read -sp "$http_user password:" http_password || return 1
openssl-htpasswd /etc/openvpn/http/htpasswd "$http_user" "$http_password"
openssl-htpasswd "$OPENVPN/http/htpasswd" "$http_user" "$http_password"

if [ ! -f "$OPENVPN/http/server.key" ]; then
echo "generating https server cert..."
read -p "https server domain/ip:" cn || return 1
openssl req -x509 -newkey rsa:4096 -nodes -subj "/CN=$cn" -keyout "$OPENVPN/http/server.key" -out "$OPENVPN/http/server.pem" -days +365 || return 1
chown openvpn:openvpn "$OPENVPN"/http/server.*
fi

return 0
}

if [ "${DEBUG:-}" == "1" ]; then
Expand Down Expand Up @@ -421,6 +430,9 @@ if diff -q "${bak:-}" "$conf" 2>/dev/null; then
rm -fv "$bak"
fi

[ "$OVPN_HTTPS_ADMIN" = 1 ] && gen_lighttpd_config
[ "$OVPN_HTTPS_ADMIN" = 1 ] && gen_lighttpd_config

# just to be sure if someone run this as root
chown -R openvpn:openvpn "$OPENVPN" "/var/www" "/etc/lighttpd"

echo "Successfully generated config"