2026-01-23 19:09:32 +00:00
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
# SecuBox HAProxy - Load Balancer & Reverse Proxy in LXC
|
|
|
|
|
# Copyright (C) 2025 CyberMind.fr
|
|
|
|
|
|
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
|
|
|
|
|
|
PKG_NAME:=secubox-app-haproxy
|
|
|
|
|
PKG_VERSION:=1.0.0
|
2026-01-26 12:08:48 +00:00
|
|
|
PKG_RELEASE:=19
|
2026-01-23 19:09:32 +00:00
|
|
|
|
|
|
|
|
PKG_MAINTAINER:=CyberMind <contact@cybermind.fr>
|
|
|
|
|
PKG_LICENSE:=MIT
|
|
|
|
|
|
|
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
|
|
|
|
|
|
define Package/secubox-app-haproxy
|
|
|
|
|
SECTION:=secubox
|
|
|
|
|
CATEGORY:=SecuBox
|
|
|
|
|
SUBMENU:=Services
|
|
|
|
|
TITLE:=HAProxy Load Balancer & Reverse Proxy
|
2026-01-25 04:56:03 +00:00
|
|
|
DEPENDS:=+lxc +lxc-common +openssl-util +wget-ssl +tar +jsonfilter +acme +acme-acmesh +socat
|
2026-01-23 19:09:32 +00:00
|
|
|
PKGARCH:=all
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
define Package/secubox-app-haproxy/description
|
|
|
|
|
HAProxy load balancer and reverse proxy running in an LXC container.
|
|
|
|
|
Features:
|
|
|
|
|
- Virtual hosts with SNI routing
|
|
|
|
|
- Multi-certificate SSL/TLS termination
|
|
|
|
|
- Let's Encrypt auto-renewal via ACME
|
|
|
|
|
- Backend health checks
|
|
|
|
|
- URL-based routing and redirections
|
|
|
|
|
- Stats dashboard
|
|
|
|
|
- Rate limiting and ACLs
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
define Package/secubox-app-haproxy/conffiles
|
|
|
|
|
/etc/config/haproxy
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
define Build/Compile
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
define Package/secubox-app-haproxy/install
|
|
|
|
|
$(INSTALL_DIR) $(1)/etc/config
|
|
|
|
|
$(INSTALL_CONF) ./files/etc/config/haproxy $(1)/etc/config/haproxy
|
|
|
|
|
|
|
|
|
|
$(INSTALL_DIR) $(1)/etc/init.d
|
|
|
|
|
$(INSTALL_BIN) ./files/etc/init.d/haproxy $(1)/etc/init.d/haproxy
|
|
|
|
|
|
|
|
|
|
$(INSTALL_DIR) $(1)/usr/sbin
|
|
|
|
|
$(INSTALL_BIN) ./files/usr/sbin/haproxyctl $(1)/usr/sbin/haproxyctl
|
2026-01-25 10:42:29 +00:00
|
|
|
$(INSTALL_BIN) ./files/usr/sbin/haproxy-sync-certs $(1)/usr/sbin/haproxy-sync-certs
|
2026-01-26 12:08:48 +00:00
|
|
|
$(INSTALL_BIN) ./files/usr/sbin/haproxy-acme-cron $(1)/usr/sbin/haproxy-acme-cron
|
2026-01-25 10:42:29 +00:00
|
|
|
|
|
|
|
|
$(INSTALL_DIR) $(1)/usr/lib/acme/deploy
|
|
|
|
|
$(INSTALL_BIN) ./files/usr/lib/acme/deploy/haproxy.sh $(1)/usr/lib/acme/deploy/haproxy.sh
|
2026-01-23 19:09:32 +00:00
|
|
|
|
|
|
|
|
$(INSTALL_DIR) $(1)/usr/share/haproxy/templates
|
|
|
|
|
$(INSTALL_DATA) ./files/usr/share/haproxy/templates/* $(1)/usr/share/haproxy/templates/
|
|
|
|
|
|
|
|
|
|
$(INSTALL_DIR) $(1)/usr/share/haproxy/certs
|
2026-01-25 10:42:29 +00:00
|
|
|
|
2026-01-26 12:08:48 +00:00
|
|
|
# Add cron jobs for certificate management
|
2026-01-25 10:42:29 +00:00
|
|
|
$(INSTALL_DIR) $(1)/etc/cron.d
|
2026-01-26 12:08:48 +00:00
|
|
|
echo "# HAProxy certificate management" > $(1)/etc/cron.d/haproxy-certs
|
|
|
|
|
echo "# Sync ACME certs to HAProxy after renewals" >> $(1)/etc/cron.d/haproxy-certs
|
2026-01-25 10:42:29 +00:00
|
|
|
echo "15 3 * * * root /usr/sbin/haproxy-sync-certs >/dev/null 2>&1" >> $(1)/etc/cron.d/haproxy-certs
|
2026-01-26 12:08:48 +00:00
|
|
|
echo "# Process pending ACME certificate requests (every 5 min)" >> $(1)/etc/cron.d/haproxy-certs
|
|
|
|
|
echo "*/5 * * * * root /usr/sbin/haproxy-acme-cron >/dev/null 2>&1" >> $(1)/etc/cron.d/haproxy-certs
|
2026-01-25 10:42:29 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
define Package/secubox-app-haproxy/postinst
|
|
|
|
|
#!/bin/sh
|
|
|
|
|
[ -n "$${IPKG_INSTROOT}" ] && exit 0
|
|
|
|
|
# Sync existing ACME certificates on install
|
|
|
|
|
/usr/sbin/haproxy-sync-certs 2>/dev/null || true
|
|
|
|
|
exit 0
|
2026-01-23 19:09:32 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
$(eval $(call BuildPackage,secubox-app-haproxy))
|