Project

ipa-ruby

0.01
No commit activity in last 3 years
No release in over 3 years
Ruby client library for FreeIPA JSON API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 1.1.2
>= 2.4.0
>= 1.7.0
 Project Readme

Ruby client library for FreeIPA JSON API

This is a simple Ruby client library that allows to interact with the FreeIPA JSON API. It currently only supports authenticating via Kerberos/GSSAPI tickets.

Pull requests to add additional API features are very welcome. I only implemented what I needed.

Install

To install it simply issue the following command:

gem install ipa-ruby

Usage

You can optionally pass a ca_cert keyword argument specifying the path to the FreeIPA CA certificate. Default is /etc/ipa/ca.crt.

require 'ipa/client'
ipa = IPA::Client.new(host: 'ipa.example.org')

Note that additional parameters can be passed via the params keyword argument.

Add a host (with a random password):

ipa.host_add(hostname: 'foo.example.org', force: true, random: true, all: true)

Add a host (with a specific password)

ipa.host_add(hostname: 'foo.example.org', force: true, userpassword: 'bar', all: true)

Delete a host:

ipa.host_del(hostname: 'foo.example.org')

Show a host:

ipa.host_show(hostname: 'foo.example.org', all: true)

Find hosts:

ipa.host_find(all: true, params: {:in_hostgroup => true})

Check if a host exists

if ipa.host_exists?('foo.example.org)
  puts "Yep :)"
else
  puts "Nope :("
end

Todo

  • Implement user API
  • Implement group API
  • Implement hostgroup API
  • Implement sudocmd API
  • Implement sudocmdgroup API
  • Implement hbacrule API
  • Implement hbacsvcgroup API

Contact

Matteo Cerutti - matteo.cerutti@hotmail.co.uk