Remote Access — Quick Setup Guide
This guide walks you through enabling remote access to CanKingService and connecting to it from another machine. For full configuration options see Remote Access for CanKingService.
On the server (the machine running CanKingService)
Step 1 — Generate a TLS certificate
Run this command, replacing myserver.example.com with your machine’s hostname or IP address:
ck remote generate-cert myserver.example.com
On success, two files are created:
myserver.example.com.pfx— the server certificate (private, stays on the server). It is saved in the default certificate directory:/usr/share/Kvaser/CanKing/ca-certificateson Linux andC:\ProgramData\Kvaser\CanKing\ca-certificateson Windows.myserver.example.com.pem— the public certificate (needs to be copied to each client). It is saved in the directory where you ran the command.
The command prints the full path of both files.
Tip: Add
--password MySecretto protect the PFX with a password, and--ip 192.168.1.10if clients will connect by IP address instead of hostname. Use--outputand--pem-outputto save the files somewhere else.
Step 2 — Enable remote connections
Point --cert-path at the PFX file from Step 1:
# Linux
ck remote enable --cert-path /usr/share/Kvaser/CanKing/ca-certificates/myserver.example.com.pfx \
--service-api-key a-strong-secret
# Windows PowerShell
ck remote enable --cert-path "C:\ProgramData\Kvaser\CanKing\ca-certificates\myserver.example.com.pfx" `
--service-api-key a-strong-secret
The --service-api-key is a shared secret that the clients need to include in each call to be authenticated.
Include --cert-password if you set a password in Step 1:
ck remote enable \
--cert-path /usr/share/Kvaser/CanKing/ca-certificates/myserver.example.com.pfx \
--cert-password MySecret \
--service-api-key a-strong-secret
Note:
ck remotecommands must reach the localCanKingService. IfCANKING_REMOTE_URLis set on the server, unset it or add--url localhost, otherwise the command is sent to the remote host.
CanKingService restarts automatically and is now reachable over the network.
On the client (the machine running ck)
Step 4 — Install the server certificate
The client needs to trust the server certificate before a secure connection can be established.
Linux (Debian/Ubuntu):
sudo cp myserver.example.com.pem /usr/share/Kvaser/CanKing/ca-certificates/
-or-
sudo cp myserver.example.com.pem /usr/local/share/ca-certificates/myserver.example.com.crt
sudo update-ca-certificates
Note: The file extension is changed from
.pemto.crtsinceupdate-ca-certificatesonly processes.crtfiles.
Linux (RHEL/Fedora/CentOS):
sudo cp myserver.example.com.pem /usr/share/Kvaser/CanKing/ca-certificates/
-or-
sudo cp myserver.example.com.pem /etc/pki/ca-trust/source/anchors/
sudo update-ca-trust extract
Windows (PowerShell):
Copy-Item .\myserver.example.com.pem $env:ProgramData\Kvaser\CanKing\ca-certificates\
-or-
Import-Certificate -FilePath ".\myserver.example.com.pem" -CertStoreLocation Cert:\CurrentUser\Root
Step 5 — Set the API key
# Linux / macOS
export CANKING_REMOTE_API_KEY="a-strong-secret"
# Windows PowerShell
$env:CANKING_REMOTE_API_KEY = "a-strong-secret"
Step 6 — Verify the connection
ck get about --url https://myserver.example.com:36701
A successful response shows the remote service version. You can now use any ck command against the remote service by appending --url https://myserver.example.com:36701. The end of the URL (36701) should match the port number used by CanKingService.
Tip: Set
CANKING_REMOTE_URL=https://myserver.example.com:36701in your environment to avoid typing--urlon every command. While it is set, everyckcommand goes to the remote service; add--url localhostto target a localCanKingService.
Step 7 — Connecting CanKing GUI Application
Click on the Remote Connection button in the left-side navigation bar. Enter the Service URL and the API Key and click on Connect. When connected a green banner will be visible in CanKing’s title bar.
Disabling remote access
Run this command on the server to turn off the remote listener:
ck remote disable
CanKingService restarts automatically with remote access disabled.