secure webapplication online
I have a webapplication which id like to host online. The user logon consists of a hashed password which is saved in the db and verified via the code, simple but it was ok for a small office开发者_如何学C which had an onsite server.
However i dont think this will be suitable when the app is hosted online. Ive considered manually listing the client ip addresses in apache to block access from other machines.
Is there anything else i can do to make access secure? Certificates maybe?
What do you mean by "user logon consists of a hashed password"? Do you use hashed password in your session cookie? Well, anyway, this are some points to get you started:
- use HTTPS only (with valid certificates)
- don't use shared hosting (use VPS if you must)
- store salted hashes of passwords in your database
- if the db is not on localhost, use only encrypted connections
- use secure and truly random session IDs
- invalidate/expire your sessions on the server
- you may consider client certificates if that suits your needs
- watch for XSS, XSRF and similar vulnerabilities
- use only POST requests for anything that changes any state or data
- use a random token in POST parameters for anything that changes any state or data
- don't rely on cookies only
- use DNSSEC if possible
Those are just a few good rules of thumb to get you started.
First of all: Security isn’t something that just needs to be attached to make an application secure. It’s rather an attitude or a basic principle that needs to be considered within each thought and each line of code.
But besides that: OWASP, the Open Web Application Security Project, maintains a list of the Top 10 Most Critical Web Application Security Risks. Read it and try to understand each security risk. That is the fundamental knowledge you need to know to develop secure web applications (under the motto “know your enemy”).
Then read the OWASP Development Guide that describes guidelines on how to develop a secure web application and try to apply their recommendations to your existing application.
精彩评论