Commit 08e83618 authored by Leo Iannacone's avatar Leo Iannacone

moved required libs back on top - moved setuid after setgid (if you set uid...

moved required libs back on top - moved setuid after setgid (if you set uid before, you will not be able to switch group after just because you have lost permissions)
parent b09999de
...@@ -7,9 +7,14 @@ var express = require('express') ...@@ -7,9 +7,14 @@ var express = require('express')
, routes = require('./routes') , routes = require('./routes')
, config = require('./lib/config.js') , config = require('./lib/config.js')
, utils = require('./lib/utils.js') , utils = require('./lib/utils.js')
, Client = require('./lib/client.js')
, Broadcaster = require('./lib/broadcaster.js')
var app = module.exports = express.createServer(); var app = module.exports = express.createServer();
//var io = require('socket.io').listen(app, { log: false }); // disable-log
var io = require('socket.io').listen(app);
// Configuration // Configuration
app.configure(function(){ app.configure(function(){
app.set('views', __dirname + '/views'); app.set('views', __dirname + '/views');
...@@ -41,8 +46,8 @@ var server = app.listen(config.port, config.host, null, function(){ ...@@ -41,8 +46,8 @@ var server = app.listen(config.port, config.host, null, function(){
// set uid e gid - drop root privileges // set uid e gid - drop root privileges
try { try {
process.setuid(config.user);
process.setgid(config.user); process.setgid(config.user);
process.setuid(config.user);
} catch (err) { } catch (err) {
if (err.code == 'EPERM') { if (err.code == 'EPERM') {
console.error('Changing user id %s: permission denied. Running as %s.', config.user, process.getuid()); console.error('Changing user id %s: permission denied. Running as %s.', config.user, process.getuid());
...@@ -53,13 +58,6 @@ var server = app.listen(config.port, config.host, null, function(){ ...@@ -53,13 +58,6 @@ var server = app.listen(config.port, config.host, null, function(){
} }
} }
var Client = require('./lib/client.js')
var Broadcaster = require('./lib/broadcaster.js')
// no log
//var io = require('socket.io').listen(app, { log: false });
var io = require('socket.io').listen(app);
// statuses // statuses
var status = {} var status = {}
status.packages = [] status.packages = []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment