freeipa-via-cloudflare
v2.4.1
Published
A module to consume FreeIPA Server API using promises. (Customized to support additional headers)
Downloads
9
Readme
freeipa-via-cloudflare
A secure Node.js client for FreeIPA that works behind Cloudflare Access.
Based on a customized fork of node-freeipa, this version supports injecting Cloudflare Access service token headers and Referer handling.
Install
npm install --save freeipa-via-cloudflare📘 Usage
const ipa = require('freeipa-via-cloudflare');
require('dotenv').config();
ipa.configure({
server: process.env.FREEIPA_SERVER,
port: 443,
path: "/ipa",
auth: {
user: process.env.FREEIPA_USER,
pass: process.env.FREEIPA_PASS
},
rejectUnauthorized: false,
referer: process.env.FREEIPA_REFERER,
headers: {
'CF-Access-Client-Id': process.env.CF_ACCESS_CLIENT_ID,
'CF-Access-Client-Secret': process.env.CF_ACCESS_CLIENT_SECRET
}
});
ipa.user_find(["username"], { all: true }).then(console.log).catch(console.error);🧩 API
configure(options)
Sets up the internal connection and authentication headers.
ipa.configure({
server: "ipa.example.org",
auth: {
user: "admin",
pass: "adminpass"
},
headers: {
"CF-Access-Client-Id": "...",
"CF-Access-Client-Secret": "...",
"Referer": "https://ipa.example.org/ipa"
}
});ipa.<method>(args[], options{})
Examples:
ipa.user_show(["admin"], { all: true });
ipa.user_find([""], { givenname: "John" });⚠️ Common Errors
| Code | Description |
|---------------------------|--------------------------------------|
| FREEIPA.NOARGS | Missing method arguments |
| FREEIPA.NO_DATA | No results from FreeIPA |
| FREEIPA.AUTH_ERROR | Login/session failure |
| FREEIPA.REQUEST_ERROR | HTTPS/network failure |
| FREEIPA.UNHANDLED_ERROR | Unexpected/non-JSON server response |
| <IPA.ERROR> | Error returned from FreeIPA itself |
🔗 Resources
📄 License
MIT © Lucas Diedrich
Customized by Somesh Nistala
