Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quesiton: How to create a user with fauxapi #26

Jgerardopine opened this issue Jul 12, 2018 · 2 comments

Quesiton: How to create a user with fauxapi #26

Jgerardopine opened this issue Jul 12, 2018 · 2 comments


Copy link


I was trying to create a user with fauxapi. From dev shell you can create a new user by running the following command:

$config['system']['user'][] = <name>

The only .inc file that makes sense of creatin a user is line 480.
I have tried with several functions with the method function_call() from fauxapi, but it doesn't create the user.
Have you been able to generate a user via fauxapi? I have been trying all day, eventhough the function is passing the arguments properly, and in the debugging is showing but the 200 ok, the user is not being created. Fo you have any clue on how to do this?

Best regards,

Jose Gerardo Pineda

Copy link

ndejong commented Aug 16, 2018

This sounded like a common enough use-case that I created some example code that implements the following:-

  • get_users - returns a dict of users on the system
  • add_user - adds a new user to the system
  • manage_user - manages users attributes such as password, sshkey, description and privileges
  • remove_user - removes a user by username
  • get_groups - returns a dict of groups on the system
  • add_group - creates a new local user group
  • manage_group - manages the description, privileges and users in a group
  • remove_group - removes a group by group name

You can review the code here:-

The thing to remember is that FauxAPI is a tool for interacting with the pfSense configuration file and as such you sometimes need to do a bit of extra work here and there - in this case we need to increment the nextuid and nextguid fields after adding users and groups - works just fine though

@ndejong ndejong closed this as completed Aug 16, 2018
Copy link

How to add nat and rules? Im using PHP.

Here is my code for NAT:

$data = [
    "nat" => [
        "rule" => [

$response = $client->config_patch($data);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

3 participants