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