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
33 # Add here commands to clean up after the build process.
34 $(MAKE) -C $(SRCDIR) clean
37 rm -f $(SRCDIR)/Config.OS \
38 $(SRCDIR)/analysisd/compiled_rules/compiled_rules.h \
39 $(SRCDIR)/analysisd/ossec-logtest \
40 $(SRCDIR)/isbigendian \
41 $(SRCDIR)/isbigendian.c \
42 $(SRCDIR)/analysisd/ossec-makelists
53 # ugly directory creation
54 for i in $(SUBDIRS); do \
55 mkdir -p -m 700 $(DESTDIR)/$$i; \
58 # various files installation
59 install -m 644 etc/internal_options.conf $(DESTDIR)/etc
60 install -m 644 etc/decoder.xml $(DESTDIR)/etc
61 install -m 644 src/rootcheck/db/*.txt $(DESTDIR)/etc/shared
62 if [ -e ossec-debian.conf ]; then \
63 install -m 440 ossec-debian.conf $(DESTDIR)/etc/ossec.conf; \
65 install -m 440 etc/ossec-local.conf $(DESTDIR)/etc/ossec.conf; \
67 install -m 440 etc/ossec-*.conf $(DESTDIR)/etc
68 cp -r etc/rules/* $(DESTDIR)/rules
69 install -m 750 src/agentlessd/scripts/* $(DESTDIR)/agentless
70 install -s -m 755 bin/* $(DESTDIR)/bin
71 install -m 755 src/init/ossec-*.sh $(DESTDIR)/bin
72 ln -s ossec-local.sh $(DESTDIR)/bin/ossec-control
73 install -m 755 active-response/*.sh $(DESTDIR)/active-response/bin
74 install -m 755 active-response/firewalls/*.sh \
75 $(DESTDIR)/active-response/bin
78 chmod -R 550 $(DESTDIR)
79 chmod -R 770 $(DESTDIR)/queue/alerts
80 chmod -R 770 $(DESTDIR)/queue/ossec
81 chmod -R 750 $(DESTDIR)/queue/fts
82 chmod -R 750 $(DESTDIR)/queue/syscheck
83 chmod -R 750 $(DESTDIR)/queue/rootcheck
84 chmod -R 750 $(DESTDIR)/queue/diff
85 chmod -R 755 $(DESTDIR)/queue/agent-info
86 chmod -R 755 $(DESTDIR)/queue/rids
87 chmod -R 755 $(DESTDIR)/queue/agentless
88 chmod -R 750 $(DESTDIR)/stats
89 chmod -R 750 $(DESTDIR)/logs
90 chmod -R 550 $(DESTDIR)/rules
91 chmod 770 $(DESTDIR)/var/run
92 chmod 550 $(DESTDIR)/etc
93 chmod 440 $(DESTDIR)/etc/internal_options.conf
94 chmod -R 770 $(DESTDIR)/etc/shared
95 chmod 700 $(DESTDIR)/.ssh
96 chmod 755 $(DESTDIR)/active-response/bin/*
97 chmod 550 $(DESTDIR)/bin/*
98 chmod 440 $(DESTDIR)/etc/ossec.conf
100 # fixups: no need for execute bits on files there
101 find $(DESTDIR)/rules -type f -exec chmod ugo-x '{}' ';'
102 find $(DESTDIR)/etc -type f -exec chmod ugo-x '{}' ';'
105 mkdir -p $(PKGDIR)/etc/init.d
106 if [ -e ossec-hids-debian.init ]; then \
107 install -m 755 ossec-hids-debian.init \
108 $(PKGDIR)/etc/init.d/ossec-hids; \
110 install -m 755 src/init/ossec-hids.init \
111 $(PKGDIR)/etc/init.d/ossec-hids; \
115 echo "DIRECTORY=\"/var/ossec\"" > $(PKGDIR)/etc/ossec-init.conf
116 echo "VERSION=\"`cat src/VERSION`\"" >> $(PKGDIR)/etc/ossec-init.conf
117 echo "DATE=\"$(shell date --utc -d "$(shell dpkg-parsechangelog | sed -ne 's/Date: //p')")\"" >> $(PKGDIR)/etc/ossec-init.conf
118 echo "TYPE=\"local\"" >> $(PKGDIR)/etc/ossec-init.conf
120 # Build architecture-independent files here.
121 binary-indep: build install
122 # We have nothing to do by default.
124 # Build architecture-dependent files here.
125 binary-arch: build install
133 # dh_installlogrotate
155 binary: binary-indep binary-arch
156 .PHONY: build clean binary-indep binary-arch binary install