fastify-mtls

1.0.1 • Public • Published

fastify-mtls

It will set up TLS on a fastify server, using Vault as CA with vault-pki-fetcher

Usage

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

Readme

Keywords

none

Package Sidebar

Install

npm i fastify-mtls

Weekly Downloads

0

Version

1.0.1

License

Apache 2.0

Unpacked Size

52.9 kB

Total Files

18

Last publish

Collaborators

  • leorossi