suricata acme_sync: less noisy output

main
Ricard Illa 2023-01-09 18:29:13 +01:00
parent a665e2d13c
commit 2d4873703f
1 changed files with 8 additions and 5 deletions

View File

@ -38,8 +38,9 @@ REMOTE_ACME_PATH=rsync://$(RSYNCD_USER)@$(RSYNCD_HOST)/acme
RSYNC_OPTS=--archive --delete --acls --xattrs --compress --verbose --human-readable RSYNC_OPTS=--archive --delete --acls --xattrs --compress --verbose --human-readable
sync_certs: sync_certs:
mkdir -p $(CERTS_DIR) @mkdir -p $(CERTS_DIR)
rsync \ @echo "pulling certs with rsync"X
@rsync \
$(RSYNC_OPTS) \ $(RSYNC_OPTS) \
$(REMOTE_ACME_PATH) \ $(REMOTE_ACME_PATH) \
$(CERTS_DIR) $(CERTS_DIR)
@ -51,7 +52,8 @@ $(ACME_KEY_FILE): sync_certs
############################################################################### ###############################################################################
$(JSON_SECRET): $(ACME_KEY_FILE) $(ACME_FULLCHAIN_FILE) $(ACME_KEY_FILE) $(JSON_SECRET): $(ACME_KEY_FILE) $(ACME_FULLCHAIN_FILE) $(ACME_KEY_FILE)
jq --null-input --raw-output \ @echo "building json secret file"
@jq --null-input --raw-output \
--arg kind "Secret" \ --arg kind "Secret" \
--arg name "$(SECRET_NAME)" \ --arg name "$(SECRET_NAME)" \
--arg cacert "$$(base64 -w 0 $(ACME_CA_FILE))" \ --arg cacert "$$(base64 -w 0 $(ACME_CA_FILE))" \
@ -87,8 +89,8 @@ define put_secret
endef endef
$(SECRET_UPDATED): $(JSON_SECRET) $(SECRET_UPDATED): $(JSON_SECRET)
mkdir -p $(@D) @mkdir -p $(@D)
GET_STATUS_CODE=$$($(call get_secret)); \ @GET_STATUS_CODE=$$($(call get_secret)); \
if [ "$${GET_STATUS_CODE}" = "404" ]; then \ if [ "$${GET_STATUS_CODE}" = "404" ]; then \
echo "adding cert"; \ echo "adding cert"; \
POST_STATUS_CODE=$$($(call post_secret,$^)); \ POST_STATUS_CODE=$$($(call post_secret,$^)); \
@ -98,5 +100,6 @@ $(SECRET_UPDATED): $(JSON_SECRET)
PUT_STATUS_CODE=$$($(call put_secret,$^)); \ PUT_STATUS_CODE=$$($(call put_secret,$^)); \
[ "$${PUT_STATUS_CODE}" = "200" ] && touch $@; \ [ "$${PUT_STATUS_CODE}" = "200" ] && touch $@; \
fi fi
@echo "done"
############################################################################### ###############################################################################