Hi,
I setup yesterday an openBalena v3.1.1 instance with a self-signed certificate using the Getting started instructions.
One particularity is that there is no customizable DNS server available on the network, so I added an Unbound instance to the server running openBalena with the proper records. This means in order to resolve the *.openbalena.internal
domain, each device has to use the IP address of the openBalena server in its DNS configuration.
I installed the self-signed certificate on my computer. So far so good, balena login
and balena devices
works without issue.
I generated the following config.json
:
$ balena config generate --app myApp --version 2.65.0 --generate-device-api-key --deviceType raspberrypi4-64 --network wifi --wifiSsid [REDACTED] --wifiKey [REDACTED] --output config.json
? Check for updates every X minutes 10
applicationId: 1
deviceType: raspberrypi4-64
userId: 2
appUpdatePollInterval: 600000
listenPort: 48484
vpnPort: 443
apiEndpoint: https://api.openbalena.internal
vpnEndpoint: vpn.openbalena.internal
registryEndpoint: registry.openbalena.internal
deltaEndpoint: https://delta.openbalena.internal
mixpanelToken: __unused__
wifiSsid: [REDACTED]
wifiKey: [REDACTED]
balenaRootCA: [REDACTED]
apiKey: [REDACTED]
$ cat config.json
{
"applicationId": 1,
"deviceType": "raspberrypi4-64",
"userId": 2,
"appUpdatePollInterval": 600000,
"listenPort": 48484,
"vpnPort": 443,
"apiEndpoint": "https://api.openbalena.internal",
"vpnEndpoint": "vpn.openbalena.internal",
"registryEndpoint": "registry.openbalena.internal",
"deltaEndpoint": "https://delta.openbalena.internal",
"mixpanelToken": "__unused__",
"wifiSsid": "[REDACTED]",
"wifiKey": "[REDACTED]",
"balenaRootCA": "[REDACTED]",
"apiKey": "[REDACTED]",
"dnsServers": "192.168.11.178"
}
I then downloaded balena-cloud-raspberrypi4-64-2.65.0+rev1-dev-v12.2.11.img
, flashed it on an SD card, then replaced the stock config.json
with the one generated previously.
Unfortunately, the device never comes online and the status LED blinks 4 times, meaning no connectivity.
Using balena scan
, I found the device IP address, then connected using ssh root@[REDACTED] -p 22222
Once logged in, I checked the logs:
Full logs
$ ssh root@[REDACTED] -p 22222
root@35e2016:~# journalctl -u resin-supervisor
-- Logs begin at Thu 2021-01-21 14:12:15 UTC, end at Thu 2021-01-21 15:05:33 UTC. --
Jan 21 14:12:24 35e2016 resin-supervisor[1790]: resin_supervisor
Jan 21 14:12:24 35e2016 resin-supervisor[1822]: active
Jan 21 14:12:26 35e2016 resin-supervisor[1824]: Container config has not changed
Jan 21 14:12:29 35e2016 resin-supervisor[1824]: [info] Supervisor v12.2.11 starting up...
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] Setting host to discoverable
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [warn] Invalid firewall mode: . Reverting to state: off
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [warn] Invalid firewall mode: . Reverting to state: off
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] Setting host to discoverable
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [warn] Invalid firewall mode: . Reverting to state: off
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] �🔥 Applying firewall mode: off
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [debug] Starting logging infrastructure
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [debug] Performing database cleanup for container log timestamps
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] Starting firewall
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] Previous engine snapshot was not stored. Skipping cleanup.
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [debug] Handling of local mode switch is completed
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: (node:1) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buf>Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] API Binder bound to: https://api.openbalena.internal/v6/
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [success] �🔥 Firewall mode applied
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [debug] Starting api binder
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [event] Event: Supervisor start {}
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [debug] Connectivity check enabled: true
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [debug] Starting periodic check for IP addresses
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] Reporting initial state, supervisor version and API info
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] Attempting to load any preloaded applications
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [error] LogBackend: unexpected error: Error: self signed certificate in certificate chain
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [error] at TLSSocket.onConnectSecure (_tls_wrap.js:1474:34)
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [error] at TLSSocket.emit (events.js:310:20)
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [error] at TLSSocket._finishInit (_tls_wrap.js:917:8)
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [error] at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:687:12)
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] VPN connection is not active.
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] Waiting for connectivity...
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] Starting API server
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] Supervisor API successfully started on port 48484
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] Applying target state
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [debug] Ensuring device is provisioned
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [event] Event: Device bootstrap {}
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] New device detected. Provisioning...
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [event] Event: Device bootstrap failed, retrying {"delay":30000,"error":{"message":""}}
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [debug] Finished applying target state
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [success] Device state apply success
Jan 21 15:03:35 35e2016 resin-supervisor[1824]: [event] Event: Device bootstrap {}
Jan 21 15:03:35 35e2016 resin-supervisor[1824]: [info] New device detected. Provisioning...
Jan 21 15:03:35 35e2016 resin-supervisor[1824]: [event] Event: Device bootstrap failed, retrying {"delay":30000,"error":{"message":""}}
Jan 21 15:04:05 35e2016 resin-supervisor[1824]: [event] Event: Device bootstrap {}
Jan 21 15:04:05 35e2016 resin-supervisor[1824]: [info] New device detected. Provisioning...
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [warn] Invalid firewall mode: . Reverting to state: off
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] �🔥 Applying firewall mode: off
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [debug] Starting logging infrastructure
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [debug] Performing database cleanup for container log timestamps
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] Starting firewall
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] Previous engine snapshot was not stored. Skipping cleanup.
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [debug] Handling of local mode switch is completed
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: (node:1) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buf>Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] API Binder bound to: https://api.openbalena.internal/v6/
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [success] �🔥 Firewall mode applied
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [debug] Starting api binder
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [event] Event: Supervisor start {}
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [debug] Connectivity check enabled: true
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [debug] Starting periodic check for IP addresses
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] Reporting initial state, supervisor version and API info
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] Attempting to load any preloaded applications
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [error] LogBackend: unexpected error: Error: self signed certificate in certificate chain
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [error] at TLSSocket.onConnectSecure (_tls_wrap.js:1474:34)
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [error] at TLSSocket.emit (events.js:310:20)
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [error] at TLSSocket._finishInit (_tls_wrap.js:917:8)
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [error] at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:687:12)
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] VPN connection is not active.
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] Waiting for connectivity...
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] Starting API server
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] Supervisor API successfully started on port 48484
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] Applying target state
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [debug] Ensuring device is provisioned
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [event] Event: Device bootstrap {}
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [info] New device detected. Provisioning...
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [event] Event: Device bootstrap failed, retrying {"delay":30000,"error":{"message":""}}
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [debug] Finished applying target state
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [success] Device state apply success
Jan 21 15:03:35 35e2016 resin-supervisor[1824]: [event] Event: Device bootstrap {}
Jan 21 15:03:35 35e2016 resin-supervisor[1824]: [info] New device detected. Provisioning...
Jan 21 15:03:35 35e2016 resin-supervisor[1824]: [event] Event: Device bootstrap failed, retrying {"delay":30000,"error":{"message":""}}
Jan 21 15:04:05 35e2016 resin-supervisor[1824]: [event] Event: Device bootstrap {}
Jan 21 15:04:05 35e2016 resin-supervisor[1824]: [info] New device detected. Provisioning...
Jan 21 15:04:35 35e2016 resin-supervisor[1824]: [event] Event: Device bootstrap {}
Jan 21 15:04:35 35e2016 resin-supervisor[1824]: [info] New device detected. Provisioning...
Jan 21 15:04:35 35e2016 resin-supervisor[1824]: [event] Event: Device bootstrap failed, retrying {"delay":30000,"error":{"message":""}}
Jan 21 15:05:05 35e2016 resin-supervisor[1824]: [event] Event: Device bootstrap {}
Jan 21 15:05:05 35e2016 resin-supervisor[1824]: [info] New device detected. Provisioning...
What stands out to me is the following:
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [error] LogBackend: unexpected error: Error: self signed certificate in certificate chain
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [error] at TLSSocket.onConnectSecure (_tls_wrap.js:1474:34)
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [error] at TLSSocket.emit (events.js:310:20)
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [error] at TLSSocket._finishInit (_tls_wrap.js:917:8)
Jan 21 14:12:30 35e2016 resin-supervisor[1824]: [error] at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:687:12)
According to this post, the cert should be populated in /etc/ssl/certs/balenaRootCA.pem
. I opened the file and can confirmed the content are correct (identical to the ca.crt
cert on openBalena).
I don’t know where else to look. It seems the certificated is correctly installed but isn’t picked up properly. I wonder if the custom DNS could be at fault, but the logs show the domains resolve.
Any help is appreciated.
Thanks in advance,
Erwan