{"library":"python-kadmin-rs","title":"Python Kadmin RS","description":"Python interface to the Kerberos administration interface (kadm5), providing a safe and idiomatic way to manage Kerberos principals and policies. It leverages a Rust implementation (kadmin-rs) for enhanced safety and performance. The library is currently at version 0.7.0 and sees active development with releases tied to new features or bug fixes.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install python-kadmin-rs"],"cli":null},"imports":["from kadmin_rs.client import Client"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nfrom kadmin_rs.client import Client\n\n# IMPORTANT: Replace with your actual Kerberos admin principal and keytab path.\n# For testing, you can set these environment variables:\n# export KADMIN_ADMIN_PRINCIPAL=\"admin/admin@EXAMPLE.COM\"\n# export KADMIN_KEYTAB_PATH=\"/etc/krb5.keytab\"\n# Ensure Kerberos is properly configured and the keytab is valid.\n\nadmin_principal = os.environ.get(\"KADMIN_ADMIN_PRINCIPAL\", \"admin/admin@EXAMPLE.COM\")\nkeytab_path = os.environ.get(\"KADMIN_KEYTAB_PATH\", \"/etc/krb5.keytab\")\n\ntry:\n    client = Client.with_keytab(\n        principal=admin_principal,\n        keytab_path=keytab_path,\n    )\n    print(f\"Kadmin client connected as {admin_principal}\")\n\n    # List all principals\n    all_principals = client.list_principals()\n    print(f\"Found {len(all_principals)} principals.\")\n    if all_principals:\n        print(f\"First principal: {all_principals[0]}\")\n\nexcept Exception as e:\n    print(f\"Error initializing Kadmin client or listing principals: {e}\")\n    print(\"Please check your Kerberos configuration, admin principal, and keytab path.\")\n    print(\"Also ensure system Kerberos development libraries are installed (e.g., libkrb5-dev).\")\n","lang":"python","description":"Demonstrates how to initialize a `Client` using a keytab file and list Kerberos principals. Requires proper Kerberos setup and a valid admin principal with a keytab.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}