Connecting to freeIPA with PHP


According to Wikipedia freeIPA is an open source project sponsored by Red Hat that aims to provide an easily managed Identity, Policy and Audit (IPA) suite primarily targeted towards networks of Linux and Unix computers. FreeIPA aims to provide support not just for Linux- and Unix-based computers, but  for Microsoft Windows and Apple OS X computers as well.

FreeIPA server offers a web API that possibilits interaction with the server. I wrote a PHP library for connection with it and published as a free software in the Github. The following lines are a guide to use it.


The best way to install is through composer, as below:

However it is also possible to install through clonning the Github repository or download zip file.

Basic Usage

First, it is necessary to obtain the server certificate. You can access https://server/ipa/config/ca.crt with your browser and save the file or use some cli software. Example:

Now you need include the autoload:

Creates a new instance of class with the server address and full path for the certificate file:

And make login

Example of $auth_info in case of error:

And success:

Managing users

You can get all information about one user:

Output example:

Or groups in which the user is:

You can search user through find() method

Or use the method findBy which is easier

You can insert a user

And modify it:

Managing groups

Adding a group

And put users, or other groups, in:

For more information and examples, see the repositório.

Over time new features will be added. If you have suggestions, even features, leave a comment.




Deixe uma resposta