I want migrate from openLDAP Authentication to another Authentication methods. My main problem is the sudoers, where I need to manually migrate them.
Thus, I need to create a script for that. I would like to use bash for this. The ldif file contains lines like the following:
dn: cn=Devs, ou=SUDOers, dc=example,dc=com sudoUser: %devs sudoCommand: /bin/su - command sudoCommand: /bin/su - wwwadmin sudoHost: ALL description: Developer Admin objectClass: sudoRole cn: Devs
So, what I need to do is:
- Read the LDIF file.
- Extract all lines between dn: and a blank line, OR, between the lines containing cn: Devs
I would like to use embedded BASH commands, grep, awk, sed etc only.
No Python, PHP, Perl etc.