eventlog: support ticket and ssh
This commit is contained in:
@@ -8,11 +8,12 @@ exports = module.exports = {
|
||||
let assert = require('assert'),
|
||||
BoxError = require('./boxerror.js'),
|
||||
constants = require('./constants.js'),
|
||||
shell = require('./shell.js'),
|
||||
eventlog = require('./eventlog.js'),
|
||||
once = require('once'),
|
||||
path = require('path'),
|
||||
paths = require('./paths.js'),
|
||||
settings = require('./settings.js');
|
||||
settings = require('./settings.js'),
|
||||
shell = require('./shell.js');
|
||||
|
||||
// the logic here is also used in the cloudron-support tool
|
||||
const AUTHORIZED_KEYS_CMD = path.join(__dirname, 'scripts/remotesupport.sh');
|
||||
@@ -48,13 +49,17 @@ function getRemoteSupport(callback) {
|
||||
cp.stdout.on('data', (data) => result = result + data.toString('utf8'));
|
||||
}
|
||||
|
||||
function enableRemoteSupport(enable, callback) {
|
||||
function enableRemoteSupport(enable, auditSource, callback) {
|
||||
assert.strictEqual(typeof enable, 'boolean');
|
||||
assert.strictEqual(typeof auditSource, 'object');
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
let si = sshInfo();
|
||||
shell.sudo('support', [ AUTHORIZED_KEYS_CMD, enable ? 'enable' : 'disable', si.filePath, si.user ], {}, function (error) {
|
||||
if (error) callback(new BoxError(BoxError.FS_ERROR, error));
|
||||
|
||||
eventlog.add(eventlog.ACTION_SUPPORT_SSH, auditSource, { enable });
|
||||
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user