aboutsummaryrefslogtreecommitdiff
path: root/src/lib/server.js
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2021-03-09 02:44:59 +0300
committerEvgeny Zinoviev <me@ch1p.io>2021-03-09 02:44:59 +0300
commitf7ca888651e737f18a0ea760326922da9d80e471 (patch)
treef61463affaf09ede1d6c720e618453775dbe065e /src/lib/server.js
parentfc004fe70a89c43068b2a455c02f7a813adcc509 (diff)
improvements, see full commit message
- added new option 'always_allow_localhost' - improve jobctl, allow connecting to password-protected instances without using configuration file
Diffstat (limited to 'src/lib/server.js')
-rw-r--r--src/lib/server.js14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/lib/server.js b/src/lib/server.js
index 051b8be..8ed2be9 100644
--- a/src/lib/server.js
+++ b/src/lib/server.js
@@ -261,13 +261,7 @@ class Connection extends EventEmitter {
* @type {boolean}
* @private
*/
- this._isAuthorized = config.get('password') === ''
-
- /**
- * @type {boolean}
- * @private
- */
- this._textConversationAllowed = false
+ this._isAuthorized = !config.get('password')
/**
* @type {boolean}
@@ -328,10 +322,8 @@ class Connection extends EventEmitter {
this.remoteAddress = socket.remoteAddress
this.remotePort = socket.remotePort
- if (this.remoteAddress === '127.0.0.1') {
+ if (this.remoteAddress === '127.0.0.1' && config.get('always_allow_localhost') === true)
this._isAuthorized = true
- this._textConversationAllowed = true
- }
this._setLogger()
this._setSocketEvents()
@@ -548,7 +540,7 @@ class Connection extends EventEmitter {
// send password once (when talking to jobd-master)
if (!this._isAuthorized) {
- message.setPassword(config.get('password'))
+ message.setPassword(config.get('password') || '')
this._isAuthorized = true
}