Allow ability to shed sudo
This commit is contained in:
parent
936b723c66
commit
6681bf3de6
9
init.js
9
init.js
@ -51,6 +51,15 @@ try{
|
|||||||
if (cluster.isMaster)
|
if (cluster.isMaster)
|
||||||
logger.warning('POSIX', 'Connection Limit', '(Safe to ignore) Must be ran as root to increase resource limits');
|
logger.warning('POSIX', 'Connection Limit', '(Safe to ignore) Must be ran as root to increase resource limits');
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
// Find out which user used sudo through the environment variable
|
||||||
|
var uid = parseInt(process.env.SUDO_UID);
|
||||||
|
// Set our server's uid to that user
|
||||||
|
if (uid) {
|
||||||
|
process.setuid(uid);
|
||||||
|
logger.debug('POSIX', 'Connection Limit', 'Raised to 100K concurrent connections, now running as non-root user: ' + process.getuid());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(e){
|
catch(e){
|
||||||
if (cluster.isMaster)
|
if (cluster.isMaster)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user