diff --git a/openvpn/README.md b/openvpn/README.md index 9c1c42bc43..2314eb957f 100644 --- a/openvpn/README.md +++ b/openvpn/README.md @@ -15,13 +15,13 @@ How do it * Make client credentials list in file /etc/openvpn/auth. Each line contains login name and hash from password. Example /etc/openvpn/auth ``` - Client1 d577273ff885c3f84dadb8578bb41399 - Client2 f5ac8127b3b6b85cdc13f237c6005d80 - Smith 9954987819a9e85b2aae8c04803f6b26 + Client1 948fe603f61dc036b5c596dc09fe3ce3f3d30dc90f024c85f3c82db2ccab679d + Client2 3f455143e75d1e7fd659dea57023496da3bd9f2f8908d1e2ac32641cd819d3e3 + Smith 3f455143e75d1e7fd659dea57023496da3bd9f2f8908d1e2ac32641cd819d3e3 ``` Use command below to easy append to file /etc/openvpn/auth ```shell -read -p "Login:" Login;read -p "Password:" Password;[ -n "$Login" ] && [ -n "$Password" ] && echo -e "$Login\t$(echo $Password|md5sum|cut -f 1 -d ' ')">>/etc/openvpn/auth +read -p "Login:" Login;read -p "Password:" Password;[ -n "$Login" ] && [ -n "$Password" ] && echo -e "$Login\t$(echo $Password|openssl dgst -sha256|cut -f 2 -d ' ')">>/etc/openvpn/auth ``` * Change OpenVPN server configuration. You can use two method to pass credentials to script. First via file ad second via environment variable. diff --git a/openvpn/openvpn-auth.sh b/openvpn/openvpn-auth.sh index 330a059b86..05474d08be 100644 --- a/openvpn/openvpn-auth.sh +++ b/openvpn/openvpn-auth.sh @@ -48,7 +48,7 @@ if [ "$script_type" == "user-pass-verify" ]; then logger -p user.error -t $PNAME "$PEER Password isn't set" exit 1 fi - local hashinput=$(echo "$password" | md5sum | cut -d " " -f 1) + local hashinput=$(echo "$password" | openssl dgst -sha256 | cut -d " " -f 2) if [ "$hashinput" == "" ]; then logger -p user.error -t $PNAME "$PEER Hash from password isn't set" exit 1 @@ -71,4 +71,4 @@ elif [ "$script_type" != "" ]; then else exit 1 fi -# Done \ No newline at end of file +# Done