environment:
- RSPAMD_REDIS_ADDR=redis
- RSPAMD_REDIS_PORT=6379
- # AddressSanitizer configuration
- - ASAN_OPTIONS=detect_leaks=1:halt_on_error=0:abort_on_error=0:print_stats=1:log_path=/data/asan.log
- - LSAN_OPTIONS=suppressions=/etc/rspamd/lsan.supp:print_suppressions=0
+ # AddressSanitizer configuration for multiple processes
+ - ASAN_OPTIONS=detect_leaks=1:halt_on_error=0:abort_on_error=0:print_stats=1:log_path=/data/asan.log:log_suffix=.%p:log_exe_name=1
+ - LSAN_OPTIONS=suppressions=/etc/rspamd/lsan.supp:print_suppressions=0:log_threads=1
healthcheck:
test: [ "CMD-SHELL", "pidof rspamd > /dev/null || exit 1" ]
interval: 10s
# Scan the same files we used for training (from shuffled list)
# Use xargs with -a to read from file and avoid argument list too long
xargs -a "$DATA_DIR/shuffled_files.txt" rspamc -h "$RSPAMD_HOST:$CONTROLLER_PORT" \
- -P "$PASSWORD" -n "$PARALLEL" -j > "$DATA_DIR/scan_results.json" 2>&1
+ -P "$PASSWORD" -n "$PARALLEL" -j > "$DATA_DIR/results.json" 2>&1
echo "✓ Scanning complete"
echo ""
# Count detections using grep and jq (or grep if jq not available)
if command -v jq &> /dev/null; then
# Use jq for JSON parsing
- TOTAL=$(jq 'length' "$DATA_DIR/scan_results.json")
- FUZZY_COUNT=$(jq '[.[] | select(.symbols | keys[] | startswith("FUZZY_"))] | length' "$DATA_DIR/scan_results.json")
- BAYES_SPAM_COUNT=$(jq '[.[] | select(.symbols.BAYES_SPAM)] | length' "$DATA_DIR/scan_results.json")
- BAYES_HAM_COUNT=$(jq '[.[] | select(.symbols.BAYES_HAM)] | length' "$DATA_DIR/scan_results.json")
+ TOTAL=$(jq 'length' "$DATA_DIR/results.json")
+ FUZZY_COUNT=$(jq '[.[] | select(.symbols | keys[] | startswith("FUZZY_"))] | length' "$DATA_DIR/results.json")
+ BAYES_SPAM_COUNT=$(jq '[.[] | select(.symbols.BAYES_SPAM)] | length' "$DATA_DIR/results.json")
+ BAYES_HAM_COUNT=$(jq '[.[] | select(.symbols.BAYES_HAM)] | length' "$DATA_DIR/results.json")
else
# Fallback to grep
- TOTAL=$(grep -c '"symbols"' "$DATA_DIR/scan_results.json" || echo 0)
- FUZZY_COUNT=$(grep -c '"FUZZY_' "$DATA_DIR/scan_results.json" || echo 0)
- BAYES_SPAM_COUNT=$(grep -c '"BAYES_SPAM"' "$DATA_DIR/scan_results.json" || echo 0)
- BAYES_HAM_COUNT=$(grep -c '"BAYES_HAM"' "$DATA_DIR/scan_results.json" || echo 0)
+ TOTAL=$(grep -c '"symbols"' "$DATA_DIR/results.json" || echo 0)
+ FUZZY_COUNT=$(grep -c '"FUZZY_' "$DATA_DIR/results.json" || echo 0)
+ BAYES_SPAM_COUNT=$(grep -c '"BAYES_SPAM"' "$DATA_DIR/results.json" || echo 0)
+ BAYES_HAM_COUNT=$(grep -c '"BAYES_HAM"' "$DATA_DIR/results.json" || echo 0)
fi
if [ "$TOTAL" -eq 0 ]; then
echo "============================================================"
echo ""
echo "Results saved to:"
-echo " - $DATA_DIR/scan_results.json"
+echo " - $DATA_DIR/results.json"
echo " - $DATA_DIR/fuzzy_train.log"
echo " - $DATA_DIR/bayes_spam.log"
echo " - $DATA_DIR/bayes_ham.log"