I'm developing a file hosting and sharing web application.
Are the following PHP session settings secure enough?
ini_set('session.cookie_httponly', 1);
ini_set('session.cookie_lifetime', 0);
ini_set('session.entropy_file', '/dev/urandom');
ini_set('session.hash_function', 'whirlpool'); //is whirlpool that necessary?
ini_set('session.use_only_cookies', 1);
ini_set('session.hash_bits_per_character', 5);
ini_set('session.cookie_secure', 1);
session_name('sid');
session_start();
if (!isset($_COOKIE['sid'])) {
$_SESSION['token'] = CryptoCharGen::alnum(); //20 chars
}
To add on to the security:
- Tying a cryptographically strong CSRF token to the user session for form validation.
- Regenerating a new session ID upon logging in and out and destroying the old session.
- Regenerating a new CSRF token upon successful submission of any form.
I've read to rename the default PHP session name, so I named it sid
instead. Is that good enough?
Should I generate the session id with my own generator? (CryptoCharGen)
Should I be concerned about how I name my session variables?