]> Git [git.vados.ru] :: Repos - Mikrotiks/ros.vados.ru.git/commitdiff
Autocommit in repo: ros.vados.ru, generated by owner: root, in 19:45:02 03.05.2026.
authorvados-dev <192440777+vados-dev@users.noreply.github.com>
Sun, 3 May 2026 16:45:03 +0000 (19:45 +0300)
committervados-dev <192440777+vados-dev@users.noreply.github.com>
Sun, 3 May 2026 16:45:03 +0000 (19:45 +0300)
html/AM-GlobalFunc.rsc
html/certs/Makefile

index 70298d023a4c906275106ac10ea7ca22888b75e0..d476a0580efeafcd2c5e25b6db7c75bb05516552 100644 (file)
@@ -17,9 +17,9 @@
 :global GlobalFuncReady false;
 
 # Git commit id & info, expected configuration version
-:global CommitId "main/438/526ccd61";
+:global CommitId "main/439/41b81333";
 :global CommitTAG "unknown";
-:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 19:40:02 03.05.2026.";
+:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 19:45:02 03.05.2026.";
 
 # The variables are received right here.
 :global GlobalConfVersion 138;
index 4866b5125f72e63632a012e8fff47f49a01c17c2..76cdaa11bf62eff7d6685533bf113566dad08216 100644 (file)
@@ -1,47 +1,65 @@
 # Makefile to check certificates
 
-BUILD_DIR := $(CURDIR)
 SHELL := /bin/bash
+BUILD_DIR := $(CURDIR)
+LIST_ROOT := lists
+
+# Current layout: lists/Makefile.<target>
+LIST_FILES := $(wildcard $(LIST_ROOT)/Makefile.*)
+FILE_TARGETS := $(patsubst $(LIST_ROOT)/Makefile.%,%,$(LIST_FILES))
 
-IPV4_LIST := lists/Makefile.ipv4
-IPV6_LIST := lists/Makefile.ipv6
-IPALL_LIST := lists/Makefile.ipall
+# Optional layout: lists/<target>/*
+LIST_DIRS := $(filter-out $(LIST_ROOT)/Makefile.%,$(wildcard $(LIST_ROOT)/*))
+DIR_TARGETS := $(notdir $(LIST_DIRS))
+TARGETS := $(sort $(FILE_TARGETS) $(DIR_TARGETS))
 
 # Big CA list with all certificates ~ 2Mb
 ALL_CA_URL := https://curl.se/ca/cacert.pem
 CA_LIST_DIR := ca-list
 
-CURL := curl --capath /dev/null --connect-timeout 5 --output /dev/null --silent --show-error
+CURL := curl \
+       --globoff \
+       --capath /dev/null \
+       --connect-timeout 5 \
+       --output /dev/null \
+       --silent \
+       --show-error
 
-.PHONY: default all ipv4 ipv6 ipall all-ca-lst check-list
-
-all: ipv4
+.PHONY: default all all-ca-lst check-list $(TARGETS)
 
 default:
-       @echo "Available targets: ipv4, ipv6, ipall, all-ca-lst"
-       @echo "List format: host-or-ip/certificate-basename"
+       @echo "Available targets: $(TARGETS) all-ca-lst"
+       @echo "List format: [scheme://]host[/path/to/generator]/certificate-basename"
+       @echo "Example: example.com/pki/acme/ISRG-Root-X1 checks https://example.com/pki/acme/ with ./ISRG-Root-X1.pem"
+
+all: $(TARGETS)
 
 all-ca-lst:
        @mkdir -p $(CA_LIST_DIR)
        $(CURL) $(ALL_CA_URL) --output $(CA_LIST_DIR)/cacert.pem
 
-ipv4: $(IPV4_LIST)
-       @$(MAKE) check-list LIST=$< CURL_FLAGS=-4
+$(FILE_TARGETS): %: $(LIST_ROOT)/Makefile.%
+       @$(MAKE) check-list LIST="$<" IP_FLAGS="$(call ip_flags,$@)"
 
-ipv6: $(IPV6_LIST)
-       @$(MAKE) check-list LIST=$< CURL_FLAGS=-6
+$(DIR_TARGETS): %: $(LIST_ROOT)/%
+       @$(MAKE) check-list LIST="$<" IP_FLAGS="$(call ip_flags,$@)"
 
-ipall: $(IPALL_LIST)
-       @$(MAKE) check-list LIST=$< CURL_FLAGS=
+ip_flags = $(if $(filter ipv4,$(1)),-4,$(if $(filter ipv6,$(1)),-6,))
 
 check-list:
        @test -n "$(LIST)" || { echo "LIST is required" >&2; exit 2; }
        @status=0; \
-       while IFS= read -r item || [ -n "$$item" ]; do \
-               [[ -z "$$item" || "$$item" =~ ^[[:space:]]*# ]] && continue; \
-               host="$${item%/*}"; \
-               cert="$${item##*/}"; \
-               printf 'Checking https://%s with %s.pem\n' "$$host" "$$cert"; \
-               $(CURL) $(CURL_FLAGS) --cacert "$(BUILD_DIR)/$$cert.pem" "https://$$host" || status=1; \
-       done < "$(LIST)"; \
+       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"; \
+                       printf 'Checking %s with %s.pem\n' "$$url" "$$cert"; \
+                       $(CURL) $(IP_FLAGS) --cacert "$(BUILD_DIR)/$$cert.pem" "$$url" || status=1; \
+               done < "$$list"; \
+       done; \
        exit $$status