Skip to content

platformatic/fastify-mtls

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

fastify-mtls

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors