Skip to content

Commit

Permalink
Merge pull request #2169 from greenbone/use-openvasd
Browse files Browse the repository at this point in the history
use openvasd
  • Loading branch information
a-h-abdelsalam authored Jun 11, 2024
2 parents d368c0d + f2c7720 commit 274e326
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
8 changes: 7 additions & 1 deletion .docker/prod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@ ARG VERSION=edge
ARG GVM_LIBS_VERSION=oldstable
ARG DEBIAN_FRONTEND=noninteractive
ARG IMAGE_REGISTRY=ghcr.io
# when set it will added to the cmake command
# As an example:
# FEATURE_TOGGLES="-DOPENVASD=1"
# enables openvasd feature toggle.
ARG FEATURE_TOGGLE=""

FROM ${IMAGE_REGISTRY}/greenbone/gvmd-build:${VERSION} as builder
ARG FEATURE_TOGGLE

COPY . /source
WORKDIR /source

RUN mkdir /build && \
mkdir /install && \
cd /build && \
cmake -DCMAKE_BUILD_TYPE=Release /source && \
cmake -DCMAKE_BUILD_TYPE=Release $FEATURE_TOGGLE /source && \
make DESTDIR=/install install

FROM greenbone/gvm-libs:${GVM_LIBS_VERSION}
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ jobs:
images:
name: Production Images
runs-on: ubuntu-latest
strategy:
matrix:
build:
- default
- openvasd
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -41,8 +46,9 @@ jobs:
type=ref,event=pr
# when a new git tag is created set stable and a latest tags
type=raw,value=latest,enable=${{ steps.latest.outputs.is-latest-tag == 'true' }}
type=raw,value=stable,enable=${{ steps.latest.outputs.is-latest-tag == 'true' }}
type=raw,value=latest,enable=${{ steps.latest.outputs.is-latest-tag == 'true' && matrix.build == 'default'}}
type=raw,value=stable,enable=${{ steps.latest.outputs.is-latest-tag == 'true' && matrix.build == 'default'}}
type=raw,value=edge-openvasd,enable=${{ steps.latest.outputs.is-latest-tag == 'false' && matrix.build == 'openvasd' }}
- name: Set container build options
id: container-opts
run: |
Expand All @@ -53,6 +59,11 @@ jobs:
echo "version=edge" >> $GITHUB_OUTPUT
echo "gvm-libs-version=oldstable-edge" >> $GITHUB_OUTPUT
fi
if [[ "${{ matrix.build }}" = 'openvasd' ]]; then
echo 'ft=-DOPENVASD=1' >> $GITHUB_OUTPUT
else
echo 'ft=-DOPENVASD=0' >> $GITHUB_OUTPUT
fi
- name: Login to Docker Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
Expand All @@ -71,6 +82,7 @@ jobs:
build-args: |
VERSION=${{ steps.container-opts.outputs.version }}
GVM_LIBS_VERSION=${{ steps.container-opts.outputs.gvm-libs-version }}
FEATURE_TOGGLE=${{ steps.container-opts.outputs.ft }}
IMAGE_REGISTRY=${{ vars.IMAGE_REGISTRY }}
file: .docker/prod.Dockerfile
platforms: linux/amd64,linux/arm64
Expand Down
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ if (NOT GVM_DEFAULT_DROP_USER)
set (GVM_DEFAULT_DROP_USER "")
endif (NOT GVM_DEFAULT_DROP_USER)


if (NOT OPENVASD)
set (OPENVASD 0)
endif (NOT OPENVASD)

message ("-- Install prefix: ${CMAKE_INSTALL_PREFIX}")

## Version
Expand Down Expand Up @@ -275,7 +280,7 @@ set (HARDENING_FLAGS "-Wformat -Wformat-security -D_FORTIFY_SOURCE=2
set (LINKER_HARDENING_FLAGS "-Wl,-z,relro -Wl,-z,now")

# To find unused functions, add: -flto -fwhole-program -ffunction-sections -Wl,--gc-sections -Wl,--print-gc-sections
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -D_BSD_SOURCE -D_ISOC99_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE -D_FILE_OFFSET_BITS=64")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -D_BSD_SOURCE -D_ISOC99_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE -D_FILE_OFFSET_BITS=64 -DOPENVASD=${OPENVASD}")

set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Werror -Wshadow ${COVERAGE_FLAGS} ${DEBUG_FUNCTION_NAMES_FLAGS}")
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${HARDENING_FLAGS} ${COVERAGE_FLAGS}")
Expand Down
4 changes: 4 additions & 0 deletions src/gvmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2300,6 +2300,9 @@ gvmd (int argc, char** argv, char *env[])
else
printf ("Sentry support disabled\n");
}
#if OPENVASD == 1
printf ("OpenVASD is enabled\n");
#endif
printf ("Copyright (C) 2009-2021 Greenbone AG\n");
printf ("License: AGPL-3.0-or-later\n");
printf
Expand Down Expand Up @@ -2484,6 +2487,7 @@ gvmd (int argc, char** argv, char *env[])
/**
* LDAP debugging
*/

if (ldap_debug)
{
if (ldap_enable_debug () == 0)
Expand Down

0 comments on commit 274e326

Please sign in to comment.