Class

pt.tecnico.dsi.kadmin

Kadmin

Related Doc: package kadmin

Permalink

class Kadmin extends LazyLogging

Linear Supertypes
LazyLogging, AnyRef, Any
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Kadmin
  2. LazyLogging
  3. AnyRef
  4. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Kadmin(config: Config)

    Permalink
  2. new Kadmin(settings: Settings = new Settings())

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Kadmin to any2stringadd[Kadmin] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (Kadmin, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Kadmin to ArrowAssoc[Kadmin] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  6. def addPolicy(options: String, policy: String): Expect[Either[ErrorCase, Unit]]

    Permalink

    Creates policy using options.

    Creates policy using options.

    This operation is idempotent, that is, if this method is invoked twice for the same principal it will be successful in both invocations. This means that this operation can be repeated or retried as often as necessary without causing unintended effects.

    Kadmin will be started with the doOperation method, that is, a password authentication will performed as specified in the configuration.

    options

    the parameters to pass to the kadmin add_policy operation. See Add Policy (MIT Kerberos) for a full list. The parameters are not checked for validity.

    policy

    the policy to create.

    returns

    an Expect that creates policy.

  7. def addPrincipal(options: String, principal: String, newPassword: Option[String] = None, randKey: Boolean = false, keysalt: Option[String] = None): Expect[Either[ErrorCase, Unit]]

    Permalink

    Creates principal using options.

    Creates principal using options. If principal already exists modifyPrincipal will be invoked to make this operation idempotent (see the caveats bellow).

    This operation is idempotent, that is, if this method is invoked twice for the same principal it will be successful in both invocations. This means that this operation can be repeated or retried as often as necessary without causing unintended effects. However there are some caveats: if principal already exists and any of newPassword, randKey or keysalt is defined, then changePassword will be invoked after the modifyPrincipal. Since changePassword is not always idempotent this method might also not be.

    The password is not sent with the "-pw" option so it will not be exposed via the system process list.

    Kadmin will be started with the doOperation method, that is, a password authentication will performed as specified in the configuration.

    options

    the parameters to pass to the kadmin add_principal operation. See Add Principal (MIT Kerberos) for a full list. The parameters are not checked for validity.

    principal

    the principal to create.

    returns

    an Expect that creates principal.

  8. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  9. def changePassword(principal: String, newPassword: Option[String] = None, randKey: Boolean = false, keysalt: Option[String] = None): Expect[Either[ErrorCase, Unit]]

    Permalink

    Changes the principal password to newPassword or sets its key to a random value.

    Changes the principal password to newPassword or sets its key to a random value. Optionally its salt to salt.

    In some cases this operation might not be idempotent. For example: if the policy assigned to principal does not allow the same password to be reused, the first time the password is changed it will be successful, however on the second time it will fail with an ErrorCase PasswordIsBeingReused.

    The password is not sent with the "-pw" option so it will not be exposed via the system process list.

    Kadmin will be started with the doOperation method, that is, a password authentication will performed as specified in the configuration.

    principal

    the principal to change the password.

    newPassword

    the new password

    returns

    an Expect that changes principal password.

  10. def checkPassword(principal: String, password: String): Expect[Either[ErrorCase, Unit]]

    Permalink

    Checks if the password of principal is password.

    Checks if the password of principal is password.

    The check is performed by trying to obtain a ticket with kinit.

    A ticket won't actually be generated since kinit is invoked with the crendentials cache set to /dev/null.

    To obtain a ticket use the function obtainTicketGrantingTicket.

    principal

    the principal to test the password.

    password

    the password to test.

    returns

    an Expect that checks if the password of principal is password.

  11. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  12. def createKeytab(options: String, principal: String): Expect[Either[ErrorCase, Unit]]

    Permalink

    Creates a keytab for the given principal.

    Creates a keytab for the given principal. The keytab can then be obtained with the obtainKeytab method.

    This operation is NOT idempotent, since multiple invocations lead to the keytab file being appended with the same tickets but with different keys.

    options

    the options to pass to the ktadd command. These are not check for validity.

    principal

    the principal for whom to create the keytab.

    returns

    an Expect that creates the keytab for principal.

  13. def deletePolicy(policy: String): Expect[Either[ErrorCase, Unit]]

    Permalink

    Deletes policy.

    Deletes policy.

    This operation is idempotent, that is, if this method is invoked twice for the same principal it will be successful in both invocations. This means that this operation can be repeated or retried as often as necessary without causing unintended effects.

    Kadmin will be started with the doOperation method, that is, a password authentication will performed as specified in the configuration.

    policy

    the policy to delete.

    returns

    an Expect that deletes policy.

  14. def deletePrincipal(principal: String): Expect[Either[ErrorCase, Unit]]

    Permalink

    Deletes principal.

    Deletes principal.

    This operation is idempotent, that is, if this method is invoked twice for the same principal it will be successful in both invocations. This means that this operation can be repeated or retried as often as necessary without causing unintended effects.

    Kadmin will be started with the doOperation method, that is, a password authentication will performed as specified in the configuration.

    principal

    the principal to delete.

    returns

    an Expect that deletes principal.

  15. def doOperation[R](f: (Expect[Either[ErrorCase, R]]) ⇒ Unit): Expect[Either[ErrorCase, R]]

    Permalink

    Creates an Expect that performs a kadmin operation f and then quits kadmin.

    Creates an Expect that performs a kadmin operation f and then quits kadmin. If the configuration password-authentication is set to true then the authentication is performed by sending password and waiting for either an error message saying the password was incorrect or the kadmin prompt. If the password was incorrect a Left(IncorrectPassword) will be returned.

    R

    the type for the Right of the Either returned by the Expect.

    f

    the kerberos administration operation to perform.

    returns

    an Expect that performs the operation f and then quits kadmin.

    Example:
    1. doOperation { e =>
        e.expect(KadminPrompt)
          .sendln(s"getprinc fullPrincipal")
      }
  16. def ensuring(cond: (Kadmin) ⇒ Boolean, msg: ⇒ Any): Kadmin

    Permalink
    Implicit information
    This member is added by an implicit conversion from Kadmin to Ensuring[Kadmin] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  17. def ensuring(cond: (Kadmin) ⇒ Boolean): Kadmin

    Permalink
    Implicit information
    This member is added by an implicit conversion from Kadmin to Ensuring[Kadmin] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  18. def ensuring(cond: Boolean, msg: ⇒ Any): Kadmin

    Permalink
    Implicit information
    This member is added by an implicit conversion from Kadmin to Ensuring[Kadmin] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  19. def ensuring(cond: Boolean): Kadmin

    Permalink
    Implicit information
    This member is added by an implicit conversion from Kadmin to Ensuring[Kadmin] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  20. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  21. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  22. def expirePrincipal(principal: String, expirationDateTime: ExpirationDateTime = DateTime.now()): Expect[Either[ErrorCase, Unit]]

    Permalink

    Sets the principal expiration date time to expirationDateTime.

    Sets the principal expiration date time to expirationDateTime.

    To expire the principal immediately:

    expirePrincipal(principal)

    To expire the principal 2 days from now:

    expirePrincipal(principal, 2.days)

    To ensure a principal never expires:

    expirePrincipal(principal, Never)

    This operation is idempotent, that is, if this method is invoked twice for the same principal it will be successful in both invocations. This means that this operation can be repeated or retried as often as necessary without causing unintended effects.

    Kadmin will be started with the doOperation method, that is, a password authentication will performed as specified in the configuration.

    principal

    the principal to expire.

    expirationDateTime

    the datetime to set as the principal expiration date. The timezone will be ignored.

    returns

    an Expect that expires principal.

  23. def expirePrincipalPassword(principal: String, expirationDateTime: ExpirationDateTime = DateTime.now(), force: Boolean = false): Expect[Either[ErrorCase, Unit]]

    Permalink

    Set the password expiration date of principal to datetime (with some caveats, read below).

    Set the password expiration date of principal to datetime (with some caveats, read below).

    This method might not change the password expiration date time. This is due to the fact that principal might have a policy that imposes a limit on how soon the password can expire and datetime comes sooner than that limit.

    To guarantee that the date will actually change it is necessary to clear the principal policy. This can be achieved by invoking this method with force set to true. If you do so, then it is your responsibility to change, at a later time, the policy back to the intended one. However bear in mind that doing so might cause the expiration date to revert back to the one defined by the policy.

    WARNING when this method is invoked with force set to false and the password expiration date does not change (due to the policy) getPasswordExpirationDate will return the original date (the one set by the policy). However if the policy is cleared and getPasswordExpirationDate is invoked again, the obtained datetime will be the one set by this method. This caveat comes from the kadmin utility and not from this library.

    Due to its caveats this method SHOULD ONLY BE USED FOR DEBUGGING applications where the fact that the principal password is about to expire or has expired changes the behavior of the application.

    Kadmin will be started with the doOperation method, that is, a password authentication will performed as specified in the configuration.

    principal

    the principal to set the password expiration date.

    expirationDateTime

    the datetime to set as the password expiration date. The timezone will be ignored.

    force

    whether or not to clear the principal policy. By default this is set to false.

    returns

    an Expect that sets the password expiration date of principal to date.

  24. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  25. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Kadmin to StringFormat[Kadmin] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  26. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  27. def getFullPrincipalName(principal: String): String

    Permalink
  28. def getKeytabFile(principal: String): File

    Permalink

    returns

    The File for the principal keytab.

  29. def getPolicy(policy: String): Expect[Either[ErrorCase, Policy]]

    Permalink

    Performs a "get_policy $$policy" and parses the output to the domain class Policy.

    Performs a "get_policy $$policy" and parses the output to the domain class Policy.

    Kadmin will be started with the doOperation method, that is, a password authentication will performed as specified in the configuration.

    policy

    the policy name.

    returns

    an Expect that returns the Policy.

  30. def getPrincipal(principal: String): Expect[Either[ErrorCase, Principal]]

    Permalink

    Performs a "get_principal principal" and parses the output to the domain class Principal.

    Performs a "get_principal principal" and parses the output to the domain class Principal.

    Kadmin will be started with the doOperation method, that is, a password authentication will performed as specified in the configuration.

    principal

    the principal name.

    returns

    an Expect that returns the Principal.

  31. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  32. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  33. def listPrincipals(expressionGlob: String): Expect[Either[ErrorCase, Seq[String]]]

    Permalink

    List all principals matching the glob expression.

    List all principals matching the glob expression.

    If expressionGlob is the empty String all principals will be listed.

    expressionGlob

    the glob expression to pass to kadmin list_principals.

    returns

    an Expect that returns the list of principals.

  34. lazy val logger: Logger

    Permalink
    Attributes
    protected
    Definition Classes
    LazyLogging
  35. def modifyPolicy(options: String, policy: String): Expect[Either[ErrorCase, Unit]]

    Permalink

    Modifies policy using options.

    Modifies policy using options.

    This operation is idempotent, that is, if this method is invoked twice for the same principal it will be successful in both invocations. This means that this operation can be repeated or retried as often as necessary without causing unintended effects.

    Kadmin will be started with the doOperation method, that is, a password authentication will performed as specified in the configuration.

    options

    the parameters to pass to the kadmin modify_policy operation. See Modify policy (MIT Kerberos) for a full list. The parameters are not checked for validity.

    policy

    the principal to policy.

    returns

    an Expect that modifies policy.

  36. def modifyPrincipal(options: String, principal: String): Expect[Either[ErrorCase, Unit]]

    Permalink

    Modifies principal using options.

    Modifies principal using options.

    Kadmin will be started with the doOperation method, that is, a password authentication will performed as specified in the configuration.

    options

    the parameters to pass to the kadmin modify_principal operation. See Modify Principal (MIT Kerberos) for a full list. The parameters are not checked for validity.

    principal

    the principal to modify.

    returns

    an Expect that modifies principal.

  37. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  38. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  39. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  40. def obtainKeytab(principal: String): Either[ErrorCase, Array[Byte]]

    Permalink

    Obtains a keytab for the given principal.

    Obtains a keytab for the given principal. If the principal does not have a keytab or the keytab exists but it isn't readable by the current user a None will be returned.

    principal

    the principal to obtain the keytab.

  41. val settings: Settings

    Permalink
  42. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  43. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  44. def unknownError[R](expectBlock: ExpectBlock[Either[ErrorCase, R]]): RegexWhen[Either[ErrorCase, R]]

    Permalink
  45. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  46. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  47. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. def withPolicy[R](policy: String)(f: (ExpectBlock[Either[ErrorCase, R]]) ⇒ Unit): Expect[Either[ErrorCase, R]]

    Permalink

    Performs the operation f over the output returned by "get_policy $$policy".

    Performs the operation f over the output returned by "get_policy $$policy". This is useful to read the policy attributes.

    Kadmin will be started with the doOperation method, that is, a password authentication will performed as specified in the configuration.

    R

    the type for the Right of the Either returned by the Expect.

    policy

    the policy to get the attributes.

    f

    the operation to perform upon the policy attributes.

    returns

    an Expect that lists the policy attributes, performs the operation f and then quits kadmin.

    Example:
    1. withPolicy(policy){ expectBlock =>
        expectBlock.when("""Minimum password length: (\d+)\n""".r)
          .returning{ m: Match =>
            //m.group(1) will contain the minimum password length.
          }
  49. def withPrincipal[R](principal: String)(f: (ExpectBlock[Either[ErrorCase, R]]) ⇒ Unit): Expect[Either[ErrorCase, R]]

    Permalink

    Performs the operation f over the output returned by "get_principal principal".

    Performs the operation f over the output returned by "get_principal principal". This is useful to read the principal attributes that are not included with getPrincipal.

    Kadmin will be started with the doOperation method, that is, a password authentication will performed as specified in the configuration.

    Consider using the parseDateTime method if f is to parse a date time. And parseDuration method if f is to parse a duration.

    R

    the type for the Right of the Either returned by the Expect.

    principal

    the principal to get the attributes.

    f

    the operation to perform upon the principal attributes.

    returns

    an Expect that lists the principal attributes, performs the operation f and then quits kadmin.

    Example:
    1. withPrincipal(principal){ expectBlock =>
        expectBlock.when("""Maximum ticket life: ([^\n]+)\n""".r)
          .returning{ m: Match =>
            val maximumTicketLife = parseDuration(m.group(1))
          }
  50. def [B](y: B): (Kadmin, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Kadmin to ArrowAssoc[Kadmin] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from LazyLogging

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from Kadmin to any2stringadd[Kadmin]

Inherited by implicit conversion StringFormat from Kadmin to StringFormat[Kadmin]

Inherited by implicit conversion Ensuring from Kadmin to Ensuring[Kadmin]

Inherited by implicit conversion ArrowAssoc from Kadmin to ArrowAssoc[Kadmin]

Ungrouped