extra routing with Windows 7 and User Access Controls

Scripts with setup, destroy, and modify routing tables and firewall rulesets for client connections.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Post Reply
jeff.sadowski
OpenVpn Newbie
Posts: 8
Joined: Thu Sep 01, 2011 6:53 pm

extra routing with Windows 7 and User Access Controls

Post by jeff.sadowski » Fri Sep 02, 2011 8:12 pm

I was looking around and found someone on this forum had scripts running on up and down so I was thinking I could use it to add and remove routes from the routing table. Much to my dismay it was failing because of User Access Controls. I don't want to disable User Access Controls. Is there a way to add routes to my client computers.

I have push route but that doesn't seem to work or even add all the arguments I want.

situation I have my servers inside address at

192.168.0.2
and my router at 192.168.0.1


My server config looks as follows

port 1194
proto udp
dev tap
dev-node Mytap
ca ca.crt
cert server.crt
dh dh1024.pem
server-bridge
push route 192.168.1.0 255.255.255.0 192.168.0.1
keepalive 10 120
comp-lzo
persist-key
persist-tun
status openvpn-status.log
verb 3

the documentation for push route only shows two arguments but I wanted to give a gateway. Either way it seems not to work. I tried the following for my client's config

client
dev tap
dev-node Mytap
proto udp
remote serverdnsname 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert client.crt
key client.key
ns-cert-type server
comp-lzo
verb 3
script-security 2
up "connect_inside_routes.bat"
down "disconnect_inside_routes.bat"

and as I stated connect_inside_routes.bat needs to be run as administrator and I can't figure out how to get openvpn to get that privilege to run it as such.
connect_inside_routes.bat looks as follows
route add 192.168.1.0 mask 255.255.255.0 192.168.0.1
rem remark so that the last exiting command returns a zero or the vpn connection fails too.

I have the file in openvpn's config directory and it appears to run.
because if I remove the last line it failes the vpn connection as stated.

So is there other configurations I can do to get more routes?

What is odd is my dhcp server should be giving the default gateway as 192.168.0.1 but it doesn't seem to.

User avatar
Bebop
Forum Team
Posts: 301
Joined: Wed Dec 15, 2010 9:24 pm

Re: extra routing with Windows 7 and User Access Controls

Post by Bebop » Sat Sep 03, 2011 1:21 am

jeff.sadowski wrote: I can't figure out how to get openvpn to get that privilege
In start menu find openvpngui icon -> right click -> run as administrator
The cure for boredom is curiosity

jeff.sadowski
OpenVpn Newbie
Posts: 8
Joined: Thu Sep 01, 2011 6:53 pm

Re: extra routing with Windows 7 and User Access Controls

Post by jeff.sadowski » Wed Nov 09, 2011 2:58 am

I found instructions that work in windows vista I will try it in windows 7 tomorrow.
They allow you to run a program with enough permissions and not have to answer the annoying question.

http://www.sevenforums.com/tutorials/11 ... reate.html

basically you create a task in task scheduler
click "run with highest privileges"
in the action tab add your program ie the openvpngui
unclick the "start program only if on ac" in the conditions tab
and create the shortcut to point to
schtasks /run /tn task-name
and wala that shortcut will start the program with the proper permissions to create routes.
now to try and right a script to do that for me.

Post Reply