Skip to content

Commit

Permalink
Merge branch 'middleware' into merge-middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnoStiefvater committed Oct 19, 2021
2 parents a3ea083 + 8ff2a3a commit 11037fc
Show file tree
Hide file tree
Showing 16 changed files with 1,152 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .docker/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Dockerfile for gvm-libs-$VERSION-$COMPILER-build

# Define ARG we use through the build
ARG VERSION=master
ARG VERSION=main
ARG BUILD_TYPE=Debug
ARG COMPILER=gcc

Expand Down
59 changes: 59 additions & 0 deletions .docker/deploy/clang/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# gvm-libs-main-debian-buster-gcc-test

# please follow docker best practices
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/

# Use '-slim' image for reduced image size
FROM debian:buster-slim

# Provides a Debian buster image with the core build dependencies for gvm-libs
LABEL module="gvm-libs"
LABEL branch="main"
LABEL platform="debian-buster"
LABEL compiler="clang"
LABEL configuration="deploy"

# This will make apt-get install without question
ARG DEBIAN_FRONTEND=noninteractive

# Install core dependencies required for building gvm-libs
RUN apt-get update && apt-get install --assume-yes \
clang \
clang-format \
clang-tools \
cmake \
git \
libglib2.0-dev \
libgnutls28-dev \
libgpgme-dev \
libhiredis-dev \
libpcap-dev \
libnet1-dev \
libssh-gcrypt-dev \
libxml2-dev \
pkg-config \
uuid-dev \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*

# clone and install mqtt paho
# workaround otherwise paho.mqtt.c creates man1 as a file
RUN mkdir /usr/local/share/man/man1

RUN git clone --depth 1 https://github.com/eclipse/paho.mqtt.c \
&& cd paho.mqtt.c \
&& make \
&& make install \
&& cd .. \
&& rm -rf paho.mqtt.c

ENV LD_LIBRARY_PATH="/usr/local/lib"

# clone and install gvm-libs
RUN git clone --depth 1 \
https://github.com/greenbone/gvm-libs.git \
cd gvm-libs && \
mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \
make install
59 changes: 59 additions & 0 deletions .docker/deploy/gcc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# gvm-libs-main-debian-buster-gcc-deploy

# please follow docker best practices
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/

# Use '-slim' image for reduced image size
FROM debian:buster-slim

# Provides a Debian buster image with the core build dependencies for gvm-libs
LABEL module="gvm-libs"
LABEL branch="main"
LABEL platform="debian-buster"
LABEL compiler="gcc"
LABEL configuration="deploy"

# This will make apt-get install without question
ARG DEBIAN_FRONTEND=noninteractive

# Install core dependencies required for building gvm-libs
RUN apt-get update && apt-get install --no-install-recommends --assume-yes \
ca-certificates \
cmake \
gcc \
git \
libglib2.0-dev \
libgnutls28-dev \
libgpgme-dev \
libhiredis-dev \
libpcap-dev \
libssh-gcrypt-dev \
libxml2-dev \
libnet1-dev \
make \
pkg-config \
uuid-dev \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*

# clone and install mqtt paho
# workaround otherwise paho.mqtt.c creates man1 as a file
RUN mkdir /usr/local/share/man/man1

RUN git clone --depth 1 https://github.com/eclipse/paho.mqtt.c \
&& cd paho.mqtt.c \
&& make \
&& make install \
&& cd .. \
&& rm -rf paho.mqtt.c

ENV LD_LIBRARY_PATH="/usr/local/lib"

# clone and install gvm-libs
RUN git clone --depth 1 \
https://github.com/greenbone/gvm-libs.git \
cd gvm-libs && \
mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \
make install
72 changes: 72 additions & 0 deletions .docker/test/clang/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# gvm-libs-main-debian-buster-gcc-test

# please follow docker best practices
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/

# Use '-slim' image for reduced image size
FROM debian:buster-slim

# Provides a Debian buster image with the core build dependencies for gvm-libs
LABEL module="gvm-libs"
LABEL branch="main"
LABEL platform="debian-buster"
LABEL compiler="clang"
LABEL configuration="test"

# This will make apt-get install without question
ARG DEBIAN_FRONTEND=noninteractive

# Install core dependencies required for building gvm-libs
RUN apt-get update && apt-get install --assume-yes \
clang \
clang-format \
clang-tools \
cmake \
git \
libglib2.0-dev \
libgnutls28-dev \
libgpgme-dev \
libhiredis-dev \
libpcap-dev \
libnet1-dev \
libssh-gcrypt-dev \
libxml2-dev \
pkg-config \
uuid-dev \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*

# clone and install mqtt paho
# workaround otherwise paho.mqtt.c creates man1 as a file
RUN mkdir /usr/local/share/man/man1

RUN git clone --depth 1 https://github.com/eclipse/paho.mqtt.c \
&& cd paho.mqtt.c \
&& make \
&& make install \
&& cd .. \
&& rm -rf paho.mqtt.c

ENV LD_LIBRARY_PATH="/usr/local/lib"

# Install Debian core dependencies required for testing gvm-libs
# support and not yet installed as dependencies of gvm-libs-core
RUN apt-get update && apt-get install --assume-yes \
lcov \
libical-dev \
libpq-dev \
libnet1-dev \
postgresql-server-dev-all \
xsltproc \
&& rm -rf /var/lib/apt/lists/*

# install cgreen for unit tests
RUN git clone --depth 1 https://github.com/cgreen-devs/cgreen.git \
&& cd cgreen \
&& make \
&& make test \
&& make install \
&& cd .. \
&& rm -rf cgreen

ENV LD_LIBRARY_PATH="/usr/local/lib"
71 changes: 71 additions & 0 deletions .docker/test/gcc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# gvm-libs-main-debian-buster-gcc-test

# please follow docker best practices
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/

# Use '-slim' image for reduced image size
FROM debian:buster-slim

# Provides a Debian buster image with the core build dependencies for gvm-libs
LABEL module="gvm-libs"
LABEL branch="main"
LABEL platform="debian-buster"
LABEL compiler="gcc"
LABEL configuration="test"

# This will make apt-get install without question
ARG DEBIAN_FRONTEND=noninteractive

# Install core dependencies required for building gvm-libs
RUN apt-get update && apt-get install --no-install-recommends --assume-yes \
ca-certificates \
cmake \
gcc \
git \
libglib2.0-dev \
libgnutls28-dev \
libgpgme-dev \
libhiredis-dev \
libpcap-dev \
libssh-gcrypt-dev \
libxml2-dev \
libnet1-dev \
make \
pkg-config \
uuid-dev \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*

# clone and install mqtt paho
# workaround otherwise paho.mqtt.c creates man1 as a file
RUN mkdir /usr/local/share/man/man1

RUN git clone --depth 1 https://github.com/eclipse/paho.mqtt.c \
&& cd paho.mqtt.c \
&& make \
&& make install \
&& cd .. \
&& rm -rf paho.mqtt.c

# Install Debian core dependencies required for testing gvm-libs
# support and not yet installed as dependencies of gvm-libs-core
RUN apt-get update && apt-get install --assume-yes \
g++ \
lcov \
libical-dev \
libpq-dev \
libnet1-dev \
postgresql-server-dev-all \
xsltproc \
&& rm -rf /var/lib/apt/lists/*

# install cgreen for unit tests
RUN git clone --depth 1 https://github.com/cgreen-devs/cgreen.git \
&& cd cgreen \
&& make \
&& make test \
&& make install \
&& cd .. \
&& rm -rf cgreen

ENV LD_LIBRARY_PATH="/usr/local/lib"
4 changes: 2 additions & 2 deletions .github/workflows/ci-c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Build and test C

on:
push:
branches: [ main, oldstable, stable, middleware ]
branches: [ main, oldstable, stable ]
pull_request:
branches: [ main, oldstable, stable, middleware ]
branches: [ main, oldstable, stable ]


jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and upload docker images

on:
push:
branches: [ main, oldstable, stable, middleware ]
branches: [ main, oldstable, stable ]

jobs:
upload-testing:
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
build/
.ccls
# clangd
# generated by
# cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1
compile_commands.json
.cache/
# cmake
CMakeFiles/
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Possibility to use lcrypt with `$6$` (sha512) for authentication [484](https://github.com/greenbone/gvm-libs/pull/484)
- Add function to perform an alive test and get the amount of alive hosts. [495](https://github.com/greenbone/gvm-libs/pull/495)
- Add functions for sentry integration. [#502](https://github.com/greenbone/gvm-libs/pull/502) [#506](https://github.com/greenbone/gvm-libs/pull/506)
- Add basic support for mqtt.
Original
[#505](https://github.com/greenbone/gvm-libs/pull/505)
[#511](https://github.com/greenbone/gvm-libs/pull/511).
Reintroduction after Rebase
[#538](https://github.com/greenbone/gvm-libs/pull/538)
- Refactor MQTT handling [#562](https://github.com/greenbone/gvm-libs/pull/562). Add function for mqtt init status [#567](https://github.com/greenbone/gvm-libs/pull/567). Fix prototypes in mqtt.h. [#584](https://github.com/greenbone/gvm-libs/pull/584)
- Add function to get the severity_vector, otherwise the cvss_base_vector. [#568](https://github.com/greenbone/gvm-libs/pull/568)
- Add function to duplicate host and vhost objects [#590](https://github.com/greenbone/gvm-libs/pull/590)

### Changed
- Handle script timeout as script preference with ID 0 [#581](https://github.com/greenbone/gvm-libs/pull/581)
Expand Down
2 changes: 2 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ Install prerequisites for optional features on Debian GNU/Linux 'Buster' 10:
libldap2-dev \
libradcli-dev

Prerequisites for MQTT support:
* libpaho-mqtt-dev >= 1.3.8. This package is currently not available in debian buster stable. Could be installed from source, backports or unstable branch.

Compiling gvm-libs
------------------
Expand Down
30 changes: 30 additions & 0 deletions base/nvti.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,36 @@ nvti_severity_score (const nvti_t *n)
return score;
}

/**
* @brief Get the severity score
*
* Extended severity was introduced but still not all
* vts are using it. Therefore it must be checked if
* we can calculate the score from the severity_vector tag
* or if we have to calculate it from the deprecated
* cvss_base_vector tag.
*
* @param n The NVT Info structure.
*
* @return The severity_vector if present or cvss_base_vector otherwise.
* NULL indicates an error. Must be free()'d by the caller.
*/
gchar *
nvti_severity_vector_from_tag (const nvti_t *n)
{
gchar *vector;

/* Currently, only one severity_vector can be stored as tag.
* Therfore we just check this one. */
vector = nvti_get_tag (n, "severity_vector");
if (vector)
return vector;

vector = nvti_get_tag (n, "cvss_base_vector");

return vector;
}

/**
* @brief Get the solution.
*
Expand Down
2 changes: 2 additions & 0 deletions base/nvti.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ vtseverity_t *
nvti_vtseverity (const nvti_t *, guint);
double
nvti_severity_score (const nvti_t *);
gchar *
nvti_severity_vector_from_tag (const nvti_t *);

nvti_t *
nvti_new (void);
Expand Down
Loading

0 comments on commit 11037fc

Please sign in to comment.