kerberos-server 0.2.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +16 -25
- package/example/server.js +9 -6
- package/index.js +46 -21
- package/kerberos_proxy.js +2 -25
- package/kerberosproxy.net/KerberosProxy/Program.cs +7 -4
- package/kerberosproxy.net/KerberosProxy/bin/Debug/KerberosProxy.exe +0 -0
- package/kerberosproxy.net/KerberosProxy/bin/Debug/KerberosProxy.pdb +0 -0
- package/kerberosproxy.net/KerberosProxy/bin/Debug/KerberosProxy.vshost.exe +0 -0
- package/kerberosproxy.net/KerberosProxy/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttributes.cs +4 -0
- package/kerberosproxy.net/KerberosProxy/obj/Debug/KerberosProxy.csproj.AssemblyReference.cache +0 -0
- package/kerberosproxy.net/KerberosProxy/obj/Debug/KerberosProxy.exe +0 -0
- package/kerberosproxy.net/KerberosProxy/obj/Debug/KerberosProxy.pdb +0 -0
- package/kerberosproxy.net/KerberosProxy.v12.suo +0 -0
- package/package.json +1 -2
- package/.npmignore +0 -18
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 Auth0, Inc. <support@auth0.com> (http://auth0.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ __Note:__ you need .Net Framework 4.5 installed.
|
|
|
13
13
|
~~~javascript
|
|
14
14
|
var express = require('express');
|
|
15
15
|
var app = express();
|
|
16
|
-
var
|
|
16
|
+
var KerberosServer = require('./..');
|
|
17
17
|
|
|
18
18
|
app.configure(function () {
|
|
19
19
|
this.use(express.logger());
|
|
@@ -23,37 +23,28 @@ app.get('/', function (req, res) {
|
|
|
23
23
|
res.send('hello ' + req.get('X-User'));
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
var server = new KerberosServer(app);
|
|
27
|
+
|
|
28
|
+
server.listen(8080, function () {
|
|
29
|
+
console.log('app listening on http://localhost:8080');
|
|
30
|
+
}).on('error', function (err) {
|
|
31
|
+
console.error(err.message);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
});
|
|
31
34
|
~~~
|
|
32
35
|
|
|
33
36
|
## How it works?
|
|
34
37
|
|
|
35
|
-
The server has always a .Net proxy running
|
|
38
|
+
The server has always a .Net proxy running listening to port, it authenticate requests and pipe to the real node http server running on a random free port (localhost only).
|
|
36
39
|
|
|
37
|
-
##
|
|
40
|
+
## Issue Reporting
|
|
38
41
|
|
|
39
|
-
The
|
|
42
|
+
If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
## Author
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
45
|
-
in the Software without restriction, including without limitation the rights
|
|
46
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
47
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
48
|
-
furnished to do so, subject to the following conditions:
|
|
46
|
+
[Auth0](auth0.com)
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
all copies or substantial portions of the Software.
|
|
48
|
+
## License
|
|
52
49
|
|
|
53
|
-
|
|
54
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
55
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
56
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
57
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
58
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
59
|
-
THE SOFTWARE.
|
|
50
|
+
This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.
|
package/example/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var express = require('express');
|
|
2
2
|
var app = express();
|
|
3
|
-
var
|
|
3
|
+
var KerberosServer = require('./..');
|
|
4
4
|
|
|
5
5
|
app.configure(function () {
|
|
6
6
|
this.use(express.logger());
|
|
@@ -10,8 +10,11 @@ app.get('/', function (req, res) {
|
|
|
10
10
|
res.send('hello ' + req.get('X-User'));
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
var server = new KerberosServer(app);
|
|
14
|
+
|
|
15
|
+
server.listen(8080, function () {
|
|
16
|
+
console.log('app listening on http://localhost:8080');
|
|
17
|
+
}).on('error', function (err) {
|
|
18
|
+
console.error(err.message);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
});
|
package/index.js
CHANGED
|
@@ -1,29 +1,54 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var freeport
|
|
4
|
-
var kerberos_proxy
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
1
|
+
var Server = require('http').Server;
|
|
2
|
+
var util = require('util');
|
|
3
|
+
var freeport = require('freeport');
|
|
4
|
+
var kerberos_proxy = require('./kerberos_proxy');
|
|
5
|
+
|
|
6
|
+
function KerberosServer(handler, options) {
|
|
7
|
+
// In case maxHeaderSize is not defined we can use the default
|
|
8
|
+
const maxHeaderSize = options?.maxHeaderSize ?? 16834;
|
|
9
|
+
|
|
10
|
+
Server.call(this, { maxHeaderSize }, handler);
|
|
11
|
+
this._options = options || {};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
util.inherits(KerberosServer, Server);
|
|
15
|
+
|
|
16
|
+
KerberosServer.prototype.listen = function (handle, callback) {
|
|
17
|
+
var self = this;
|
|
12
18
|
|
|
13
19
|
freeport(function (err, node_port) {
|
|
14
20
|
var opts = {
|
|
15
|
-
proxy_to:
|
|
16
|
-
port:
|
|
17
|
-
header:
|
|
18
|
-
test_user:
|
|
21
|
+
proxy_to: node_port,
|
|
22
|
+
port: handle,
|
|
23
|
+
header: self._options.header || 'X-Forwarded-User',
|
|
24
|
+
test_user: self._options.test_user
|
|
19
25
|
};
|
|
20
26
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
KerberosServer.super_.prototype.listen.call(self, node_port, callback);
|
|
28
|
+
|
|
29
|
+
var proxy = kerberos_proxy.start(opts);
|
|
30
|
+
|
|
31
|
+
var proxyOutput = '';
|
|
32
|
+
|
|
33
|
+
function storeProxyOutput (data) {
|
|
34
|
+
proxyOutput += data.toString();
|
|
27
35
|
}
|
|
36
|
+
|
|
37
|
+
proxy.stdout.on('data', storeProxyOutput);
|
|
38
|
+
proxy.stderr.on('data', storeProxyOutput);
|
|
39
|
+
|
|
40
|
+
proxy.on('exit', function (signal) {
|
|
41
|
+
if (signal) {
|
|
42
|
+
var err = new Error('The .Net proxy exited with status ' + signal + '\n' +
|
|
43
|
+
'This is the full STDOOUT/STDERR of the process \n' + proxyOutput);
|
|
44
|
+
self.emit('error', err);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
self._proxy = proxy;
|
|
28
49
|
});
|
|
50
|
+
|
|
51
|
+
return self;
|
|
29
52
|
};
|
|
53
|
+
|
|
54
|
+
module.exports = KerberosServer;
|
package/kerberos_proxy.js
CHANGED
|
@@ -1,30 +1,7 @@
|
|
|
1
1
|
var exec = require('child_process').exec;
|
|
2
|
-
var debug = require('debug')('kerberos-server');
|
|
3
2
|
var proxy_path = '"' + __dirname + '\\kerberosproxy.net\\KerberosProxy\\bin\\Debug\\KerberosProxy.exe"';
|
|
4
3
|
|
|
5
4
|
exports.start = function (options) {
|
|
6
5
|
var cmd = [proxy_path, options.port, 'http://localhost:' + options.proxy_to, options.header, options.test_user].join(' ');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
//start the proxy
|
|
11
|
-
var proc = exec(cmd, function (err) {
|
|
12
|
-
if (err) {
|
|
13
|
-
console.log('can\'t start kerberosproxy.exe');
|
|
14
|
-
process.exit(1);
|
|
15
|
-
}
|
|
16
|
-
}).on('exit', function (code) {
|
|
17
|
-
if (code) {
|
|
18
|
-
console.log('kerberosproxy.exe closed with status code ' + code);
|
|
19
|
-
process.exit(1);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
proc.stdout.on('data', function (data) {
|
|
24
|
-
debug('proxy: ' + data.toString());
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
proc.stderr.on('data', function (data) {
|
|
28
|
-
debug('proxy: ' + data.toString());
|
|
29
|
-
});
|
|
30
|
-
};
|
|
6
|
+
return exec(cmd);
|
|
7
|
+
};
|
|
@@ -51,10 +51,13 @@ namespace KerberosProxy
|
|
|
51
51
|
HttpListener listener =
|
|
52
52
|
(HttpListener)app.Properties["System.Net.HttpListener"];
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
if (Program.TestUser == null)
|
|
55
|
+
{
|
|
56
|
+
listener.AuthenticationSchemes =
|
|
57
|
+
AuthenticationSchemes.IntegratedWindowsAuthentication;
|
|
58
|
+
|
|
59
|
+
listener.UnsafeConnectionNtlmAuthentication = true;
|
|
60
|
+
}
|
|
58
61
|
|
|
59
62
|
app.Run(async context =>
|
|
60
63
|
{
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/kerberosproxy.net/KerberosProxy/obj/Debug/KerberosProxy.csproj.AssemblyReference.cache
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kerberos-server",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Kerberos http server interface",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
"express": "~3.4.7"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"debug": "~0.7.4",
|
|
17
16
|
"freeport": "~1.0.2"
|
|
18
17
|
}
|
|
19
18
|
}
|