[Freeipa-users] Export data

Rob Crittenden rcritten at redhat.com
Wed Feb 19 20:59:30 UTC 2014


Choudhury, Suhail wrote:
> Hi Martin,
>
> Thanks for your previous answer.
>
> And how can I export a list of DNS entries using ldapsearch?

He included the basics in his previous answer:

 > $ kinit admin
 > $ ldapsearch -h `hostname` -Y GSSAPI -b 
'cn=users,cn=accounts,dc=example,dc=com'

You can append the command with the list of attributes you want, and 
suppress a bunch of the extraneous output with -LLL, so something like:

$ ldapsearch -LLL -h `hostname` -Y GSSAPI -b 
'cn=users,cn=accounts,dc=example,dc=com' dn

rob

>
> Regards,
> Suhail.
> DevOps BSkyB.
>
> ________________________________________
> From: Martin Kosek [mkosek at redhat.com]
> Sent: 22 January 2014 13:30
> To: Choudhury, Suhail; freeipa-users at redhat.com
> Subject: Re: [Freeipa-users] Export data
>
> On 01/22/2014 01:48 PM, Choudhury, Suhail wrote:
>> Hi guys,
>>
>> I trying to get a dump of all users, hosts and DNS entries from IPA so
>> we can run scripts/Puppet against them.
>>
>> Tried searching for it but cannot find anything, so was hoping someone
>> can give some hints on how best to do this please.
>>
>
> You can either export them via ldapsearch:
>
> $ kinit admin
> $ ldapsearch -h `hostname` -Y GSSAPI -b 'cn=users,cn=accounts,dc=example,dc=com'
>
>
> ... or for write a Python script to do what you want. Very simple example:
>
> $ kinit admin
> $ python
>>>> from ipalib import api
>>>> api.bootstrap()
>>>> api.finalize()
>>>> api.Backend.xmlclient.connect()
>>>> users = api.Command.user_find()
>>>> for user in users['result']:...     print "%s:%s:%s" % (user['uid'][0],
> user['uidnumber'][0], user['gidnumber'][0])
> ...
> admin:1913600000:1913600000
> tuser:1913600001:1913600001
>
>
> Martin
>
>
> Information in this email including any attachments may be privileged, confidential and is intended exclusively for the addressee. The views expressed may not be official policy, but the personal views of the originator. If you have received it in error, please notify the sender by return e-mail and delete it from your system. You should not reproduce, distribute, store, retransmit, use or disclose its contents to anyone. Please note we reserve the right to monitor all e-mail communication through our internal and external networks. SKY and the SKY marks are trademarks of British Sky Broadcasting Group plc and Sky International AG and are used under licence. British Sky Broadcasting Limited (Registration No. 2906991), Sky-In-Home Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited (Registration No. 2340150) are direct or indirect subsidiaries of British Sky Broadcasting Group plc (Registration No. 2247735). All of the companies mentioned in this!
  p!
>   aragraph are incorporated in England and Wales and share the same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.
>
>
>
> _______________________________________________
> Freeipa-users mailing list
> Freeipa-users at redhat.com
> https://www.redhat.com/mailman/listinfo/freeipa-users
>




More information about the Freeipa-users mailing list