Cardiff University IT Security Team Tech Site Information services

Ip Security (IpSec) Under Windows 2003

The anatomy of an ipsec policy script:

ipseccmd -w REG -p "OS build" -r "Web cache access" -f131.251.0.4+0 -f131.251.0.10+0 -f131.251.0.7:8080+0::TCP -f131.251.0.8:8080+0::TCP -f131.251.0.11:8080+0::TCP -f131.251.0.5:8080+0::TCP -f131.251.0.20:8080+0::TCP -n PASS

This rule will create a ipsec policy called "OS build"

ipseccmd -w REG -p "OS build" -r

It will then create a group called "Web cache access" with the following rule

"Web cache access" -f131.251.0.4+0 -f131.251.0.10+0 -f131.251.0.7:8080+0::TCP -f131.251.0.8:8080+0::TCP -f131.251.0.11:8080+0::TCP -f131.251.0.5:8080+0::TCP -f131.251.0.20:8080+0::TCP -n PASS

Each -f statement is an address path to add to this group for example "-f 131.251.0.5 : 8080 + 0 : : TCP"

Here we are setting the path from 131.251.0.5 using port 8080 to ME (the computer with this policy installed) using any port because of the missing number using the tcp protocol type.

The final statement is what to do with the traffic we have just specified, in this case we would like to pass it (let the communication go ahead) -n PASS.

The next line tells the computer to take all the traffic that has not already been passed by rules ahead above to be blocked

ipseccmd -w REG -p "OS build" -r "All inbound traffic" -f*+0 -n BLOCK

Next we specify that the local registry policy is assigned

ipseccmd -w REG -p "OS build" -x

Lastly we run a reg file to add a setting to the registry to change the web cache settings of internet explorer to use the university web cache

regedit /s connection_settings.reg

The policy should look like this :

ipseccmd -w REG -p "OS build" -r "Web cache access" -f131.251.0.4+0 -f131.251.0.10+0 -f131.251.0.7:8080+0::TCP -f131.251.0.8:8080+0::TCP -f131.251.0.11:8080+0::TCP -f131.251.0.5:8080+0::TCP -f131.251.0.20:8080+0::TCP -n PASS
ipseccmd -w REG -p "OS build" -r "All inbound traffic" -f*+0 -n BLOCK
ipseccmd -w REG -p "OS build" -x
regedit /s connection_settings.reg
@echo off
pause

_