title: PHP/LDAP Authentication Using a VPN
body: <p>I have an interesting situation, and Google doesn't appear to have any information regarding the issue.</p>
  
  <p>I develop a web-based software written in PHP. Most of our clients have some sort of CAS server setup for authentication, and we simply point our site at their authentication server. We have a new client that does not have a CAS server, so I told them we could use LDAP, preferably with SSL (LDAPS). I'm not sure if they have the ability to do LDAPS, but the real problem is that (at the moment) they require the LDAP connection to be on the same network, thus, I would need to connect to their VPN first, and then query their LDAP server.</p>
  
  <p>Now, I'm sure that I could make the VPN connection on our server, and have all traffic directed through that, but that would create a single point of failure for all of our clients and would be totally out of our control; so this really isn't an option.</p>
  
  <p>I could probably find a way to make a connection, authenticate the user, then release the connection; but that seems like a poor choice that would take a long time.</p>
  
  <p>So, does anybody know if I can (a) open a VPN connection in <em>only</em> PHP and then use that connection to connect to the LDAP server or (2) somehow code PHP/configure my server so that only requests to the LDAP server use the VPN and all other requests use the default Internet connection?</p>
  
  <p>I'm really a bit lost as to a good way to do this, any help would be greatly appreciated. Thanks very much!</p>