From 1ecc464388802fc7697660fae79f3c109def2ef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Wed, 4 Aug 2021 16:46:35 +0200 Subject: [PATCH 1/2] Use better defaults for installation directories Changed defaults for installation locations * SYSCONFDIR is /etc by default now * LOCALSTATEDIR is /var by default now * GVM_RUN_DIR is /run/gvm by default now * OPENVAS_DEFAULT_SOCKET is /run/ospd/ospd-openvas.sock by default now * SYSTEMD_SERVICE_DIR is /lib/systemd/system by default now Dropped gvmd.default file and use sane defaults in generated gvmd.service file instead. Packagers should patch that file if it doesn't fit instead of using the gvmd.default file. --- CMakeLists.txt | 8 ++++---- config/CMakeLists.txt | 12 ++---------- config/gvmd.default.in | 19 ------------------- config/gvmd.service.in | 8 +++++--- 4 files changed, 11 insertions(+), 36 deletions(-) delete mode 100644 config/gvmd.default.in diff --git a/CMakeLists.txt b/CMakeLists.txt index aae1e23a1..c5ff9b527 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,7 +125,7 @@ if (SYSCONF_INSTALL_DIR) endif (SYSCONF_INSTALL_DIR) if (NOT SYSCONFDIR) - set (SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc") + set (SYSCONFDIR "/etc") endif (NOT SYSCONFDIR) if (NOT EXEC_PREFIX) @@ -145,7 +145,7 @@ if (NOT LIBDIR) endif (NOT LIBDIR) if (NOT LOCALSTATEDIR) - set (LOCALSTATEDIR "${CMAKE_INSTALL_PREFIX}/var") + set (LOCALSTATEDIR "/var") endif (NOT LOCALSTATEDIR) if (NOT DATADIR) @@ -196,7 +196,7 @@ set (GVM_CLIENT_KEY "${GVM_STATE_DIR}/private/CA/clientkey.pem") set (GVM_CA_CERTIFICATE "${GVM_STATE_DIR}/CA/cacert.pem") if (NOT GVM_RUN_DIR) - set (GVM_RUN_DIR "${LOCALSTATEDIR}/run") + set (GVM_RUN_DIR "/run/gvm") endif (NOT GVM_RUN_DIR) if (NOT GVM_FEED_LOCK_PATH) @@ -205,7 +205,7 @@ endif (NOT GVM_FEED_LOCK_PATH) add_definitions (-DGVM_FEED_LOCK_PATH="${GVM_FEED_LOCK_PATH}") if (NOT OPENVAS_DEFAULT_SOCKET) - set (OPENVAS_DEFAULT_SOCKET "/var/run/ospd/ospd.sock") + set (OPENVAS_DEFAULT_SOCKET "/run/ospd/ospd-openvas.sock") endif (NOT OPENVAS_DEFAULT_SOCKET) add_definitions (-DOPENVAS_DEFAULT_SOCKET="${OPENVAS_DEFAULT_SOCKET}") diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index b0524aba8..015bd98cb 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -17,26 +17,18 @@ if (NOT SYSTEMD_SERVICE_DIR) - set (SYSTEMD_SERVICE_DIR "${CMAKE_INSTALL_PREFIX}/lib/systemd/system") + set (SYSTEMD_SERVICE_DIR "/lib/systemd/system") endif (NOT SYSTEMD_SERVICE_DIR) -if (NOT DEFAULT_CONFIG_DIR) - set (DEFAULT_CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/etc/default") -endif (NOT DEFAULT_CONFIG_DIR) - if (NOT LOGROTATE_DIR) - set (LOGROTATE_DIR "${CMAKE_INSTALL_PREFIX}/etc/logrotate.d") + set (LOGROTATE_DIR "${SYSCONFDIR}/logrotate.d") endif (NOT LOGROTATE_DIR) configure_file (gvmd.service.in gvmd.service) configure_file (gvmd.logrotate.in gvmd.logrotate) -configure_file (gvmd.default.in gvmd.default) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/gvmd.service DESTINATION ${SYSTEMD_SERVICE_DIR}/) -install (FILES ${CMAKE_CURRENT_BINARY_DIR}/gvmd.default - DESTINATION ${DEFAULT_CONFIG_DIR}/ RENAME gvmd) - install (FILES ${CMAKE_CURRENT_BINARY_DIR}/gvmd.logrotate DESTINATION ${LOGROTATE_DIR}/ RENAME gvmd) diff --git a/config/gvmd.default.in b/config/gvmd.default.in deleted file mode 100644 index 28c96744b..000000000 --- a/config/gvmd.default.in +++ /dev/null @@ -1,19 +0,0 @@ -# -# The user for running the gvmd in the gvmd.service systemd file -# -GVMD_USER="gvm" - -# -# The group for running the gvmd in the gvmd.service systemd file -# -GVMD_GROUP="gvm" - -# -# Unix socket for OSP NVT update (--osp-vt-update) -# -OSP_VT_UPDATE="${OPENVAS_DEFAULT_SOCKET}" - -# -# Additional options -# -OPTIONS="" diff --git a/config/gvmd.service.in b/config/gvmd.service.in index 3f47b8639..e708952fa 100644 --- a/config/gvmd.service.in +++ b/config/gvmd.service.in @@ -7,11 +7,13 @@ ConditionKernelCommandLine=!recovery [Service] Type=forking -User=$GVMD_USER -Group=$GVMD_GROUP +User=gvm +Group=gvm PIDFile=${GVM_RUN_DIR}/gvmd.pid +RuntimeDirectory=gvm +RuntimeDirectoryMode=2775 EnvironmentFile=${DEFAULT_CONFIG_DIR}/gvmd -ExecStart=${SBINDIR}/gvmd --osp-vt-update=$OSP_VT_UPDATE $OPTIONS +ExecStart=${SBINDIR}/gvmd --osp-vt-update=/run/ospd/ospd-openvas.sock --listen-group=gvm Restart=always TimeoutStopSec=10 From 3541c2bdf12c73b47268858b0bd9d2ff39eea3a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Wed, 4 Aug 2021 16:54:03 +0200 Subject: [PATCH 2/2] Add changelog entry --- CHANGELOG.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b72607cb0..33e3c38f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,14 +4,22 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## [Unreleased] +## [20.8.4] - Unreleased ### Added ### Changed +* Changed defaults for installation locations [#1662](https://github.com/greenbone/gvmd/pull/1662) + * SYSCONFDIR is /etc by default now + * LOCALSTATEDIR is /var by default now + * GVM_RUN_DIR is /run/gvm by default now + * OPENVAS_DEFAULT_SOCKET is /run/ospd/ospd-openvas.sock by default now + * SYSTEMD_SERVICE_DIR is /lib/systemd/system by default now + * Removed gvmd.default file and adjusted gvmd.service file accordingly + ### Deprecated ### Removed ### Fixed -[Unreleased]: https://github.com/greenbone/gvmd/compare/v20.8.3...HEAD +[20.8.4]: https://github.com/greenbone/gvmd/compare/v20.8.3...gvmd-20.08 ## [20.8.3] - 2021-08-03