Skip to content

Commit a6fabf7

Browse files
committed
Improve the troubleshooting of a kerberos deployment
1. output logs when the kerberos proxy crash 2. introduce a new endpoint `/test-headers` to troubleshoot the connector. If you go to http://localhost:port/test-headers it will display the headers that the connector receive AFTER the kerberos authentication and BEFORE fetching the profile from LDAP. 3. introduce a new variable `KERBEROS_DEBUG_USER`. When the connector is started with this variable it will disable kerberos and use always the same user. eg `KERBEROS_DEBUG_USER=john`.
1 parent d1b3497 commit a6fabf7

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

endpoints.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,18 @@ exports.install = function (app) {
4141
});
4242
}
4343

44+
app.get('/test-headers', function (req, res) {
45+
res.json(req.headers);
46+
});
47+
4448
app.get('/test-iis', function (req, res) {
4549
res.send(200, 'worked! your iis user is: ' + req.headers['x-iisnode-logon_user']);
4650
});
4751

4852
app.get('/wsfed',
4953
function (req, res, next) {
5054
if (req.session.messages) return next();
51-
55+
5256
var strategies = nconf.get('LDAP_URL') ?
5357
(nconf.get('CLIENT_CERT_AUTH') ?
5458
['ClientCertAuthentication'] :

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"express-passport-logout": "~0.1.0",
3434
"freeport": "~1.0.2",
3535
"jsonwebtoken": "5.0.4",
36-
"kerberos-server": "*",
36+
"kerberos-server": "^1.0.0",
3737
"ldapjs": "~0.7.1",
3838
"level-spaces": "~2.0.0",
3939
"level-ttl": "~2.2.0",

server.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ connectorSetup.run(__dirname, function(err) {
7878
require('./endpoints').install(app);
7979

8080
var options = {
81-
port: nconf.get('PORT')
81+
port: nconf.get('PORT'),
82+
test_user: nconf.get('KERBEROS_DEBUG_USER')
8283
};
8384

8485
// client certificate-based authentication
@@ -105,8 +106,13 @@ connectorSetup.run(__dirname, function(err) {
105106
console.log('Using kerberos authentication');
106107

107108
if (process.platform === 'win32') {
108-
var kerberos_server = require('kerberos-server');
109-
kerberos_server.createServer(options, app);
109+
var KerberosServer = require('kerberos-server');
110+
var kerberosServer = new KerberosServer(app, options);
111+
kerberosServer.listen(options.port)
112+
.on('error', function (err) {
113+
console.error(err.message);
114+
return process.exit(1);
115+
});
110116
} else if (nconf.get('WITH_KERBEROS_PROXY_FRONTEND')) {
111117
var http = require('http');
112118
http.createServer(app).listen(options.port);

0 commit comments

Comments
 (0)