views:

44

answers:

3

Our workflow currently has developers working on locally hosted copies of our web application with SVN for source control. We have post-commit hooks that deploy each new revision to a designated staging environment running on a subdomain.

My question is, what is the best way to restrict access to these staging sites so that they can't be stumbled across or god forbid indexed by search engines?

We'd really like to avoid anything IP based, as we have remote developers working unavoidably from dynamic IPs.

I have some initial ideas such as a simple form that you can hit with login credentials to either a) give you an access cookie that's checked for when running in the staging environment, or b) register your current IP address as allowed for a determinate length of time.

If anyone can share ideas, previous experience or best practice it would be very much appreciated

+6  A: 

If you're using Apache a simple and very basic protection should be an .htaccess File. If this doesn't satisfy your needs for security, you should think about implementing your own security mechanism.

The best solution is to put your staging server in a closed network and only allow access via a secure VPN.

Henrik P. Hessel
The .htaccess approach would be ideal, yes. The root .htaccess file is under version control however. I wonder is there a way to make this hostname specific so it only applies when running in 'staging mode'
WibblePoop
@WibblePoop: if you modified the .htaccess file locally on your staging server, the new versions checked out from SVN should leave that file modified. You'd only have to deal with it manually if there was a conflict.
rmeador
@rmeador: Thanks for the explanation, I wasn't sure if this would be the case and hadn't tried it in any case. The issue is that the .htaccess file also contains rewrite rules which we'd need to carry forward on commits, hence I don't think this would work.
WibblePoop
A: 

You can make that Page accessible only on your Company network and use LDAP or something similar to allow people access.

That sub domain can be made accessible over a VPN. OpenVPN is an option you can look into.

sheki
+2  A: 

You could wrap your web application with an apache (lighttpd, etc.) webserver and use the .htaccess file to restrict access to named users that have to login with password.

tangens