Skip to content

Commit

Permalink
Use better defaults for for ospd-openvas settings
Browse files Browse the repository at this point in the history
* Make the service file usable for real scenarios
* Use better file names for configs
* In service file load configs from /etc/gvm
  • Loading branch information
bjoernricks committed Jul 1, 2021
1 parent 0885365 commit f631e18
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 43 deletions.
7 changes: 7 additions & 0 deletions config/ospd-openvas.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[OSPD - openvas]
log_level = INFO
socket_mode = 0o770
unix_socket = /run/ospd/ospd-openvas.sock
pid_file = /run/ospd/ospd-openvas.pid
log_file = /var/log/gvm/ospd-openvas.log
lock_file_dir = /var/lib/openvas
25 changes: 0 additions & 25 deletions config/ospd-openvas.default

This file was deleted.

16 changes: 7 additions & 9 deletions config/ospd-openvas.service
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
[Unit]
Description=OpenVAS Wrapper of the Greenbone Vulnerability Management (ospd-openvas)
Description=OSPd Wrapper for the OpenVAS Scanner (ospd-openvas)
Documentation=man:ospd-openvas(8) man:openvas(8)
After=network.target networking.service redis-server@openvas.service
Wants=redis-server@openvas.service
ConditionKernelCommandLine=!recovery

[Service]
Type=forking
EnvironmentFile=<install-prefix>/etc/default/ospd-openvas.default
Environment="PATH=$PATH"
Environment="PYTHONPATH=$PYTHONPATH"
User=$OSPD_OPENVAS_USER
Group=$OSPD_OPENVAS_GROUP
PIDFile=$OSPD_OPENVAS_PID
ExecStart=<install-prefix>/bin/ospd-openvas $OSPD_OPENVAS_ARGS
User=gvm
Group=gvm
RuntimeDirectory=ospd
RuntimeDirectoryMode=2775
PIDFile=/run/ospd/ospd-openvas.pid
ExecStart=/usr/local/bin/ospd-openvas --config /etc/gvm/ospd-openvas.conf --log-config /etc/gvm/ospd-logging.conf
SuccessExitStatus=SIGKILL
# This works asynchronously, but does not take the daemon down during the reload so it's ok.
Restart=always
RestartSec=60

Expand Down
7 changes: 0 additions & 7 deletions config/ospd.conf

This file was deleted.

2 changes: 1 addition & 1 deletion ospd_openvas/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ class OSPDopenvas(OSPDaemon):
""" Class for ospd-openvas daemon. """

def __init__(
self, *, niceness=None, lock_file_dir='/var/run/ospd', **kwargs
self, *, niceness=None, lock_file_dir='/var/lib/openvas', **kwargs
):
""" Initializes the ospd-openvas daemon's internal data. """
self.main_db = MainDB()
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ keywords = [
packages = [
{ include = "ospd_openvas"},
{ include = "docs/ospd-openvas.8", format = "sdist"},
{ include = "config/ospd-openvas.default", format = "sdist"},
{ include = "config/ospd-openvas.service", format = "sdist"},
{ include = "config/ospd.conf", format = "sdist"},
{ include = "tests", format = "sdist" },
Expand Down

0 comments on commit f631e18

Please sign in to comment.