Mender auth

Hi,

After installing the .deb version of the mender-client: Installing | Mender documentation, currently using version 2.4.0, I see that it enables a service that runs tries to connect to my platform. Could you please explain me what does this service does and how it manages to connect to the right server (mine).

My main question is, after a few steps I edit the config used by mender and I restart the service. However, this doesn’t override the existent temp to connection (it shows in depend) and I only manage to use a new temp if I dismiss via the site (tab devices) to dismiss the temp.

Here’s my code to “install mender” after installing the .deb

#!/bin/bash

set -o errexit
set -o nounset
set -o pipefail

_running_script=${0##*/}

echo " [$_running_script] [+] Mender client installation... `date`"

_device_id=$(cat $CCAR_CAR_CONFIG/iot_core_config.json | python3 -c "import sys, json; print(json.load(sys.stdin)['device_id'])")
echo " [$_running_script] [+] Replace mender-device-identity script with our version of the script"
echo -e "#!/bin/sh\n" > /usr/share/mender/identity/mender-device-identity
echo "echo \"mac=$_device_id\nid=$_device_id\nsku=$_device_id\nsn=$_device_id\"" >> /usr/share/mender/identity/mender-device-identity

_private_key=$CCAR_CAR_CONFIG/rsa_private.pem
echo " [$_running_script] [+] Exchange mender-agent for our private key"

if ! cp $_private_key /var/lib/mender/mender-agent.pem; then
  echo " [$_running_script] [Error] Failed to exchange mender-device-identity script"
  exit 1
fi

mender setup \
  --quiet \
  --device-type $CCAR_DEVICE_TYPE \
  --hosted-mender \
  --tenant-token $CCAR_TENANT_TOKEN \
  --retry-poll 30 \
  --update-poll 30 \
  --inventory-poll 120

systemctl restart menderd.service
echo " [$_running_script] [.] Mender successfully set up"

Uppercase variables are set elsewhere and they aren’t relevant for the problem here.

Repeating the process using this .deb worked flawless:

wget "https://downloads.mender.io/master/dist-packages/debian/armhf/mender-client_master-1_armhf.deb"

I don’t know if it’s due the change of .deb or the fact that the server was crashing today/yesterday.