security AuthN & AuthZ¶
Authentication and Authorization with Secure PVAccess
Authentication (AuthN) determines and verifies the identity of a client or server.
Authorization (AuthZ) defines and enforces access rights to PV resources.
Secure PVAccess enhances Long Running Certificates with fine-grained control based on:
Authentication Mode
Authentication Method
Certifying Authority
Protocol
Authentication Modes¶
Mutual
: Both client and server are authenticated via certificates (spva:METHOD
isx509
)Server-only
: Only server is authenticated via certificate (spva:METHOD
isca
oranonymous
, butPROTOCOL
istls
)Un-authenticated
: Credentials supplied inAUTHZ
message (legacy:METHOD
isca
)Unknown
: No credentials (legacy:METHOD
isanonymous
)
Legacy Authentication Mode¶
Methods:
anonymous
-Unknown
ca
-Un-authenticated

Optional
AUTHZ
message from client:
AUTHZ method: ca
AUTHZ user: george
AUTHZ host: McInPro.level-n.com
Server uses PeerInfo structure:
PeerInfo fields map to
asAddClient
parameters …for authorization through the
ACF
definitions ofUAG
andASG
…to control access to PVs
Secure PVAccess Authentication Mode¶
Methods:
server:
x509
/ client:x509
-Mutual
server:
x509
-Server-Only

Client Identity optionally established via X.509 certificate during TLS handshake:
CN: greg
O: SLAC.stanford.edu
OU: SLAC National Accelerator Laboratory
C: US
EPICS agent optionally verifies certificate via trust chain
PeerCredentials structure provides peer information:
Extended
asAddClientIdentity()
function provides
Secure authorization control enhanced with:
METHOD
AUTHORITY
PROTOCOL
through the ACF definitions of ASGs …
to control access to PVs
Authentication Method¶
anonymous Method¶
No credentials are supplied.
ca Method¶
Unauthenticated credentials are supplied in AUTHZ
message.
x509 Method¶
A new Authentication Method is added with Secure PVAccess - x509
.
With x509
EPICS clients provde authenticated credentials in the form of an X.509 certificate.
Optionally EPICS clients can use a variety of Site Authenticators that can create an X.509 certificate from a variety of sources including
Kerberos
LDAP
Standard Authenticator (Just provide a username and optional organization)
The x509 authentication method integrates with Secure PVAccess via a PKCS#12 keychain file using the certificates and keys that it contains.
Protocol¶
The Protocol is the method used to transport the identity of an EPICS agent to its peer.
TLS
- Transport Layer Security (Secure PVAccess)TCP
- Transmission Control Protocol (Legacy)
The TLS protocol is negotiated during the TLS handshake using the X.509 certificate provided by the server and optionally by the client.
Site Authenticators¶
Authenticators are ways of generating the certificate and placing it in the PKCS#12 keychain file,
using credentials (tickets, tokens, or other identity-affirming methods) from existing authentication methods
that may be in use at a particular site. The simplest is called “Standard Authenticator” (std
) and it
allows a user to create an arbitrary x509 certificate that has to be APPROVED
by a network administrator before
it is allowed on the network.
Tools that start with authn
e.g. authnstd
are the commandline interfaces to these Authenticators.
Reference Authenticators¶
TYPE 0
- Basic Credentials¶
Uses basic information:
CN: Common name
Commandline flag:
-n
--name
Username
O: Organisation
Commandline flag:
-o
--organization
Hostname
IP address
OU: Organisational Unit
Commandline flag:
--ou
C: Country
Commandline flag:
-c
--country
Locale (not reliable)
Default = “US”
No verification performed
Certificates start in
PENDING_APPROVAL
stateRequires administrator approval
TYPE 1
- Independently Verifiable Tokens¶
Tokens verified independently or via endpoint (e.g., JWT)
Verification methods:
Token signature verification
Token payload validation
Verification endpoint calls
TYPE 2
- Source Verifiable Tokens¶
Requires programmatic API integration (e.g., Kerberos)
Adds verifiable data to Certificate Creation Request (CCR) message
PVACMS uses method-specific libraries for verification
Common Environment Variables for all Authenticators¶
Configuration options for Standard Authenticator
Name |
Keys and Values |
Description |
---|---|---|
<number of minutes>
e.g.
1y for 1 year |
Amount of minutes before the certificate expires.
e.g. 1d or 1y 2w 1d or 24h
Where:
1y = 365 days
1M = 30 days
1w = 7 days
|
|
EPICS_PVA_AUTH
_NAME
|
{name to use}
e.g.
archiver
e.g. IOC1 e.g.
greg |
Name to use in new certificates
|
EPICS_PVAS_AUTH
_NAME
|
||
EPICS_PVA_AUTH
_ORGANIZATION
|
{organization to use}
e.g.
site.epics.org
e.g. SLAC.STANFORD.EDU e.g.
KLYS:LI01:101 e.g.
centos07 |
Organization to use in new certificates
|
EPICS_PVAS_AUTH
_ORGANIZATION
|
||
ORGANIZATIONAL_UNIT
|
{organization unit to use}
e.g.
data center
e.g. ops e.g.
prod e.g.
remote |
Organization Unit to use in new certificates
|
ORGANIZATIONAL_UNIT
|
||
EPICS_PVA_AUTH
_COUNTRY
|
{country to use}
e.g.
US
e.g. CA |
Country to use in new certificates.
Must be a two digit country code
|
EPICS_PVAS_AUTH
_COUNTRY
|
||
EPICS_PVA_AUTH
_ISSUER
|
{issuer of cert. mgmt. service}
e.g.
f0a9e1b8 |
The issuer ID to contact for any certificate operation.
Must be am 8 character SKID
If there are PVACMS’s from different certificate authorities
on the network, this allows you to specify the one you want
|
EPICS_PVAS_AUTH
_ISSUER
|
||
EPICS_PVA_CERT
_PV_PREFIX
|
{certificate mgnt. prefix}
e.g.
SLAC_CERTS |
Specify the prefix for the PVACMS PV to contact for new certificates
default
CERT |
EPICS_PVAS_CERT
_PV_PREFIX
|
Included Reference Authenticators¶
Though it is recommended that you create your own site-specific Authenticators PVXS provides four reference implementations:
authnstd
: Standard Authenticator - Uses explicitly specified and unverified credentialsauthnkrb
: Kerberos Authenticator - Kerberos credentials verified by the KDCauthnldap
: LDAP Authenticator - Login to LDAP directory to establish identity
authstd Configuration and Usage¶
This Authenticator is used for explicitly specified and unverified credentials. It can be used to create a certificate with a username and hostname.
CN
field in the certificate will be the logged in usernameunless the
-n
--name
commandline option is setunless the
EPICS_PVA_AUTH_NAME
,EPICS_PVAS_AUTH_NAME
environment variable is set
O
field in the certificate will be the hostname or ip addressunless the
-o
--organization
commandline option is setunless the
EPICS_PVA_AUTH_ORGANIZATION
,EPICS_PVAS_AUTH_ORGANIZATION
environment variable is set
OU
field in the certificate will not be setunless the
--ou
commandline option is setunless the
EPICS_PVA_AUTH_ORGANIZATIONAL_UNIT
,EPICS_PVAS_AUTH_ORGANIZATIONAL_UNIT
environment variable is set
C
field in the certificate will be set to the local country codeunless the
-c
--country
commandline option is setunless the
EPICS_PVA_AUTH_COUNTRY
,EPICS_PVAS_AUTH_COUNTRY
environment variable is set
usage
Uses the standard EPICS_PVA_TLS_<name>
environment variables to determine the keychain,
and password file locations.
authnstd - Secure PVAccess Standard Authenticator
Generates client, server, or ioc certificates based on the Standard Authenticator.
Uses specified parameters to create certificates that require administrator APPROVAL before becoming VALID.
usage:
authnstd [options] Create certificate in PENDING_APPROVAL state
authnstd (-h | --help) Show this help message and exit
authnstd (-V | --version) Print version and exit
options:
(-u | --cert-usage) <usage> Specify the certificate usage. client|server|ioc. Default `client`
(-n | --name) <name> Specify common name of the certificate. Default <logged-in-username>
(-o | --organization) <organization> Specify organisation name for the certificate. Default <hostname>
--ou <org-unit> Specify organisational unit for the certificate. Default <blank>
(-c | --country) <country> Specify country for the certificate. Default locale setting if detectable otherwise `US`
(-t | --time) <minutes> Duration of the certificate in minutes. e.g. 30 or 1d or 1y3M2d4m
(-D | --daemon) Start a daemon that re-requests a certificate on expiration`
--cert-pv-prefix <cert_pv_prefix> Specifies the pv prefix to use to contact PVACMS. Default `CERT`
--add-config-uri Add a config uri to the generated certificate
--force Force overwrite if certificate exists
(-a | --trust-anchor) Download Trust Anchor into keychain file. Do not create a certificate
(-s | --no-status) Request that status checking not be required for this certificate
(-i | --issuer) <issuer_id> The issuer ID of the PVACMS service to contact. If not specified (default) broadcast to any that are listening
(-v | --verbose) Verbose mode
(-d | --debug) Debug mode
Examples
# create a client certificate for greg@slac.stanford.edu
authnstd -u client -n greg -o slac.stanford.edu
# create a server certificate for IOC1
authnstd -u server -n IOC1 -o "KLI:LI01:10" --ou "FACET"
# create a client certificate for current user with no status monitoring
authnstd --no-status
# create a ioc certificate for gateway1
authnstd -u ioc -n gateway1 -o bridge.ornl.gov --ou "Networking"
# Download the Trust Anchor into your keychain file for server-only authenticated connections
authnstd --trust-anchor
Setup of standard authenticator in Docker Container for testing
In the source code under /examples/docker/spva_std
you’ll find a Dockerfile and supporting resources for creating an environment
that contains a working Secure PVAccess with the following characteristics:
users (unix)
pvacms
- serviceadmin
- principal with password “secret” (includes a configured PVACMS administrator certificate)softioc
- service principal with password “secret”client
- principal with password “secret”
services
PVACMS
authkrb Configuration and Usage¶
This Authenticator is a TYPE 2
Authenticator.
It can be used to create a certificate from a Kerberos ticket.
A user will need to have a Kerberos ticket to use this Authenticator typically
using the kinit
command.
kinit -l 24h greg@SLAC.STANFORD.EDU
CN
field in the certificate will be kerberos usernameO
field in the certificate will be the kerberos realmOU
field in the certificate will not be setC
field in the certificate will be set to the local country code
usage
Uses the standard EPICS_PVA_TLS_<name>
environment variables to determine the keychain,
and password file locations.
authnkrb - Secure PVAccess Kerberos Authenticator
Generates client, server, or ioc certificates based on the kerberos Authenticator.
Uses current kerberos ticket to create certificates with the same validity as the ticket.
usage:
authnkrb [options] Create certificate
authnkrb (-h | --help) Show this help message and exit
authnkrb (-V | --version) Print version and exit
options:
(-u | --cert-usage) <usage> Specify the certificate usage. client|server|ioc. Default ``client``
--krb-validator <service-name> Specify kerberos validator name. Default ``pvacms``
--krb-realm <krb-realm> Specify the kerberos realm. If not specified we'll take it from the ticket
(-D | --daemon) Start a daemon that re-requests a certificate on expiration`
--cert-pv-prefix <cert_pv_prefix> Specifies the pv prefix to use to contact PVACMS. Default `CERT`
--add-config-uri Add a config uri to the generated certificate
--force Force overwrite if certificate exists
(-s | --no-status) Request that status checking not be required for this certificate
(-i | --issuer) <issuer_id> The issuer ID of the PVACMS service to contact. If not specified (default) broadcast to any that are listening
(-v | --verbose) Verbose mode
(-d | --debug) Debug mode
Extra options that are available in PVACMS
usage:
pvacms [kerberos options] Run PVACMS. Interrupt to quit
kerberos options
--krb-keytab <keytab file> kerberos keytab file for non-interactive login`
--krb-realm <realm> kerberos realm. Default ``EPICS.ORG``
--krb-validator <validator-service> pvacms kerberos service name. Default ``pvacms``
Environment Variables for PVACMS AuthnKRB Verifier
The environment variables and parameters in the following table configure the Kerberos Credentials Verifier for PVACMS at runtime.
Env. authnkrb |
Env. pvacms |
Params. authkrb |
Params. pvacms |
Keys and Values |
Description |
---|---|---|---|---|---|
KRB5_KTNAME
|
--krb-keytab |
{string location of keytab file}
|
|||
KRB5_CLIENT_KTNAME
|
|||||
EPICS_AUTH_KRB_VALIDATOR_SERVICE
|
--krb-validator |
{this is validator service name}
e.g.
pvacms |
The name of the service user created in the KDC that the pvacms
service will log in as.
/cluster@{realm} will be added |
||
EPICS_AUTH_KRB_REALM
|
--krb-realm |
e.g.
EPICS.ORG |
Kerberos REALM to authenticate against
|
Setup of Kerberos in Docker Container for testing
In the source code under /examples/docker/spva_krb
you’ll find a Dockerfile and supporting resources for creating an environment
that contains a working kerberos KDC with the following characteristics:
users (both unix and kerberos principals)
pvacms
- service principal with private keytab file for authentication in~/.config/pva/1.3/pvacms.keytab
admin
- principal with password “secret” (includes a configured PVACMS administrator certificate)softioc
- service principal with password “secret”client
- principal with password “secret”
services
KDC
kadmin Daemon
PVACMS
authldap Configuration and Usage¶
This Authenticator is a TYPE 2
Authenticator.
It can be used to create a certificate by logging in to the LDAP directory service.
A user will be prompted to log in to the LDAP directory service to verify their identity.
CN
field in the certificate will be LDAP usernameO
field in the certificate will be the LDAP domain parts concatenated with “.”OU
field in the certificate will not be setC
field in the certificate will be set to the local country code
usage
Uses the standard EPICS_PVA_TLS_<name>
environment variables to determine the keychain,
and password file locations.
authnldap - Secure PVAccess LDAP Authenticator
Generates client, server, or ioc certificates based on the LDAP credentials.
usage:
authnldap [options] Create certificate in PENDING_APPROVAL state
authnldap (-h | --help) Show this help message and exit
authnldap (-V | --version) Print version and exit
options:
(-u | --cert-usage) <usage> Specify the certificate usage. client|server|ioc. Default `client`
(-n | --name) <name> Specify LDAP username for common name in the certificate.
e.g. name ==> LDAP: uid=name, ou=People ==> Cert: CN=name
Default <logged-in-username>
(-o | --organization) <organization> Specify LDAP org for organization in the certificate.
e.g. epics.org ==> LDAP: dc=epics, dc=org ==> Cert: O=epics.org
Default <hostname>
(-p | --password) <name> Specify LDAP password. If not specified will prompt for password
--ldap-host <hostname> LDAP server host
--ldap-port <port> LDAP serever port
(-D | --daemon) Start a daemon that re-requests a certificate on expiration`
--cert-pv-prefix <cert_pv_prefix> Specifies the pv prefix to use to contact PVACMS. Default `CERT`
--add-config-uri Add a config uri to the generated certificate
--force Force overwrite if certificate exists
(-s | --no-status) Request that status checking not be required for this certificate
(-i | --issuer) <issuer_id> The issuer ID of the PVACMS service to contact. If not specified (default) broadcast to any that are listening
(-v | --verbose) Verbose mode
(-d | --debug) Debug mode
Extra options that are available in PVACMS
usage:
pvacms [ldap options] Run PVACMS. Interrupt to quit
ldap options
--ldap-host <host> LDAP Host. Default localhost
--ldap-port <port> LDAP port. Default 389
Environment Variables for authnldap and PVACMS AuthnLDAP Verifier
The environment variables and parameters in the following table configure the authnldap client and LDAP Credentials Verifier for PVACMS at runtime.
Env. authnldap |
Env. pvacms |
Params. authldap |
Params. pvacms |
Keys and Values |
Description |
---|---|---|---|---|---|
EPICS_AUTH_LDAP
_ACCOUNT_PWD_FILE
|
{location of password file}
e.g.
~/.config/ldap.pass/ |
file containing password for the given LDAP user account
|
|||
-p --password |
{LDAP account password}
e.g.
secret |
password for the given LDAP user account
|
|||
EPICS_AUTH_LDAP_HOST
|
--ldap-host |
{hostname of LDAP server}
e.g.
ldap.stanford.edu |
Trusted hostname of the LDAP server
|
||
EPICS_AUTH_LDAP_PORT
|
--ldap-port |
<port_number>
e.g.
389 |
LDAP server port number. Default is 389
|
Setup of LDAP in Docker Container for testing
In the source code under /examples/docker/spva_ldap
you’ll find a Dockerfile and supporting resources for creating an environment
that contains a working LDAP with the following characteristics:
users (both unix and LDAP users)
pvacms
- service with verifier for LDAP serviceadmin
- principal with password “secret” (includes a configured PVACMS administrator certificate)softioc
- service principal with password “secret”client
- principal with password “secret”
services
LDAP service + example schemas
PVACMS
Long Running Certificates¶
In Experimental Physics and Industrial Control Systems, maintaining uninterrupted connections is critical. Even a microsecond break can trigger fail-safety mechanisms that might disrupt experiments.
With TLS 1.3 (implemented in OpenSSL), renegotiation has been completely removed from the protocol due to serious security vulnerabilities. Previous versions of TLS allowed session renegotiation, which permitted changing security parameters (including certificates) without closing the connection. However, this feature was exploited in several attacks, including the “Triple Handshake Attack” and “Secure Renegotiation” vulnerabilities.
This means that once a TLS connection has been established with an IOC over Secure PVAccess, we cannot change the certificate without breaking and re-establishing the connection. Our solution to this problem involves:
Creating very long running certificates (decades)
Allowing them to be
REVOKED
by administrators when necessaryImplementing a kind of “soft-expiration” tied to authenticator configuration
Providing the ability to renew certificates without breaking existing connections
Specifying long running certificates¶
Common to all Authenticators - commandline parameters¶
Use the -t,--time
flag to specify a duration for the certificate using these components:
y
- Years (e.g.,2y
for two years)M
- Months (e.g.,6M
for six months)w
- Weeks (e.g.,1w
for one week)d
- Days (e.g.,15d
for 15 days)h
- Hours (e.g.,12h
for 12 hours)m
- Minutes (e.g.,30m
for 30 minutes, or simply30
)s
- Seconds (e.g.,45s
for 45 seconds)
Examples:
1y and 6M
- one year and six months2y3M15d
- two years, three months, and 15 days
The system uses natural time understanding, accounting for daylight savings, leap years, etc. For example, if you specify 1 year, the certificate will expire on the same calendar day next year, regardless of leap years.
Common to all Authenticators - environment variables¶
EPICS_AUTH_CERT_VALIDITY_MINS
- sets a global duration for any Authenticator using the same format as the commandline parameter.
PVACMS Defaults - Parameters¶
PVACMS defaults to 6 months for certificate duration unless overridden by:
--cert_validity
- default duration for all certificates--cert_validity-client
- default for client certificates--cert_validity-server
- default for server certificates--cert_validity-ioc
- default for IOC certificates--disallow-custom-durations
- prevents clients from specifying durations for any certificates--disallow-custom-durations-client
- restricts custom durations for client certificates--disallow-custom-durations-server
- restricts custom durations for server certificates--disallow-custom-durations-ioc
- restricts custom durations for IOC certificates
PVACMS Defaults - Environment Variables¶
Values can also be set using environment variables:
EPICS_PVACMS_CERT_VALIDITY
- default duration for all certificatesEPICS_PVACMS_CERT_VALIDITY_CLIENT
- default for client certificatesEPICS_PVACMS_CERT_VALIDITY_SERVER
- default for server certificatesEPICS_PVACMS_CERT_VALIDITY_IOC
- default for IOC certificatesEPICS_PVACMS_DISALLOW_CUSTOM_DURATION
- YES/NO to prevent custom durations for any certificatesEPICS_PVACMS_DISALLOW_CLIENT_CUSTOM_DURATION
- YES/NO for client certificatesEPICS_PVACMS_DISALLOW_SERVER_CUSTOM_DURATION
- YES/NO for server certificatesEPICS_PVACMS_DISALLOW_IOC_CUSTOM_DURATION
- YES/NO for IOC certificates
The Authenticator Controls the Certificate Renewal Date¶
The actual time before a certificate needs renewal is determined by the Authenticator (and by extension, the network administrators controlling the authentication methods).
This is known as the Authenticated Expiration Date:
Standard Authenticator: Default is 6 months with no upper limit (subject to admin approval)
Kerberos: Limited by service ticket lifetime (typically 1 day)
LDAP: Limited by server default (typically 1 day)
Mapping requested duration to certificate expiration¶
Two critical dates govern certificate lifecycle:
Requested Duration → Certificate Expiration Date: When the certificate becomes invalid
Authenticated Expiration → Certificate Renew-By Date: When the certificate should be renewed
The PVACMS will change a certificate’s status from VALID
to PENDING_RENEWAL
when it reaches the
renew-by date. Certificates in this state can’t establish new connections, but existing connections
can continue until the certificate is renewed.
How do we enforce Renew By dates¶
All certificates with renew-by dates must have certificate status monitoring enabled. If status monitoring is disabled for the PVACMS server, generating certificates with renew-by dates will be forbidden.
Secure PVAccess monitors certificate status and reacts to state changes:
VALID
: Certificate is operationalPENDING_RENEWAL
: Certificate needs renewal but isn’t revokedREVOKED
/EXPIRED
: Certificate is permanently invalidated
When a certificate transitions to PENDING_RENEWAL
:
IOCs/servers will only accept TCP connections (no TLS)
Clients won’t search for TLS protocol services
Monitoring consoles will pause until certificate renewal
Renewing certificates¶
To renew a certificate, simply perform the same action used to get the original certificate. PVACMS will:
Recognize that the certificate is for the same subject
Automatically renew it
Keep both the new certificate and the original one active
This means:
Existing connections using the long-running certificate continue without interruption
New connections will use the newer certificate
You can renew certificates multiple times, and the system will always keep the last certificate obtained as well as the original, renewed one.
Best practice: Renew before the certificate enters PENDING_RENEWAL
state to maintain uninterrupted service. If renewal occurs after the renew-by date, the certificate will automatically transition back to VALID
upon successful renewal.