Installing CES Private Agent (Docker)
A private agent is fully managed by a customer yet connected to SaaS. It might be placed in a customer’s network and monitor internal resources unavailable from the Internet.
A private location is a group of private agents that are placed in the same geographical location.
System Requirements
Supported OS: RedHat 8 or higher, Debian 11 or higher (or compatible systems like Ubuntu and CentOS)
Containerization: Docker 22 (or higher versions)
Other software: Java 11 or higher
Nested virtualization: No
Installing Prerequisites
Java (Ubuntu example, change to your preferred Java version):
Java (Redhat example, change to your preferred Java version):
Docker (ubuntu example):
Docker (Red hat example):
Installing a private location and a private agent
Navigate to Manage → Private Locations (Available only for customer admins).
Click on Add Private Location and fill out the form. The locations will appear in Private Locations.
Click on Add Private Agent and fill out the form. Download and save the certificates. When an agent is just created it doesn’t have any geolocation. Therefore the agent will appear in Ungrouped Agents.
Install the required software on the server where the private agent is supposed to be installed.
Download the packages from Apica S3 bucket:
Upload the RPM or deb package on the server and install it with the following command:
deb package:
rpm package:
The agent will be installed to:
Log out of the agent machine and unzip the certificates archive and upload the certificates to
/opt/apica-private-agent/certificates
. The certificates directory should have the following files:client.pem
issuer.pem
key.pem
This can be done with the following commands:
scp -i "Certfile" client.pem issuer.pem key.pem ubuntu@ec2-11-11-111-11.eu-north-1.compute.amazonaws.com:/tmp/
ssh -i "Certfile" ubuntu@ec2-11-11-111-11.eu-north-1.compute.amazonaws.com 'sudo mkdir -p /opt/apica-private-agent/certificates && sudo mv /tmp/client.pem /tmp/issuer.pem /tmp/key.pem /opt/apica-private-agent/certificates/'
Run the configuration script
/opt/apica-private-agent/configure.sh
You might need tochmod + x
the file to run it. During the configuration process, you will be asked for the following parameters:Websocket host: npx.ces.apicasystem.com
beta host: npx.ces.beta.apicasystem.com
Websocket port: 443
Username: Enter whatever you want
Password: Enter whatever you want
Agent ID: Click Edit near the private agent (In ASM) and copy Agent ID
asm_geoloc: Copy the Gelocation string from the Private location you want to use (or created previously in ASM)
asm_agent_access_group: It can be found on the top right side on the private locations page
Start apica-sidecar with the following command:
If you run systemctl status apica-sidecar
you should see something like this if it is correctly configured:
Start nomad node with the following command:
If you run systemctl status nomad
you should see something like this if it is correctly configured:
You might need to open port 15647 (on Red Hat) for nomad to reach apica-sidecar which can done with the following command:
[sudo] iptables -I INPUT -p tcp --dport 15647 -j ACCEPT
Make sure that both services are running. After a while, the agent should move from Ungrouped Agents to the location that you used in asm_geoloc. If asm_geoloc doesn’t match any existing private location the agent will appear under Unmapped Locations.
Make sure that the agent has “green” status.
Hover over Location Settings and click on Enable to make the location visible for users. After a while, the location will appear in the location list on the create/edit check pages.
Set up the services to run on machine reboot
Run the following two commands:
sudo systemctl enable apica-sidecar.service
sudo systemctl enable nomad
Private Agent Components
A private agent consists of the following components:
Check executors
Apica sidecar
Nomad node
Executors
An executor is a docker container responsible for running specific check types. There are 4 executors:
fpr-executor - browser checks
zebratester-executor - zebratester checks
postman-executor - postman checks
runbin-executor - URLv2, SSL checks, scripted checks, etc
The executors should be uploaded to a docker repository accessible to the private agent.
Nomad mounts the following directories to the container:
/opt/apica-private-agent/certificates
→/runner-certs
/opt/apica-private-agent/runner-config
→/config
Apica Sidecar
Apica sidecar is a sidecar application responsible for establishing an HTTP over WebSocket tunnel to Apica SaaS. The tunnel is secured with TLS and JWT.
Nomad Node
A nomad node is a nomad client node responsible for running checks. It uses the tunnel provided by Apica Sidecar to connect to Apica’s Nomad cluster.
Configuring private docker repositories
By default, nomad uses default Apica’s docker hub repository. It might not be available from the location where a private agent is installed. If this is the case you would need to configure your own private repository and upload Apica’s docker images to it.
Upload docker images provided by Apica to your docker repository.
After the repository is created click on Repository Settings → Configure Repository for the location where the repository needs to be used and configure it:
Set the repository URL that is available for the private agent, repository name, username, and password.
Set tags of the uploaded images that are to be used for running checks.
Click Save Repository
Add the repository to other locations if needed by selecting it in the dropdown and click Save Repository:
Enabling/Disabling Private Locations
By default, when a private location is created it is disabled to avoid creating checks in locations that are not ready yet. When a location is ready click Location Settings → Enable to make the location visible for users.
A private can be disabled for maintenance. If a location is disabled:
It’s not shown on create/edit check pages
Existing checks still work
Configuring proxy server
A private agent might be behind a proxy server. To make the private agent work with the server fill up the following properties:
in
/opt/apica-private-agent/sidecar-config/sidecar.properties
in
/opt/apica-private-agent/runnec-config/appllication.properties
Note: certificates
and runner-config
are mounted to the container with the following paths:
/opt/apica-private-agent/certificates
→ /runner-certs
/opt/apica-private-agent/runner-config
→ /config
Troubleshooting
Apica Sidecar can’t connect to Nomad Proxy
Check
websocket-host
andwebsocket-port
in/opt/apica-private-agent/sidecar-config/sidecar.properties
Apica Sidecar not authorized
Make sure that directory
/opt/apica-private-agent/certificates
is not emptyMake sure that the following properties from
/opt/apica-private-agent/sidecar-config/sidecar.properties
point to the certificates and the keyjwt.client-cert
- client certificatejwt.issuer-cert
- issuer certificatejwt.private-key
- private key
Make sure that the following properties from
/opt/apica-private-agent/runner-config/application.properties
have the correct names of the certificates and the private key. They will be provided to the container with a volume, therefore only names are needed.com.apicasystems.checkrunner.client-cert-name
- client certificatecom.apicasystems.checkrunner.ca-cert-name
- issuer certificatecom.apicasystems.checkrunner.client-key-name
- private key
If needed reissue certificates in ASM UI
Wrong Client Id
Go to
/opt/apica-private-agent/datadir/client
Make sure that
client-id
has only ASCII text with the following commandfile ./client-id
. The output must be something like./client-id: ASCII text, with no line terminators
If needed delete the file and create it once again with the following command:
for example:
Podman is not working
Enable linger for the user
sudo loginctl enable-linger <username>
Configure
XDG_RUNTIME_DIR
for the userSwitch to the user
Get the user id:
id -u
Open
~/.bachrc
Add
export XDG_RUNTIME_DIR=/run/user/<user-id>
save and exitApply changes:
source ~/.bashrc
Start and enable podman socker
systemctl --user start podman.socket
systemctl --user enable podman.socket
Init and start podman machine
podman machine init
podman machine start
Resize the partition
We might face the issue of low disk space available, so we can resize the partition using following commands
df -Th /home sudo lvextend -L +10G <path-from-previous-command> sudo xfs_growfs /home
Here we have added 10Gb of extra space to our home directory
Refresh
In case there are some issues and we want to start the installation from scratch, we need to tear down everything. For same, we need to run the following commands
Please note that the last command, in the section above, will remove the package from the VM. Hence, to start again we will have to copy the package again to the VM or skip running the command.
Last updated
Was this helpful?