/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: 2022-04-23 23:58:39 UTC
  • mto: This revision was merged to the branch mainline in revision 406.
  • Revision ID: teddy@recompile.se-20220423235839-cnt9aq1kjveqaydc
Bug fix in mandos-ctl: handle backslashes in password

* mandos-ctl (mode=password): When sending the password to gpg, use
  "printf" instead of "echo -n".  This avoids the behavior of the
  "echo" builtin in "dash", which always interprets backslash escape
  codes.

Reported-By: Jesse Norell <jesse@kci.net>

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
# For info about _FORTIFY_SOURCE, see feature_test_macros(7)
31
31
# and <https://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html>.
32
 
FORTIFY:=-fstack-protector-all -fPIC
33
 
CPPFLAGS+=-D_FORTIFY_SOURCE=3
 
32
FORTIFY:=-D_FORTIFY_SOURCE=3 -fstack-protector-all -fPIC
34
33
LINK_FORTIFY_LD:=-z relro -z now
35
34
LINK_FORTIFY:=
36
35
 
42
41
#COVERAGE=--coverage
43
42
OPTIMIZE:=-Os -fno-strict-aliasing
44
43
LANGUAGE:=-std=gnu11
45
 
CPPFLAGS+=-D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
 
44
FEATURES:=-D_FILE_OFFSET_BITS=64
46
45
htmldir:=man
47
 
version:=1.8.16
 
46
version:=1.8.14
48
47
SED:=sed
49
48
PKG_CONFIG?=pkg-config
50
49
 
64
63
# DRACUTMODULE:=$(DESTDIR)/usr/lib/dracut/modules.d/90mandos
65
64
# STATEDIR:=$(DESTDIR)/var/lib/mandos
66
65
# LIBDIR:=$(PREFIX)/lib
67
 
# DBUSPOLICYDIR:=$(DESTDIR)/etc/dbus-1/system.d
68
66
##
69
67
 
70
68
## These settings are for a package-type install
85
83
                        break; \
86
84
                fi; \
87
85
        done)
88
 
DBUSPOLICYDIR:=$(DESTDIR)/usr/share/dbus-1/system.d
89
86
##
90
87
 
91
88
SYSTEMD:=$(DESTDIR)$(shell $(PKG_CONFIG) systemd \
99
96
GNUTLS_LIBS:=$(shell $(PKG_CONFIG) --libs gnutls)
100
97
AVAHI_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I avahi-core)
101
98
AVAHI_LIBS:=$(shell $(PKG_CONFIG) --libs avahi-core)
102
 
GPGME_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I gpgme 2>/dev/null \
103
 
        || gpgme-config --cflags; getconf LFS_CFLAGS)
104
 
GPGME_LIBS:=$(shell $(PKG_CONFIG) --libs gpgme 2>/dev/null \
105
 
        || gpgme-config --libs; getconf LFS_LIBS; \
 
99
GPGME_CFLAGS:=$(shell gpgme-config --cflags; getconf LFS_CFLAGS)
 
100
GPGME_LIBS:=$(shell gpgme-config --libs; getconf LFS_LIBS; \
106
101
        getconf LFS_LDFLAGS)
107
102
LIBNL3_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I libnl-route-3.0)
108
103
LIBNL3_LIBS:=$(shell $(PKG_CONFIG) --libs libnl-route-3.0)
111
106
 
112
107
# Do not change these two
113
108
CFLAGS+=$(WARN) $(DEBUG) $(FORTIFY) $(COVERAGE) $(OPTIMIZE) \
114
 
        $(LANGUAGE) -DVERSION='"$(version)"'
 
109
        $(LANGUAGE) $(FEATURES) -DVERSION='"$(version)"'
115
110
LDFLAGS+=-Xlinker --as-needed $(COVERAGE) $(LINK_FORTIFY) $(strip \
116
111
        ) $(foreach flag,$(LINK_FORTIFY_LD),-Xlinker $(flag))
117
112
 
375
370
 
376
371
# Used by run-server
377
372
confdir/mandos.conf: mandos.conf
378
 
        install -D --mode=u=rw,go=r $^ $@
 
373
        install --directory confdir
 
374
        install --mode=u=rw,go=r $^ $@
379
375
confdir/clients.conf: clients.conf keydir/seckey.txt keydir/tls-pubkey.pem
380
 
        install -D --mode=u=rw $< $@
 
376
        install --directory confdir
 
377
        install --mode=u=rw $< $@
381
378
# Add a client password
382
379
        ./mandos-keygen --dir keydir --password --no-ssh >> $@
383
380
statedir:
388
385
 
389
386
.PHONY: install-html
390
387
install-html: html
391
 
        install -D --mode=u=rw,go=r --target-directory=$(htmldir) \
 
388
        install --directory $(htmldir)
 
389
        install --mode=u=rw,go=r --target-directory=$(htmldir) \
392
390
                $(htmldocs)
393
391
 
394
392
.PHONY: install-server
395
393
install-server: doc
 
394
        install --directory $(CONFDIR)
396
395
        if install --directory --mode=u=rwx --owner=$(USER) \
397
396
                --group=$(GROUP) $(STATEDIR); then \
398
397
                :; \
399
398
        elif install --directory --mode=u=rwx $(STATEDIR); then \
400
399
                chown -- $(USER):$(GROUP) $(STATEDIR) || :; \
401
400
        fi
402
 
        if [ "$(TMPFILES)" != "$(DESTDIR)" ]; then \
403
 
                install -D --mode=u=rw,go=r tmpfiles.d-mandos.conf \
 
401
        if [ "$(TMPFILES)" != "$(DESTDIR)" \
 
402
                        -a -d "$(TMPFILES)" ]; then \
 
403
                install --mode=u=rw,go=r tmpfiles.d-mandos.conf \
404
404
                        $(TMPFILES)/mandos.conf; \
405
405
        fi
406
 
        if [ "$(SYSUSERS)" != "$(DESTDIR)" ]; then \
407
 
                install -D --mode=u=rw,go=r sysusers.d-mandos.conf \
 
406
        if [ "$(SYSUSERS)" != "$(DESTDIR)" \
 
407
                        -a -d "$(SYSUSERS)" ]; then \
 
408
                install --mode=u=rw,go=r sysusers.d-mandos.conf \
408
409
                        $(SYSUSERS)/mandos.conf; \
409
410
        fi
410
 
        install --directory $(PREFIX)/sbin
411
 
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
412
 
                mandos
 
411
        install --mode=u=rwx,go=rx mandos $(PREFIX)/sbin/mandos
413
412
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
414
413
                mandos-ctl
415
414
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
416
415
                mandos-monitor
417
 
        install --directory $(CONFDIR)
418
416
        install --mode=u=rw,go=r --target-directory=$(CONFDIR) \
419
417
                mandos.conf
420
418
        install --mode=u=rw --target-directory=$(CONFDIR) \
421
419
                clients.conf
422
 
        install -D --mode=u=rw,go=r dbus-mandos.conf \
423
 
                $(DBUSPOLICYDIR)/mandos.conf
424
 
        install -D --mode=u=rwx,go=rx init.d-mandos \
 
420
        install --mode=u=rw,go=r dbus-mandos.conf \
 
421
                $(DESTDIR)/etc/dbus-1/system.d/mandos.conf
 
422
        install --mode=u=rwx,go=rx init.d-mandos \
425
423
                $(DESTDIR)/etc/init.d/mandos
426
 
        if [ "$(SYSTEMD)" != "$(DESTDIR)" ]; then \
427
 
                install -D --mode=u=rw,go=r mandos.service \
428
 
                        $(SYSTEMD); \
 
424
        if [ "$(SYSTEMD)" != "$(DESTDIR)" -a -d "$(SYSTEMD)" ]; then \
 
425
                install --mode=u=rw,go=r mandos.service $(SYSTEMD); \
429
426
        fi
430
 
        install -D --mode=u=rw,go=r default-mandos \
 
427
        install --mode=u=rw,go=r default-mandos \
431
428
                $(DESTDIR)/etc/default/mandos
432
429
        if [ -z $(DESTDIR) ]; then \
433
430
                update-rc.d mandos defaults 25 15;\
434
431
        fi
435
 
        install --directory $(MANDIR)/man8 $(MANDIR)/man5
436
432
        gzip --best --to-stdout mandos.8 \
437
433
                > $(MANDIR)/man8/mandos.8.gz
438
434
        gzip --best --to-stdout mandos-monitor.8 \
448
444
 
449
445
.PHONY: install-client-nokey
450
446
install-client-nokey: all doc
 
447
        install --directory $(LIBDIR)/mandos $(CONFDIR)
451
448
        install --directory --mode=u=rwx $(KEYDIR) \
452
449
                $(LIBDIR)/mandos/plugins.d \
453
450
                $(LIBDIR)/mandos/plugin-helpers
454
 
        if [ "$(SYSUSERS)" != "$(DESTDIR)" ]; then \
455
 
                install -D --mode=u=rw,go=r sysusers.d-mandos.conf \
 
451
        if [ "$(SYSUSERS)" != "$(DESTDIR)" \
 
452
                        -a -d "$(SYSUSERS)" ]; then \
 
453
                install --mode=u=rw,go=r sysusers.d-mandos.conf \
456
454
                        $(SYSUSERS)/mandos-client.conf; \
457
455
        fi
458
456
        if [ "$(CONFDIR)" != "$(LIBDIR)/mandos" ]; then \
459
 
                install --directory \
460
 
                        --mode=u=rwx "$(CONFDIR)/plugins.d" \
 
457
                install --mode=u=rwx \
 
458
                        --directory "$(CONFDIR)/plugins.d" \
461
459
                        "$(CONFDIR)/plugin-helpers"; \
462
460
        fi
463
 
        install --directory --mode=u=rwx,go=rx \
 
461
        install --mode=u=rwx,go=rx --directory \
464
462
                "$(CONFDIR)/network-hooks.d"
465
463
        install --mode=u=rwx,go=rx \
466
464
                --target-directory=$(LIBDIR)/mandos plugin-runner
467
465
        install --mode=u=rwx,go=rx \
468
466
                --target-directory=$(LIBDIR)/mandos \
469
467
                mandos-to-cryptroot-unlock
470
 
        install --directory $(PREFIX)/sbin
471
468
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
472
469
                mandos-keygen
473
470
        install --mode=u=rwx,go=rx \
491
488
        install --mode=u=rwx,go=rx \
492
489
                --target-directory=$(LIBDIR)/mandos/plugin-helpers \
493
490
                plugin-helpers/mandos-client-iprouteadddel
494
 
        install -D initramfs-tools-hook \
 
491
        install initramfs-tools-hook \
495
492
                $(INITRAMFSTOOLS)/hooks/mandos
496
 
        install -D --mode=u=rw,go=r initramfs-tools-conf \
 
493
        install --mode=u=rw,go=r initramfs-tools-conf \
497
494
                $(INITRAMFSTOOLS)/conf.d/mandos-conf
498
 
        install -D --mode=u=rw,go=r initramfs-tools-conf-hook \
 
495
        install --mode=u=rw,go=r initramfs-tools-conf-hook \
499
496
                $(INITRAMFSTOOLS)/conf-hooks.d/zz-mandos
500
 
        install -D initramfs-tools-script \
 
497
        install initramfs-tools-script \
501
498
                $(INITRAMFSTOOLS)/scripts/init-premount/mandos
502
 
        install -D initramfs-tools-script-stop \
 
499
        install initramfs-tools-script-stop \
503
500
                $(INITRAMFSTOOLS)/scripts/local-premount/mandos
504
 
        install -D --mode=u=rw,go=r \
505
 
                --target-directory=$(DRACUTMODULE) \
 
501
        install --directory $(DRACUTMODULE)
 
502
        install --mode=u=rw,go=r --target-directory=$(DRACUTMODULE) \
506
503
                dracut-module/ask-password-mandos.path \
507
504
                dracut-module/ask-password-mandos.service
508
505
        install --mode=u=rwxs,go=rx \
511
508
                dracut-module/cmdline-mandos.sh \
512
509
                dracut-module/password-agent
513
510
        install --mode=u=rw,go=r plugin-runner.conf $(CONFDIR)
514
 
        install --directory $(MANDIR)/man8
515
511
        gzip --best --to-stdout mandos-keygen.8 \
516
512
                > $(MANDIR)/man8/mandos-keygen.8.gz
517
513
        gzip --best --to-stdout plugin-runner.8mandos \
614
610
                $(DESTDIR)/etc/dbus-1/system.d/mandos.conf
615
611
                $(DESTDIR)/etc/default/mandos \
616
612
                $(DESTDIR)/etc/init.d/mandos \
 
613
                $(SYSTEMD)/mandos.service \
617
614
                $(DESTDIR)/run/mandos.pid \
618
615
                $(DESTDIR)/var/run/mandos.pid
619
 
        if [ "$(SYSTEMD)" != "$(DESTDIR)" -a -d "$(SYSTEMD)" ]; then \
620
 
                -rm --force -- $(SYSTEMD)/mandos.service; \
621
 
        fi
622
616
        -rmdir $(CONFDIR)
623
617
 
624
618
.PHONY: purge-client