Configuration¶
Changed in version 2.0.
By default, gvm-tools programs are evaluating the
~/.config/gvm-tools.conf
ini style
config file since version 2.0. The name of the config file to be used can be set with the
-c/--config command line switch.
Settings¶
The configuration file consists of sections, each led by a [section]
header, followed by key/value entries separated by a =
character.
Whitespace between key and value is ignored. Meaning key = value
is the
same as key=value
.
Currently five sections are evaluated:
Main section
The main section allows changing the default connection timeout besides defining variables for Interpolation.
[main]
timeout = 60
GMP section
The GMP section allows setting the default username and password for GMP (Greenbone Management Protocol) based communication.
[gmp]
username=gmpuser
password=gmppassword
Socket section
The socket section allows setting the default path to the Unix Domain socket of gvmd or openvasmd respectively. Not to be confused with the socket path to the redis server used by openvassd. Only relevant if the socket connection type is used.
[unixsocket]
socketpath=/var/run/gvmd.sock
TLS section
The TLS section allows setting the default port, TLS certificate file, TLS key file and TLS certificate authority file. Only relevant if the TLS connection type is used (Default for accessing openvasmd on GOS 3.1).
[tls]
port=1234
certfile=/path/to/tls.cert
keyfile=/path/to/tls.key
cafile=/path/to/tls.ca
SSH section
The SSH section allows setting the default SSH port, SSH username and SSH password. Only relevant if the SSH connection type is used (Default for accessing openvasmd on GOS 4 and beyond).
[ssh]
username=sshuser
password=sshpassword
port=2222
Comments
Configuration files may also contain comments by using the special character
#
. A comment should be placed on a separate line above or below the
setting.
[main]
# connection timeout of 120 seconds
timeout=120
Interpolation
The configuration file also supports interpolation of values.
It is possible to define values in the [main]
section which can be
referenced via a %(<variablename>)s
syntax. Additionally, values of the
same section can be referenced.
[main]
my_first_name=John
[gmp]
my_last_name=Smith
username=%(my_first_name)s%(my_last_name)s
Using this syntax will set the gmp username setting to JohnSmith.
Example¶
Full example configuration.
[main]
# increased timeout to 5 minutes
timeout = 300
tls_path=/data/tls
default_user=johnsmith
[gmp]
username=%(default_user)s
password=choo4Gahdi2e
[unixsocket]
socketpath=/var/run/gvmd.sock
[tls]
port=1234
certfile=%(tls_path)s/tls.cert
keyfile=%(tls_path)s/tls.key
cafile=%(tls_path)s/tls.ca
[ssh]
username=%(default_user)s
password=Poa8Ies1iJee