I've recently setup my first server here, and after perusing these forums, decided to setup RRAS and IPSec to limit access to the minimum required. However, while I found some good how-tos on RRAS setup, there was not as much on IPSec. I found one script which was helpful, but ended up making several more. So I figured other might find this helpful. (And thanks to the first scripter out there, these are all based on that one)
I've attached a zip file containing a number of scripts. First (for the wise amongst you) check them out to ensure that the code is what I said it is.
Then run SetupIPSec.bat, with 3 command line arguments:
1- The primary IP Address of the server
2- Your IP address you normally administer the server from
3- The X.X.X.0 subnet of your address (i.e. if your admin from 123.123.123.123, enter 123.123.123.0) I'll explain this bizarre entry later.
This script will then setup an IPSec policy containing everything I've scripted. You won't want to choose them all, so open the IPSec management snap-in (see elsewhere on forum if unsure how to do this) and go through each one and customize it for your needs
Each script can be run on it's own if you want.
A summary of the items setup is as follows:
1- It blocks all traffic not otherwise allowed
2- It enables port 1248 and ICMP for ServerMatrix
3- It enables Remote Desktop ONLY for ServerMatrix and your Admin IP (this is critical I believe)
4- It enables HTTP + HTTPs for all your IP Addresses
5- It enables SMTP for your server
6- It enables Outboung HTTP (including DNS) so you can web browse while logged in (to download a Microsoft patch directly for instance)
7- It enables Active + Passive FTP only to your admin address
8- It enables Active FTP only to all addresses
9- It enables Streaming Media (RTSP/MMS TCP + UDP) access to all addresses
10- It enables Urchin access for your admin IP
11- It enables Urchin access for all IP Addresses
Like I said, obviously you don't need all these enabled, but you can simply select which you want from your IPSec control panel once they are loaded. And when there are some examples in front of you, modifying them or making new filters becomes more apparent. For instance, I haven't done a POP3 one yet (since I don't need it), but it should probably be in here
FTP was a real bear, and that filter is bit strange (it's the one that requires the 3 octet submask). I didn't enable Passive FTP for the public access version as that would have required opening all inbound TCP ports which defeats the whole point of IPsec. If someone comes up with a better way of doing Passive FTP, please let me know.
Finally, but quite important, running this script will only load the policy, it is NOT active afterwards. This is good because you can check it over before you assign it and potentially lock yourself out if you got the address wrong or whatever.
One last note of caution for those new out there. 'Your' IP address is the public IP address the server will see, not your pre-NAT IP address. Basically, if you are thinking about entering 192.168.X.X as your admin address, that's probably the wrong address and you are about to lock yourself out.
I hope some people find this useful. It's a starting point to check out if nothing else. And personally I recommend running RRAS over top of this, it stealths all your admin ports and gives 'defense in depth'.
Geof
Oh yes, the link: http://70.85.92.50/SetupIPSec.zip
(link edited)