Management of TLS keys and certificates in implemented in NDB
Cluster as the executable utility program
ndb_sign_keys, which can normally be found in
the MySQL bin directory. The program
performs such functions as creating, signing, and retiring keys
and certificates, and normally works as follows:
ndb_sign_keys connects to ndb_mgmd and fetches the cluster' configuration.
For each cluster node that is configured to run on the local machine, ndb_sign_keys finds the node' private key and sign it, creating an active node certificate.
Some additional tasks that can be performed by ndb_sign_keys are listed here:
Obtaining configuration information from a config.ini file rather than a running ndb_mgmd
Creating the cluster' certificate authority (CA) if it does not yet exist
Creating private keys
Saving keys and certificates as pending rather than active
Signing the key for a single node as specified using command-line options described later in this section
Requesting a CA located on a remote host to sign a local key
Options that can be used with ndb_sign_keys are shown in the following table. Additional descriptions follow the table.
-
Command-Line Format --bind-host=hostType String Default Value mgmd, apiCreate a certificate bound to a hostname list of node types that should have certificate hostname bindings, from the set
(mgmd,db,api). -
Command-Line Format --bound-hostname=hostnameType String Default Value [none]Create a certificate bound to the hostname passed to this option.
-
Command-Line Format --CA-cert=nameType File name Default Value NDB-Cluster-certUse the name passed to this option for the CA Certificate file.
-
Command-Line Format --CA-key=nameType File name Default Value NDB-Cluster-private-keyUse the name passed to this option for the CA private key file.
-
Command-Line Format --CA-ordinal=nameType String Default Value [none]Valid Values FirstSecondSet the ordinal CA name; defaults to
Firstfor--create-CAandSecondfor--rotate-CA. The Common Name in the CA certificate is “MySQL NDB ClusterordinalCertificate”, whereordinalis the ordinal name passed to this option. -
Command-Line Format --CA-search-path=nameType File name Default Value [none]Specify a list of directories to search for a CA file. On Unix platforms, the directory names are separated by colons (
:); on Windows systems, the semicolon character (;) is used as the separator. A directory reference may be relative or absolute; it may contain one or more environment variables, each denoted by a prefixed dollar sign ($), and expanded prior to use.Searching begins with the leftmost named directory and proceeds from left to right until a file is found. An empty string denotes an empty search path, which causes all searches to fail. A string consisting of a single dot (
.) indicates that the search path is limited to the current working directory.If no search path is supplied, the compiled-in default value is used. This value depends on the platform used: On Windows, this is
$HOMEPATH\ndb-tls; on other platforms (including Linux), it is$HOME/ndb-tls. This default can be overridden by compiling NDB Cluster using-DWITH_NDB_TLS_SEARCH_PATH. -
Command-Line Format --CA-tool=nameType File name Default Value [none]Designate an executable helper tool, including the path.
-
Command-Line Format --checkCheck certificate expiry dates.
-
Command-Line Format --config-file=fileDisabled by no-configType File name Default Value [none]Supply the path to the cluster configuration file (usually
config.ini). -
Command-Line Format --connect-retries=#Type Integer Default Value 12Minimum Value -1Maximum Value 12Set the number of times that ndb_sign_keys attempts to connect to the cluster. If you use
-1, the program keeps trying to connect until it succeeds or is forced to stop. -
Command-Line Format --connect-retry-delay=#Type Integer Default Value 5Minimum Value 0Maximum Value 5Set the number of seconds after a failed connection attempt which ndb_sign_keys waits before trying again, up to the number of times determined by
--connect-retries. -
Command-Line Format --create-CACreate the CA key and certificate.
-
Command-Line Format --CA-days=#Type Integer Default Value 1461Minimum Value -1Maximum Value 2147483647Set the lifetime of the certificate to this many days. The default is equivalent to 4 years plus 1 day.
-1means the certificate never expires.This option was added in NDB 8.4.1.
-
Command-Line Format --create-keyCreate or replace private keys.
-
Command-Line Format --curve=nameType String Default Value P-256Use the named curve for encrypting node keys.
-
Command-Line Format --defaults-extra-file=pathType String Default Value [none]Read this option file after the global files are read.
-
Command-Line Format --defaults-file=pathType String Default Value [none]Read this option file only.
-
Command-Line Format --defaults-group-suffix=stringType String Default Value [none]Read not only the usual option groups, but also groups with the usual names and a suffix of
string. -
Command-Line Format --duration=#Type Integer Default Value 0Minimum Value -500000Maximum Value 0Unit seconds Set the lifetime of certificates or signing requests, in seconds.
-
Command-Line Format --helpPrint help text and exit.
-
Command-Line Format --keys-to-dir=dirnameType Directory name Default Value [none]Specify output directory for private keys (only); for this purpose, it overrides any value set for
--to-dir. -
Command-Line Format --login-path=pathType String Default Value [none]Read this path from the login file.
-
Command-Line Format --ndb-connectstring=connection_stringType String Default Value [none]Set the connection string to use for connecting to ndb_mgmd, using the syntax
[nodeid=. If this option is set, it overrides the value set forid;][host=]hostname[:port]NDB_CONNECTSTRING(if any), as well as any value set in amy.cnf. file. -
Command-Line Format --ndb-mgm-tls=levelType Enumeration Default Value relaxedValid Values relaxedstrictSets the level of TLS support required for the ndb_mgm client; one of
relaxedorstrict.relaxed(the default) means that a TLS connection is attempted, but success is not required;strictmeans that TLS is required to connect. -
Command-Line Format --ndb-tls-search-path=listType Path name Default Value (Unix) $HOME/ndb-tlsDefault Value (Windows) $HOMEDIR/ndb-tlsSpecify a list of directories containing TLS keys and certificates.
For syntax, see the description of the
--CA-search-pathoption. -
Command-Line Format --no-configDo not obtain the cluster configuration; create a single certificate based on the options supplied (including defaults for those not specified).
-
Command-Line Format --no-defaultsDo not read default options from any option file other than the login file.
-
Command-Line Format --no-login-pathsDo not read login paths from the login path file.
-
Command-Line Format --passphrase=phraseType String Default Value [none]Specify a CA key pass phrase.
-
Command-Line Format --node-id=#Type Integer Default Value 0Minimum Value 0Maximum Value 255Create or sign a key for the node having the specified node ID.
-
Command-Line Format --node-type=setType Set Default Value mgmd,db,apiCreate or sign keys for the specified type or types from the set
(mgmd,db,api). -
Command-Line Format --pendingSave keys and certificates as pending, rather than active.
-
Command-Line Format --print-defaultsPrint the program argument list, then exit.
-
Command-Line Format --promotePromote pending files to active, then exit.
-
Command-Line Format --remote-CA-host=hostnameType String Default Value [none]Specify the address or hostname of a remote CA host.
-
Command-Line Format --remote-exec-pathType Path name Default Value [none]Provide the full path to an executable on the remote CA host specified with
--remote-CA-host. -
Command-Line Format --remote-opensslUse OpenSSL for signing of keys on the remote CA host specified with
--remote-CA-host. -
Command-Line Format --replace-by=#Type Integer Default Value -10Minimum Value -128Maximum Value 127Suggest a certificate replacement date for periodic checks, as a number of days after the CA expiration date. Use a negative number to indicate days before expiration.
-
Command-Line Format --rotate-CAReplace an older CA with a newer one. The new CA can be created using OpenSSL, or you can allow ndb_sign_keys to create the new one, in which case the new CA is created with an intermediate CA certificate, signed by the old CA.
-
Command-Line Format --schedule=listType String Default Value 120,10,130,10,150,0Assign a schedule of expiration dates to certificates. The schedule is defined as a comma-delimited list of six integers, in the format shown here:
api_valid,api_extra,dn_valid,dn_extra,mgm_valid,mgm_extraThese values are defined as follows:
api_valid: A fixed number of days of validity for client certificates.api_extra: A number of extra days for client certificates.dn_valid: A fixed number of days of validity for client certificates for data node certificates.dn_extra: A number of extra days for data node certificates.mgm_valid: A fixed number of days of validity for management server certificates.mgm_extra: A number of extra days for management server certificates.
In other words, for each node type (API node, data node, management node), certificates are created with a lifetime equal to a whole fixed number of days, plus some random amount of time less than or equal to the number of extra days. The default schedule is shown here:
--schedule=120,10,130,10,150,0Following the default schedule, client certificates begin expiring on the 120th day, and expire at random intervals over the next 10 days; data node certificates expire at random times between the 130th and 140th days; and management node certificates expire on the 150th day (with no random interval following).
-
Command-Line Format --signDisabled by skip-signCreate signed certificates; enabled by default. Use
--skip-signto create certificate signing requests instead. -
Command-Line Format --skip-signCreate certificate signing requests instead of signed certificates.
-
Command-Line Format --stdioRead certificate signing requests from
stdin, and write X.509 tostdout. -
Command-Line Format --to-dir=dirnameType Directory name Default Value [none]Specify the output directory for created files. For private key files, this can be overriden using
--keys-to-dir. -
Command-Line Format --usagePrint help text, then exit (alias for
--help). -
Command-Line Format --versionPrint version information, then exit.