|
NAMElibtacplus —
TACACS+ client library
SYNOPSIS#include <taclib.h>
int
void
void
int
int
int
int
char *
char *
void *
char *
struct tac_handle *
int
int
int
int
int
int
int
int
int
int
const char *
DESCRIPTIONThelibtacplus library implements the client side of the
TACACS+ network access control protocol. TACACS+ allows clients to perform
authentication, authorization, and accounting by means of network requests to
remote servers. This library currently supports only the authentication and
authorization portion of the protocol.
INITIALIZATIONTo use the library, an application must first calltac_open () to obtain a struct
tac_handle *, which provides context for subsequent operations. Calls to
tac_open () always succeed unless insufficient virtual
memory is available. If the necessary memory cannot be allocated,
tac_open () returns NULL .
Before issuing any TACACS+ requests, the library must be made
aware of the servers it can contact. The easiest way to configure the
library is to call The library can also be configured programmatically by calls to
CREATING A TACACS+ AUTHENTICATION REQUESTTo begin constructing a new authentication request, calltac_create_authen (). The action,
type, and service arguments must
be set to appropriate values as defined in the TACACS+ protocol specification.
The <taclib.h> header file
contains symbolic constants for these values.
CREATING A TACACS+ AUTHORIZATION REQUESTTo begin constructing a new authorization request, calltac_create_author (). The method,
type, and service arguments must
be set to appropriate values as defined in the TACACS+ protocol specification.
The <taclib.h> header file
contains symbolic constants for these values.
CREATING A TACACS+ ACCOUNTING REQUESTTo begin constructing a new accounting request, calltac_create_acct (). The acct,
action, type, and
service arguments must be set to appropriate values as
defined in the TACACS+ protocol specification. The
<taclib.h> header file
contains symbolic constants for these values.
SETTING OPTIONAL PARAMETERS ON A REQUESTAfter creating a request, various optional parameters may be attached to it through calls totac_set_av (),
tac_set_data (),
tac_set_port (),
tac_set_priv (),
tac_set_rem_addr (), and
tac_set_user (). The library creates its own copies of
any strings provided to these functions, so that it is not necessary for the
caller to preserve them. By default, each of these parameters is empty except
for the privilege level, which defaults to
‘USER ’ privilege.
SENDING THE AUTHENTICATION REQUEST AND RECEIVING THE RESPONSEAfter the TACACS+ authentication request has been constructed, it is sent by means oftac_send_authen (). This function connects to
a server if not already connected, sends the request, and waits for a reply.
On failure, tac_send_authen () returns -1. Otherwise,
it returns the TACACS+ status code and flags, packed into an integer value.
The status can be extracted using the macro
TAC_AUTHEN_STATUS (). Possible status codes, defined in
<taclib.h> , include:
The only flag is the no-echo flag, which can be tested using the
macro EXTRACTING INFORMATION FROM THE SERVER'S AUTHENTICATION RESPONSEAn authentication response packet from the server may contain a server message, a data string, or both. After a successful call totac_send_authen (), this information may be retrieved
from the response by calling tac_get_msg () and
tac_get_data (). These functions return
dynamically-allocated copies of the information from the packet. The caller is
responsible for freeing the copies when it no longer needs them. The data
returned from these functions is guaranteed to be terminated by a null byte.
In the case of SENDING AUTHENTICATION CONTINUE PACKETSIftac_send_authen () returns a value containing one of
the status codes TAC_AUTHEN_STATUS_GETDATA ,
TAC_AUTHEN_STATUS_GETUSER , or
TAC_AUTHEN_STATUS_GETPASS , then the client must
provide additional information to the server by means of a TACACS+ CONTINUE
packet. To do so, the application must first set the packet's user message
and/or data fields using tac_set_msg () and
tac_set_data (). The client then sends the CONTINUE
packet with tac_send_authen (). N.B.,
tac_create_authen () should not be
called to construct a CONTINUE packet; it is used only for the initial
authentication request.
When it receives the CONTINUE packet, the server may again request
more information by returning
SENDING THE AUTHORIZATION REQUEST AND RECEIVING THE RESPONSEAfter the TACACS+ authorization request has been constructed, it is sent by means oftac_send_author (). This function connects to
a server if not already connected, sends the request, and waits for a reply.
On failure, tac_send_author () returns -1. Otherwise,
it returns the TACACS+ status code and number of attribute value (AV) pairs
received packed into an integer value. The status can be extracted using the
macro TAC_AUTHOR_STATUS (). Possible status codes,
defined in <taclib.h> ,
include:
The number of AV pairs received is obtained using
SENDING THE ACCOUNTING REQUEST AND RECEIVING THE RESPONSEAfter the TACACS+ authorization request has been constructed, it is sent by means oftac_send_acct (). This function connects to a
server if not already connected, sends the request, and waits for a reply. On
failure, tac_send_acct () returns -1. Otherwise, it
returns the TACACS+ status code. Possible status codes, defined in
<taclib.h> , include:
EXTRACTING INFORMATION FROM THE SERVER'S AUTHORIZATION RESPONSELike an authentication response packet, an authorization response packet from the server may contain a server message, a data string, or both. Refer to EXTRACTING INFORMATION FROM THE SERVER'S AUTHENTICATION RESPONSE for instruction on extraction of those values.An authorization response packet from the server may also contain
attribute value (AV) pairs. To extract these, use
OBTAINING ERROR MESSAGESThose functions which accept a struct tac_handle * argument record an error message if they fail. The error message can be retrieved by callingtac_strerror (). The message text
is overwritten on each new error for the given struct
tac_handle *. Thus the message must be copied if it is to be preserved
through subsequent library calls using the same handle.
CLEANUPTo free the resources used by the TACACS+ library, calltac_close ().
RETURN VALUESThe following functions return a non-negative value on success. If they detect an error, they return -1 and record an error message which can be retrieved usingtac_strerror ().
The following functions return a
non-
The following functions return a
non-
FILES
SEE ALSOtacplus.conf(5)D. Carrel and Lol Grant, The TACACS+ Protocol, Version 1.78, draft-grant-tacacs-02.txt (Internet Draft). AUTHORSThis software was written by John Polstra and Paul Fraley, and donated to the FreeBSD project by Juniper Networks, Inc.
Visit the GSP FreeBSD Man Page Interface. |