compiling the agent code separately

9 views
Skip to first unread message

Ursus Schneider

unread,
Jun 12, 2017, 4:14:33 PM6/12/17
to ossec-dev
Hi

I would like to get ossec (only the agent) running in a TA (trusted application in a trusted execution environment). I have checked out the code and found that most of what I need is in the client-agent subdirectory. I have now moved this code (and only this code) to another folder and would like to compile it (adding anything that I need piece meal). Unfortunately there isn't a separate Makefile for the agent, it seems to be part of the 1310 line Makefile in the src directory :o)  Does somebody maybe have a simpler Makefile just for the agent code? 

I have tried to decipher the lines in the Makefile that I would need but am getting a bit stuck... I have found the line that compiles:

client-agent/%.o: client-agent/%.c
${OSSEC_CC} ${OSSEC_CFLAGS} -I./client-agent ${ZLIB_INCLUDE} -DARGV0=\"ossec-agentd\" -c $^ -o $@

I want to know that the compiler is:

     OSSEC_CC=${QUIET_CC}${MING_BASE}${CC}

ok, so what is QUIET_CC

     QUIET_CC      = @printf '    %b %b\n' ${CCCOLOR}CC${ENDCOLOR} ${SRCCOLOR}$@${ENDCOLOR} 1>&2;

ok, not sure what that is for... just the colours for the line?

     MING_BASE:=amd64-mingw32msvc-     

as I am compiling for the Raspberry Pi 3. The 
 
    {$CC}

has me stumped as it has not been setup before the OSSEC_CC line?

I am also stumped about the C flags as 

   ${OSSEC_CFLAGS}

is used but never set... not even in the install.sh file?

I have found the settings if I do a make with debug enabled:

    CFLAGS           -g -DMAX_AGENTS=2048 -DOSSECHIDS -DDEFAULTDIR="/var/ossec" -DUSER="ossec" -DREMUSER="ossecr" -DGROUPGLOBAL="ossec" -DMAILUSER="ossecm" -DLinux -DINOTIFY_ENABLED -DPICVIZ_OUTPUT_ENABLED -DLIBOPENSSL_ENABLED -DCLIENT -Wall -Wextra -I./ -I./headers/

    LDFLAGS          -lm -lpthread -lssl -lcrypto

    CC              cc

    MAKE            make


but was wondering where all the settings are from?

Oh, I am using version 2.9.0

Anyway, thank you for any help given

Cheers
Ursus

Scott R. Shinn

unread,
Jun 15, 2017, 3:49:10 PM6/15/17
to osse...@googlegroups.com
"make TARGET=agent" is what Im using in the RPM and Debian packaging
for an agent

-Scott
CTO, Atomicorp
> -- 
>
> --- 
> You received this message because you are subscribed to the Google
> Groups "ossec-dev" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to ossec-dev+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

dan (ddp)

unread,
Jun 15, 2017, 4:04:18 PM6/15/17
to ossec-dev
Why go through all this trouble when the agent TARGET exists?

Ursus Schneider

unread,
Jun 16, 2017, 4:49:20 AM6/16/17
to ossec-dev, sc...@atomicrocketturtle.com
Scott - that would give me an agent that has been built for Ubuntu (in my case).  I basically want to cross-compile the agent for the Pi3. I do realise that I could compile on the Pi itself but the Pi is not really a developers dream when it comes to speed :o)
Reply all
Reply to author
Forward
0 new messages