EMS HA installation with standalone remote database without Docker
The following uses PostgreSQL (Postgres) for the remote database. EMS and the Postgres database are hosted on two Ubuntu machines.
To configure the Postgres server:
- Install Postgres 15 on the Postgres Ubuntu machine:
sudo apt install -y --no-install-recommends curl ca-certificates
sudo install -d /usr/share/postgresql-common/pgdg
sudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
sudo sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt update
sudo apt install -y postgresql-15
- Install EMS custom extensions. The following commands require the ems_pg_extensions.tar.gz file, which you can download from the Fortinet Support site. Use the ems_pg_extensions.tar.gz file under the EMS 7.4.0 page to install extensions for EMS 7.4.1:
sudo tar zxvf ems_pg_extensions.tar.gz -C /
sh -c 'head -c 20 /dev/urandom | md5sum | head -c 20;' |sudo tee /var/lib/postgresql/15/symmetric_key.txt > /dev/null
sudo systemctl restart postgresql
- You can tune Postgres based on the specs of the host server by applying the recommended configuration. While there are various tools you can use to find the recommended configuration, these instructions use PGTune. Generate and copy the recommended configuration:
- Go to PGTune and enter the following information:
- Click Generate.
- Click Copy configuration.
-
Update
/etc/postgresql/15/main/postgresql.conf
:- Add or update the configuration in
/etc/postgresql/15/main/postgresql.conf
with the content that you copied in step 3. - Uncomment and change
wal_level
tominimal
, e.g.wal_level = minimal
. This removes all logging except the information required to recover from a crash or immediate shutdown. - Uncomment and change
max_wal_senders
to0
, e.g.max_wal_senders = 0
. This disables replication. - Uncomment and change
listen_addresses
to‘*’
, e.g.'localhost' >> listen_addresses = '*'
.
- Add or update the configuration in
- Give passwordless permission to the Postgres user on the same machine by changing
/etc/postgresql/15/main/pg_hba.conf
running:sed -i 's/# Database administrative login by Unix domain socket/\nhost all postgres 127.0.0.1\/32 trust\nhost all postgres ::1\/128 trust/' /etc/postgresql/15/main/pg_hba.conf
- Allow connection from the remote machine by updating the following in pg_hba.conf:
# IPv4 local connections:
host all all 127.0.0.1/32 scram-sha-256 >> host all all 0.0.0.0/0 scram-sha-256 - Restart the postgreSQL service:
systemctl restart postgresql
- Change the postgres user password:
sudo -u postgres psql
ALTER USER postgres PASSWORD 'Fortinet123#';
To configure EMS HA:
- On both nodes, do the following:
- Download the forticlientems_7.4.1.XXXX.bin file from https://support.fortinet.com.
- Change permissions and add execute permissions to the installation file:
sudo chmod +x forticlientems_7.4.1.XXXX.bin
- On the primary node, install EMS:
- Set
umask
to022
if the existingumask
setting is more restrictive. - Install EMS:
sudo ./forticlientems_7.4.1.XXXX.bin -- --db_host "172.16.1.26" --db_user postgres --db_pass Fortinet123# --skip_db_install --allowed_hosts '*' --enable_remote_https
Run the installer to/from any directory other than
/tmp
. Running the installer to/from/tmp
causes issues. After installation completes, check that all EMS services are running by entering the following command:
systemctl --all --type=service | grep -E 'fcems|apache|redis|postgres'
The output shows that postgresql.service status displays as
exited
. This is the expected status. EMS does not create this service, which only exists to pass commands to version-specific Postgres services. It displays as part of the output as the command filters for all services that contain "postgres" in the name.
- Set
- On the secondary node, install EMS:
- Set
umask
to022
if the existingumask
setting is more restrictive. - Install EMS:
sudo ./forticlientems_7.4.1.XXXX.bin -- --db_host "172.16.1.26" --db_user postgres --db_pass Fortinet123# --skip_db_install --skip_db_deploy --allowed_hosts '*' --enable_remote_https
Run the installer to/from any directory other than
/tmp
. Running the installer to/from/tmp
causes issues. - After installation completes, check that EMS services are running by entering the following command. On the secondary EMS, only fcems_monitor, fcems_pgbouncer, fcems_wspgbouncer, and redis-server services should be running:
systemctl --all --type=service | grep -E 'fcems|apache|redis|postgres'
- Set
-
After installation on both nodes is complete, access the EMS GUI from the primary node using a browser by going to https://localhost. Complete initial configuration for EMS by doing the following:
-
Set the password for the default administrator. See Starting FortiClient EMS and logging in.
-
Configure the EMS FQDN and remote access. See Configuring EMS after installation.
-
License EMS. See Licensing FortiClient EMS.
-
-
Go to System Settings > EMS Settings.
-
In the Custom hostname field, enter a virtual IP address (VIP) that is configured in the FortiGate load balancer (LB) as the VIP for EMS. In this example, the VIP is 172.16.1.50.
-
Configure a FortiGate as an LB for EMS HA:
- Create a health check:
- Go to Policy & Objects > Health Check. Click Create New.
For Type, select TCP.
- In the Interval field, enter 10.
- In the Timeout field, enter 2.
- In the Retry field, enter 3.
In the Port field, enter 8013. Click OK.
- Create a virtual server:
- Go to Policy & Objects and create a virtual server.
- Configure the fields as follows:
Field
Value
Virtual server IP
VIP that you configured in step 6. In this example, the VIP is 172.16.1.50.
Virtual server port
10443
Load Balancing method
First Alive
Health check
Monitor that you configured.
- Under Real Servers, select Create New.
- In the IPv4 address field, enter the primary EMS node IP address. In this example, it is 192.168.1.10.
- In the Port field, enter 10443.
- In the Max connections field, enter 0.
- For Mode, select Active.
- Create a real server for the secondary EMS node. Click Save.
- Repeat steps i-ix to create five additional virtual servers. The additional servers use ports 443, 8013, 8015, 8443, and 8871, but otherwise have identical settings to the first virtual server created. If you have enabled Chromebook management, create a virtual server for port 8443. Similarly, if you require importing an ACME certificate, create a virtual server for port 80.
- Create a security policy that includes the LB virtual server as a destination address:
- Go to Policy & Objects > Firewall Policy.
- Click Create New.
- Configure the Incoming Interface and Outgoing Interface fields. The outgoing interface connects to the primary EMS node.
- For Source, select all.
- In the Destination field, select ports 10443, 443, 8013, 8015, 8443, and 8871.
- For Service, select ALL.
- For Inspection Mode, select Proxy-based.
- Save the policy.
- If the EMS nodes are in different subnets, repeat these steps to configure a policy for the secondary EMS node. In this example, the nodes are in the same subnet, so you do not need to add a separate policy for the secondary EMS.
- Create a health check:
-
After the FortiGate LB configuration is complete, you can access EMS using the VIP configured in the FortiGate LB. If after initially installing EMS 7.4.1 you need to upgrade to a newer build, repeat steps 1-3 with the new installation file.