mitlist: List MIT Kerberos Principals by Type on Linux

Ask an MIT Kerberos realm “what principals do we have?” and you usually end up running kadmin -q listprincs and scrolling through one long, unsorted mix of users, host keys and service accounts. mitlist is a small open-source, read-only tool that gives you an ldaplist-style view instead: principals grouped by type and sorted alphabetically, run as an ordinary user with no admin principal required.

Project on GitHub: azwieg103/mitlist

What mitlist lists

User principals are the ones without a slash, such as alice@EXAMPLE.COM. Service principals are grouped by service name, matched case-insensitively. The groups mitlist recognizes include:

GroupPrincipal prefixes
Usersusername@REALM
Web, file and mailHTTP/, cifs/, host/, imap/, smtp/, ldap/, nfs/
Databasesmysql/, postgres/, oracle/, MSSQLSvc/, db2/, hana/, informix/, mongodb/, cassandra/, redis/
Messagingxmpp/, kafka/, zookeeper/, rabbitmq/, activemq/
App servers and toolstomcat/, jboss/, was/, weblogic/, jenkins/, elasticsearch/, solr/, docker/
Access and storagessh/, ftp/, sftp/, afs/, ceph/
InfrastructureDNS/, dhcp/, radius/, tacacs/, nagios/, zabbix/, prometheus/, kubernetes/, nn/, dn/, etcd/, ntp/

A service group only prints if the realm actually has a matching principal, so you won’t see empty headings. Anything unrecognized goes into an Other group, and entries are sorted alphabetically within each group.

How it works, and why it’s read-only

mitlist doesn’t read the KDC database. It uses the MIT Kerberos remote administration protocol: it finds the realm’s admin_server in your active krb5.conf (including one selected with KRB5_CONFIG), gets the kadmin/ service ticket for that host using your existing ticket cache, and runs kadmin with the list_principals query. It never prompts for or stores a password, and it never adds, modifies or deletes principals or extracts keys. KEYRING credential caches work too.

The one required step: grant the list permission on the KDC

MIT Kerberos has no anonymous way to enumerate principals. The supported way to allow read-only listing is the lowercase l (list) permission in kadm5.acl. Without it, mitlist cannot list anything, even with a valid ticket. On the primary KDC:

  1. Find the ACL file named by acl_file in kdc.conf. If it’s unset, the default is usually LOCALSTATEDIR/krb5kdc/kadm5.acl; the exact path depends on how MIT Kerberos was packaged.
  2. Back up the file.
  3. Add a line for the exact user principal, before any broader entry that would match it, because the first matching entry wins.
  4. Restart kadmind so it rereads the ACL.
alice@EXAMPLE.COM    l

The l flag grants listing of principals and policies only. It does not grant add (a), modify (m), delete (d), change-password (c), inquire (i) or key extraction (e). Don’t use *, x or admcil for this. Note the scope: MIT treats listing as a database-wide operation, so the user can see every principal and policy name in the realm, but gets no keys or management rights.

Need a KDC to try this on? See Set Up an MIT Kerberos KDC on AlmaLinux 10. If you run a replica, the ACL change belongs on the primary, which runs kadmind (Set Up a Kerberos Primary and Replica KDC on AlmaLinux 10).

Verify access

With a ticket in the cache, test the underlying operation first (change the host and realm to yours):

klist
kadmin -c "$KRB5CCNAME" -s kdc.yourdomain.com:749 -q list_principals

If that works, mitlist will too.

Install mitlist on AlmaLinux 10

From the RPM

Download the latest binary RPM from the releases page and install it. It depends on krb5-workstation, which provides kadmin:

sudo dnf install ./mitlist-*.el10.x86_64.rpm
mitlist --version

Build the RPM yourself

sudo dnf install -y gcc make krb5-devel krb5-workstation rpm-build git
git clone https://github.com/azwieg103/mitlist.git
cd mitlist
bash scripts/build-rpm.sh

The RPMs are written to dist/, and the package installs the mitlist(1) man page. If you just want the binary, make and sudo make install also work. The Makefile uses krb5-config for flags and installs to /usr/bin by default.

AlmaLinux 10 x86_64 is the primary target. The README lists Windows builds as the next priority, with more platforms to follow.

Usage

mitlist                 # all principals, grouped
mitlist -u              # user principals only
mitlist -t HTTP         # one service class (case-insensitive)
mitlist -t cifs
mitlist -f 'www*'       # wildcard filter on principal names
mitlist -r EXAMPLE.COM  # one realm
mitlist --info          # default realm, KDCs, admin servers, SRV records
mitlist --help
mitlist --version

Options are case-insensitive, and a bare pattern argument works the same as --filter, using shell-style wildcards. --info shows the default realm, any KDC and admin-server entries set explicitly in the configuration, and live DNS SRV answers for the KDC, master KDC, admin and password services, with target, port, priority and weight. It’s a DNS lookup, not a connectivity test, and it can’t be combined with the listing filters.

Where it helps

  • Auditing which hosts and services have keys before a migration or cleanup. Pair it with Create and Manage Kerberos Keytabs on AlmaLinux 10.
  • Checking that an HTTP/, ldap/ or nfs/ principal exists before you troubleshoot GSSAPI.
  • Giving help-desk or monitoring accounts a read-only view of the realm without handing out an /admin principal.

Troubleshooting

  • Permission or authorization errors: check the exact principal shown by klist, then the ACL entry and its position in kadm5.acl, and confirm kadmind was restarted.
  • Can’t get the kadmin service ticket: this is a separate problem from the ACL. Check that the kadmin/admin or kadmin/ADMINHOST principal exists and that KDC policy allows the ticket. Granting broader database rights won’t fix it.
  • Connection failures: make sure the client can reach kadmind (normally TCP 749) and that admin_server is set for the realm in krb5.conf. Client setup is covered in Configure a Kerberos Client on AlmaLinux 10.
  • cannot execute kadmin: install krb5-workstation.

License and source

mitlist is free software. The repository’s LICENSE file is the GNU GPL version 3. Source, man page and releases are at github.com/azwieg103/mitlist.

Leave a Reply

Your email address will not be published. Required fields are marked *