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 = .ssh active-response active-response/bin agentless bin etc etc/shared logs logs/alerts logs/archives logs/firewall queue queue/agent-info queue/agentless queue/alerts queue/diff queue/fts queue/ossec queue/rids queue/rootcheck queue/syscheck rules stats tmp var var/run
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 \
39 $(SRCDIR)/analysisd/ossec-makelists
50 # ugly directory creation
51 for i in $(SUBDIRS); do \
52 mkdir -p -m 700 $(DESTDIR)/$$i; \
55 # various files installation
56 install -m 644 etc/internal_options.conf $(DESTDIR)/etc
57 install -m 644 etc/decoder.xml $(DESTDIR)/etc
58 install -m 644 src/rootcheck/db/*.txt $(DESTDIR)/etc/shared
59 if [ -e ossec-debian.conf ]; then \
60 install -m 440 ossec-debian.conf $(DESTDIR)/etc/ossec.conf; \
62 install -m 440 etc/ossec-local.conf $(DESTDIR)/etc/ossec.conf; \
64 install -m 440 etc/ossec-*.conf $(DESTDIR)/etc
65 cp -r etc/rules/* $(DESTDIR)/rules
66 install -m 750 src/agentlessd/scripts/* $(DESTDIR)/agentless
67 install -s -m 755 bin/* $(DESTDIR)/bin
68 install -m 755 src/init/ossec-*.sh $(DESTDIR)/bin
69 ln -s ossec-local.sh $(DESTDIR)/bin/ossec-control
70 install -m 755 active-response/*.sh $(DESTDIR)/active-response/bin
71 install -m 755 active-response/firewalls/*.sh \
72 $(DESTDIR)/active-response/bin
75 chmod -R 550 $(DESTDIR)
76 chmod -R 770 $(DESTDIR)/queue/alerts
77 chmod -R 770 $(DESTDIR)/queue/ossec
78 chmod -R 750 $(DESTDIR)/queue/fts
79 chmod -R 750 $(DESTDIR)/queue/syscheck
80 chmod -R 750 $(DESTDIR)/queue/rootcheck
81 chmod -R 750 $(DESTDIR)/queue/diff
82 chmod -R 755 $(DESTDIR)/queue/agent-info
83 chmod -R 755 $(DESTDIR)/queue/rids
84 chmod -R 755 $(DESTDIR)/queue/agentless
85 chmod -R 750 $(DESTDIR)/stats
86 chmod -R 750 $(DESTDIR)/logs
87 chmod -R 550 $(DESTDIR)/rules
88 chmod 770 $(DESTDIR)/var/run
89 chmod 550 $(DESTDIR)/etc
90 chmod 440 $(DESTDIR)/etc/internal_options.conf
91 chmod -R 770 $(DESTDIR)/etc/shared
92 chmod 700 $(DESTDIR)/.ssh
93 chmod 755 $(DESTDIR)/active-response/bin/*
94 chmod 550 $(DESTDIR)/bin/*
95 chmod 440 $(DESTDIR)/etc/ossec.conf
97 # fixups: no need for execute bits on files there
98 find $(DESTDIR)/rules -type f -exec chmod ugo-x '{}' ';'
99 find $(DESTDIR)/etc -type f -exec chmod ugo-x '{}' ';'
102 mkdir -p $(PKGDIR)/etc/init.d
103 if [ -e ossec-hids-debian.init ]; then \
104 install -m 755 ossec-hids-debian.init \
105 $(PKGDIR)/etc/init.d/ossec-hids; \
107 install -m 755 src/init/ossec-hids.init \
108 $(PKGDIR)/etc/init.d/ossec-hids; \
112 echo "DIRECTORY=\"/var/ossec\"" > $(PKGDIR)/etc/ossec-init.conf
113 echo "VERSION=\"`cat src/VERSION`\"" >> $(PKGDIR)/etc/ossec-init.conf
114 echo "DATE=\"$(shell date --utc -d "$(shell dpkg-parsechangelog | sed -ne 's/Date: //p')")\"" >> $(PKGDIR)/etc/ossec-init.conf
115 echo "TYPE=\"local\"" >> $(PKGDIR)/etc/ossec-init.conf
117 # Build architecture-independent files here.
118 binary-indep: build install
119 # We have nothing to do by default.
121 # Build architecture-dependent files here.
122 binary-arch: build install
130 # dh_installlogrotate
152 binary: binary-indep binary-arch
153 .PHONY: build clean binary-indep binary-arch binary install