vector-bin: Initial import

Signed-off-by: Stefan Knoblich <stkn@bitplumber.de>
This commit is contained in:
2023-10-19 14:03:13 +02:00
parent 1666cc29e1
commit 87befbaac4
9 changed files with 138 additions and 0 deletions

View File

View File

@@ -0,0 +1,21 @@
#!/sbin/openrc-run
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
VECTOR_USER="${VECTOR_USER:-vector}"
VECTOR_GROUP="${VECTOR_GROUP:-vector}"
VECTOR_CONFIG="${VECTOR_CONFIG:-/etc/vector/config.toml}"
VECTOR_DATA_DIR="${VECTOR_DATA_DIR:-/var/lib/vector}"
VECTOR_LOG_DIR="${VECTOR_LOG_DIR:-/var/log/vector}"
command="/usr/bin/vector"
command_args="--config ${VECTOR_CONFIG}"
pidfile="/run/${RC_SVCNAME}.pid"
command_background="true"
start_stop_daemon_args="--user=\"${VECTOR_USER}\" --group=\"${VECTOR_GROUP}\" --stdout ${VECTOR_LOG_DIR}/vector.log --stderr ${VECTOR_LOG_DIR}/vector.err"
start_pre() {
checkpath -d -o "${VECTOR_USER}" -m750 "${VECTOR_DATA_DIR}"
checkpath -d -o "${VECTOR_USER}" -m750 "${VECTOR_LOG_DIR}"
}

View File

@@ -0,0 +1,51 @@
[Unit]
Description=Vector
After=network.target
[Service]
User=vector
Group=vector
ExecStartPre=/usr/bin/vector validate --config /etc/vector/config.toml
ExecStart=/usr/bin/vector --config /etc/vector/config.toml
ExecReload=/usr/bin/vector validate --config /etc/vector/config.toml
ExecReload=/bin/kill -HUP $MAINPID
Restart=no
# capabilities
AmbientCapabilities=CAP_NET_BIND_SERVICE
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
# sandboxing
ProtectHostname=yes
ProtectClock=yes
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectKernelLogs=yes
ProtectSystem=strict
ProtectHome=yes
ProtectControlGroups=yes
PrivateTmp=yes
PrivateDevices=yes
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
LockPersonality=yes
MemoryDenyWriteExecute=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
NoNewPrivileges=yes
RemoveIPC=yes
RestrictNamespaces=yes
WorkingDirectory=/var/lib/vector
StateDirectory=vector
StateDirectoryMode=0750
# syscall filtering
SystemCallFilter=@system-service @debug
SystemCallArchitectures=native
# process properties
UMask=077
[Install]
WantedBy=multi-user.target