I am compiling and installing Ubuntu

This is an error that has occurred. Now the installation is complete, but there are still some problems

Version 22.04.0.dev1

There is no data after the installation. Where should I troubleshoot the problem

/var/log/gvm/gvmd.log
md manage:WARNING:2022-09-26 10h38.59 UTC:25380: osp_scanner_feed_version: failed to connect to /run/ospd/ospd-openvas.sock

x@x:/var/log/gvm$ cat ospd-openvas.log
OSPD[21424] 2022-09-26 09:12:23,542: ERROR: (ospd_openvas.db) Redis Error: Not possible to connect to the kb.

Version 22.04.0.dev1

There is no data after the installation. Where should I troubleshoot the problem

‘/run/ospd/’ no files

x@x:/run/ospd$ ls -a
. …

gvmd.log:

md manage:WARNING:2022-09-27 02h53.17 UTC:41662: osp_scanner_feed_version: failed to connect to /run/ospd/ospd-openvas.sock

build install

#!/bin/bash
#==========================
#Building 22.4 from Source
export SAKURA=$HOME/sakura/openvas
export PATH=$PATH:/usr/local/sbin
export INSTALL_PREFIX=/usr/local

export SOURCE_DIR=$HOME/openvas/source
export BUILD_DIR=$HOME/openvas/build
export INSTALL_DIR=$HOME/openvas/install


prerequisites(){
    ls $HOME/openvas >/dev/null 2>&1
    if [ $? -eq 0 ]; then
      return
    fi
    sudo useradd -r -M -U -G sudo -s /bin/bash gvm
    sudo usermod -aG gvm $USER

    cp -r $SAKURA $HOME

    sudo apt update
    sudo apt install --no-install-recommends --assume-yes \
          build-essential \
          curl \
          cmake \
          pkg-config \
          python3 \
          python3-pip \
          gnupg
}

gvm_libs_make(){
    ls $BUILD_DIR/gvm-libs >/dev/null 2>&1
    if [ $? -eq 0 ]; then
      return
    fi
    sudo apt install -y \
       libglib2.0-dev \
       libgpgme-dev \
       libgnutls28-dev \
       uuid-dev \
       libssh-gcrypt-dev \
       libhiredis-dev \
       libxml2-dev \
       libpcap-dev \
       libnet1-dev \
       libpaho-mqtt-dev

    sudo apt install -y \
       libldap2-dev \
       libradcli-dev

    mkdir -p $BUILD_DIR/gvm-libs && cd $BUILD_DIR/gvm-libs

    cmake $SOURCE_DIR/gvm-libs \
      -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
      -DCMAKE_BUILD_TYPE=Release \
      -DSYSCONFDIR=/etc \
      -DLOCALSTATEDIR=/var

    make -j$(nproc)
    make DESTDIR=$INSTALL_DIR install
    sudo cp -rv $INSTALL_DIR/* /
}

gvmd_make(){
    ls $BUILD_DIR/gvmd >/dev/null 2>&1
    if [ $? -eq 0 ]; then
      return
    fi
    sudo apt install -y \
       libglib2.0-dev \
       libgnutls28-dev \
       libpq-dev \
       postgresql-server-dev-14 \
       libical-dev \
       xsltproc \
       rsync \
       libbsd-dev \
       libgpgme-dev

    sudo apt install -y --no-install-recommends \
       texlive-latex-extra \
       texlive-fonts-recommended \
       xmlstarlet \
       zip \
       rpm \
       fakeroot \
       dpkg \
       nsis \
       gnupg \
       gpgsm \
       wget \
       sshpass \
       openssh-client \
       socat \
       snmp \
       python3 \
       smbclient \
       python3-lxml \
       gnutls-bin \
       xml-twig-tools

    mkdir -p $BUILD_DIR/gvmd && cd $BUILD_DIR/gvmd

    cmake $SOURCE_DIR/gvmd \
      -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
      -DCMAKE_BUILD_TYPE=Release \
      -DLOCALSTATEDIR=/var \
      -DSYSCONFDIR=/etc \
      -DGVM_DATA_DIR=/var \
      -DGVMD_RUN_DIR=/run/gvmd \
      -DOPENVAS_DEFAULT_SOCKET=/run/ospd/ospd-openvas.sock \
      -DGVM_FEED_LOCK_PATH=/var/lib/gvm/feed-update.lock \
      -DSYSTEMD_SERVICE_DIR=/lib/systemd/system \
      -DLOGROTATE_DIR=/etc/logrotate.d \
      -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql

    make -j$(nproc)
    make DESTDIR=$INSTALL_DIR install
    sudo cp -rv $INSTALL_DIR/* /
}

pg_gvm_make(){
    ls $BUILD_DIR/pg-gvm >/dev/null 2>&1
    if [ $? -eq 0 ]; then
      return
    fi
    sudo apt install -y \
      libglib2.0-dev \
      postgresql-server-dev-14 \
      libical-dev

    mkdir -p $BUILD_DIR/pg-gvm && cd $BUILD_DIR/pg-gvm

    cmake $SOURCE_DIR/pg-gvm \
        -DCMAKE_BUILD_TYPE=Release \
        -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql

    make -j$(nproc)
    make DESTDIR=$INSTALL_DIR install
    sudo cp -rv $INSTALL_DIR/* /
}

gsa_make(){
    ls $INSTALL_PREFIX/share/gvm/gsad/web >/dev/null 2>&1
    if [ $? -eq 0 ]; then
      return
    fi
    # node
    export NODE_VERSION=node_14.x
    export KEYRING=/usr/share/keyrings/nodesource.gpg
    export DISTRIBUTION="$(lsb_release -s -c)"

    curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | sudo tee "$KEYRING" >/dev/null
    gpg --no-default-keyring --keyring "$KEYRING" --list-keys

    echo "deb [signed-by=$KEYRING] https://deb.nodesource.com/$NODE_VERSION $DISTRIBUTION main" | sudo tee /etc/apt/sources.list.d/nodesource.list
    echo "deb-src [signed-by=$KEYRING] https://deb.nodesource.com/$NODE_VERSION $DISTRIBUTION main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list

    sudo apt update
    sudo apt install -y nodejs

    #yarn
    sudo apt remove cmdtest
    sudo apt remove yarn

    curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
    echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

    sudo apt update
    sudo apt install yarn
    sudo apt install -y yarn


    cd $SOURCE_DIR/gsa

    rm -rf build
    yarn
    yarn build
    sudo mkdir -p $INSTALL_PREFIX/share/gvm/gsad/web/
    sudo cp -r build/* $INSTALL_PREFIX/share/gvm/gsad/web/
}

gsad_make(){
    ls $BUILD_DIR/gsad >/dev/null 2>&1
    if [ $? -eq 0 ]; then
      return
    fi
    sudo apt install -y \
       libmicrohttpd-dev \
       libxml2-dev \
       libglib2.0-dev \
       libgnutls28-dev

    mkdir -p $BUILD_DIR/gsad && cd $BUILD_DIR/gsad

    cmake $SOURCE_DIR/gsad \
      -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
      -DCMAKE_BUILD_TYPE=Release \
      -DSYSCONFDIR=/etc \
      -DLOCALSTATEDIR=/var \
      -DGVMD_RUN_DIR=/run/gvmd \
      -DGSAD_RUN_DIR=/run/gsad \
      -DLOGROTATE_DIR=/etc/logrotate.d

    make -j$(nproc)
    make DESTDIR=$INSTALL_DIR install
    sudo cp -rv $INSTALL_DIR/* /
}

openvas_smb_make(){
    ls $BUILD_DIR/openvas-smb >/dev/null 2>&1
    if [ $? -eq 0 ]; then
      return
    fi
    sudo apt install -y \
        gcc-mingw-w64 \
        libgnutls28-dev \
        libglib2.0-dev \
        libpopt-dev \
        libunistring-dev \
        heimdal-dev \
        perl-base

    mkdir -p $BUILD_DIR/openvas-smb && cd $BUILD_DIR/openvas-smb

    cmake $SOURCE_DIR/openvas-smb \
      -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
      -DCMAKE_BUILD_TYPE=Release

    chmod +x $SOURCE_DIR/openvas-smb/samba/build_idl.sh

    make -j$(nproc)
    make DESTDIR=$INSTALL_DIR install
    sudo cp -rv $INSTALL_DIR/* /
}

openvas_scanner_make(){
    ls $BUILD_DIR/openvas-scanner >/dev/null 2>&1
    if [ $? -eq 0 ]; then
      return
    fi
    sudo apt install -y \
        bison \
        libglib2.0-dev \
        libgnutls28-dev \
        libgcrypt20-dev \
        libpcap-dev \
        libgpgme-dev \
        libksba-dev \
        rsync \
        nmap \
        libjson-glib-dev \
        libbsd-dev
    sudo apt install -y \
        python3-impacket \
        libsnmp-dev


    mkdir -p $BUILD_DIR/openvas-scanner && cd $BUILD_DIR/openvas-scanner

    cmake $SOURCE_DIR/openvas-scanner \
      -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
      -DCMAKE_BUILD_TYPE=Release \
      -DSYSCONFDIR=/etc \
      -DLOCALSTATEDIR=/var \
      -DOPENVAS_FEED_LOCK_PATH=/var/lib/openvas/feed-update.lock \
      -DOPENVAS_RUN_DIR=/run/ospd

    make -j$(nproc)
    make DESTDIR=$INSTALL_DIR install
    sudo cp -rv $INSTALL_DIR/* /
}

ospd_openvas_make(){
     INSTALL_PREFIX=/usr
     sudo apt install -y \
       python3 \
       python3-pip \
       python3-setuptools \
       python3-packaging \
       python3-wrapt \
       python3-cffi \
       python3-psutil \
       python3-lxml \
       python3-defusedxml \
       python3-paramiko \
       python3-redis \
       python3-paho-mqtt

    cd $SOURCE_DIR/ospd-openvas
    python3 -m pip install . --prefix=$INSTALL_PREFIX --root=$INSTALL_DIR --no-warn-script-location
    sudo cp -rv $INSTALL_DIR/* /

}

notus_scanner_make(){
    INSTALL_PREFIX=/usr
    sudo apt install -y \
        python3 \
        python3-pip \
        python3-setuptools \
        python3-paho-mqtt \
        python3-psutil \
        python3-gnupg

    cd $SOURCE_DIR/notus-scanner
    python3 -m pip install . --prefix=$INSTALL_PREFIX --root=$INSTALL_DIR --no-warn-script-location
    sudo cp -rv $INSTALL_DIR/* /
}

gvm_tools_make(){
    sudo apt install -y \
        python3 \
        python3-pip \
        python3-setuptools \
        python3-packaging \
        python3-lxml \
        python3-defusedxml \
        python3-paramiko

    python3 -m pip install --user gvm-tools
    python3 -m pip install --prefix=$INSTALL_PREFIX --root=$INSTALL_DIR --no-warn-script-location gvm-tools
    sudo cp -rv $INSTALL_DIR/* /
}

redis_rst(){
  sudo apt install -y redis-server
  sudo cp $SOURCE_DIR/openvas-scanner-$GVM_VERSION/config/redis-openvas.conf /etc/redis/
  sudo chown redis:redis /etc/redis/redis-openvas.conf
  echo "db_address = /run/redis-openvas/redis.sock" | sudo tee -a /etc/openvas/openvas.conf
  sudo systemctl start redis-server@openvas.service
  sudo systemctl enable redis-server@openvas.service
  sudo usermod -aG redis gvm
}

mqtt_broker_rst(){
  sudo apt install -y mosquitto
  sudo systemctl start mosquitto.service
  sudo systemctl enable mosquitto.service
  echo "mqtt_server_uri = localhost:1883" | sudo tee -a /etc/openvas/openvas.conf
}

directory_permissions_rst(){
    sudo mkdir -p /var/lib/notus
    sudo mkdir -p /run/gvmd

    sudo chown -R gvm:gvm /var/lib/gvm
    sudo chown -R gvm:gvm /var/lib/openvas
    sudo chown -R gvm:gvm /var/lib/notus
    sudo chown -R gvm:gvm /var/log/gvm
    sudo chown -R gvm:gvm /run/gvmd

    sudo chmod -R g+srw /var/lib/gvm
    sudo chmod -R g+srw /var/lib/openvas
    sudo chmod -R g+srw /var/log/gvm


    sudo chown gvm:gvm /usr/local/sbin/gvmd
    sudo chmod 6750 /usr/local/sbin/gvmd

    sudo chown gvm:gvm /usr/local/bin/greenbone-nvt-sync
    sudo chmod 740 /usr/local/sbin/greenbone-feed-sync
    sudo chown gvm:gvm /usr/local/sbin/greenbone-*-sync
    sudo chmod 740 /usr/local/sbin/greenbone-*-sync
}

gpg_rst(){
    export GNUPGHOME=/tmp/openvas-gnupg
    mkdir -p $GNUPGHOME

    gpg --import /tmp/GBCommunitySigningKey.asc
    gpg --import-ownertrust < /tmp/ownertrust.txt

    export OPENVAS_GNUPG_HOME=/etc/openvas/gnupg
    sudo mkdir -p $OPENVAS_GNUPG_HOME
    sudo cp -r /tmp/openvas-gnupg/* $OPENVAS_GNUPG_HOME/
    sudo chown -R gvm:gvm $OPENVAS_GNUPG_HOME
}

sudo_scanning_rst(){
  sudo sh -c 'cat >> /etc/sudoers << EOF
%gvm ALL = NOPASSWD: /usr/local/sbin/openvas
EOF'
}

postgres_rst(){
  sudo apt install -y postgresql
  sudo systemctl start postgresql@14-main
  sudo -u postgres bash <<EOF
cd
createuser -DRS gvm
createdb -O gvm gvmd
psql gvmd << EOF
create role dba with superuser noinherit;
grant dba to gvm;
EOF
}
postgres_rst

admin_user_rst(){
  sudo gvmd --create-user=admin --password=admin
}

feed_import_owner_rst(){
gvmd_value=$(sudo gvmd --get-users --verbose | grep admin | awk '{print $2}')
sudo gvmd --modify-setting 78eceaec-3385-11ea-b237-28d24461215b --value $gvmd_value
}

systemd_rst(){
cat << EOF > $BUILD_DIR/ospd-openvas.service
[Unit]
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
User=gvm
Group=gvm
RuntimeDirectory=ospd
RuntimeDirectoryMode=2775
PIDFile=/run/ospd/ospd-openvas.pid
ExecStart=/usr/local/bin/ospd-openvas --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 --socket-mode 0o770 --mqtt-broker-address localhost --mqtt-broker-port 1883 --notus-feed-dir /var/lib/notus/advisories
SuccessExitStatus=SIGKILL
Restart=always
RestartSec=60

[Install]
WantedBy=multi-user.target
EOF

sudo cp $BUILD_DIR/ospd-openvas.service /etc/systemd/system/

cat << EOF > $BUILD_DIR/notus-scanner.service
[Unit]
Description=Notus Scanner
Documentation=https://github.com/greenbone/notus-scanner
After=mosquitto.service
Wants=mosquitto.service
ConditionKernelCommandLine=!recovery

[Service]
Type=forking
User=gvm
RuntimeDirectory=notus-scanner
RuntimeDirectoryMode=2775
PIDFile=/run/notus-scanner/notus-scanner.pid
ExecStart=/usr/local/bin/notus-scanner --products-directory /var/lib/notus/products --log-file /var/log/gvm/notus-scanner.log
SuccessExitStatus=SIGKILL
Restart=always
RestartSec=60

[Install]
WantedBy=multi-user.target
EOF

sudo cp $BUILD_DIR/notus-scanner.service /etc/systemd/system/

cat << EOF > $BUILD_DIR/gvmd.service
[Unit]
Description=Greenbone Vulnerability Manager daemon (gvmd)
After=network.target networking.service postgresql.service ospd-openvas.service
Wants=postgresql.service ospd-openvas.service
Documentation=man:gvmd(8)
ConditionKernelCommandLine=!recovery

[Service]
Type=forking
User=gvm
Group=gvm
PIDFile=/run/gvmd/gvmd.pid
RuntimeDirectory=gvmd
RuntimeDirectoryMode=2775
ExecStart=/usr/local/sbin/gvmd --osp-vt-update=/run/ospd/ospd-openvas.sock --listen-group=gvm
Restart=always
TimeoutStopSec=10

[Install]
WantedBy=multi-user.target
EOF

sudo cp $BUILD_DIR/gvmd.service /etc/systemd/system/

cat << EOF > $BUILD_DIR/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=exec
User=gvm
Group=gvm
RuntimeDirectory=gsad
RuntimeDirectoryMode=2775
PIDFile=/run/gsad/gsad.pid
ExecStart=/usr/local/sbin/gsad --listen=192.166.85.147 --port=9392 --http-only
Restart=always
TimeoutStopSec=10

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

  sudo cp $BUILD_DIR/gsad.service /etc/systemd/system/
  sudo systemctl daemon-reload
  sudo systemctl enable notus-scanner
  sudo systemctl enable ospd-openvas
  sudo systemctl enable gvmd
  sudo systemctl enable gsad
}


feed_sync_vts_rst(){
  sudo -u gvm greenbone-nvt-sync
}

feed_sync_other_rst(){
  sudo -u gvm greenbone-feed-sync --type SCAP
  sudo -u gvm greenbone-feed-sync --type CERT
  sudo -u gvm greenbone-feed-sync --type GVMD_DATA
}

start_services_rst(){
  sudo systemctl start notus-scanner
  sudo systemctl start ospd-openvas
  sudo systemctl start gvmd
  sudo systemctl start gsad

  sudo systemctl status notus-scanner
  sudo systemctl status ospd-openvas
  sudo systemctl status gvmd
  sudo systemctl status gsad
}

prerequisites
gvm_libs_make
gvmd_make
pg_gvm_make
gsa_make
gsad_make
#openvas_smb_make
openvas_scanner_make
ospd_openvas_make
notus_scanner_make
gvm_tools_make

redis_rst
mqtt_broker_rst
directory_permissions_rst
gpg_rst
sudo_scanning_rst
postgres_rst
admin_user_rst
feed_import_owner_rst
systemd_rst
#feed_sync_vts_rst
#feed_sync_other_rst
start_services_rst

Hi @qwqw,

I moved all of your posts into your original thread, as when it’s posted to different threads it’s impossible to follow along, so please keep the relevant information in one thread (unless advised to start a new one). Also, before bumping the topic it’s best to wait for a response before posting again. If you need to add additional info, it’s better to edit your most recent post. Thanks!

2 Likes

This is not a version you should use anyways. dev indicates, you are using our in-development version, which is not for official use. You should use one of our latest releases as described in our official documentation!!!

1 Like