Little Script Problem with OpenVPN Authentication Solution


i have a Little Script Error in a working OpenVPN Authentication Soltion.

The Solution consists of a Script which asks another File with Usernames and Passwords:


# Config parameters


# End of config parameters

if [ "$1" = "" ] || [ "$1" = "help" ]
	echo " v0.1 - OpenVPN sh authentication script with simple user db"
	echo "                   for use withauth-user-pass-verify via-file option"
	echo ""
	echo "help - prints help"
	echo "sha password - to compute password sha checksum"
	exit 1

        echo "$1.`uname -n`" > /tmp/$$.shacalc
        sum="`sha256sum /tmp/$$.shacalc | awk '{print $1}'`"
        rm /tmp/$$.shacalc
        echo "$sum"

if [ "$1" = "sha" ]
	echo `sha $2`
	exit 1

	echo "`date +'%m/%d/%y %H:%M'` - $1" >> $logfile

	enviroment="`env | awk '{printf "%s ", $0}'`"
	echo "`date +'%m/%d/%y %H:%M'` - $enviroment" >> $logfile

envr="`echo `env``"
userpass=`cat $1`
username=`echo $userpass | awk '{print $1}'`
password=`echo $userpass | awk '{print $2}'`

# computing password sha
password=`sha $password`
userpass=`cat $conf | grep $username= | awk -F= '{print $2}'`

if [ "$password" = "$userpass" ] 
	log "OpenVPN authentication successfull: $username"
	exit 0
	log "OpenVPN authentication failed"
	log `cat $1`
	exit 1

This Script asks the .Conf File which contains only singe lines with
Username=Password (encrypted in sha256)

In my OpenVPN Conf i have:
option auth_user_pass_verify '/etc/openvpn/ via-file'

The Solution works perfectly fine but in the Lede System Log i get every five seconds an error:
"daemon.err openvpn(ovpnauth-sha)[1945]: Options error: Unrecognized option or missing or extra parameter(s) in /etc/openvpn/ovpnauth-sha.conf:2: username=password (2.4.2)"
where Username=Password stands for real user and Password in sha256.

So i think the problem is that the script gets no Username Parameter at this time (because nobody realy logs on) and therefore i get this error back...

Maybe somebody has a (simple) solution / workaround for this...


Im using the last LEDE Version 17.01.2
It could be that this error appears since the last update but i'm not hundred percent sure abou that...

I get rid of this error now with a little script change.
I will post details about that soon...

Hello excelsi, how did you get around your issue.

I setup everything as the README file says and I am no able to authenticate. How did you setup your ovpnauth.conf file?

Yeah, I just figured it out. hahahah when encrypting the password I didn't specified which one. I need to get used with terminologies.