feat: Mejorar la configuración y seguridad de Koji

Este commit introduce varias mejoras en los roles de Ansible para Koji:

- **Rol koji_hub:**
  - Se reemplazó `lineinfile` con una plantilla completa para `hub.conf` para mejorar la legibilidad y mantenibilidad.
  - Se aseguró la instalación del paquete `python3-koji-hub-plugins` para soportar el plugin `echo`.
  - Se eliminó una tarea `blockinfile` redundante que duplicaba la configuración de la base de datos en `hub.conf`.
  - Se rehabilitó el plugin `echo` en `hub.conf` después de asegurar su disponibilidad.

- **Rol postgresql:**
  - Se modificó la configuración de `pg_hba.conf` para iterar correctamente sobre todos los hosts en el grupo `kojihub`, asegurando que todas las instancias del hub puedan conectarse a la base de datos.

- **Rol dist_git:**
  - Se implementó el etiquetado persistente de contextos SELinux para los directorios de `dist-git` usando `semanage fcontext` y `restorecon`, asegurando que los contextos persistan tras reetiquetados del sistema de archivos.

- **Rol common:**
  - Se mejoró la seguridad en la generación de claves GPG usando un archivo temporal para el script por lotes, el cual se elimina de forma segura después de la generación de la clave.

- **Configuración Global:**
  - Se introdujo la variable `koji_source_script_path` en `vars/default.yaml` para centralizar la ruta del script `mxos-get-sources.bash`, eliminando rutas hardcodeadas en `kojid_allowed_scms` y las tareas de `kojid`.

- **Documentación:**
  - Se actualizó `docs/instalación.rst` para reflejar los cambios en la configuración de Dist-Git, plugins y variables.
This commit is contained in:
Rénich Bon Ćirić 2025-11-22 11:48:06 -06:00
commit f14c01da0b
Signed by: renich
GPG key ID: AB2A9F49384FE324
25 changed files with 731 additions and 123 deletions

View file

@ -1,25 +1,63 @@
# Koji Hub Configuration
[hub]
# Main directory for Koji data (packages, repos, etc.)
## ConfigParser style config file, similar to ini files
## https://docs.python.org/library/configparser.html
## Basic options ##
DBName = {{ koji_db_name }}
DBUser = {{ koji_db_user }}
DBHost = {{ koji_db_host }}
DBPass = {{ koji_db_password }}
KojiDir = {{ koji_top_dir }}
# Authentication methods. 'ssl' is primary for clients, 'password' for web UI.
AuthMethods = ssl, password
## Auth-related options ##
# CheckClientIP = True
# Automatically create a user account on first successful SSL login.
## Kerberos authentication options ##
# ProxyPrincipals = koji/kojiweb@EXAMPLE.COM
# HostPrincipalFormat = compile/%s@EXAMPLE.COM
# AllowedKrbRealms = *
# DisableURLSessions = False
## SSL client certificate auth configuration ##
# The client username is the common name of the subject of their client certificate
DNUsernameComponent = CN
# ProxyDNs is used to allow a specific user (usually the web interface) to act as others
# This should match the DN of the 'kojiweb' certificate
ProxyDNs = /C={{ koji_cert_country }}/ST={{ koji_cert_state }}/L={{ koji_cert_locality }}/O={{ koji_cert_organization }}/CN={{ koji_hub_fqdn }}
## Other options ##
LoginCreatesUser = On
KojiWebURL = {{ koji_url }}
EmailDomain = {{ koji_email_domain | default('mx-os.mx') }}
NotifyOnSuccess = False
NotifyOnFailure = False
DisableNotifications = False
# Header used by Apache/mod_proxy to forward the original client IP.
ProxyUserHeader = X-Forwarded-For
## Resource limits ##
# RLIMIT_AS =
# RLIMIT_CORE =
# RLIMIT_CPU =
# RLIMIT_DATA =
# RLIMIT_FSIZE =
# RLIMIT_MEMLOCK =
# RLIMIT_NOFILE =
# RLIMIT_NPROC =
# RLIMIT_OFILE =
# RLIMIT_RSS =
# RLIMIT_STACK =
# Message to display in the client when the hub is offline.
ServerOfflineMessage = The Koji build system is currently offline for maintenance.
## MemoryWarnThreshold = 5000
## MaxRequestLength = 4194304
# How long builder should wait for host-init to finish (seconds)
HostInitTimeout = 120
## Extended features
# EnableMaven = False
# EnableWin = False
Plugins = sigul_sign
## Koji hub plugins
PluginPath = /usr/lib/koji-hub-plugins
Plugins = echo
[sigul]
# Sigul server URL (replace with actual Sigul server address)
SigulServer = {{ sigul_server }}
## Debugging
KojiDebug = On
LogLevel = INFO