Giter VIP home page Giter VIP logo

pfsense-certs's Introduction

pfsense-certs

pfSense 3.0 should have a REST API, but in the meantime, this is a library for pulling user info and certificates from a pfSense server.

It uses the web connector interface, form-scraper, and cheerio to scrape the forms and submit them to get the certificate data.

Installation

You will probably want both this package and pfsense-session so you can create session objects.

npm install pfsense-session
npm install pfsense-certs

To use each function, you will need a session object, which can be created using the pfsense-session's login method.

Example

Get all certificates for all users and dump to the console

var pfSenseSession = require('pfsense-session');
var pfSenseCerts = require('./pfsense-certs');

pfSenseSession.login('your-pfsense-hostname-here', 'admin', 'pfsense', function(err, session) {

  pfSenseCerts.getUsers(session, function(err, users) {
    users.forEach(function(user) {
      pfSenseCerts.getCerts(session, user.id, function(err, certs) {
        certs.forEach(function(cert) {
          pfSenseCerts.exportCert(session, user.id, cert.id, function(err, certData) {
            console.log(certData);
          });
        });
      });
    });
  });
});

.getUsers(session, cb)

Gets the users stored in the pfSense user database

.getCerts(session, userID, cb)

Gets the certificate names for the specified user

.exportCert(session, userID, certID, cb)

Gets the contents of a certificate

.exportKey(session, userID, certID, cb)

Gets the contents of a private key

pfsense-certs's People

Contributors

austinkeeley avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.