Este contenido no está disponible en el idioma seleccionado.
Chapter 7. Appendix: Modifying the configuration of the command-line assistant
The command-line assistant daemon (clad) is the core of the command-line assistant powered by RHEL Lightspeed that manages the communication with the Red Hat Lightspeed services, such as user history management, among other services. The clad is a dbus activated daemon. Any interaction with the command-line assistant, for example, by entering a c command, activates the daemon.
You can modify the command-line assistant configuration, for example, if you use a proxy, or connect to a different database. Note that these configurations are optional.
7.1. Setting up a proxy configuration Copiar enlaceEnlace copiado en el portapapeles!
If you need a proxy for Internet access, you can set up a proxy configuration by making the following changes in the config.toml configuration file.
Prerequisites
- The command-line assistant powered by RHEL Lightspeed is installed.
Procedure
-
Access the proxy configuration by opening the
/etc/xdg/command-line-assistant/config.tomlconfiguration file. Locate and change the following block in the
config.tomlfile :# Backend settings for communicating with the external API. [backend] ... # proxies = { http = "http://example-host:8002", https = "https://example-host:8002" }Uncomment the
proxieskey and define yourhttporhttpsproxy host:[backend] … # For a https proxy host proxies = { https = "https://<your-https-proxy-host:1234>"}After making the changes, restart
cladfor the changes to be effective:$ sudo systemctl restart cladNoteYou can use the
httpvalue andhttpskey control if the http or https traffic fromcladis routed to the specified proxy. However, the protocol does not influence the proxy type selection, and you can have a configuration that uses http proxy for https traffic. For example:https = "http://<your-https-proxy-host:1234>"
Managing databases with the command-line assistant daemon
To store information and give you access to your history database, by default, command-line assistant daemon (clad) uses an unencrypted SQLite database. You can install and connect to a different database backend, such as PostgreSQL or MySQL. Clad does not include these databases by default to avoid bringing unwanted dependencies to your system.
7.2. Changing the default database in the configuration file Copiar enlaceEnlace copiado en el portapapeles!
With the unencrypted SQLite database, you can store information and have access to your history database from the command-line assistant.
Prerequisites
- You have installed the command-line assistant.
Procedure
Install the database of your choice:
To install MySQL, enter:
# dnf install python3-PyMySQLTo install PostgreSQL, enter:
# dnf install python3-psycopg2
-
Access your database configuration file at
/etc/xdg/command-line-assistant/config.toml. Locate and comment out the default configuration. For example:
[database] # type = "sqlite" # connection_string = "/var/lib/command-line-assistant/history.db"Configure the database of your choice. The following information is also available in
/etc/xdg/command-line-assistant/config.toml.-
Set the database type, where
<db_type>can bemysqlorpostgresql. Set the database details.
type = <db_type> host = "<hostname_or_ip_address>" port = "5432" username = "<database_user_name>" password = "<password>" database = "<database_name>"
-
Set the database type, where
After changing the database type, restart the
claddaemon to apply the changes:$ sudo systemctl restart clad
7.3. Connecting to your database by using the stored systemd-creds passwords Copiar enlaceEnlace copiado en el portapapeles!
You can use the systemd-creds tool to securely store your encrypted credentials, and use the secrets stored in systemd-creds to connect to the database of your choice: PostgreSQL, SQLite, or MySQL.
Prerequisites
- The command-line assistant.
- Access to the database configuration file.
Procedure
-
Access your database configuration file at
/etc/xdg/command-line-assistant/config.toml. Remove the
usernameandpasswordparameters from the[database]section, for example:[database] type = "postgresql" host = "localhost" port = "5432" database = "history"NoteIf you leave the username and password in the configuration file, these credentials take precedence over the
systemd-credstool.Generate encrypted credentials for your username or password. The following example uses
systemd-ask-passwordcommands. The name must follow the schema ofdatabase-usernameanddatabase-password, otherwise,claddoes not load the credentials properly.To generate an encrypted username, run the following command:
$ systemd-ask-password -n | ( echo "[Service]" && systemd-creds encrypt --name=<database-username> -p - - ) >/etc/systemd/system/clad.service.d/<username>.confTo generate an encrypted password, enter:
$ systemd-ask-password -n | ( echo "[Service]" && systemd-creds encrypt --name=<database-password> -p - - ) >/etc/systemd/system/clad.service.d/<password>.conf
After updating the database credentials, reload
systemdand restart thecladdaemon to apply the changes:$ sudo systemctl restart clad