Skip to content

macOS client: connecting to an HTTPS (TLS) data server fails; server certificate on the client #1385

Backlog

Description

@ohlincha

Reported on #1380 (2026-12-02): the macOS client has problems connecting to a data server over HTTPS. This path (TLS data server, port 8443, with the broker on 8883) has not been tested on macOS recently. One suspect is how the server's certificate gets to the client.

On Linux the client gets the certificate with sudo ecce-remote-setup <host> --tls --pin server.pem (or --fetch-pin), which writes <ECCE_HOME>/siteconfig/RemoteServer/server.pem. On macOS ECCE_HOME is inside /Applications/ECCE.app, so the pin is written into the app bundle. To check:

  • whether ecce-remote-setup --tls --pin / --fetch-pin succeeds on macOS and where the pin ends up;
  • whether the first-connection pinning from the Start window (Central server: HTTPS for the data server and TLS for the broker #236) works on macOS;
  • whether a pin written into the bundle survives an app update, and whether writing into the bundle upsets Gatekeeper.

Details needed: ECCE version, macOS version and architecture, self-signed or CA certificate, how the client was set up, and the exact message.

Related: #761.

Activity

  1. ohlincha commented on Dec 2, 2026

    @ohlincha
    CollaboratorAuthor

    Test on the released 9.6.1 x86_64 dmg, macOS 12.7.6 (Intel), client only. Server: 9.6.1 on Debian 13, ecce-remote-setup --server all --tls (self-signed RSA-3072 certificate), data server on 8443, broker on 8883.

    1. ecce-remote-setup on macOS fails without ECCE_HOME

    $ /Applications/ECCE.app/Contents/Resources/bin/ecce-remote-setup <server> --tls --pin server.pem
    ecce-remote-setup: no siteconfig at /opt/ecce/siteconfig
      Set ECCE_HOME to the installation you want to configure.
    

    The script defaults to ECCE_HOME=/opt/ecce (packaging/dataserver/ecce-remote-setup, : "${ECCE_HOME:=/opt/ecce}"). The command is also not on PATH on macOS, so the documented sudo ecce-remote-setup <host> --tls --pin server.pem cannot work as written. With ECCE_HOME=/Applications/ECCE.app/Contents/Resources/ecce it works, and no sudo is needed when the user who copied the app into /Applications owns the bundle:

    Central server: https://<server>:8443/Ecce
      reachable
    Copied the server's machine list: 3 machine(s) ...
    Wrote:
      .../ECCE.app/Contents/Resources/ecce/siteconfig/RemoteServer/DataServers
      .../ECCE.app/Contents/Resources/ecce/siteconfig/RemoteServer/site_runtime
      .../ECCE.app/Contents/Resources/ecce/siteconfig/RemoteServer/server.pem
    

    2. The pinned connection works up to the login

    ecce -remote (with Contents/Resources/bin on PATH) wrote the broker file with tls=1, cafile=.../siteconfig/RemoteServer/server.pem, pinned=1; the gateway's HTTPS requests reached the server (HEAD /Ecce 301, OPTIONS /Ecce 200, HEAD /Ecce/users 401, i.e. waiting for the login). A TLS handshake with that pin succeeds from the Mac on both 8443 and 8883 (TLS 1.3). The MQTT login after the data server login was not checked (it needs the password typed into the login window). --fetch-pin and the first-connection pinning from the Start window were not tried.

    3. The pin lives inside the app bundle

    • codesign --verify --deep /Applications/ECCE.app already fails before any setup (a sealed resource is missing or invalid): the bundled Python writes __pycache__/*.pyc into Contents/Resources/python at run time. The setup adds four more file added: entries under siteconfig/RemoteServer. The app still started.
    • Replacing ECCE.app for an update deletes siteconfig/RemoteServer, so the server setting and the pin are lost and the setup has to be repeated.

    4. Likely failure with a CA-signed certificate (--system-ca) on macOS (found in the code and binaries, not run)

    • The bundled Contents/Frameworks/libcrypto.3.dylib has OPENSSLDIR: "/Users/runner/ecce-deps/ssl" (the CI build path). Without a pin, CTLSClientSocket calls SSL_CTX_set_default_verify_paths (src/dsm/cipc/CTLSSocket.C), which then loads no CA certificates on a user's Mac. Every CA-signed server certificate would fail verification.
    • ecce-gateway-start picks capath=/etc/ssl/certs for the broker without a pin. On macOS that directory exists but is empty; the CA list is /etc/ssl/cert.pem.

    Suggested fixes: default ECCE_HOME from the script's own location in ecce-remote-setup, and give the macOS command line instructions with the bundle path; on macOS, load /etc/ssl/cert.pem (or set SSL_CERT_FILE in the launcher) for the data server, and write cafile=/etc/ssl/cert.pem for the broker; keep the client's server setting and pin outside the bundle (for example /Library/Application Support/ECCE/RemoteServer, or ~/.ECCE/RemoteServer via --user) so that an update keeps them.

    Still needed from the report: self-signed or CA certificate, how the client was set up, and the exact message.

  2. matthewasplund commented on Dec 2, 2026

    @matthewasplund
    Collaborator

    I am working on a patch set that will allow each data server to have its own certificate that is loaded when the server is added. I had an issue that was causing a seg fault, but I am just testing a fix that would fix it.
    With this, I should have portable configurations that can be e-mailed out to users that will set up the data server(s), compute machines (but not usernames or passwords) and available codes as a json file that is loaded in the preference screen.

  3. ohlincha commented on Dec 2, 2026

    @ohlincha
    CollaboratorAuthor

    Correction to item 1 above: Contents/Resources/bin/ecce-remote-setup is a wrapper that finds ECCE_HOME beside itself, so the /opt/ecce message came from running the inner script (Resources/ecce/bin/ecce-remote-setup) directly. Run through the wrapper, the script hits a different macOS bug:

    $ /Applications/ECCE.app/Contents/Resources/bin/ecce-remote-setup --user <host>
    Central server: http://<host>:8096/Ecce
    .../ecce-remote-setup: line 461: CURL_TLS[@]: unbound variable
    

    macOS /bin/bash is 3.2, where an empty array is "unbound" under set -u. Every plain-HTTP setup and every --system-ca setup stops here; only --pin/--fetch-pin got through, which is why the TLS test above worked.

    Branch wip/1385-mac-setup (0bdd811):

    • ecce-remote-setup guards its array expansions (checked on macOS 12.7.6: the patched script reaches the server check).
    • ecce-gateway-start gives the broker cafile=/etc/ssl/cert.pem on macOS instead of the empty /etc/ssl/certs.

    Left to the per-server certificate work in #1387, so the two don't collide in CTLSSocket.C: where the pin is stored (outside the app bundle) and the data-server side of --system-ca on macOS. The latter is SSL_CTX_set_default_verify_paths with the bundled libcrypto's OPENSSLDIR at the CI path, so no CA certificates load. Loading /etc/ssl/cert.pem on __APPLE__ when no pin is set would cover it.

  4. added a commit that references this issue on Dec 3, 2026
  5. ohlincha commented on Dec 3, 2026

    @ohlincha
    CollaboratorAuthor

    The bash 3.2 fix for ecce-remote-setup and the macOS CA file for the broker are merged to main (aea0af7) after the TLS, first-start, site-setup and import tests passed. The pin location and the data-server CA on macOS stay with #1387.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions