title: How to write a VPN server
body: <p>I have decided to write my own light weight VPN server in Java. From a programming standpoint it appears to me a VPN server is just a pass-through proxy that encrypts traffic from the client, and decrypts it on the server. Can someone point me to a skeleton of writing this sort of server? </p>
  
  <p>I know there are many out of the box and even open source ones, but unfortunately even though I know several web programming languages the C code examples I have seen is not documented/structured in such a way that I can understand it.</p>
  
  <p>The parts I would Imagine I need are:</p>
  
  <ul>
  <li>A thread factory for client objects  </li>
  <li>A socket connector for clients</li>
  <li>Method for creating IPSec Authentication Header (AH) </li>
  <li>Method for creating IPSec Encapsulating Security Payload (ESP)</li>
  <li>Something for Internet Security Association and Key Management Protocol (ISAKMP)</li>
  <li>An Internet Key Exchange (IKE)</li>
  <li>PKI Certificate Authentication modules</li>
  <li>A Certificate Repository (SQLLite)</li>
  <li>Oakley key generation (for IKE and ISAKMP)</li>
  <li>Some Anti-replay prevention of packets</li>
  </ul>
  
  <p>The parts I plan to use generic modules for (and create adapters for) are the Cryptographic Algorythms (AES preferably although it appears that windows like DES / 3DES -- Noobs)</p>
  
  <p>If someone can add more detail to the parts that are necessary for an IPSec vpn server please feel free to contribute. Since it is necessary to run this on older linux hardware from what I can tell, the server should be IPSec as opposed to an SSLVPN hotness. The target platform is an old 1.5 Ghz intel box that I pumped up with 2 GB of DDR2 ram, mirrored 100 GB hard drive and 2 Gigabit Nic's.</p>
  
  <p>On the bright side since there are so many types of client-side VPN's I am pretty sure that do not need to make one for my needs.</p>