Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/platformatic/fastify-mtls
fastify-mtls
https://github.com/platformatic/fastify-mtls
Last synced: about 1 month ago
JSON representation
fastify-mtls
- Host: GitHub
- URL: https://github.com/platformatic/fastify-mtls
- Owner: platformatic
- License: apache-2.0
- Created: 2023-05-05T13:23:43.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-15T11:51:34.000Z (about 1 year ago)
- Last Synced: 2024-05-06T12:24:35.361Z (8 months ago)
- Language: JavaScript
- Size: 172 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fastify-mtls
It will set up TLS on a fastify server, using Vault as CA with [`vault-pki-fetcher`](https://github.com/platformatic/vault-pki-fetcher)
## Usage
```javascript
const fastify = require('fastify')
const mtlsPlugin = require('fastify-mtls')const server = fastify({
https: {
key: '',
cert: '',
requestCert: true,
rejectUnauthorized: true
}
})
server.register(mtlsPlugin, mtlsOptions)
const mtlsOptions = {
vaultNamespace: 'admin',
vaultAddress: 'http://localhost:8200',
roleId: 'fake-role-id',
secretId: 'fake-secret-id',
CAName: 'your_ca',
PKIRole: 'ca_role',
commonName: 'example.com',
ttl: '365d'
}
const server = fastify({
https: {
key: '',
cert: ''
}
})server.register(mtlsPlugin, mtlsOptions)
await server.listen({ port: 0 })
console.log(server.mtls) // { ca: '...', cert: '...', key: '...' }
```## License
Apache 2.0