3 # Uncomment this to turn on verbose mode.
8 PKGDIR = $(CURDIR)/debian/ossec-hids
9 DESTDIR = $(PKGDIR)/var/ossec
11 # OSSEC INSTALL SUBDIRS
12 SUBDIRS = logs logs/archives logs/alerts logs/firewall bin queue queue/ossec queue/alerts queue/syscheck queue/rids queue/fts queue/syscheck queue/rootcheck queue/diff queue/agent-info queue/agentless tmp var var/run etc etc/shared stats rules active-response active-response/bin agentless .ssh
14 ###################### main ######################
21 $(MAKE) -C $(SRCDIR) setlocal all build
30 # Add here commands to clean up after the build process.
31 $(MAKE) -C $(SRCDIR) clean
34 rm -f $(SRCDIR)/Config.OS \
35 $(SRCDIR)/analysisd/compiled_rules/compiled_rules.h \
36 $(SRCDIR)/analysisd/ossec-logtest \
37 $(SRCDIR)/isbigendian \
38 $(SRCDIR)/isbigendian.c \
49 # ugly directory creation
50 for i in $(SUBDIRS); do \
51 mkdir -p -m 700 $(DESTDIR)/$$i; \
55 chmod -R 550 $(DESTDIR)
56 chmod -R 770 $(DESTDIR)/queue/alerts
57 chmod -R 770 $(DESTDIR)/queue/ossec
58 chmod -R 750 $(DESTDIR)/queue/fts
59 chmod -R 750 $(DESTDIR)/queue/syscheck
60 chmod -R 750 $(DESTDIR)/queue/rootcheck
61 chmod -R 750 $(DESTDIR)/queue/diff
62 chmod -R 755 $(DESTDIR)/queue/agent-info
63 chmod -R 755 $(DESTDIR)/queue/rids
64 chmod -R 755 $(DESTDIR)/queue/agentless
65 chmod -R 750 $(DESTDIR)/stats
66 chmod -R 750 $(DESTDIR)/logs
67 chmod -R 550 $(DESTDIR)/rules
68 chmod 770 $(DESTDIR)/var/run
69 chmod 550 $(DESTDIR)/etc
70 chmod 770 $(DESTDIR)/etc/shared
71 chmod 700 $(DESTDIR)/.ssh
73 # various files installation
74 install -m 644 etc/internal_options.conf $(DESTDIR)/etc
75 install -m 644 etc/decoder.xml $(DESTDIR)/etc
76 install -m 644 src/rootcheck/db/*.txt $(DESTDIR)/etc/shared
77 if [ -e etc/ossec.mc ]; then \
78 install -m 440 etc/ossec.mc $(DESTDIR)/etc/ossec.conf; \
80 install -m 440 etc/ossec-agent.conf $(DESTDIR)/etc/ossec.conf; \
82 install -m 440 etc/ossec-*.conf $(DESTDIR)/etc
83 cp -r etc/rules/* $(DESTDIR)/rules
84 find $(DESTDIR)/rules -type f -exec chmod 640 '{}' ';'
85 install -m 750 src/agentlessd/scripts/* $(DESTDIR)/agentless
86 install -s -m 755 bin/* $(DESTDIR)/bin
87 install -m 755 src/init/ossec-*.sh $(DESTDIR)/bin
88 ln -s ossec-local.sh $(DESTDIR)/bin/ossec-control
89 install -m 755 active-response/*.sh $(DESTDIR)/active-response/bin
90 install -m 755 active-response/firewalls/*.sh \
91 $(DESTDIR)/active-response/bin
94 mkdir -p $(PKGDIR)/etc/init.d
95 install -m 755 src/init/ossec-hids.init $(PKGDIR)/etc/init.d/ossec-hids
98 echo "DIRECTORY=\"/var/ossec\"" > $(PKGDIR)/etc/ossec-init.conf
99 echo "VERSION=\"`cat src/VERSION`\"" >> $(PKGDIR)/etc/ossec-init.conf
100 echo "DATE=\"`date --utc`\"" >> $(PKGDIR)/etc/ossec-init.conf
101 echo "TYPE=\"local\"" >> $(PKGDIR)/etc/ossec-init.conf
103 # Build architecture-independent files here.
104 binary-indep: build install
112 # dh_installlogrotate
132 # Build architecture-dependent files here.
133 binary-arch: build install
134 # We have nothing to do by default.
136 binary: binary-indep binary-arch
137 .PHONY: build clean binary-indep binary-arch binary install