* Allow SSHPMPT.ASC for displaying SSH/secure app info/instructions
This commit is contained in:
parent
4a22ce0924
commit
93cff52c1f
|
@ -77,7 +77,9 @@ function getDefaultConfig() {
|
||||||
invalidUsernames : [],
|
invalidUsernames : [],
|
||||||
|
|
||||||
groups : [ 'users', 'sysops' ], // built in groups
|
groups : [ 'users', 'sysops' ], // built in groups
|
||||||
defaultGroups : [ 'users' ] // default groups new users belong to
|
defaultGroups : [ 'users' ], // default groups new users belong to
|
||||||
|
|
||||||
|
newUserNames : [ 'new', 'apply' ], // Names reserved for applying
|
||||||
},
|
},
|
||||||
|
|
||||||
// :TODO: better name for "defaults"... which is redundant here!
|
// :TODO: better name for "defaults"... which is redundant here!
|
||||||
|
|
|
@ -8,6 +8,7 @@ var Log = require('../logger.js').log;
|
||||||
var ServerModule = require('../server_module.js').ServerModule;
|
var ServerModule = require('../server_module.js').ServerModule;
|
||||||
var userLogin = require('../user_login.js').userLogin;
|
var userLogin = require('../user_login.js').userLogin;
|
||||||
var enigVersion = require('../../package.json').version;
|
var enigVersion = require('../../package.json').version;
|
||||||
|
var theme = require('../theme.js');
|
||||||
|
|
||||||
var ssh2 = require('ssh2');
|
var ssh2 = require('ssh2');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
@ -63,6 +64,8 @@ function SSHClient(clientConn) {
|
||||||
// :TODO: Can we display somthing here?
|
// :TODO: Can we display somthing here?
|
||||||
termConnection();
|
termConnection();
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
return ctx.reject(SSHClient.ValidAuthMethods);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ctx.accept();
|
ctx.accept();
|
||||||
|
@ -73,6 +76,8 @@ function SSHClient(clientConn) {
|
||||||
return ctx.reject(SSHClient.ValidAuthMethods);
|
return ctx.reject(SSHClient.ValidAuthMethods);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(ctx.method)
|
||||||
|
|
||||||
if(0 === username.length) {
|
if(0 === username.length) {
|
||||||
// :TODO: can we display something here?
|
// :TODO: can we display something here?
|
||||||
return ctx.reject();
|
return ctx.reject();
|
||||||
|
@ -89,12 +94,26 @@ function SSHClient(clientConn) {
|
||||||
// :TODO: can we display something here?
|
// :TODO: can we display something here?
|
||||||
termConnection();
|
termConnection();
|
||||||
} else {
|
} else {
|
||||||
interactivePrompt.prompt = 'Access denied\n' + ctx.username + '\'s password: ';
|
|
||||||
|
|
||||||
if(loginAttempts >= conf.config.general.loginAttempts) {
|
if(loginAttempts >= conf.config.general.loginAttempts) {
|
||||||
termConnection();
|
termConnection();
|
||||||
} else {
|
} else {
|
||||||
return ctx.prompt(interactivePrompt, retryPrompt);
|
var artOpts = {
|
||||||
|
client : self,
|
||||||
|
name : 'SSHPMPT.ASC',
|
||||||
|
readSauce : false,
|
||||||
|
};
|
||||||
|
theme.getThemeArt(artOpts, function gotArt(err, artInfo) {
|
||||||
|
if(err) {
|
||||||
|
interactivePrompt.prompt = 'Access denied\n' + ctx.username + '\'s password: ';
|
||||||
|
} else {
|
||||||
|
var newUserNameList = '"' + (conf.config.users.newUserNames || []).join(', ') + '"';
|
||||||
|
interactivePrompt.prompt =
|
||||||
|
'Access denied\n' +
|
||||||
|
artInfo.data.format( { newUserNames : newUserNameList } ) +
|
||||||
|
'\n' + ctx.username + '\'s password: ';
|
||||||
|
}
|
||||||
|
return ctx.prompt(interactivePrompt, retryPrompt);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue