OpenVPN user/password authentication

How to add an OpenVPN user/password authentication to a DD-WRT OpenVPN server.

This is a shameless rip-off from Dagger and SgtPepperKSU, kudos!

First log in to your DD-WRT router (192.168.22.1).
Go to Administration >> Commands
Add the following text in the “Commands” text box:

echo ‘#!/bin/sh
pass=`awk “\\\$1 == \”${username}\” { print substr(\\\$0,length(\\\$1)+2) }” /tmp/openvpn-auth`
test -n “$pass” && test “$pass” == “${password}” && exit 0
exit 1’ > /tmp/quickAuth.sh
chmod 755 /tmp/quickAuth.sh

echo ‘
user1 pass1
user2 pass2
user3 pass3
<etc>
‘ > /tmp/openvpn-auth

Press <Run Commands>
Press <Save Startup>

222-01

Go to Services >> VPN
Scroll down to “Additional Config” and add the following text to the already existing one:

script-security 3
auth-user-pass-verify /tmp/quickAuth.sh via-env

Press <Save>

222-02

Press <Apply Settings>

Now update the client (e.g. ClientName2).
Run OpenVPN client GUI as administrator.

222-03

Right-click the OpenVPN GUI and left-click <Edit Config>.

222-04

Add the following text and save the file:

auth-user-pass

222-05

Right-click the OpenVPN GUI and left-click <Connect>

222-06

Type your login (user1) and password (pass1) and press <OK>.
Wait a while for the connect message.

222-07

If connected, you successfully added a user/password authentication to your DD-WRT OpenVPN server, congrats!

Leave a Reply