-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add authorization support for checking token at server (PoC) (#146)
* wip for add token authorization to grpc * workable auth poc * 0.25.2 * finish auth poc * 0.25.3 * 0.25.4
- Loading branch information
Showing
12 changed files
with
237 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
ca.crt | ||
ca.key | ||
client.crt | ||
client.csr | ||
client.key | ||
server.crt | ||
server.csr | ||
server.key | ||
# all generated openssl files | ||
*.crt | ||
*.key | ||
*.csr | ||
*.srl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# See | ||
|
||
- [Monkey patching tls in node.js to support self-signed certificates with custom root certificate authorities](https://medium.com/trabe/monkey-patching-tls-in-node-js-to-support-self-signed-certificates-with-custom-root-cas-25c7396dfd2a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import fs from 'fs' | ||
import https from 'https' | ||
|
||
console.info('faint') | ||
|
||
https.request({ | ||
ca: [fs.readFileSync('./rootCA.crt')], | ||
hostname: '127.0.0.1', | ||
method: 'GET', | ||
path: '/', | ||
port: 6000, | ||
// rejectUnauthorized: false, | ||
}, res => { | ||
res.on('data', data => { | ||
process.stdout.write(data) | ||
}) | ||
}).end() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
# Private key for the root cert | ||
openssl genrsa -des3 -out rootCA.key 4096 | ||
|
||
# root certificate | ||
openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 365 -out rootCA.crt | ||
|
||
# Private key for the server cert | ||
openssl genrsa -out server.key 2048 | ||
|
||
# Signing request for the server | ||
openssl req -new -key server.key -out server.csr | ||
|
||
# Server cert using the root certificate | ||
openssl x509 -req -in server.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial \ | ||
-out server.crt -days 365 -sha256 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import fs from 'fs' | ||
import https from 'https' | ||
|
||
const server = https.createServer({ | ||
cert: fs.readFileSync('./server.crt'), | ||
key: fs.readFileSync('./server.key'), | ||
// ca: fs.readFileSync('./rootCA.crt') | ||
}) | ||
|
||
server.on('request', (_req, res) => { | ||
res.writeHead(200) | ||
res.end('Alive!\n') | ||
}) | ||
|
||
server.listen(6000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.