OPC UA client certificates
An OPC UA Sign or SignAndEncrypt channel requires a client certificate and matching private key, with trust approved by the Server administrator. The certificate SAN must include URI:urn:taosx-opc:client. Check connectivity after uploading. A channel certificate does not replace user authorization.
Entry point: PowerShell or Bash on the certificate preparation host; taosExplorer → Data Ingestion → OPC UA → Connection Configuration; the OPC UA Server's certificate trust management page.
Security modes Sign and SignAndEncrypt require a client certificate and matching private key, and the Server administrator must trust the certificate. Secure channel certificates establish signed or encrypted channels, while user authentication determines the access identity. Configure the two separately.
1. Prerequisites
- Prepare the OpenSSL command-line tool and run
openssl versionto confirm availability. Windows can also useC:\Program Files\Git\usr\bin\openssl.exebundled with Git for Windows. - Use PEM format for the certificate and private key. A server certificate downloaded from the Server, a DER file, or a PKCS#12 file cannot be entered directly in the client certificate field.
- The client application URI is
urn:taosx-opc:client. The certificate's Subject Alternative Name (SAN) must includeURI:urn:taosx-opc:client. - Have the security administrator confirm the algorithm, validity period, issuer, and private-key custody method. The following self-signed, 365-day example is for isolated integration testing. In production, issue certificates according to organizational policy; this example validity period is not a product requirement.
2. Generate the certificate and private key
Certificates can be generated on a separate preparation host; this does not need to run on the taosX host. The commands below create a new directory and stop if it already exists, avoiding overwriting a private key in use. The generated private key has no passphrase. Restrict access to the relevant administrators and upload it through a protected channel.
- Linux
- Windows
- macOS
Run in Bash. umask 077 restricts new files to the current account. Do not store private keys in shared directories.
set -e
umask 077
certificate_directory="$HOME/taosx-opcua-certificate"
mkdir "$certificate_directory"
cat > "$certificate_directory/client.cnf" <<'EOF'
[req]
distinguished_name = req_dn
x509_extensions = v3_ext
prompt = no
[req_dn]
CN = taosx-opc-client
O = TDengine
[v3_ext]
basicConstraints = CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
extendedKeyUsage = clientAuth, serverAuth
subjectAltName = URI:urn:taosx-opc:client
EOF
openssl req -x509 -newkey rsa:2048 -nodes -days 365 \
-config "$certificate_directory/client.cnf" \
-out "$certificate_directory/client_cert.pem" \
-keyout "$certificate_directory/client_key.pem"
openssl x509 -in "$certificate_directory/client_cert.pem" -noout -subject -dates -ext subjectAltName
openssl x509 -in "$certificate_directory/client_cert.pem" -noout -fingerprint -sha1
Run in PowerShell. If OpenSSL is not on PATH, set $opensslCommand to the actual executable path.
$opensslCommand = 'C:\Program Files\Git\usr\bin\openssl.exe'
$certificateDirectory = Join-Path $HOME 'taosx-opcua-certificate'
if (Test-Path -LiteralPath $certificateDirectory) { throw '目录已存在,请选择新的证书目录。' }
New-Item -ItemType Directory -Path $certificateDirectory -ErrorAction Stop | Out-Null
$configuration = @'
[req]
distinguished_name = req_dn
x509_extensions = v3_ext
prompt = no
[req_dn]
CN = taosx-opc-client
O = TDengine
[v3_ext]
basicConstraints = CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
extendedKeyUsage = clientAuth, serverAuth
subjectAltName = URI:urn:taosx-opc:client
'@
$configurationFile = Join-Path $certificateDirectory 'client.cnf'
$certificateFile = Join-Path $certificateDirectory 'client_cert.pem'
$privateKeyFile = Join-Path $certificateDirectory 'client_key.pem'
Set-Content -LiteralPath $configurationFile -Value $configuration -Encoding ascii
& $opensslCommand req -x509 -newkey rsa:2048 -nodes -days 365 -config $configurationFile -out $certificateFile -keyout $privateKeyFile
if ($LASTEXITCODE -ne 0) { throw '证书生成失败,不要上传不完整文件。' }
& $opensslCommand x509 -in $certificateFile -noout -subject -dates -ext subjectAltName
& $opensslCommand x509 -in $certificateFile -noout -fingerprint -sha1
If using cmd.exe, first generate client.cnf using the PowerShell steps above, then run openssl req -x509 -newkey rsa:2048 -nodes -days 365 -config client.cnf -out client_cert.pem -keyout client_key.pem in the certificate directory. Do not generate certificates into the same files from two terminals simultaneously.
Use OpenSSL with support for x509 -ext, and run the Bash commands on the Linux tab. This only prepares certificates on macOS; it does not mean every industrial collection plugin can run on macOS. If the system tool rejects an option, first confirm that it is OpenSSL rather than another compatible tool.
Check that the output includes URI:urn:taosx-opc:client and that the current time falls within the certificate validity period. The SHA1 fingerprint is only used by some vendor interfaces to identify and bind certificates; it is not a recommendation to use SHA1 as a signature algorithm.
3. Upload and establish trust
- In the OPC UA task's Connection Configuration, upload
client_cert.pemto Secure Channel Certificate andclient_key.pemto Certificate's Private Key. These are the corresponding labels in the English interface. - Match security mode and security policy to the Server endpoint. Then separately select anonymous, username/password, or user-certificate authentication. Select anonymous only when the source explicitly allows it.
- Run a connectivity check. A Server may reject a new certificate before it is trusted. A first failed check alone does not establish that the certificate is invalid.
- Ask the Server administrator to check the subject, SAN, fingerprint, and validity period. Approve the client certificate and complete any required user association using Connect to Ignition OPC UA Server or Connect to GE CSS OPC UA Server.
- Check connectivity again, browse an authorized test Point, and start small-scope collection. Check the target value and source time. Connectivity does not replace read and write verification.
3.1 CLI certificate files and user identities
For ingestion through taosx run, use certificate and private_key for channel certificates and keys, and auth_certificate and auth_private_key for user certificates and keys. Specify each file with @ followed by a controlled absolute path on the actual collection host. Encode paths according to DSN rules and quote the complete DSN for the shell. Beyond file existence, verify PEM loading, matching private keys, application URI, validity, and source trust. Do not treat a path on the browser host as a file on a remote taosX-Agent.
For user-certificate authentication, do not also supply a DSN username/password. Provide both the user certificate and its private key. Putting raw PEM text directly in a user-certificate field does not guarantee selection of a user-certificate identity. For the CLI, prefer the @文件路径 form above. Base64, a plain filename, or a server certificate is not the same file representation. After an anonymous endpoint connection succeeds, separately verify authorization for the user-certificate identity. For complete parameters and entry-point differences, see OPC UA connection parameters.
4. Troubleshooting and renewal
| Symptom | Check and action |
|---|---|
StatusBadCertificateUriInvalid | Check the URI in SAN rather than only changing the subject CN. Reestablish trust after reissuing. |
| PEM or private-key loading fails | Confirm that the upload is PEM with its matching private key, not a server certificate, DER file, or key from another certificate pair. |
StatusBadSecurityChecksFailed | Check mode, policy, certificate trust, validity, and host clocks individually. Do not bypass production security policy by disabling it. |
| Channel succeeds but access is denied | Continue checking user authentication, source account, and Point permissions. Replacing the channel certificate repeatedly does not solve all permission problems. |
Certificate renewal changes the identity material that must be trusted. Retain the current configuration before maintenance. Approve the new certificate first, then update and verify the task according to the maintenance plan. For rollback, use a paired copy of the original certificate and private key. Do not include private keys in screenshots, logs, support attachments, or version control.
For other task, write, and runtime problems, see Troubleshooting by symptom.