Skip to content

mgrpxy should automatically deploy systemid from httpd.yaml to volume during proxy setup #723

Description

@ajaykumarmandapati

Summary

The mgrpxy start command does not automatically extract and deploy the systemid certificate from httpd.yaml to the uyuni-proxy-systemid volume, requiring manual intervention to make proxy authentication work. This makes proxy deployment error-prone and non-intuitive.

Environment

  • Uyuni Version: 2026.01
  • uyuni-tools Version: (check with mgrpxy --version)
  • OS: openSUSE Leap 15.6
  • Deployment Method: Podman (containerized)
  • Configuration Method: spacecmd proxy_container_config_generate_cert

Steps to Reproduce

  1. Generate proxy configuration using spacecmd:

    podman exec uyuni-server spacecmd proxy_container_config_generate_cert -- \
      proxy.example.com \
      master.example.com \
      2048 \
      admin@example.com \
      -o /tmp/config.tar.gz
  2. Transfer config.tar.gz to proxy host and extract:

    scp config.tar.gz root@proxy-host:/root/
    ssh root@proxy-host
    cd /root
    tar -xzf config.tar.gz
  3. Ensure systemid volume mount is configured:

    cat /etc/systemd/system/uyuni-proxy-httpd.service.d/systemid-mount.conf
    # Contains: Environment="HTTPD_EXTRA_CONF=-v uyuni-proxy-systemid:/etc/sysconfig/rhn"
  4. Start proxy containers:

    mgrpxy start
  5. Test proxy authentication:

    curl -sSk -I https://proxy.example.com/rhn/manager/download/debian-12-amd64-uyuni-client/Packages

Expected Behavior

  • mgrpxy start should:

    1. Read the httpd.yaml file in the current directory
    2. Extract the system_id field value (XML certificate)
    3. Write it to the uyuni-proxy-systemid volume at /systemid
    4. Start the containers with the systemid already deployed
    5. Proxy authentication should work immediately
  • The proxy should successfully authenticate with the master and return HTTP/1.1 403 Forbidden (or 200 with proper client credentials)

Actual Behavior

  • mgrpxy start starts containers but does not deploy the systemid from httpd.yaml
  • The uyuni-proxy-systemid volume remains empty or contains an old systemid
  • Proxy authentication fails with HTTP/1.1 500 Internal Server Error
  • Master logs show: Checksum check failed: <old-checksum> != <new-checksum>
  • Proxy httpd logs show: socket.timeout: The read operation timed out during server.proxy.login()

Manual Workaround Required

Users must manually extract and deploy the systemid:

# Extract systemid from httpd.yaml
grep 'system_id:' /root/httpd.yaml | \
    sed 's/^[[:space:]]*system_id:[[:space:]]*//' > /tmp/systemid.xml

# Deploy to volume
VOLUME_PATH=$(podman volume inspect uyuni-proxy-systemid --format '{{.Mountpoint}}')
mkdir -p "$VOLUME_PATH"
cp /tmp/systemid.xml "$VOLUME_PATH/systemid"

# Restart httpd container
podman restart uyuni-proxy-httpd

Impact

  • User Experience: Confusing and error-prone deployment process
  • Documentation Gap: Not documented in official guides that this manual step is required
  • Production Risk: Easy to miss this step, leading to non-functional proxies
  • Update Complexity: Every proxy configuration update requires manual systemid extraction

Root Cause Analysis

The mgrpxy tool:

  1. Reads config.yaml, httpd.yaml, and ssh.yaml to configure containers
  2. Uses httpd.yaml to set environment variables and mount volumes
  3. Does NOT extract the system_id field from httpd.yaml and write it to the filesystem/volume
  4. Assumes the systemid already exists in the volume (which is not true for new deployments or updates)

The httpd.yaml contains the systemid in this format:

httpd:
    system_id: <?xml version="1.0"?><params><param><value><struct>...

But this value is never written to /etc/sysconfig/rhn/systemid in the container.

Proposed Solution

Enhance mgrpxy start to automatically deploy the systemid:

Option 1: Deploy During Container Start (Recommended)

Modify mgrpxy start to:

  1. Check if httpd.yaml exists in the current directory
  2. Extract the system_id field value
  3. Get the uyuni-proxy-systemid volume mount point
  4. Write the systemid to <volume-path>/systemid
  5. Proceed with normal container startup

Option 2: Add Explicit Command

Add a new command: mgrpxy deploy-systemid that users can run before mgrpxy start:

mgrpxy deploy-systemid /root/httpd.yaml
mgrpxy start

Option 3: Init Container

Use a podman init container that runs before httpd starts and extracts/deploys the systemid from the yaml configuration.

Additional Context

Related Issues:

  • Proxy systemid must be in a persistent volume for authentication to work
  • The volume mount is configured via systemd override: HTTPD_EXTRA_CONF=-v uyuni-proxy-systemid:/etc/sysconfig/rhn
  • This issue affects both new proxy deployments and proxy configuration updates

Documentation References:

Affected Commands:

  • mgrpxy start
  • mgrpxy install (if it also doesn't handle systemid deployment)

Additional Information

Workaround Script

We've created an automated deployment script that handles this:

#!/bin/bash
# Automated proxy configuration deployment
# This is what mgrpxy should do automatically

CONFIG_ARCHIVE="${1:-/root/config.tar.gz}"
TEMP_DIR=$(mktemp -d)
tar -xzf "$CONFIG_ARCHIVE" -C "$TEMP_DIR"

# Extract systemid from httpd.yaml
grep 'system_id:' "$TEMP_DIR/httpd.yaml" | \
    sed 's/^[[:space:]]*system_id:[[:space:]]*//' > "$TEMP_DIR/systemid.xml"

# Deploy to volume
VOLUME_PATH=$(podman volume inspect uyuni-proxy-systemid --format '{{.Mountpoint}}')
mkdir -p "$VOLUME_PATH"
cp "$TEMP_DIR/systemid.xml" "$VOLUME_PATH/systemid"

# Move config files
cp "$TEMP_DIR"/*.yaml /root/

# Start containers
cd /root
mgrpxy start

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions