Auth

This module contains authentication mechanisms to secure your server.

fn auth()

Get authentication credentials from the client.

Effective smtp stage

authenticate only.

Return

  • Credentials - the credentials of the client.

Example

#{
    authenticate: [
       action "log info" || log("info", `${auth()}`),
    ]
}


fn authenticate()

Process the SASL authentication mechanism.

The current implementation support “PLAIN” mechanism, and will call the testsaslauthd program to check the credentials.

The credentials will be verified depending on the mode of saslauthd.

A native implementation will be provided in the future.



fn is_authenticated()

Check if the client is authenticated.

Effective smtp stage

authenticate only.

Return

  • bool - true if the client succeeded to authenticate itself, false otherwise.

Example

#{
    authenticate: [
       action "log info" || log("info", `${is_authenticated()}`),
    ]
}


fn is_secured()

Has the connection been secured under the encryption protocol SSL/TLS

Effective smtp stage

all

Return

  • boolean value (true if the connection is secured, false otherwise)

Example

#{
  mail: [
    action "log ssl/tls" || {
      log("info", `My client is ${if is_secured() { "secured" } else { "unsecured!!!" }}`)
    }
  ]
}