API documentation

This is the tacacs_plus API documentation. It contains the documentation extracted from the docstrings of the various classes, methods, and functions in the tacacs_plus package. If you want to know what a certain function/method does, this is the place to look.

tacacs_plus.client module

source: https://github.com/ansible/tacacs_plus/blob/master/tacacs_plus/client.py

class tacacs_plus.client.TACACSClient(host, port, secret, timeout=10, session_id=None, family=2, version_max=12, version_min=0)

A TACACS+ authentication client. https://datatracker.ietf.org/doc/draft-ietf-opsawg-tacacs

An open source TACACS+ server daemon is available at http://www.shrubbery.net/tac_plus/

account(username, flags, arguments=[], authen_type=1, priv_lvl=0, rem_addr='python_device', port='python_tty0')

Account with a TACACS+ server.

Parameters:
  • username
  • flags – TAC_PLUS_ACCT_FLAG_START, TAC_PLUS_ACCT_FLAG_WATCHDOG, TAC_PLUS_ACCT_FLAG_STOP
  • arguments – The authorization arguments
  • authen_type – TAC_PLUS_AUTHEN_TYPE_ASCII, TAC_PLUS_AUTHEN_TYPE_PAP, TAC_PLUS_AUTHEN_TYPE_CHAP
  • priv_lvl – Minimal Required priv_lvl.
  • rem_addr – AAA request source, default to TAC_PLUS_VIRTUAL_REM_ADDR
  • port – AAA port, default to TAC_PLUS_VIRTUAL_PORT
Returns:

TACACSAccountingReply

Raises:

socket.timeout, socket.error

authenticate(username, password, priv_lvl=0, authen_type=1, chap_ppp_id=None, chap_challenge=None, rem_addr='python_device', port='python_tty0')

Authenticate to a TACACS+ server with a username and password.

Parameters:
  • username
  • password
  • priv_lvl
  • authen_type – TAC_PLUS_AUTHEN_TYPE_ASCII, TAC_PLUS_AUTHEN_TYPE_PAP, TAC_PLUS_AUTHEN_TYPE_CHAP
  • chap_ppp_id – PPP ID when authen_type == ‘chap’
  • chap_challenge – challenge value when authen_type == ‘chap’
  • rem_addr – AAA request source, default to TAC_PLUS_VIRTUAL_REM_ADDR
  • port – AAA port, default to TAC_PLUS_VIRTUAL_PORT
Returns:

TACACSAuthenticationReply

Raises:

socket.timeout, socket.error

authorize(username, arguments=[], authen_type=1, priv_lvl=0, rem_addr='python_device', port='python_tty0')

Authorize with a TACACS+ server.

Parameters:
  • username
  • arguments – The authorization arguments
  • authen_type – TAC_PLUS_AUTHEN_TYPE_ASCII, TAC_PLUS_AUTHEN_TYPE_PAP, TAC_PLUS_AUTHEN_TYPE_CHAP
  • priv_lvl – Minimal Required priv_lvl.
  • rem_addr – AAA request source, default to TAC_PLUS_VIRTUAL_REM_ADDR
  • port – AAA port, default to TAC_PLUS_VIRTUAL_PORT
Returns:

TACACSAuthenticationReply

Raises:

socket.timeout, socket.error

closing(**kwds)
send(body, req_type, seq_no=1)

Send a TACACS+ message body

Parameters:
  • body – packed bytes, i.e., struct.pack(…)
  • req_type – TAC_PLUS_AUTHEN, TAC_PLUS_AUTHOR, TAC_PLUS_ACCT
  • seq_no – The sequence number of the current packet. The first packet in a session MUST have the sequence number 1 and each subsequent packet will increment the sequence number by one. Thus clients only send packets containing odd sequence numbers, and TACACS+ servers only send packets containing even sequence numbers.
Returns:

TACACSPacket

Raises:

socket.timeout, socket.error

sock
version

tacacs_plus.packet module

source: https://github.com/ansible/tacacs_plus/blob/master/tacacs_plus/packet.py

class tacacs_plus.client.TACACSHeader(version, type, session_id, length, seq_no=1, flags=0)
packed
classmethod unpacked(raw)
version_max
version_min
class tacacs_plus.client.TACACSPacket(header, body_bytes, secret)
body
crypt
encrypted
seq_no

tacacs_plus.authentication module

source: https://github.com/ansible/tacacs_plus/blob/master/tacacs_plus/authentication.py

class tacacs_plus.authentication.TACACSAuthenticationStart(username, authen_type, priv_lvl=0, data='', rem_addr='python_device', port='python_tty0')
packed
class tacacs_plus.authentication.TACACSAuthenticationContinue(password, data='', flags=0)
packed
class tacacs_plus.authentication.TACACSAuthenticationReply(status, flags, server_msg, data)
error
getpass
human_status
invalid
classmethod unpacked(raw)
valid

tacacs_plus.authorization module

source: https://github.com/ansible/tacacs_plus/blob/master/tacacs_plus/authorization.py

class tacacs_plus.authorization.TACACSAuthorizationStart(username, authen_method, priv_lvl, authen_type, arguments, rem_addr='python_device', port='python_tty0')
packed
class tacacs_plus.authorization.TACACSAuthorizationReply(status, arg_cnt, server_msg, data, arguments)
error
follow
human_status
invalid
reply
classmethod unpacked(raw)
valid

tacacs_plus.accounting module

source: https://github.com/ansible/tacacs_plus/blob/master/tacacs_plus/accounting.py

class tacacs_plus.accounting.TACACSAccountingStart(username, flags, authen_method, priv_lvl, authen_type, arguments, rem_addr='python_device', port='python_tty0')
packed
class tacacs_plus.accounting.TACACSAccountingReply(status, server_msg, data)
error
follow
human_status
classmethod unpacked(raw)
valid

tacacs_plus.flags module

source: https://github.com/ansible/tacacs_plus/blob/master/tacacs_plus/flags.py

this module contains all the constant flags used to implement the tacacs+ RFC.