Chapter 2. Troubleshooting Discovery
2.1. Determining the version of the Discovery server
Prerequisites
- You must be logged in to the command line interface as the Discovery server administrator.
- You will need sudo access to perform certain functions in Podman.
Procedure
To determine the version of the Discovery server, use the following steps:
Enter the
dsc server status
command. The expected output provides the version of the server that you are using:"server_address": "127.0.0.1:9443", "server_id": "45a8ea20-2ec4-4113-b459-234fed505b0d", "server_version": "1.0.0.3e15fa8786a974c9eafe6376ff31ae0211972c36"
If you cannot get the server status command to run, or you cannot log in to the server, use the following Podman images command:
podman images --filter 'reference=registry.redhat.io/discovery/discovery-server-rhel9:latest' --format '{{.Labels.url}}'
2.2. Uninstalling Discovery
Prerequisites
- You must be logged in to the command line interface as the Discovery server administrator.
- You will need sudo access to perform certain functions in Podman.
Procedure
To uninstall Discovery servers, use the following steps:
Stop the containers and remove the pod.
$ podman stop discovery $ podman stop dsc-db $ podman pod rm discovery-pod
Remove the Discovery container images.
$ podman rmi registry.redhat.io/discovery/discovery-server-rhel9 $ podman rmi registry.redhat.io/rhel9/postgresql-15
Remove the storage volumes.
$ podman volume rm dsc-data
Uninstall the command line interface, if installed.
$ sudo dnf remove dsc
2.3. Getting help with the command line interface
Prerequisites
- You must be logged in to the command line interface as the Discovery server administrator.
Procedure
- For help on general topics, see the man page information.
For help on a specific subcommand, use the
-h
option. For example:$ dsc cred -h $ dsc source -h $ dsc scan -h
2.4. Unable to run dsc commands with the command line interface
The following error message or a similar message might indicate that you have not established the dsc
alias command for Discovery.
bash: dsc: command not found
Prerequisites
- You must be logged in to the command line interface as the Discovery server administrator.
- You will need sudo access to perform certain functions in Podman.
Procedure
To create the dsc
alias, use the following commands:
$ podman exec dsc-db psql -c 'CREATE ROLE dsc LOGIN PASSWORD' <username>
$ podman exec dsc-db psql -c 'GRANT ALL PRIVILEGES ON DATABASE' "dsc-db" to dsc
Verification
If the second command fails, the database may not exist. To create the database, use the following command:
$ podman exec dsb-db psql -c 'CREATE DATABASE "dsc-db"'
2.5. SSH credential configuration
If you receive an error message that includes text similar to not a valid file on the filesystem
, that message might indicate an issue with the mount point on the file system that enables access to the SSH keyfiles.
When you are creating your network credentials with SSH keyfiles, make sure that the copy of the private key has been correctly added to the "${HOME}"/.local/share/discovery/sshkeys
directory on the server.
Detailed information about credential configuration and authentication with SSH keyfiles is available in Adding SSH keys to the discovery server for network scans.
2.6. Log file locations
Prerequisites
- You must be logged in to the command line interface as the Discovery server administrator.
Procedure
Log files for the Discovery server that are on the local file system are located in the following path: "{HOME}"/.local/share/discovery/log
.
Log files for the container itself can be accessed with the following command:
$ podman exec -it discovery bash $ cd "{HOME}"/.local/share/discovery/log/
Log data is also copied to stdout
and can be accessed through Podman logs. To follow the log output, include the -f
option as shown in the following command:
$ podman logs -f discovery
2.7. Unable to connect to the Discovery server with the command line interface
The following error message or a similar message might indicate an issue with the Discovery server:
A connection error occurred while attempting to communicate with the server
Restore the server by restarting the server pod.
Prerequisites
- You must be logged in to the command line interface as the Discovery server administrator.
- You will need sudo access to perform certain functions in Podman.
Procedure
To restore the Discovery server, use the following command:
$ podman pod start discovery-pod
2.8. Backing up or restoring the Discovery database
Prerequisites
- You must be logged in to the command line interface as the Discovery server administrator.
- You might need sudo access to perform certain functions in Podman.
Procedure
-
To back up the Discovery database, use the
pg_dump
command to create a script dump of the data. When prompted, enter the credentials for the Discovery database administrator. To restore a previous database to a new or upgraded Discovery server, use the following commands, where
dump.sql
is the example name of the script dump file:$ podman cp _dump.sql_ dsc-db:. $ podman exec dsc-db psql -f _dump.sql_ $ podman exec dsc-db rm _dump.sql_
2.9. Backing up or restoring SSH credentials
Prerequisites
- You must be logged in to the command line interface as the Discovery server administrator.
Procedure
-
To back up the SSH credentials, navigate to the following directory and copy the SSH keyfile directory:
"${HOME}"/.local/share/discovery/sshkeys
To restore the SSH credentials, use the following command, where SSHkeys_backup_directory is the path of the SSH keyfile backup directory where the individual keyfiles are backed up:
$ cp -p __SSHkeys_backup_directory__/* "${HOME}"/.local/share/discovery/sshkeys/
2.10. Backing up or restoring encrypted SSH credentials
Passwords are not stored as plain text. They are encrypted and decrypted by using the content of the secret.txt
file as a secret key. If you need to back up and restore the secret.txt
file, use these steps.
Prerequisites
- You must be logged in to the command line interface as the Discovery server administrator.
Procedure
-
To back up the encrypted SSH credentials, navigate to
"${HOME}"/.local/share/discovery/data
directory and copy thesecret.txt
file. To restore the
secret.txt
file, enter the following command, where path_to_backup is the path where thesecret.txt
file is backed up:$ cp -p __path_to_backup__/secret.txt "${HOME}"/.local/share/discovery/data/
2.11. Restarting the Discovery server after a reboot
Prerequisites
- You must be logged in to the command line interface as the Discovery server administrator.
- You will need sudo access to perform certain functions in Podman.
Procedure
To restart the Discovery server after a reboot, use the following command:
$ podman pod restart discovery-pod