update version: sonarqube, gvm

This commit is contained in:
2025-05-07 17:53:32 +02:00
parent cf43143810
commit d8e27c9feb
5 changed files with 36 additions and 11 deletions

View File

@@ -5,11 +5,15 @@ LABEL io.hass.name="GVM Scanner"
LABEL io.hass.description="un a GVM (OpenVAS) scanner as a Home Assistant add-on."
LABEL io.hass.arch="amd64|aarch64"
LABEL io.hass.type="addon"
LABEL io.hass.version="0.0.1-beta"
LABEL io.hass.version="0.0.2-beta"
# Set timezone
ENV TZ=Europe/Rome
# Install jq for parsing config
RUN apt-get update && apt-get install -y jq \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy the entrypoint script
COPY run.sh /run.sh
RUN chmod +x /run.sh
@@ -17,5 +21,8 @@ RUN chmod +x /run.sh
# Expose default GVM Web UI port
EXPOSE 9392
# Optionally persist data
VOLUME [ "/data" ]
# Set entrypoint
CMD [ "/run.sh" ]

View File

@@ -48,7 +48,7 @@ gvm/
## 🛡 Security
> ⚠️ Always use strong passwords and ensure secure network settings, especially for database connections.
> ⚠️ Always use strong passwords and ensure secure network settings.
---

View File

@@ -1,6 +1,6 @@
{
"name": "GVM Scanner",
"version": "0.0.1-beta",
"version": "0.0.2-beta",
"slug": "gvm",
"description": "Run a GVM (OpenVAS) scanner as a Home Assistant add-on.",
"startup": "services",

View File

@@ -7,15 +7,34 @@ log() {
echo "[GVM ADD-ON] $(date +"%Y-%m-%d %H:%M:%S") - $*"
}
# Ensure required env vars are set
: "${USERNAME:?Environment variable USERNAME not set}"
: "${PASSWORD:?Environment variable PASSWORD not set}"
# Load user config passed by Home Assistant (as JSON env vars)
CONFIG_PATH="/data/options.json"
log "Starting GVM (OpenVAS) add-on..."
if [ ! -f "$CONFIG_PATH" ]; then
log "ERROR: Config file not found at $CONFIG_PATH"
exit 1
fi
# Extract variables using jq
USERNAME=$(jq -r '.username' "$CONFIG_PATH")
PASSWORD=$(jq -r '.password' "$CONFIG_PATH")
# Validate
if [ -z "$USERNAME" ] || [ -z "$PASSWORD" ]; then
log "ERROR: username and/or password not set in options.json"
exit 1
fi
# Set them for the environment
export USERNAME
export PASSWORD
export DB_PASSWORD="$PASSWORD"
log "INFO: Starting GVM (OpenVAS) add-on as user $USERNAME..."
# Setup timezone
if [ -n "$TZ" ]; then
log "Setting timezone to $TZ"
log "INFO: Setting timezone to $TZ"
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
echo "$TZ" > /etc/timezone
fi
@@ -23,9 +42,9 @@ fi
# Initialize data directory
DATA_DIR="/data"
if [ ! -d "$DATA_DIR" ]; then
log "Creating data directory at $DATA_DIR"
log "INFO: Creating data directory at $DATA_DIR"
mkdir -p "$DATA_DIR"
fi
log "Launching GVM service..."
log "INFO: Launching GVM service..."
exec /usr/local/bin/dumb-init gvm-start | tee -a "$DATA_DIR/gvm.log"

View File

@@ -39,7 +39,6 @@
"SONAR_JDBC_USERNAME": "jdbc_username",
"SONAR_JDBC_PASSWORD": "jdbc_password"
},
"image": "sonarqube",
"webui": "http://[HOST]:[PORT:9000]",
"build_from": {
"amd64": "alpine:3.18",