mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-08-07 15:40:58 +02:00
Merge pull request #765 from jloveland/more-security
Adding more secure settings
This commit is contained in:
@@ -136,10 +136,16 @@ module.exports.initModulesConfiguration = function (app, db) {
|
||||
*/
|
||||
module.exports.initHelmetHeaders = function (app) {
|
||||
// Use helmet to secure Express headers
|
||||
var SIX_MONTHS = 15778476000;
|
||||
app.use(helmet.xframe());
|
||||
app.use(helmet.xssFilter());
|
||||
app.use(helmet.nosniff());
|
||||
app.use(helmet.ienoopen());
|
||||
app.use(helmet.hsts({
|
||||
maxAge: SIX_MONTHS,
|
||||
includeSubdomains: true,
|
||||
force: true
|
||||
}));
|
||||
app.disable('x-powered-by');
|
||||
};
|
||||
|
||||
|
||||
@@ -21,7 +21,34 @@ module.exports = function (app, db) {
|
||||
var certificate = fs.readFileSync('./config/sslcerts/cert.pem', 'utf8');
|
||||
var options = {
|
||||
key: privateKey,
|
||||
cert: certificate
|
||||
cert: certificate,
|
||||
// requestCert : true,
|
||||
// rejectUnauthorized : true,
|
||||
secureProtocol: 'TLSv1_method',
|
||||
ciphers: [
|
||||
'ECDHE-RSA-AES128-GCM-SHA256',
|
||||
'ECDHE-ECDSA-AES128-GCM-SHA256',
|
||||
'ECDHE-RSA-AES256-GCM-SHA384',
|
||||
'ECDHE-ECDSA-AES256-GCM-SHA384',
|
||||
'DHE-RSA-AES128-GCM-SHA256',
|
||||
'ECDHE-RSA-AES128-SHA256',
|
||||
'DHE-RSA-AES128-SHA256',
|
||||
'ECDHE-RSA-AES256-SHA384',
|
||||
'DHE-RSA-AES256-SHA384',
|
||||
'ECDHE-RSA-AES256-SHA256',
|
||||
'DHE-RSA-AES256-SHA256',
|
||||
'HIGH',
|
||||
'!aNULL',
|
||||
'!eNULL',
|
||||
'!EXPORT',
|
||||
'!DES',
|
||||
'!RC4',
|
||||
'!MD5',
|
||||
'!PSK',
|
||||
'!SRP',
|
||||
'!CAMELLIA'
|
||||
].join(':'),
|
||||
honorCipherOrder: true
|
||||
};
|
||||
|
||||
// Create new HTTPS Server
|
||||
|
||||
@@ -10,8 +10,8 @@ fi
|
||||
|
||||
echo "Generating self-signed certificates..."
|
||||
mkdir -p ./config/sslcerts
|
||||
openssl genrsa -out ./config/sslcerts/key.pem 1024
|
||||
openssl genrsa -out ./config/sslcerts/key.pem 4096
|
||||
openssl req -new -key ./config/sslcerts/key.pem -out ./config/sslcerts/csr.pem
|
||||
openssl x509 -req -days 9999 -in ./config/sslcerts/csr.pem -signkey ./config/sslcerts/key.pem -out ./config/sslcerts/cert.pem
|
||||
openssl x509 -req -days 365 -in ./config/sslcerts/csr.pem -signkey ./config/sslcerts/key.pem -out ./config/sslcerts/cert.pem
|
||||
rm ./config/sslcerts/csr.pem
|
||||
chmod 600 ./config/sslcerts/key.pem ./config/sslcerts/cert.pem
|
||||
|
||||
Reference in New Issue
Block a user