pfsense-blink1 v0.2.4
pfsense-blink(1)
Introduction
Watch your pfSense® firewall temperature with blink(1) using Node.js® runtime
Quickstart
Docker (recommended: docker-compose.yml)
docker pull ghcr.io/amacado/pfsense-blink1:latestRequirements
- blink(1)
mk2ormk3by THINGMmk1does not have two LEDs on both top and bottom which are independently addressable. It might work, but not tested.
Preparations & setup
The intended deployment of this script is on another machine (or container) than the pfSense®. It's recommended to keep your firewall server as "clean" as possible.
- Setup jaredhendrickson13/pfsense-api for pfSense®
- Create an API Token for the REST API (see
jaredhendrickson13/pfsense-apiinstructions) - Install libusb driver
apt-get install libusb-1.0-0which is required to access the blink(1) device using the node package sandeepmistry/node-blink1 - Install
nodejs(see nodejs.org) - Connect the blink(1) via USB
Run the application
- Copy
config/config.sample.json5, rename it to/path/to/config.json5(default/config/config.json5) and paste API credentials and pfSense® URI (see json5.org for more information about the this next level json project) - Adjust settings in
config/config.json5to your needs. The default values are defined inConfigurationManager - Install and start
pfsense-blink1applicationnpm i pfsense-blink1 -g pfsense-blink1 [--config "/path/to/config.json5"]
Development or 'Go build yourself'
- Install
yarnpackage manager (see yarnpkg.com) - Clone this repository (
gh repo clone amacado/pfsense-blink1) - Execute
yarn install - Execute
yarn servefor TypeScript watcher - Execute
yarn buildto build the project and create production ready project in /dist/ Setup
pre-pushhook with following script#!/bin/sh yarn build git add dist/ git diff-index --quiet HEAD || git commit -m ":octocat: build sources via pre-push hook" exit 0
Publishing new (npm package) version
This project follows Semantic Versioning 2.0.0 with the help ofnp CLI tool
to ensure quality.
yarn global add np
npm install np -gCreate a new version and publish (np is installed as dev-dependency):
npKnown problems
Error TypeError: cannot open device with path
This error may occurs when the current user is not allowed to access the attached blink(1) device:
TypeError: cannot open device with path /dev/hidraw0If you're running this script in a docker container you might want to check the bindings and
mount /dev:/dev which allows the container to access the device.
Error libusb-1.0.so.0: cannot open shared object file
Error: libusb-1.0.so.0: cannot open shared object file: No such file or directoryThis error occurs if you haven't installed libusb driver apt-get install libusb-1.0-0.
ERR! self signed certificate
ERR! self signed certificateThis error occurs when the SSL certificate which should secure your REST API connection
is self signed. There are two solutions for this problem: Either authorize your SSL certificate
or skip the check by setting configuration option api.httpsAgent.rejectUnauthorized = false (see /config/config.sample.json5).
Credits
Special thanks to these projects: