Modsecurity Console: make mlogc will nicht so recht

DerBastian

New Member
Hallo Forum,

ich habe seit einiger Zeit ModSec am laufen jedoch nur mit Log-Funktion.
Nun wollte ich mich nicht durch die ganz Logs wühlen und habe mich an der Console versucht. Soweit so gut, Console läuft.
Nun brauche ich ja noch mlogc um die Logs an die Console zu übergeben und da scheiterts.

Ein make mlogc im Verzeichniss: /modsecurity-apache_2.5.9/apache2/mlogc-src
bringt mir folgende Meldung:

cc mlogc.c -o mlogc
mlogc.c:20:17: error: apr.h: Datei oder Verzeichnis nicht gefunden
mlogc.c:21:23: error: apr_errno.h: Datei oder Verzeichnis nicht gefunden
mlogc.c:22:25: error: apr_general.h: Datei oder Verzeichnis nicht gefunden
mlogc.c:23:25: error: apr_file_io.h: Datei oder Verzeichnis nicht gefunden
mlogc.c:24:27: error: apr_file_info.h: Datei oder Verzeichnis nicht gefunden
mlogc.c:25:22: error: apr_hash.h: Datei oder Verzeichnis nicht gefunden
mlogc.c:26:21: error: apr_lib.h: Datei oder Verzeichnis nicht gefunden
mlogc.c:27:25: error: apr_strings.h: Datei oder Verzeichnis nicht gefunden
mlogc.c:28:24: error: apr_signal.h: Datei oder Verzeichnis nicht gefunden
mlogc.c:29:29: error: apr_thread_proc.h: Datei oder Verzeichnis nicht gefunden
mlogc.c:30:30: error: apr_global_mutex.h: Datei oder Verzeichnis nicht gefunden
mlogc.c:31:24: error: apr_getopt.h: Datei oder Verzeichnis nicht gefunden
mlogc.c:35:18: error: pcre.h: Datei oder Verzeichnis nicht gefunden
mlogc.c:36:23: error: curl/curl.h: Datei oder Verzeichnis nicht gefunden
mlogc.c:41:25: error: msc_release.h: Datei oder Verzeichnis nicht gefunden
mlogc.c: In function 'error_log':
mlogc.c:45: error: expected declaration specifiers before 'PRINTF_ATTRIBUTE'
mlogc.c:97: error: parameter 'logline_pattern' is initialized
mlogc.c:115: error: parameter 'requestline_pattern' is initialized
mlogc.c:124: error: expected specifier-qualifier-list before 'apr_size_t'
mlogc.c:125: error: storage class specified for parameter 'entry_t'
mlogc.c:130: error: parameter 'logc_pid' is initialized
mlogc.c:131: error: parameter 'conffile' is initialized
mlogc.c:131: error: 'NULL' undeclared (first use in this function)
mlogc.c:131: error: (Each undeclared identifier is reported only once
mlogc.c:131: error: for each function it appears in.)
mlogc.c:132: error: parameter 'lockfile' is initialized
mlogc.c:133: error: parameter 'have_read_data' is initialized
mlogc.c:134: error: parameter 'checkpoint_interval' is initialized
mlogc.c:135: error: expected declaration specifiers before 'apr_time_t'
mlogc.c:136: error: parameter 'collector_root' is initialized
mlogc.c:137: error: expected declaration specifiers before 'apr_table_t'
mlogc.c:138: error: parameter 'console_uri' is initialized
mlogc.c:139: error: expected declaration specifiers before 'apr_array_header_t'
mlogc.c:140: error: parameter 'current_workers' is initialized
mlogc.c:141: error: parameter 'management_thread_active' is initialized
mlogc.c:142: error: parameter 'entry_counter' is initialized
mlogc.c:143: error: parameter 'error_log_path' is initialized
mlogc.c:144: error: expected declaration specifiers before 'apr_file_t'
mlogc.c:145: error: parameter 'error_log_level' is initialized
mlogc.c:146: error: expected declaration specifiers before 'apr_hash_t'
mlogc.c:147: error: parameter 'keep_alive' is initialized
mlogc.c:148: error: parameter 'keep_alive_timeout' is initialized
mlogc.c:149: error: parameter 'keep_entries' is initialized
mlogc.c:150: error: parameter 'log_repository' is initialized
mlogc.c:151: error: parameter 'logline_regex' is initialized
mlogc.c:152: error: parameter 'max_connections' is initialized
mlogc.c:153: error: expected declaration specifiers before 'apr_global_mutex_t'
mlogc.c:154: error: expected declaration specifiers before 'apr_thread_mutex_t'
mlogc.c:155: error: expected declaration specifiers before 'apr_pool_t'
mlogc.c:156: error: expected declaration specifiers before 'apr_array_header_t'
mlogc.c:157: error: parameter 'queue_path' is initialized
mlogc.c:159: error: parameter 'requestline_regex' is initialized
mlogc.c:160: error: parameter 'running' is initialized
mlogc.c:161: error: parameter 'sensor_password' is initialized
mlogc.c:162: error: parameter 'sensor_username' is initialized
mlogc.c:163: error: parameter 'server_error' is initialized
mlogc.c:164: error: expected declaration specifiers before 'apr_time_t'
mlogc.c:165: error: parameter 'server_error_timeout' is initialized
mlogc.c:166: error: parameter 'startup_delay' is initialized
mlogc.c:167: error: parameter 'transaction_delay' is initialized
mlogc.c:168: error: parameter 'transaction_log_path' is initialized
mlogc.c:169: error: expected declaration specifiers before 'apr_file_t'
mlogc.c:173: error: parameter 'opt_force' is initialized
mlogc.c:178: error: expected declaration specifiers or '...' before 'apr_size_t'
mlogc.c:179: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:247: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:260: error: expected declaration specifiers or '...' before 'apr_size_t'
mlogc.c:260: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:309: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:331: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:347: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:378: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:406: error: expected ')' before '*' token
mlogc.c:459: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:535: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:551: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:632: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:681: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:720: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:845: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:854: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:885: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:918: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:962: error: expected ')' before '*' token
mlogc.c:988: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:1090: error: expected ')' before '*' token
mlogc.c:1145: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'thread_worker'
mlogc.c:1461: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:1507: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'thread_manager'
mlogc.c:1584: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'thread_signals'
mlogc.c:1604: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:1744: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:1767: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:1786: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:1799: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
mlogc.c:1865: error: old-style parameter declarations in prototyped function definition
mlogc.c:1865: error: expected '{' at end of input
make: *** [mlogc] Fehler 1

Auch das stundenlange penetrieren von Google und Co. bringt mich nicht weiter.
Wo liegt mein Problem bzw. wer hat einen Lösungsansatz?

MfG.: Bastian
 
Hallo Whistler,

danke für den Tip.

Edit: Ich glaube ich hab meinen Fehler gefunden. Mal eben testen.
Edit2: Ne, war folgendes Paket: libapr1-dev

Die Header liegen ja nun in folgendem Verzeichniss: /usr/include/apr-1.0/
jedoch werden sie beim Make immer noch nicht gefunden?
Habe ich etwas vergessen?

MfG.: Bastian
 
Last edited by a moderator:
Der schon wieder ;)

Ich hab mir zusätzlich noch die APR 1.3.8 besorgt und installiert.
Leider finde ich keine genaue Anleitung für Mlogc.
Wie sollte die Makefile.in aussehen wenn die apr.h in folgendem Verzeichniss liegt?
/usr/local/apr/include/apr-1/

Makefile.in:
Code:
# Generated Makefile for ModSecurity Log Collector (mlogc)

CC = @CC@
EXTRA_CFLAGS = @EXTRA_CFLAGS@

srcdir = .
srclibdir = $(srcdir)/srclib

MLOGC_VERSION = `grep '^\#define *VERSION ' mlogc.c | sed 's/.*VERSION *"\([^"]*\)"/\1/'`

MLOGC_SRCDIST_FILES = srclib/*.sh srclib/archives mlogc.c mlogc*.conf mlogc-batch-load.pl Makefile Makefile.in CHANGES BUILD INSTALL
MLOGC_SRCDIST_DIR = mlogc-src_$(MLOGC_VERSION)$(MLOGC_VERSION_SRCEXTRA)
MLOGC_SRCDIST_NAME = mlogc-src_$(MLOGC_VERSION)$(MLOGC_VERSION_SRCEXTRA).tar.gz

MLOGC_BINDIST_FILES = mlogc mlogc*.conf mlogc-batch-load.pl CHANGES INSTALL
MLOGC_BINDIST_DIR = mlogc_$(MLOGC_VERSION)$(MLOGC_VERSION_BINEXTRA)
MLOGC_BINDIST_NAME = mlogc_$(MLOGC_VERSION)$(MLOGC_VERSION_BINEXTRA).tar.gz

APR_FLAGS = @APR_CFLAGS@
APR_LIBS = @APR_LINK_LD@

CURL_FLAGS = @CURL_CFLAGS@
CURL_LIBS = @CURL_LIBS@

PCRE_FLAGS = @PCRE_CFLAGS@
PCRE_LIBS = @PCRE_LIBS@

APR_S_FLAGS = `$(srclibdir)/install/apr/bin/apr-1-config --includes --cppflags --cflags`
APR_S_LIBS = `$(srclibdir)/install/apr/bin/apr-1-config --link-ld`

CURL_S_FLAGS = `$(srclibdir)/install/curl/bin/curl-config --cflags`
CURL_S_LIBS = `$(srclibdir)/install/curl/bin/curl-config --libs`

PCRE_S_FLAGS = `$(srclibdir)/install/pcre/bin/pcre-config --cflags`
PCRE_S_LIBS = `$(srclibdir)/install/pcre/bin/pcre-config --libs`

all: mlogc

static: mlogc-static

mlogc: mlogc.c
	@echo; \
	echo "Building dynamically linked mlogc..."; \
	$(CC) $(CFLAGS) -o mlogc mlogc.c \
	$(APR_FLAGS) $(CURL_FLAGS) $(PCRE_FLAGS) \
	$(APR_LIBS) $(CURL_LIBS) $(PCRE_LIBS); \
	chmod 755 mlogc; \
	echo; \
	echo "Build finished.  Please follow the INSTALL instructions to complete the install."; \
	echo

mlogc-static: archives support-libs mlogc.c
	@echo; \
	echo "Building statically linked mlogc..."; \
	$(CC) $(CFLAGS) -o mlogc mlogc.c \
	$(APR_S_FLAGS) $(CURL_S_FLAGS) $(PCRE_S_FLAGS) \
	$(APR_S_LIBS) $(CURL_S_LIBS) $(PCRE_S_LIBS); \
	chmod 755 mlogc; \
	echo; \
	echo "Build finished.  Please follow the INSTALL instructions to complete the install."; \
	echo

.archives-ok:
	@if [ -n "$(MLOGC_NOVERIFY)" -a "$(MLOGC_NOVERIFY)" = "1" ]; then \
		touch .archives-ok; \
	else \
		$(srclibdir)/archives.sh && touch .archives-ok; \
	fi

.support-libs-ok:
	$(srclibdir)/build.sh && touch .support-libs-ok

archives: .archives-ok

fake-archives:
	@mkdir -p $(srclibdir)/archives

support-libs: .support-libs-ok

clean-archives:
	@rm -rf $(srclibdir)/archives

clean-srcdist:
	@rm -rf $(MLOGC_SRCDIST_DIR) $(MLOGC_SRCDIST_NAME)

clean-bindist:
	@rm -rf $(MLOGC_BINDIST_DIR) $(MLOGC_BINDIST_NAME)

clean-build:
	@rm -rf $(srclibdir)/build

clean-install:
	@rm -rf $(srclibdir)/install

clean-mlogc:
	@rm -rf core mlogc *~ *.o *.so *.lo *.la *.slo .libs/ .support-libs-ok .archives-ok

distclean: clean clean-archives

clean: clean-build clean-install clean-mlogc clean-srcdist clean-bindist

srcdist: full-srcdist

full-srcdist: archives small-srcdist

small-srcdist: fake-archives
	@echo; \
	echo "Building source distribution archive $(MLOGC_VERSION_SRCEXTRA)..."; \
	rm -rf $(MLOGC_SRCDIST_DIR) || exit 1; \
	mkdir $(MLOGC_SRCDIST_DIR) || exit 1; \
	tar -cf - $(MLOGC_SRCDIST_FILES) | (cd $(MLOGC_SRCDIST_DIR) && tar -xf -) || exit 1; \
	tar -cvf - $(MLOGC_SRCDIST_DIR) | gzip > $(MLOGC_SRCDIST_NAME) || exit 1; \
	echo "Created $(MLOGC_SRCDIST_NAME)"; \
	rm -rf $(MLOGC_SRCDIST_DIR);

bindist: archives mlogc-static
	@echo; \
	echo "Building static binary distribution archive $(MLOGC_VERSION_BINEXTRA)..."; \
	rm -rf $(MLOGC_BINDIST_DIR) || exit 1; \
	mkdir $(MLOGC_BINDIST_DIR) || exit 1; \
	tar -cf - $(MLOGC_BINDIST_FILES) | (cd $(MLOGC_BINDIST_DIR) && tar -xf -) || exit 1; \
	tar -cvf - $(MLOGC_BINDIST_DIR) | gzip > $(MLOGC_BINDIST_NAME) || exit 1; \
	echo "Created $(MLOGC_BINDIST_NAME)"; \
	rm -rf $(MLOGC_BINDIST_DIR);
	
dist: bindist srcdist

MfG.: Bastian
 
Die Zeile aus dem Makefile
Code:
APR_S_FLAGS = `$(srclibdir)/install/apr/bin/apr-1-config --includes --cppflags --cflags`
sollte das richtige Verzeichnis zurückgeben:
Code:
 -I/usr/local/apr/include/apr-1  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE  -pthread
Das kannst Du ja an der Konsole testen.

Eventuell hast Du ja zwei konkurrierende apr-Versionen (unter /usr und /usr/local).
Notfalls must Du APR_S_FLAGS und APR_S_LIBS auf einen festen Wert setzen.
 
Back
Top