{"id":22486591,"url":"https://github.com/mgcrea/node-easyrsa","last_synced_at":"2025-08-02T19:32:25.635Z","repository":{"id":57232654,"uuid":"49579450","full_name":"mgcrea/node-easyrsa","owner":"mgcrea","description":"Node.js public key infrastructure management library inspired by EasyRSA.","archived":false,"fork":false,"pushed_at":"2018-02-09T09:57:28.000Z","size":103,"stargazers_count":36,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-25T14:55:26.452Z","etag":null,"topics":["cryptography"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mgcrea.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-13T14:39:10.000Z","updated_at":"2021-02-15T22:12:34.000Z","dependencies_parsed_at":"2022-08-31T14:11:03.328Z","dependency_job_id":null,"html_url":"https://github.com/mgcrea/node-easyrsa","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgcrea%2Fnode-easyrsa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgcrea%2Fnode-easyrsa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgcrea%2Fnode-easyrsa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgcrea%2Fnode-easyrsa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mgcrea","download_url":"https://codeload.github.com/mgcrea/node-easyrsa/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228500152,"owners_count":17930002,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptography"],"created_at":"2024-12-06T17:14:57.456Z","updated_at":"2024-12-06T17:15:58.909Z","avatar_url":"https://github.com/mgcrea.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Node.js EasyRSA\n\n[![npm version](https://img.shields.io/npm/v/easyrsa.svg)](https://www.npmjs.com/package/easyrsa)\n[![license](https://img.shields.io/github/license/mgcrea/node-easyrsa.svg?style=flat)](https://tldrlegal.com/license/mit-license)\n[![build status](http://img.shields.io/travis/mgcrea/node-easyrsa/master.svg?style=flat)](http://travis-ci.org/mgcrea/node-easyrsa)\n[![dependencies status](https://img.shields.io/david/mgcrea/node-easyrsa.svg?style=flat)](https://david-dm.org/mgcrea/node-easyrsa)\n[![devDependencies status](https://img.shields.io/david/dev/mgcrea/node-easyrsa.svg?style=flat)](https://david-dm.org/mgcrea/node-easyrsa#info=devDependencies)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/99844d4bed38450f9ec9e03650d19954)](https://www.codacy.com/app/mgcrea/node-easyrsa?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=mgcrea/node-easyrsa\u0026amp;utm_campaign=Badge_Grade)\n[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/99844d4bed38450f9ec9e03650d19954)](https://www.codacy.com/app/mgcrea/node-easyrsa?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=mgcrea/node-easyrsa\u0026utm_campaign=Badge_Coverage)\n[![npm downloads](https://img.shields.io/npm/dm/easyrsa.svg)](https://www.npmjs.com/package/easyrsa)\n\nNode.js public key infrastructure management library inspired by [EasyRSA](https://github.com/OpenVPN/easy-rsa).\n\n- Uses [forge](https://github.com/digitalbazaar/forge) to manage cryptography\n- Provides ready-to-use templates to create your certificate authority: `vpn`, `ssl` or `mdm`.\n- Available both as a cli and a lib.\n- Provides easy-to-use templates for generic use cases (VPN, SSL, MDM)\n- Can easily be plugged to a database backend.\n\n## Quickstart\n\n### VPN Server setup\n\n- Command Line Interface\n\n```bash\nnpm i -g easyrsa\neasyrsa init-pki\neasyrsa build-ca\neasyrsa gen-req EntityName\neasyrsa sign-req client EntityName\n```\n\n- Node.js usage \n\n```js\nimport EasyRSA from 'easyrsa';\n\nconst easyrsa = new EasyRSA({pkiDir});\n\nconst pkiAttributes = {\n  organizationalUnitName: 'foo.online',\n  organizationName: 'Foo',\n  localityName: 'Paris',\n  stateOrProvinceName: 'Ile-de-France',\n  countryName: 'France'\n}\n\n// Build an OpenVPN infrastructure\neasyrsa.initPKI()\n  .then(() =\u003e {\n    const commonName = `ca@${myHost}`;\n    const attributes = {\n      ...pkiAttributes\n    };\n    log.warn('Building new CA ...');\n    return easyrsa.buildCA({commonName, attributes, serialNumberBytes: 9, privateKey: ca.privateKey})\n      .then(({privateKey, cert}) =\u003e {\n        log.info('Built new CA with serialNumber=\"%s\"', cert.serialNumber);\n      });\n  })\n  .then(() =\u003e {\n    const commonName = `server@${myHost}`;\n    const attributes = {\n      ...pkiAttributes,\n      unstructuredName: 'OpenVPN Service'\n    };\n    log.info('Generating new server certificate with commonName=\"%s\" ...', commonName);\n    return easyrsa.createServer({commonName, attributes, privateKey: vpn.privateKey})\n      .then(({privateKey, csr, cert, serial, index}) =\u003e {\n        log.info('Built new certificate for commonName=\"%s\" with serialNumber=\"%s\"', commonName, cert.serialNumber);\n      });\n  })\n  .then(() =\u003e {\n  \tconst commonName = 'client@${myHost}'\n\tconst {pkiAttributes} = this.config;\n    const attributes = {\n      ...pkiAttributes,\n      unstructuredName: 'My first Client'\n    };\n    log.info('Generating new %s client for commonName=\"%s\" ...', type, commonName);\n    return easyrsa.createClient({commonName, attributes, privateKey})\n      .then(({csr, cert, serial, index}) =\u003e {\n        log.info('Built new client certificate with commonName=\"%s\" with serialNumber=\"%s\"', commonName, cert.serialNumber);\n      });\n  })\n```\n\n## Testing\n\n- You can quickly start hacking around\n\n```bash\ngit clone -o github git@github.com:mgcrea/node-easyrsa.git\ncd node-easyrsa\nnpm i\nnpm start\n```\n\n## Docs\n\n- [EasyRSA quickstart](https://github.com/OpenVPN/easy-rsa/blob/master/README.quickstart.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgcrea%2Fnode-easyrsa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmgcrea%2Fnode-easyrsa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgcrea%2Fnode-easyrsa/lists"}