Encrypting Configuration Files

Overview

circle-info

This feature was introduced in NetObserv 7.21.0

NetObserv can encrypt configuration files (decrypting them on startup to read them).

Files encrypted with this feature:

  • NetObserv Flow: flowcoll.yml, Azure vnet config file

    • See additional docs if you are using NetObserv Flow and want to encrypt Azure vnet config

  • NetObserv SNMP: snmpcoll.yml

  • NetObserv SNMP Trap: trapcoll.yml

Set Up Encryption For Configuration Files

There are two modes of encryption:

  1. (default) full-file encryption -- where the entire contents of the yml config file is encrypted.

  2. Value-only encryption -- where the config names are plain-text in the yml file, but all the values are encrypted.

Install System Dependencies

Ensure agearrow-up-right is installed in your local environment in order to edit the config file

# Debian based linux
sudo apt install age
age --version # to verify install

Or (for RPM based distributions)

If you want to use the value-only encryption mode, you must also install sops. Follow the sops installation stepsarrow-up-right to install sops.

Create Encryption Keys

If you also want to encrypt the private key with a password (optional):

Enable File Encryption

Edit the file /etc/systemd/system/snmpcoll.env

  • set EF_CONFIG_ENCRYPT_ENABLE=true

  • if you used a password to encrypt the private key, set EF_CONFIG_ENCRYPT_PASSWORD to match the password

If you want to use the alternative mode of encryption (where only values are encrypted), then change EF_CONFIG_ENCRYPT_TYPE to be sops

Then reload system config: sudo systemctl daemon-reload

Setting Up Initial Encryption

You must manually encrypt the config file for the first time.

For Default Encryption Mode

For Value-Only Encryption Mode

If you have set EF_CONFIG_ENCRYPT_TYPE to sops, then you have to do the initial encryption of snmpcoll.yml

Restart NetObserv

Restart NetObserv, and it will use the encrypted config file

Editing Config Files

Using Default Encryption Mode

To edit an encrypted config file, you will need to use the age cli tool to decrypt first.

Then edit the contents of snmpcoll.decrypted.yml

Once done, use age to encrypt again

Then restart NetObserv

Using Value-Only Encryption Mode

To securely edit encrypted configuration files, you can use sops via the CLI:

This command will decrypt the file in memory and open with a cli text editor. By default, the editor used will be vim

To use another editor (like nano) instead of vim, change the EDITOR environment variable:

Then restart NetObserv

Disabling File Encryption

Edit /etc/systemd/system/snmpcoll.env and set EF_CONFIG_ENCRYPT_ENABLE=false

If using default encryption mode, use this command to decrypt config file:

If using value-only encryption mode, use this command:

Last updated

Was this helpful?