From f577bc3475c102ac8e2040dfbdab4e1c788fe444 Mon Sep 17 00:00:00 2001 From: vados-dev <192440777+vados-dev@users.noreply.github.com> Date: Sun, 3 May 2026 20:30:03 +0300 Subject: [PATCH] Autocommit in repo: ros.vados.ru, generated by owner: root, in 20:30:02 03.05.2026. --- html/AM-GlobalFunc.rsc | 4 ++-- html/certs/Makefile | 44 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/html/AM-GlobalFunc.rsc b/html/AM-GlobalFunc.rsc index 0a65d0421..0192e9348 100644 --- a/html/AM-GlobalFunc.rsc +++ b/html/AM-GlobalFunc.rsc @@ -17,9 +17,9 @@ :global GlobalFuncReady false; # Git commit id & info, expected configuration version -:global CommitId "main/447/d3c4c763"; +:global CommitId "main/448/465d2959"; :global CommitTAG "unknown"; -:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 20:25:02 03.05.2026."; +:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 20:30:02 03.05.2026."; # The variables are received right here. :global GlobalConfVersion 138; diff --git a/html/certs/Makefile b/html/certs/Makefile index 740711c6d..dacdcef05 100644 --- a/html/certs/Makefile +++ b/html/certs/Makefile @@ -1,4 +1,4 @@ -# Makefile to download and check certificates +# Makefile to download, check, and clean certificates SHELL := /bin/bash BUILD_DIR := $(CURDIR) @@ -13,6 +13,7 @@ LIST_DIRS := $(filter-out $(LIST_ROOT)/Makefile.%,$(wildcard $(LIST_ROOT)/*)) DIR_TARGETS := $(notdir $(LIST_DIRS)) TARGETS := $(sort $(FILE_TARGETS) $(DIR_TARGETS)) CHECK_TARGETS := $(addprefix check-,$(TARGETS)) +CLEAN_TARGETS := $(addprefix clean-,$(TARGETS)) # Big CA list with all certificates ~ 2Mb ALL_CA_URL := https://curl.se/ca/cacert.pem @@ -26,18 +27,22 @@ CURL := curl \ --silent \ --show-error -.PHONY: default all all-ca-lst download-list check-list $(TARGETS) $(CHECK_TARGETS) +.PHONY: default all clean all-ca-lst download-list check-list clean-list $(TARGETS) $(CHECK_TARGETS) $(CLEAN_TARGETS) default: @echo "Available download targets: all-ca-lst $(TARGETS)" @echo "Available check targets: $(CHECK_TARGETS)" + @echo "Available clean targets: clean $(CLEAN_TARGETS)" @echo "all downloads all-ca-lst and certificates from all list targets" + @echo "clean checks all target directories and removes unavailable PEM files" @echo "List format: [scheme://]host[/path/to/generator]/certificate-basename" @echo "Example: example.com/pki/acme/ISRG-Root-X1 downloads https://example.com/pki/acme/ISRG-Root-X1.pem -> .//ISRG-Root-X1.pem" - @echo "check target verifies https://example.com/pki/acme/ with .//ISRG-Root-X1.pem" + @echo "check/clean verify https://example.com/pki/acme/ with .//ISRG-Root-X1.pem" all: all-ca-lst $(TARGETS) +clean: $(CLEAN_TARGETS) + all-ca-lst: @mkdir -p $(CA_LIST_DIR) @echo "Downloading $(ALL_CA_URL) -> $(ALL_CA_FILE)" @@ -54,11 +59,14 @@ $(DIR_TARGETS): %: $(LIST_ROOT)/% $(CHECK_TARGETS): check-%: @$(MAKE) check-list LIST="$(call list_for_target,$*)" OUT_DIR="$*" +$(CLEAN_TARGETS): clean-%: + @$(MAKE) clean-list LIST="$(call list_for_target,$*)" OUT_DIR="$*" + list_for_target = $(if $(wildcard $(LIST_ROOT)/Makefile.$(1)),$(LIST_ROOT)/Makefile.$(1),$(LIST_ROOT)/$(1)) # Convert a list item to URL/cert in shell: # host/path/cert-name -> https://host/path/cert-name.pem for download -# host/path/cert-name -> https://host/path/ for check +# host/path/cert-name -> https://host/path/ for check/clean # IPv6 colons may be escaped as \: for make compatibility and are normalized here. download-list: @test -n "$(LIST)" || { echo "LIST is required" >&2; exit 2; } @@ -101,3 +109,31 @@ check-list: done < "$$list"; \ done; \ true + +clean-list: + @test -n "$(LIST)" || { echo "LIST is required" >&2; exit 2; } + @test -n "$(OUT_DIR)" || { echo "OUT_DIR is required" >&2; exit 2; } + @if [ -d "$(LIST)" ]; then inputs=("$(LIST)"/*); else inputs=("$(LIST)"); fi; \ + for list in "$${inputs[@]}"; do \ + [ -f "$$list" ] || continue; \ + while IFS= read -r item || [ -n "$$item" ]; do \ + [[ -z "$$item" || "$$item" =~ ^[[:space:]]*# ]] && continue; \ + item="$${item//\\:/:}"; \ + cert="$${item##*/}"; \ + url="$${item%/*}/"; \ + [[ "$$url" =~ ^https?:// ]] || url="https://$$url"; \ + pem="$(BUILD_DIR)/$(OUT_DIR)/$$cert.pem"; \ + if [ ! -f "$$pem" ]; then \ + echo "WARN: missing $$pem" >&2; \ + continue; \ + fi; \ + printf 'Cleaning check %s with %s\n' "$$url" "$$pem"; \ + if $(CURL) --output /dev/null --cacert "$$pem" "$$url"; then \ + echo "KEEP: $$pem"; \ + else \ + echo "REMOVE: $$pem"; \ + rm -f -- "$$pem"; \ + fi; \ + done < "$$list"; \ + done; \ + true -- 2.52.0