Skip to content

Generate self-signed ssl certificates for your domain/IP.

License

Notifications You must be signed in to change notification settings

linux-remote/ssl-self-signed

Repository files navigation

ssl-self-signed

Generate 100-year self-signed ssl certificates for your domain/IP.

Requested

Linux

OpenSSL

Install

npm install ssl-self-signed

Examples

var sss = require('ssl-self-signed');
// auto generate CA
sss({
  output: __dirname, 
  commonName: '192.168.56.101',
  end(){
    if(err){
      return console.error(err);
    }
    console.log('ok');
  }
});

Generate files:

  • CA.key CA's private key.
  • CA.crt Import into browser.
  • server.crtserver.key use for server.

opts

  • CA If not set(undefined): If under the ouput not have CA.key and CA.crt, It will generate CA. otherwise It will use CA.key and CA.crt under the ouput. default undefined.

    If is Object: It will use you provide'CA,

    • key CA's private key path.
    • cert CA's cert file path.
  • bit: default 2048

  • days: default 365 * 100

  • C: Country default "CN"

  • O: Organization default "AAA ssl-self-signed"

Use other CA:

var sss = require('ssl-self-signed');

sss({
  output: __dirname,
  commonName: '192.168.56.101',
  CA: {
    key: '/somePath/CA.key', //cmd path is output
    cert: '/somePath/CA.crt'
  },
  C: 'CN', // Must be the same as CA, otherwise will be get a unhandle error.
  O: 'AAA', // Must be the same as CA, otherwise will be get a unhandle error.
  end(err){
    if(err){
      return console.error(err);
    }
    console.log('ok');
  }
});

Import CA:

Import CA.crt into browsers(should put it into 'Trusted Root Certification Authorities' place). Some guide like: window-chrome-import-guide

Also need restart your browser.

About

Generate self-signed ssl certificates for your domain/IP.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published