greenbone / gsad

Greenbone Security Assistant HTTP Server - The server talking to the Greenbone Vulnerability Management daemon (gvmd).
GNU Affero General Public License v3.0
11 stars 14 forks source link

manager port not working #77

Closed chuenlye closed 2 years ago

chuenlye commented 2 years ago

Expected behavior

I want to use the manager port(gsad --mport 9390), but it can't be listening.

└─$ systemctl cat gsad.service
# /lib/systemd/system/gsad.service
[Unit]
Description=Greenbone Security Assistant daemon (gsad)
Documentation=man:gsad(8) https://www.greenbone.net
After=network.target gvmd.service
Wants=gvmd.service

[Service]
Type=forking
User=_gvm
Group=_gvm
RuntimeDirectory=gsad
RuntimeDirectoryMode=2775
PIDFile=/run/gsad/gsad.pid
ExecStart=/usr/sbin/gsad --listen 0.0.0.0 --port 9392 --mlisten 127.0.0.1 --mport 9390
Restart=always
TimeoutStopSec=10

[Install]
WantedBy=multi-user.target
Alias=greenbone-security-assistant.service

Actual behavior

Only tcp port 9392 is listening, 9390 manager port not working.

└─$ sudo ss -natlp | grep 939
LISTEN 0      4096         0.0.0.0:9392      0.0.0.0:*    users:(("gsad",pid=370656,fd=10))

└─$ sudo cat /var/log/gvm/gsad.log
...
gsad main:MESSAGE:2022-07-29 15h12.44 utc:370651: Starting GSAD version 21.4.4
gsad main:  DEBUG:2022-07-29 15h12.44 utc:370651: Forking...
gsad main:  DEBUG:2022-07-29 15h12.44 utc:370656: Forking for redirect...
gsad main:  DEBUG:2022-07-29 15h12.44 utc:370657: GSAD started successfully and is redirecting on port 80.
gsad main:  DEBUG:2022-07-29 15h12.44 utc:370656: GSAD started successfully and is listening on port 9392.

Steps to reproduce

  1. on the latest kali linux 2022.03, gsad will be installed by sudo apt install gvm .

  2. edit the service unit file of gsad, add --mlisten 127.0.0.1 --mport 9390 to ExecStart, like the following: ExecStart=/usr/sbin/gsad --listen 0.0.0.0 --port 9392 --mlisten 127.0.0.1 --mport 9390

  3. sudo systemctl daemon-reload && sudo systemctl restart gsad.service

GVM versions

gsa: (gsad --version)

$ gsad --version
Oops, secure memory pool already initialized
Greenbone Security Assistant 21.4.4

gvm: (gvmd --version)

Greenbone Vulnerability Manager 21.4.5
Manager DB revision 242

openvas-scanner: (openvassd --version)

$ openvas --version
OpenVAS 21.4.4
gvm-libs 21.4.4

gvm-libs: gvm-libs 21.4.4

Environment

Operating system:

$ cat /etc/os-release
PRETTY_NAME="Kali GNU/Linux Rolling"
NAME="Kali GNU/Linux"
ID=kali
VERSION="2022.3"
VERSION_ID="2022.3"
VERSION_CODENAME="kali-rolling"
ID_LIKE=debian
ANSI_COLOR="1;31"
HOME_URL="https://www.kali.org/"
SUPPORT_URL="https://forums.kali.org/"
BUG_REPORT_URL="https://bugs.kali.org/"

Installation method / source: (packages, source installation) sudo apt install gvm

Logfiles

└─$ sudo cat /var/log/gvm/gsad.log
...
gsad main:MESSAGE:2022-07-29 15h12.44 utc:370651: Starting GSAD version 21.4.4
gsad main:  DEBUG:2022-07-29 15h12.44 utc:370651: Forking...
gsad main:  DEBUG:2022-07-29 15h12.44 utc:370656: Forking for redirect...
gsad main:  DEBUG:2022-07-29 15h12.44 utc:370657: GSAD started successfully and is redirecting on port 80.
gsad main:  DEBUG:2022-07-29 15h12.44 utc:370656: GSAD started successfully and is listening on port 9392.
chuenlye commented 2 years ago

It seems to be my misunderstanding.

$ gsad --help 
...
  --mlisten=<address>                    Manager address.
  -m, --mport=<number>                   Use manager port number <number>.

The manager seems to be the gvmd, not started by gsad itself. By default, gvmd use unix socket. So if gvmd is listening on TCP port, --mlisten in gsad will be gvmd's address and --mport will be gvmd's port.

Just now I need to connect openvas from metasploit, its openvas plugin doesn't support unix socket, so I tried to start the manager port from gsad.

Okey, my problem has been solved now.

If I am right, pls close this issue.