Help Center/ Host Security Service/ Best Practices/ A Third-Party Server Accessing HSS Through a Direct Connect and Proxy Servers/ Process/ Creating an Agent Installation Package or Installation Commands Using a Proxy Server
Updated on 2024-08-07 GMT+08:00

Creating an Agent Installation Package or Installation Commands Using a Proxy Server

Generate the agent installation command for Linux servers and the agent package for Windows servers using a proxy server.

Creating an Agent Installation Commands Using a Proxy Server (Linux)

  1. Log in to the proxy server.
  2. Run the following command to access the /tmp directory:

    cd /tmp

  3. Run the following commands in sequence to check whether the IP address in private_ip.conf is available:

    echo `hostname -I` > private_ip.conf

    cat private_ip.conf

    Figure 1 Viewing IP addresses
    • Check whether the IP address in private_ip.conf is available for the proxy server. Ensure that the IP address can be connected by third-party servers.
    • If the IP address is not available, manually change it.

  4. After confirming that the IP address is available, perform the following operations in sequence to generate the installation command:

    1. Run the following commands in sequence to generate the installation commands:
      • x86 RPM software package image:

        echo -e "# for Liunx x86 CentOS EulerOS OpenSUSE Fedora\n\ncurl -k -O 'https://private_ip:10180/package/agent/linux/x86/hostguard.x86_64.rpm' && echo 'MASTER_IP=private_ip:10180' > hostguard_setup_config.conf && echo 'SLAVE_IP=private_ip:10180' >> hostguard_setup_config.conf && echo 'ORG_ID=project_id' >> hostguard_setup_config.conf && rpm -ivh hostguard.x86_64.rpm && rm -f hostguard_setup_config.conf && rm -f hostguard*.rpm" > x86_rpm_install.sh

      • x86 deb software package image:

        echo -e "# for Liunx x86 Ubuntu Debian\n\ncurl -k -O 'https://private_ip:10180/package/agent/linux/x86/hostguard.x86_64.deb' && echo 'MASTER_IP=private_ip:10180' > hostguard_setup_config.conf && echo 'SLAVE_IP=private_ip:10180' >> hostguard_setup_config.conf && echo 'ORG_ID=project_id' >> hostguard_setup_config.conf && dpkg -i hostguard.x86_64.deb && rm -f hostguard_setup_config.conf && rm -f hostguard*.deb" > x86_deb_install.sh

      • ARM RPM software package image:

        echo -e "# for Liunx ARM CentOS EulerOS OpenSUSE Fedora UOS Kylin\n\ncurl -k -O 'https://private_ip:10180/package/agent/linux/arm/hostguard.aarch64.rpm' && echo 'MASTER_IP=private_ip:10180' > hostguard_setup_config.conf && echo 'SLAVE_IP=private_ip:10180' >> hostguard_setup_config.conf && echo 'ORG_ID=project_id' >> hostguard_setup_config.conf && rpm -ivh hostguard.aarch64.rpm && rm -f hostguard_setup_config.conf && rm -f hostguard*.rpm" > arm_rpm_install.sh

      • ARM deb software package image:

        echo -e "# for Liunx ARM Ubuntu Debian\n\ncurl -k -O 'https://private_ip:10180/package/agent/linux/arm/hostguard.aarch64.deb' && echo 'MASTER_IP=private_ip:10180' > hostguard_setup_config.conf && echo 'SLAVE_IP=private_ip:10180' >> hostguard_setup_config.conf && echo 'ORG_ID=project_id' >> hostguard_setup_config.conf && dpkg -i hostguard.aarch64.deb && rm -f hostguard_setup_config.conf && rm -f hostguard*.deb" > arm_deb_install.sh

    2. Run the following command to replace the available IP address:

      The command needs to be run without modification.

      sed -i "s#private_ip#`cat private_ip.conf`#g" *install.sh && sed -i "s#project_id#`cat /usr/local/hostguard/run/metadata.conf | grep -v enterprise_project_id | grep project_id | cut -d ":" -f 2 | cut -d " " -f 2`#g" *install.sh

    • All the five commands must be executed. The last command that is used to change to an available IP address must be executed at last.
    • The installation commands in x86_rpm_install.sh are suitable for images managed by the RPM software package in the x86 architecture, such as CentOS, EulerOS, OpenSUSE, and Fedora.
    • The installation commands in x86_deb_install.sh are suitable for images managed by the .deb software package in the x86 architecture, such as Ubuntu and Debian.
    • The installation commands in arm_rpm_install.sh are suitable for images managed by the RPM software package in the ARM architecture, such as CentOS, EulerOS, OpenSUSE, Fedora, UOS, and Kylin.
    • The installation commands in arm_deb_install.sh are suitable for images managed by the .deb software package in the ARM architecture, such as Ubuntu and Debian.

  5. View the generated installation command, which will be used to install agents on the third-party Linux servers.

    Figure 2 Linux installation commands

Creating an Agent Installation Package Using a Proxy Server (Windows)

  1. Run the following command to access the /tmp directory:

    cd /tmp

  2. Run the following commands in sequence to generate the agent installation package for Windows servers:

    curl -k -O https://`cat private_ip.conf`:10180/package/agent/windows/hostguard_setup.exe && echo '[system]' > hostguard_setup_config.ini && echo 'master='`cat private_ip.conf`':10180' >> hostguard_setup_config.ini && echo 'slave='`cat private_ip.conf`':10180' >> hostguard_setup_config.ini && echo 'orgid='`cat /usr/local/hostguard/run/metadata.conf | grep -v enterprise_project_id | grep project_id | cut -d ":" -f 2 | cut -d " " -f 2` >> hostguard_setup_config.ini

    zip hostguard_setup.zip hostguard_setup.exe hostguard_setup_config.ini

    If the proxy server does not have zip commands, run the following command to install the zip plugin:

    yum install -y zip

  3. View the generated installation package, which will be used to install agents on the third-party Windows servers.

    Figure 3 Windows installation package