/mandos/trunk

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

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Teddy Hogeborn
  • Date: 2024-09-08 00:31:34 UTC
  • Revision ID: teddy@recompile.se-20240908003134-kvu38pk7wzhz4rbu
Very minor security improvement when uninstalling package

* debian/mandos-client.postrm: Also shred(1) tls-privkkey.pem.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#COVERAGE=--coverage
43
43
OPTIMIZE:=-Os -fno-strict-aliasing
44
44
LANGUAGE:=-std=gnu11
45
 
CPPFLAGS+=-D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
 
45
CPPFLAGS+=-D_FILE_OFFSET_BITS=64
46
46
htmldir:=man
47
47
version:=1.8.16
48
48
SED:=sed
289
289
                --expression='s/\(mandos_\)[0-9.]\+\(\.orig\.tar\.gz\)/\1$(version)\2/' \
290
290
                $@)
291
291
 
292
 
# Uses nested functions
293
 
plugin-runner: LDFLAGS += -Xlinker --no-warn-execstack
294
 
dracut-module/password-agent: LDFLAGS += -Xlinker --no-warn-execstack
295
 
plugins.d/password-prompt: LDFLAGS += -Xlinker --no-warn-execstack
296
 
plugins.d/mandos-client: LDFLAGS += -Xlinker --no-warn-execstack
297
 
plugins.d/plymouth: LDFLAGS += -Xlinker --no-warn-execstack
298
 
 
299
292
# Need to add the GnuTLS, Avahi and GPGME libraries
300
293
plugins.d/mandos-client: CFLAGS += $(GNUTLS_CFLAGS) $(strip \
301
294
        ) $(AVAHI_CFLAGS) $(GPGME_CFLAGS)
382
375
 
383
376
# Used by run-server
384
377
confdir/mandos.conf: mandos.conf
385
 
        install -D --mode=u=rw,go=r $^ $@
 
378
        install --directory confdir
 
379
        install --mode=u=rw,go=r $^ $@
386
380
confdir/clients.conf: clients.conf keydir/seckey.txt keydir/tls-pubkey.pem
387
 
        install -D --mode=u=rw $< $@
 
381
        install --directory confdir
 
382
        install --mode=u=rw $< $@
388
383
# Add a client password
389
384
        ./mandos-keygen --dir keydir --password --no-ssh >> $@
390
385
statedir:
395
390
 
396
391
.PHONY: install-html
397
392
install-html: html
398
 
        install -D --mode=u=rw,go=r --target-directory=$(htmldir) \
 
393
        install --directory $(htmldir)
 
394
        install --mode=u=rw,go=r --target-directory=$(htmldir) \
399
395
                $(htmldocs)
400
396
 
401
397
.PHONY: install-server
402
398
install-server: doc
 
399
        install --directory $(CONFDIR)
403
400
        if install --directory --mode=u=rwx --owner=$(USER) \
404
401
                --group=$(GROUP) $(STATEDIR); then \
405
402
                :; \
406
403
        elif install --directory --mode=u=rwx $(STATEDIR); then \
407
404
                chown -- $(USER):$(GROUP) $(STATEDIR) || :; \
408
405
        fi
409
 
        if [ "$(TMPFILES)" != "$(DESTDIR)" ]; then \
410
 
                install -D --mode=u=rw,go=r tmpfiles.d-mandos.conf \
 
406
        if [ "$(TMPFILES)" != "$(DESTDIR)" \
 
407
                        -a -d "$(TMPFILES)" ]; then \
 
408
                install --mode=u=rw,go=r tmpfiles.d-mandos.conf \
411
409
                        $(TMPFILES)/mandos.conf; \
412
410
        fi
413
 
        if [ "$(SYSUSERS)" != "$(DESTDIR)" ]; then \
414
 
                install -D --mode=u=rw,go=r sysusers.d-mandos.conf \
 
411
        if [ "$(SYSUSERS)" != "$(DESTDIR)" \
 
412
                        -a -d "$(SYSUSERS)" ]; then \
 
413
                install --mode=u=rw,go=r sysusers.d-mandos.conf \
415
414
                        $(SYSUSERS)/mandos.conf; \
416
415
        fi
417
 
        install --directory $(PREFIX)/sbin
418
 
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
419
 
                mandos
 
416
        install --mode=u=rwx,go=rx mandos $(PREFIX)/sbin/mandos
420
417
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
421
418
                mandos-ctl
422
419
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
423
420
                mandos-monitor
424
 
        install --directory $(CONFDIR)
425
421
        install --mode=u=rw,go=r --target-directory=$(CONFDIR) \
426
422
                mandos.conf
427
423
        install --mode=u=rw --target-directory=$(CONFDIR) \
428
424
                clients.conf
429
 
        install -D --mode=u=rw,go=r dbus-mandos.conf \
 
425
        install --mode=u=rw,go=r dbus-mandos.conf \
430
426
                $(DBUSPOLICYDIR)/mandos.conf
431
 
        install -D --mode=u=rwx,go=rx init.d-mandos \
 
427
        install --mode=u=rwx,go=rx init.d-mandos \
432
428
                $(DESTDIR)/etc/init.d/mandos
433
 
        if [ "$(SYSTEMD)" != "$(DESTDIR)" ]; then \
434
 
                install -D --mode=u=rw,go=r mandos.service \
435
 
                        $(SYSTEMD); \
 
429
        if [ "$(SYSTEMD)" != "$(DESTDIR)" -a -d "$(SYSTEMD)" ]; then \
 
430
                install --mode=u=rw,go=r mandos.service $(SYSTEMD); \
436
431
        fi
437
 
        install -D --mode=u=rw,go=r default-mandos \
 
432
        install --mode=u=rw,go=r default-mandos \
438
433
                $(DESTDIR)/etc/default/mandos
439
434
        if [ -z $(DESTDIR) ]; then \
440
435
                update-rc.d mandos defaults 25 15;\
441
436
        fi
442
 
        install --directory $(MANDIR)/man8 $(MANDIR)/man5
443
437
        gzip --best --to-stdout mandos.8 \
444
438
                > $(MANDIR)/man8/mandos.8.gz
445
439
        gzip --best --to-stdout mandos-monitor.8 \
455
449
 
456
450
.PHONY: install-client-nokey
457
451
install-client-nokey: all doc
 
452
        install --directory $(LIBDIR)/mandos $(CONFDIR)
458
453
        install --directory --mode=u=rwx $(KEYDIR) \
459
454
                $(LIBDIR)/mandos/plugins.d \
460
455
                $(LIBDIR)/mandos/plugin-helpers
461
 
        if [ "$(SYSUSERS)" != "$(DESTDIR)" ]; then \
462
 
                install -D --mode=u=rw,go=r sysusers.d-mandos.conf \
 
456
        if [ "$(SYSUSERS)" != "$(DESTDIR)" \
 
457
                        -a -d "$(SYSUSERS)" ]; then \
 
458
                install --mode=u=rw,go=r sysusers.d-mandos.conf \
463
459
                        $(SYSUSERS)/mandos-client.conf; \
464
460
        fi
465
461
        if [ "$(CONFDIR)" != "$(LIBDIR)/mandos" ]; then \
466
 
                install --directory \
467
 
                        --mode=u=rwx "$(CONFDIR)/plugins.d" \
 
462
                install --mode=u=rwx \
 
463
                        --directory "$(CONFDIR)/plugins.d" \
468
464
                        "$(CONFDIR)/plugin-helpers"; \
469
465
        fi
470
 
        install --directory --mode=u=rwx,go=rx \
 
466
        install --mode=u=rwx,go=rx --directory \
471
467
                "$(CONFDIR)/network-hooks.d"
472
468
        install --mode=u=rwx,go=rx \
473
469
                --target-directory=$(LIBDIR)/mandos plugin-runner
474
470
        install --mode=u=rwx,go=rx \
475
471
                --target-directory=$(LIBDIR)/mandos \
476
472
                mandos-to-cryptroot-unlock
477
 
        install --directory $(PREFIX)/sbin
478
473
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
479
474
                mandos-keygen
480
475
        install --mode=u=rwx,go=rx \
498
493
        install --mode=u=rwx,go=rx \
499
494
                --target-directory=$(LIBDIR)/mandos/plugin-helpers \
500
495
                plugin-helpers/mandos-client-iprouteadddel
501
 
        install -D initramfs-tools-hook \
 
496
        install initramfs-tools-hook \
502
497
                $(INITRAMFSTOOLS)/hooks/mandos
503
 
        install -D --mode=u=rw,go=r initramfs-tools-conf \
 
498
        install --mode=u=rw,go=r initramfs-tools-conf \
504
499
                $(INITRAMFSTOOLS)/conf.d/mandos-conf
505
 
        install -D --mode=u=rw,go=r initramfs-tools-conf-hook \
 
500
        install --mode=u=rw,go=r initramfs-tools-conf-hook \
506
501
                $(INITRAMFSTOOLS)/conf-hooks.d/zz-mandos
507
 
        install -D initramfs-tools-script \
 
502
        install initramfs-tools-script \
508
503
                $(INITRAMFSTOOLS)/scripts/init-premount/mandos
509
 
        install -D initramfs-tools-script-stop \
 
504
        install initramfs-tools-script-stop \
510
505
                $(INITRAMFSTOOLS)/scripts/local-premount/mandos
511
 
        install -D --mode=u=rw,go=r \
512
 
                --target-directory=$(DRACUTMODULE) \
 
506
        install --directory $(DRACUTMODULE)
 
507
        install --mode=u=rw,go=r --target-directory=$(DRACUTMODULE) \
513
508
                dracut-module/ask-password-mandos.path \
514
509
                dracut-module/ask-password-mandos.service
515
510
        install --mode=u=rwxs,go=rx \
518
513
                dracut-module/cmdline-mandos.sh \
519
514
                dracut-module/password-agent
520
515
        install --mode=u=rw,go=r plugin-runner.conf $(CONFDIR)
521
 
        install --directory $(MANDIR)/man8
522
516
        gzip --best --to-stdout mandos-keygen.8 \
523
517
                > $(MANDIR)/man8/mandos-keygen.8.gz
524
518
        gzip --best --to-stdout plugin-runner.8mandos \
621
615
                $(DESTDIR)/etc/dbus-1/system.d/mandos.conf
622
616
                $(DESTDIR)/etc/default/mandos \
623
617
                $(DESTDIR)/etc/init.d/mandos \
 
618
                $(SYSTEMD)/mandos.service \
624
619
                $(DESTDIR)/run/mandos.pid \
625
620
                $(DESTDIR)/var/run/mandos.pid
626
 
        if [ "$(SYSTEMD)" != "$(DESTDIR)" -a -d "$(SYSTEMD)" ]; then \
627
 
                -rm --force -- $(SYSTEMD)/mandos.service; \
628
 
        fi
629
621
        -rmdir $(CONFDIR)
630
622
 
631
623
.PHONY: purge-client