Defender unable to connect to the Prisma Cloud Console with the Error "Connection failed due to hostname conflict"

Defender unable to connect to the Prisma Cloud Console with the Error "Connection failed due to hostname conflict"

21035
Created On 08/15/22 15:23 PM - Last Modified 03/01/23 04:31 AM


Symptom


Defender unable to connect to the Prisma Cloud Console with the following Error message seen in Defender Logs:
Connection failed due to hostname conflict, Defender name "<hostname>" is already connected.


Environment


  • Prisma Cloud


Cause


  • During installation, Defender will take the Hostname from the underlying Host as the Defender ID.
  • Prisma Cloud Console requires the Defender ID to be unique.
  • If not unique, the subsequent connection by another Host with the same Defender ID (Hostname) will be rejected.


Resolution


  • Following are the steps listed for different Deployment Scenarios to Re-install the Defender with the flag: unique_hostname=true

Orchestrator(daemonset):

  • With any orchestrator such as Kubernetes or Openshift, you can simply modify the YAML/Helm Chart as below, and apply again to the cluster.
  • The Orchestrator will re-deploy the defender pods across the nodes with new config automatically.

If you have YAML/HELM that was used for deployment, here are the steps:


YAML
 

  1. Open the yaml file with text editor, and find a key with name CLOUD_HOSTNAME_ENABLED, and modify the value from false to true
  2. Create a new key/value as below pic when you can't find key CLOUD_HOSTNAME_ENABLED:

    Screen Shot 2022-08-15 at 10.46.36 PM.png

  3. Execute command to push the new settings of the daemonset:

kubectl apply -f example.yaml

Note: Replace the example.yaml to the yaml file name you are using.

      4.  After updating the daemonset, the cluster will automatically remove the existing pods, and deploy pods with new settings which have unique hostname/defender ID. 


Helm Chart
 

  1. Open value.yaml in the path of twistlock defender Helm chart, and modify the value of the key with name unique_hostname, from false to true

  2. Create a new key/value as below pic, when you can't find the key unique_hostname:

Screen Shot 2022-08-15 at 11.00.32 PM.png

  1. Execute command to push the new settings of the daemonset via helm:
     

    helm upgrade -n twistlock twistlock

    (Note: You may need to change namespace, and/or helm release name from twistlock to your own defined name)
    Example output:

Screen Shot 2022-08-15 at 11.03.52 PM.png


Can't find original YAML/Helm Chart?
 

  • If you can't find the YAML/HELM chart that used to deploy the defender, you can generate a new YAML/HELM with below steps:

  1. Go to Compute UI > Manage > Defenders > Deploy > Defenders > Orchestrator.

  2. Select the best option/value that fits your environment, such as choosing the orchestrator type, Defender communication port...etc.

  3. Make sure you have "Assign globally unique names to Hosts (optional)" is "On":

Screen Shot 2022-08-14 at 4.44.05 PM.png

  1. After confirming all options are well-chosen, click download YAML or Helm chart accordingly:

Screen Shot 2022-08-15 at 11.08.38 PM.png


Single Defender:
 

  • If you are using Single Defender, you will need to uninstall the current defender, and then install a new defender with below steps:

  1. Uninstall the defender:

  • Windows:

    • Run this cmd in command prompt with admin:

C:\Program Files\Prisma Cloud\scripts\defender.ps1 -uninstall

          OR

C:\Program Files\Twistlock\scripts\defender.ps1 -uninstall

  • Linux - Container Defender:

    • Run this cmd:

      sudo /var/lib/twistlock/scripts/twistlock.sh -u

  • Linux - Host Defender:

    • Run this cmd:

sudo /var/lib/twistlock/scripts/twistlock.sh -u defender-server

  1. Re-Install the Defender:

    1. Visit Compute UI > Manage > Defenders > Deploy > Defenders > Single Defender

    2. Select the best option/value that fits your environment, such as choosing the Defender type, Defender communication port...etc.

    3. Make sure you have "Assign globally unique names to Hosts (optional)" is "On"

Screen Shot 2022-08-15 at 11.19.07 PM.png

  1. Copy the script in the last step, and execute on your host to install a new defender.

    • For Linux, paste the result on terminal/CLI

    • For Windows, paste the result on powershell

  2. After the new installation, the defender should use unique hostname to report to Console. Issue solved.



Additional Information


Log Path:
 


Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA14u000000wlIDCAY&lang=en_US&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail

Choose Language