Admin(3pm)
โจ Admin(3pm) โ User Contributed Perl Documentation โจ
okay so bestie, this is Admin(3pm), part 1 of 2, and we're gonna get you fluent in the Authen::Krb5::Admin module. ๐
๐ NAME ๐
Authen::Krb5::Admin โ Perl extension for MIT Kerberos 5 admin interface โจ
๐ธ SYNOPSIS ๐ธ
use Authen::Krb5::Admin;
use Authen::Krb5::Admin qw(:constants);
๐ฆ DESCRIPTION ๐ฆ
okay so the Authen::Krb5::Admin Perl module is literally an object-oriented interface to the Kerberos 5 admin server. Right now only MIT KDCs are supported, but the author is envisioning seamless integration with other KDCs. periodt.
The following classes are provided by this module:
Authen::Krb5::Admin handle for performing kadmin operations
Authen::Krb5::Admin::Config kadmin configuration parameters
Authen::Krb5::Admin::Key key data from principal object
Authen::Krb5::Admin::Policy kadmin policies
Authen::Krb5::Admin::Principal kadmin principals
๐ Configuration Parameters, Policies, and Principals ๐
Before doing any kadmin operations, bestie, the programmer has to construct objects to represent the entities being manipulated. Each of these classes:
Authen::Krb5::Admin::Config
Authen::Krb5::Admin::Key
Authen::Krb5::Admin::Policy
Authen::Krb5::Admin::Principal
has a constructor new that takes no arguments (except for the class name). The new object can be populated using accessor methods, and each one is named for the C struct element it represents. Methods always return the current value of the attribute, except for policy_clear, which returns nothing. If a value is provided, the attribute gets set to that value, and the new value is returned. slay.
All attributes may be modified in each object, but read-only attributes will be ignored when performing kadmin operations. These attributes are indicated in the documentation for their accessor methods. no cap.
Each of the C functions that manipulate kadm5 principal and policy structures takes a mask argument to indicate which fields should be taken into account. The Perl accessor methods take care of the mask for you, assuming that when you change a value, you will eventually want it changed on the server. iconic.
Flags for the read-only fields do not get set automatically because they would result in a bad mask error when performing kadmin operations.
Some writable attributes are not allowed to have their masks set for certain operations. For example, KADM5_POLICY may not be set during a create_principal operation, but since the Perl module sets that flag automatically when you set the policy attribute of the principal object, a bad mask error would result. Therefore, some kadmin operations automatically clear certain flags first. the way that works is lowkey wild but okay.
Though you should never have to, you can manipulate the mask on your own using the mask methods and the flags associated with each attribute (indicated in curly braces ({}s) below). Use the tag :constants to request that the flag constants (and all other constants) be made available (see Exporter(3)). ๐
๐ Authen::Krb5::Admin::Config ๐
This class is used to configure a kadmin connection. Without this object, Authen::Krb5::Admin constructors will default to the configuration defined in the Kerberos 5 profile (/etc/krb5.conf by default). So this object is usually only needed when selecting alternate realms or contacting a specific, non-default server. periodt.
The only methods in this class are the constructor (new, described above) and the following accessor methods.
admin_server{KADM5_CONFIG_ADMIN_SERVER}โ Admin server hostname ๐ฆkadmind_port{KADM5_CONFIG_KADMIND_PORT}โ Admin server port number โจkpasswd_port{KADM5_CONFIG_KPASSWD_PORT}โ Kpasswd server port number ๐ซmaskโ Mask (described above) ๐profile{KADM5_CONFIG_PROFILE}โ Kerberos 5 configuration profile ๐ธrealm{KADM5_CONFIG_REALM}โ Kerberos 5 realm name ๐
๐ Authen::Krb5::Admin::Key ๐
This class represents key data contained in kadmin principal objects. The only methods in this class are the constructor (new, described above) and the following accessor methods.
key_contentsโ Key contents, encrypted with the KDC master key. This data may not be available remotely. ๐enc_typeโ Kerberos 5 enctype of the key โจkey_typeโ Alias forenc_type๐kvnoโ Key version number ๐ขsalt_contentsโ Salt contents, if any (ver > 1) ๐งsalt_typeโ Salt type, if any (ver > 1) ๐งverโ Version number of the underlyingkrb5_key_datastructure ๐
๐ Authen::Krb5::Admin::Policy ๐
This class represents kadmin policies. The only methods in this class are the constructor (new, described above) and the following accessor methods.
maskโ Mask (described above) ๐name{KADM5_POLICY}โ Policy name ๐pw_history_num{KADM5_PW_HISTORY_NUM}โ Number (between 1 and 10, inclusive) of past passwords to be stored for the principal. A principal may not set its password to any of its previouspw_history_numpasswords. ๐pw_max_life{KADM5_PW_MAX_LIFE}โ Default number of seconds a password lasts before the principal is required to change it โณpw_max_fail{KADM5_PW_MAX_FAILURE}โ The maximum allowed number of attempts before a lockout. ๐ซpw_failcnt_interval{KADM5_PW_FAILURE_COUNT_INTERVAL}โ The period after which the bad preauthentication count will be reset. โฑ๏ธpw_lockout_duration{KADM5_PW_LOCKOUT_DURATION}โ The period in which lockout is enforced; a duration of zero means that the principal must be manually unlocked. ๐pw_min_classes{KADM5_PW_MIN_CLASSES}โ Number (between 1 and 5, inclusive) of required character classes represented in a password ๐กpw_min_length{KADM5_PW_MIN_LENGTH}โ Minimum number of characters in a password ๐pw_min_life{KADM5_PW_MIN_LIFE}โ Number of seconds a password must age before the principal may change it โณpolicy_refcnt{KADM5_REF_COUNT}โ Number of principals referring to this policy (read-only, does not setKADM5_REF_COUNTautomatically) ๐
๐ Authen::Krb5::Admin::Principal ๐
The attributes fail_auth_count, last_failed, and last_success are only meaningful if the KDC is configured to update the database with this type of information. iykyk.
The only methods in this class are the constructor (new, described above), the following accessor methods, and policy_clear, which is used to clear the policy attribute.
attributes{KADM5_ATTRIBUTES}โ Bitfield representing principal attributes (seekadmin(8)) ๐๏ธaux_attributes{KADM5_AUX_ATTRIBUTES}โ Bitfield used by kadmin. Currently only recognizes theKADM5_POLICY, which indicates that a policy is in effect for this principal. This attribute is read-only, soKADM5_AUX_ATTRIBUTESis not set automatically. ๐fail_auth_count{KADM5_FAIL_AUTH_COUNT}โ Number of consecutive failedAS_REQsfor this principal. This attribute is read-only, soKADM5_FAIL_AUTH_COUNTis not set automatically. ๐ญkvno{KADM5_KVNO}โ Key version number ๐ขlast_failed{KADM5_LAST_FAILED}โ Time (in seconds since the Epoch) of the last failedAS_REQfor this principal. This attribute is read-only, soKADM5_LAST_FAILEDis not set automatically. โฐlast_pwd_change{KADM5_LAST_PWD_CHANGE}โ Time (in seconds since the Epoch) of the last password change for this principal. This attribute is read-only, soKADM5_LAST_PWD_CHANGEis not set automatically. ๐last_success{KADM5_LAST_SUCCESS}โ Time (in seconds since the Epoch) of the last successfulAS_REQfor this principal. This attribute is read-only, soKADM5_LAST_SUCCESSis not set automatically. โmaskโ Mask (see above) ๐max_life{KADM5_MAX_LIFE}โ maximum lifetime in seconds of any Kerberos ticket issued to this principal โณmax_renewable_life{KADM5_MAX_RLIFE}โ maximum renewable lifetime in seconds of any Kerberos ticket issued to this principal ๐mod_date{KADM5_MOD_TIME}โ Time (in seconds since the Epoch) this principal was last modified. This attribute is read-only, soKADM5_MOD_TIMEis not set automatically. ๐ฐ๏ธmod_name{KADM5_MOD_NAME}โ Kerberos principal (Authen::Krb5::Principal, seeAuthen::Krb5(3)) that last modified this principal. This attribute is read-only, soKADM5_MOD_NAMEis not set automatically. ๐คpolicy{KADM5_POLICY}โ Name of policy that affects this principal ifKADM5_POLICYis set inaux_attributes๐policy_clear{KADM5_POLICY_CLR}โ Not really an attribute--disables the current policy for this principal. This method doesn't return anything. ๐ซprinc_expire_time{KADM5_PRINC_EXPIRE_TIME}โ Expire time (in seconds since the Epoch) of the principal โprincipal{KADM5_PRINCIPAL}โ Kerberos principal itself (Authen::Krb5::Principal, seeAuthen::Krb5(3)) ๐pw_expiration{KADM5_PW_EXPIRATION}โ Expire time (in seconds since the Epoch) of the principal's password ๐db_args[@ARGS]โ When called without any@ARGS, returns the list of arguments that will be passed into the underlying database, as with"addprinc -x"in"kadmin". If@ARGSis non-empty, it will replace any database arguments, which will then be returned, like this:
my @old = $principal->db_args;
# -or-
my @old = $principal->db_args(@new);
# The RPC call will ignore the tail data unless
# you set this flag:
$principal->mask($principal->mask | KADM5_TL_DATA);
๐ฆ Operations ๐ฆ
To perform kadmin operations (addprinc, delprinc, etc.), we first construct an object of the class Authen::Krb5::Admin, which contains a server handle. Then we use object methods to perform the operations using that handle.
In the following synopses, parameter types are indicated by their names as follows:
$error Kerberos 5 error code
$kadm5 Authen::Krb5::Admin
$kadm5_config Authen::Krb5::Admin::Config
$kadm5_pol Authen::Krb5::Admin::Policy
$kadm5_princ Authen::Krb5::Admin::Principal
$krb5_ccache Authen::Krb5::Ccache
$krb5_princ Authen::Krb5::Principal
$success TRUE if if the call succeeeded, undef otherwise
Everything else is an unblessed scalar value (or an array of them) inferable from context. ๐
okay so before we go any further โ any parameter wrapped up in square brackets ([]) is optional, bestie. Every single one. That's the vibe check for this whole page. ๐
Constructors ๐
Each of these lil constructors authenticates as $client against the admin server $service, which defaults to KADM5_ADMIN_SERVICE if it's undef. And if $kadm5_config is undefined? The interface just infers the config from the Kerberos 5 profile (/etc/krb5.conf by default). Easy. โจ
$kadm5 = Authen::Krb5::Admin->init_with_creds($client, $krb5_ccache[, $service, $kadm5_config])โ Authenticate using the credentials cached in$krb5_ccache.$kadm5 = Authen::Krb5::Admin->init_with_password($client[, $password, $service, $kadm5_config])โ Authenticate with$password.$kadm5 = Authen::Krb5::Admin->init_with_skey($client[, $keytab_file, $service, $kadm5_config])โ Authenticate using the keytab stored in$keytab_file. And if$keytab_fileis undef? You get the default keytab. Slay.
Principal Operations ๐
$success = $kadm5->chpass_principal($krb5_princ, $password)โ Change the password of$krb5_princto$password.$success = $kadm5->create_principal($kadm5_princ[, $password])โ Insert$kadm5_princinto the database, optionally setting its password to the string in$password. This one clearsKADM5_POLICY_CLRandKADM5_FAIL_AUTH_COUNT.$success = $kadm5->delete_principal($krb5_princ)โ Delete the principal represented by$krb5_princfrom the database. bye bestie ๐$kadm5_princ = $kadm5->get_principal($krb5_princ[, $mask])โ Retrieve theAuthen::Krb5::Admin::Principalobject for the principal$krb5_princfrom the database. Pro tip: useKADM5_PRINCIPAL_NORMAL_MASKto grab all of the useful attributes. ๐ธ@names = $kadm5->get_principals([$expr])โ Retrieve a list of principal names matching the glob pattern$expr. If there's no$expr, you get the list of all principal names.$success = $kadm5->modify_principal($kadm5_princ)โ Modify$kadm5_princin the database. The principal to modify is determined by$kadm5_princ->principal, and the rest of the writable parameters get modified accordingly. This one clearsKADM5_PRINCIPAL.@keys = $kadm5->randkey_principal($krb5_princ)โ Randomize the principal in the database represented by$krb5_princ, and it hands you backAuthen::Krb5::Keyblockobjects. ๐ฅ$success = $kadm5->rename_principal($krb5_princ_from, $krb5_princ_to)โ Change the name of the principal from$krb5_princ_fromto$krb5_princ_to. glow-up, fr fr โจ
Policy Operations ๐
$success = $kadm5->create_policy($kadm5_pol)โ Insert$kadm5_polinto the database.$success = $kadm5->delete_policy($name)โ Delete the policy named$namefrom the database.$kadm5_pol = $kadm5->get_policy([$name])โ Retrieve theAuthen::Krb5::Admin::Policyobject for the policy named$namefrom the database.@names = $kadm5->get_policies([$expr])โ Retrieve a list of policy names matching the glob pattern$expr. No$expr? You get the list of all policy names. ๐ฆ$success = $kadm5->modify_policy($kadm5_pol)โ Modify$kadm5_polin the database. The policy to modify is determined by$kadm5_pol->name, and the rest of the writable parameters get modified accordingly. This one clearsKADM5_POLICY.
Other Methods ๐ซ
$magic_value = Authen::Krb5::Admin::error [$error]โ Returns a value that acts like$!(go peek atperlvar(1)if you don't know her) for the most recentAuthen::Krb5::Admincall. Pass an error code$errorand it returns the error message corresponding to that error code.$error_code = Authen::Krb5::Admin::error_codeโ Returns the value of the error code for the most recentAuthen::Krb5::Admincall, as a simple integer. no cap ๐งฎ$privs = $kadm5->get_privsโ Returns a bitfield representing the kadmin privileges a principal has, like so:
get KADM5_PRIV_GET
add KADM5_PRIV_ADD
modify KADM5_PRIV_MODIFY
delete KADM5_PRIV_DELETE
โจ EXAMPLES โจ
Want examples? Go look at the unit tests that ship with this software โ they're chillin' in the t/ subdirectory of the distribution. ๐
๐ FILES ๐
krb.confโ Kerberos 5 configuration file
๐ BUGS ๐
Okay so here's the tea: there is no facility for specifying keysalts for methods like create_principal and modify_principal. That facility is provided by the Kerberos 5 API and it needs an initialized context. So honestly it probably makes more sense for Authen::Krb5(3) to handle those functions. not me calling out the API design ๐ญ
๐ AUTHOR ๐
Stephen Quinney <squinney@inf.ed.ac.uk>
Author Emeritus: Andrew J. Korty <ajk@iu.edu>
๐ SEE ALSO ๐
perl(1), perlvar(1), Authen::Krb5(3), Exporter(3), kadmin(8).
and that's the whole page, bestie ๐ซถ this one's from perl v5.40.1, dated 2025-04-11, and it lives at Admin(3pm). go forth and admin responsibly ๐โจ๐
๐ฆ where this page comes from
- debian trixie: libauthen-krb5-admin-perl 0.17-5 ยท BSD-2-Clause
- ubuntu resolute: libauthen-krb5-admin-perl 0.17-5 ยท BSD-2-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms