/mandos/release

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/release

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Teddy Hogeborn
  • Date: 2018-02-10 13:23:58 UTC
  • mto: (237.7.594 trunk)
  • mto: This revision was merged to the branch mainline in revision 362.
  • Revision ID: teddy@recompile.se-20180210132358-8pfvo9vshq9l32y5
Remove unnecessary text left from old example init.d file

* init.d-mandos: Remove unnecessary text left from old example init.d
  file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
        -Wmissing-format-attribute -Wnormalized=nfc -Wpacked \
11
11
        -Wredundant-decls -Wnested-externs -Winline -Wvla \
12
12
        -Wvolatile-register-var -Woverlength-strings
13
 
 
14
 
#DEBUG:=-ggdb3 -fsanitize=address $(SANITIZE)
15
 
## Check which sanitizing options can be used
16
 
#SANITIZE:=$(foreach option,$(ALL_SANITIZE_OPTIONS),$(shell \
17
 
#       echo 'int main(){}' | $(CC) --language=c $(option) \
18
 
#       /dev/stdin -o /dev/null >/dev/null 2>&1 && echo $(option)))
 
13
#DEBUG:=-ggdb3 -fsanitize=address 
 
14
# For info about _FORTIFY_SOURCE, see feature_test_macros(7)
 
15
# and <https://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html>.
 
16
FORTIFY:=-D_FORTIFY_SOURCE=2 -fstack-protector-all -fPIC
19
17
# <https://developerblog.redhat.com/2014/10/16/gcc-undefined-behavior-sanitizer-ubsan/>
20
18
ALL_SANITIZE_OPTIONS:=-fsanitize=leak -fsanitize=undefined \
21
19
        -fsanitize=shift -fsanitize=integer-divide-by-zero \
25
23
        -fsanitize=object-size -fsanitize=float-divide-by-zero \
26
24
        -fsanitize=float-cast-overflow -fsanitize=nonnull-attribute \
27
25
        -fsanitize=returns-nonnull-attribute -fsanitize=bool \
28
 
        -fsanitize=enum -fsanitize-address-use-after-scope
29
 
 
30
 
# For info about _FORTIFY_SOURCE, see feature_test_macros(7)
31
 
# and <https://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html>.
32
 
FORTIFY:=-D_FORTIFY_SOURCE=2 -fstack-protector-all -fPIC
 
26
        -fsanitize=enum
 
27
# Check which sanitizing options can be used
 
28
SANITIZE:=$(foreach option,$(ALL_SANITIZE_OPTIONS),$(shell \
 
29
        echo 'int main(){}' | $(CC) --language=c $(option) /dev/stdin \
 
30
        -o /dev/null >/dev/null 2>&1 && echo $(option)))
33
31
LINK_FORTIFY_LD:=-z relro -z now
34
32
LINK_FORTIFY:=
35
33
 
42
40
OPTIMIZE:=-Os -fno-strict-aliasing
43
41
LANGUAGE:=-std=gnu11
44
42
htmldir:=man
45
 
version:=1.8.4
 
43
version:=1.7.16
46
44
SED:=sed
47
45
 
48
 
USER:=$(firstword $(subst :, ,$(shell getent passwd _mandos \
49
 
        || getent passwd nobody || echo 65534)))
50
 
GROUP:=$(firstword $(subst :, ,$(shell getent group _mandos \
51
 
        || getent group nogroup || echo 65534)))
 
46
USER:=$(firstword $(subst :, ,$(shell getent passwd _mandos || getent passwd nobody || echo 65534)))
 
47
GROUP:=$(firstword $(subst :, ,$(shell getent group _mandos || getent group nogroup || echo 65534)))
52
48
 
53
49
## Use these settings for a traditional /usr/local install
54
50
# PREFIX:=$(DESTDIR)/usr/local
92
88
LIBNL3_LIBS:=$(shell pkg-config --libs libnl-route-3.0)
93
89
 
94
90
# Do not change these two
95
 
CFLAGS+=$(WARN) $(DEBUG) $(FORTIFY) $(COVERAGE) \
96
 
        $(OPTIMIZE) $(LANGUAGE) -DVERSION='"$(version)"'
97
 
LDFLAGS+=-Xlinker --as-needed $(COVERAGE) $(LINK_FORTIFY) $(strip \
98
 
        ) $(foreach flag,$(LINK_FORTIFY_LD),-Xlinker $(flag))
 
91
CFLAGS+=$(WARN) $(DEBUG) $(FORTIFY) $(SANITIZE) $(COVERAGE) \
 
92
        $(OPTIMIZE) $(LANGUAGE) $(GNUTLS_CFLAGS) $(AVAHI_CFLAGS) \
 
93
        $(GPGME_CFLAGS) -DVERSION='"$(version)"'
 
94
LDFLAGS+=-Xlinker --as-needed $(COVERAGE) $(LINK_FORTIFY) $(foreach flag,$(LINK_FORTIFY_LD),-Xlinker $(flag))
99
95
 
100
96
# Commands to format a DocBook <refentry> document into a manual page
101
97
DOCBOOKTOMAN=$(strip cd $(dir $<); xsltproc --nonet --xinclude \
257
253
                --expression='s/\(mandos_\)[0-9.]\+\(\.orig\.tar\.gz\)/\1$(version)\2/' \
258
254
                $@)
259
255
 
260
 
# Need to add the GnuTLS, Avahi and GPGME libraries
261
256
plugins.d/mandos-client: plugins.d/mandos-client.c
262
 
        $(LINK.c) $^ $(GNUTLS_CFLAGS) $(AVAHI_CFLAGS) $(strip\
263
 
                ) $(GPGME_CFLAGS) $(GNUTLS_LIBS) $(strip\
264
 
                ) $(AVAHI_LIBS) $(GPGME_LIBS) $(LOADLIBES) $(strip\
265
 
                ) $(LDLIBS) -o $@
 
257
        $(LINK.c) $^ -lrt $(GNUTLS_LIBS) $(AVAHI_LIBS) $(strip\
 
258
                ) $(GPGME_LIBS) $(LOADLIBES) $(LDLIBS) -o $@
266
259
 
267
 
# Need to add the libnl-route library
268
260
plugin-helpers/mandos-client-iprouteadddel: plugin-helpers/mandos-client-iprouteadddel.c
269
261
        $(LINK.c) $(LIBNL3_CFLAGS) $^ $(LIBNL3_LIBS) $(strip\
270
262
                ) $(LOADLIBES) $(LDLIBS) -o $@
283
275
maintainer-clean: clean
284
276
        -rm --force --recursive keydir confdir statedir
285
277
 
286
 
check: all
 
278
check:  all
287
279
        ./mandos --check
288
280
        ./mandos-ctl --check
289
 
        ./mandos-keygen --version
290
 
        ./plugin-runner --version
291
 
        ./plugin-helpers/mandos-client-iprouteadddel --version
292
281
 
293
282
# Run the client with a local config and key
294
 
run-client: all keydir/seckey.txt keydir/pubkey.txt keydir/tls-privkey.pem keydir/tls-pubkey.pem
 
283
run-client: all keydir/seckey.txt keydir/pubkey.txt
295
284
        @echo "###################################################################"
296
285
        @echo "# The following error messages are harmless and can be safely     #"
297
286
        @echo "# ignored:                                                        #"
310
299
        ./plugin-runner --plugin-dir=plugins.d \
311
300
                --plugin-helper-dir=plugin-helpers \
312
301
                --config-file=plugin-runner.conf \
313
 
                --options-for=mandos-client:--seckey=keydir/seckey.txt,--pubkey=keydir/pubkey.txt,--tls-privkey=keydir/tls-privkey.pem,--tls-pubkey=keydir/tls-pubkey.pem,--network-hook-dir=network-hooks.d \
 
302
                --options-for=mandos-client:--seckey=keydir/seckey.txt,--pubkey=keydir/pubkey.txt,--network-hook-dir=network-hooks.d \
314
303
                --env-for=mandos-client:GNOME_KEYRING_CONTROL= \
315
304
                $(CLIENTARGS)
316
305
 
317
306
# Used by run-client
318
 
keydir/seckey.txt keydir/pubkey.txt keydir/tls-privkey.pem keydir/tls-pubkey.pem: mandos-keygen
 
307
keydir/seckey.txt keydir/pubkey.txt: mandos-keygen
319
308
        install --directory keydir
320
309
        ./mandos-keygen --dir keydir --force
321
310
 
328
317
confdir/mandos.conf: mandos.conf
329
318
        install --directory confdir
330
319
        install --mode=u=rw,go=r $^ $@
331
 
confdir/clients.conf: clients.conf keydir/seckey.txt keydir/tls-pubkey.pem
 
320
confdir/clients.conf: clients.conf keydir/seckey.txt
332
321
        install --directory confdir
333
322
        install --mode=u=rw $< $@
334
323
# Add a client password
403
392
                "$(CONFDIR)/network-hooks.d"
404
393
        install --mode=u=rwx,go=rx \
405
394
                --target-directory=$(LIBDIR)/mandos plugin-runner
406
 
        install --mode=u=rwx,go=rx \
407
 
                --target-directory=$(LIBDIR)/mandos mandos-to-cryptroot-unlock
408
395
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
409
396
                mandos-keygen
410
397
        install --mode=u=rwx,go=rx \
430
417
                plugin-helpers/mandos-client-iprouteadddel
431
418
        install initramfs-tools-hook \
432
419
                $(INITRAMFSTOOLS)/hooks/mandos
433
 
        install --mode=u=rw,go=r initramfs-tools-conf \
434
 
                $(INITRAMFSTOOLS)/conf.d/mandos-conf
435
 
        install --mode=u=rw,go=r initramfs-tools-conf-hook \
436
 
                $(INITRAMFSTOOLS)/conf-hooks.d/zz-mandos
 
420
        install --mode=u=rw,go=r initramfs-tools-hook-conf \
 
421
                $(INITRAMFSTOOLS)/conf-hooks.d/mandos
437
422
        install initramfs-tools-script \
438
423
                $(INITRAMFSTOOLS)/scripts/init-premount/mandos
439
 
        install initramfs-tools-script-stop \
440
 
                $(INITRAMFSTOOLS)/scripts/local-premount/mandos
441
424
        install --mode=u=rw,go=r plugin-runner.conf $(CONFDIR)
442
425
        gzip --best --to-stdout mandos-keygen.8 \
443
426
                > $(MANDIR)/man8/mandos-keygen.8.gz
517
500
        -rmdir $(CONFDIR)
518
501
 
519
502
purge-client: uninstall-client
520
 
        -shred --remove $(KEYDIR)/seckey.txt $(KEYDIR)/tls-privkey.pem
 
503
        -shred --remove $(KEYDIR)/seckey.txt
521
504
        -rm --force $(CONFDIR)/plugin-runner.conf \
522
 
                $(KEYDIR)/pubkey.txt $(KEYDIR)/seckey.txt \
523
 
                $(KEYDIR)/tls-pubkey.txt $(KEYDIR)/tls-privkey.txt
 
505
                $(KEYDIR)/pubkey.txt $(KEYDIR)/seckey.txt
524
506
        -rmdir $(KEYDIR) $(CONFDIR)/plugins.d $(CONFDIR)