Repository navigation
Conditions
The dataset contains a set of conditions that define specific checks to be performed in certain cases. Multiple conditions can be combined by using logical operators AND, OR, parenthesis (, ) and the negation symbol !.
In case of numeric values, the comparison operators >, >=, <, <=, == and != can be used.
Important
The conditions can be used to define additional notes or to dynamically change the requirement level of an element. Each condition MUST return either True or False.
Tip
These conditions can be evaluated automatically by using the dataset combined with TLSAssistant.
The conditions that can be currently verified are:
-
"CA
X" - can be used to perform additional checks on the certificate authority that issued the certificate. The value ofXcan be:- "count" - Returns the number of CAs which issued the certificate. Example: "CA count > 1";
- "publicly trusted" - returns
Trueif the CA is publicly trusted. The check is performed using theTrustedCertsfield from testssl.sh. Example: "CA publicly trusted";
-
"CERTIFICATESIGNATURE
X"/"CERTSIGX" - can be used to check whether the certificate signature algorithmXis enabled or not. For a list of all the possible values, please refer to the "Certificate Signature.md" file. Example: "CERTSIG rsa"; -
"CHECK_AIA
X" - checks if the "Authority Information Access" (AIA) extension's access method isX; -
"CHECK_AKI" - checks if the Authority Key Identifier is compliant with the requirement "Same as subject key identifier in issuing CA certificate; Prohibited: Issuer DN, Serial Number tuple" found in the NIST guidelines;
-
"CHECK_NO_BRAINPOOL" - checks that the current element is enabled only if no brainpool curve is available. If any brainpool curve is enabled the entry becomes a NOT RECOMMENDED and a note is added.
-
"CHECK_CRL_DISTRIBUTION_POINTS
X" - checks if the "CRL Distribution Points" extension contains at least one entry in the fieldX; -
"CHECK_DN" - checks if the Distinguished Name of the certificate is compliant with the requirement "A single value should be encoded in each Relative Distinguished Name (RDN) (the single values that compose the DN). All attributes that are of DirectoryString type should be encoded as a PrintableString.". Example: "CHECK_DN Issuer Distinguished Name - der" or "CHECK_DN Subject Distinguished Name - der";
-
"CHECK_KEYUSAGE
X" - checks if the "KeyUsage" extension in the Certificate has valueX; -
"CHECK_KEY_TYPE
X" - checks if the key type defined in a certificate is compliant with the requirement "The key type should be consistent with the signature algorithm". Example: "CHECK_KEY_TYPE rsa"; -
"CHECK_SAME_KEYUSAGE" - checks if the "KeyUsage" extension's values are consistent with the "extendedKeyUsage"' extension's values.
-
"CHECK_SAN
X" - checks if the "Subject Alternative Name" (SAN) extension's value has typeX; -
"CIPHER
X" - same as CertificateSignature but for the cipher suites; -
"DAYS
operator X" - checks if the certificate is valid for a given range of days Example: "DAYS = 90"; -
"DISABLE_IF
X" - always returnsTrue. If the result of the conditions evaluation isX, the element is disabled. Example: "CHECK_AKI AND DISABLE_IF False"; -
"EXTENSION" - same as CertificateSignature but for the TLS extensions;
-
"GROUPS" - same as CertificateSignature but for the groups;
-
"HASH" - same as CertificateSignature but for the hash algorithms;
-
"KEY" - same as CertificateSignature but for the key lengths;
-
"NOTE_ALWAYS" - it always returns
True. A note is always added to the report for the given element. Example: "NOTE_ALWAYS this is a note"; -
"NOTE_DISABLED" - same as NOTE_ALWAYS but only if the element is disabled;
-
"NOTE_ENABLED" - same as NOTE_ALWAYS but only if the element is enabled;
-
"NOTE_FALSE" - same as NOTE_ALWAYS but only if the result of the conditions evaluation is
False; -
"NOTE_TRUE" - same as NOTE_ALWAYS but only if the result of the conditions evaluation is
True; -
"PRIORITY
X" - it always returnsTrue. Used to set the ordering (higher better) of elements. When generating configurations with TLSAssistant this order is used. Example: "PRIORITY 1"; -
"PROTOCOLS
X" - checks if the given protocol version is enabled. Example: "PROTOCOLS TLS 1.2", -
"THIS or
CategoryElement" - returnsTrueif the current element (the entry in the first column of the row containing this condition) or the alternative element (Element) is enabled. Example: "THIS or PROTOCOLS TLS 1.2". Multiple elements can be checked at the same time by using;as a separator e.g.CertificateSignature rsa;ecdsa. If any of the elements is enabled and the final result of the condition isTrue, all the alternative elements are considered as if they are enabled; -
"TRANSPARENCY
X" - checks the type of certificate transparency used by the certificate. The possible values forXare:- "certificate extension"
- "OCSP extension"
- "TLS extension"
Tip
For more details please refer to Mozilla Docs
-
"VALUE
CategoryvaluecomparisonToCompare" - used to check the value of a given element.-
Category- name of the Markdown file containing the element to compare;-
value- value to be checked; -
comparison- comparison operator. The possible comparison operators are:==,!=,>,>=,<,<=; -
ToCompare- indicates which value to check against. Example: "VALUE Certificate 2 == X.509 version"
-
-
Important
If the target element is contained inside a dictionary, the syntax [field][subfield] can be used together with the in, not in operators. Example: VALUE Certificate * in [Issuer Distinguished Name][CN];
Tip
TLSAssistant does not support the use of the VALUE condition for the CertificateExtensions sheet, a new condition for each element should be defined instead.
-
"VERIFY_SCSV" - checks if the server offers the
fallback_SCSVcipher suite; -
"VLP
X" - checks if any TLS version up to v1.2 (included) is enabled. If so, it checks ifXisTrueorFalse. IfXisFalse, the element's level becomes "MUST NOT". Otherwise, it checks if the result of the version check is consistent withX. Example: "VLP False"; -
"YEAR
X" - returnsTrueif the execution date is before 31-dec-X(included). IfXends with “+” then the condition is always considered to beTrue; -
"YEARS
operator X" - checks if the certificate is valid for a given range of years. Example: "YEARS <= 3";
To automate the check of a new condition, you have to:
- write the function with the
fn(**kwargs): boolsignature; - add the new function as a method to the CustomFunctions class, found in
modules/compliance/compliance_base.py; - (optional) define an alias for the function in the
configs/compliance/condition instructions.jsonfile.