client-connect /jffs/scripts/ovpn-client-connect.sh
#!/bin/sh
[ $username == "admin" ] && exit 1
So it looks like the script is matching the username test and exiting with code 1. I can't say whether that's right or wrong for your setup because I don't use Username/Password Authentication soHowever I always get the error "Dec 29 16:21:25 ovpn-server1[19616]: client WARNING: Failed running command (--client-connect): external program exited with error status: 1"
$username
doesn't exist for me."$username"
just to be safe.AFAIK, the specification for the "client-connect" option says that the cmd or script must return a success code for clients to connect, so something like this should work:...
Here the content of the "/jffs/scripts/ovpn-client-connect.sh"
Code:#!/bin/sh [ $username == "admin" ] && exit 1
[ $username = "admin" ] && exit 1 || exit 0
AFAIK, the specification for the "client-connect" option says that the cmd or script must return a success code for clients to connect, so something like this should work:
Bash:[ $username = "admin" ] && exit 1 || exit 0
I don't know whether the current OpenVPN version in your router is enforcing this rule.
Yes, that's technically correct. But based on the OP's results here:Unless set otherwise (e.g. a syntax error) the exit code is 0, so there shouldn't be any need to explicitly set it.
I thought: "Well, just make the success status explicit and see how the server reacts."I restarted the router and the VPN Server starts now with the "client-connect" script. However I always get the error "Dec 29 16:21:25 ovpn-server1[19616]: client WARNING: Failed running command (--client-connect): external program exited with error status: 1", allthough I login with a different username (not "admin")
Ah yes, I see my mistake now. He edited his post after I replied.Yes, that's technically correct. But based on the OP's results here:
I thought: "Well, just make the success status explicit and see how the server reacts."
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!