/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: 2019-07-27 10:11:45 UTC
  • mto: This revision was merged to the branch mainline in revision 384.
  • Revision ID: teddy@recompile.se-20190727101145-jnpbpf8220gldbcd
Add dracut(8) support

Add support for the dracut(8) system for generating initramfs image
files; dracut is an alternative to the "initramfs-tools" package.

* .bzrignore (dracut-module/password-agent): Ignore new binary file.
* dracut-module: New directory for the dracut module.
* INSTALL (Prerequisites/Libraries/Mandos Client): Add dracut as an
                                                   alternative to
                                                   initramfs-tools,
                                                   and also add GLib.
* Makefile (DRACUTMODULE, GLIB_CFLAGS, GLIB_LIBS): New.
  (CPROGS): Add "dracut-module/password-agent".
  (DOCS): Add "dracut-module/password-agent.8mandos".
  (dracut-module/password-agent.8mandos): New.
  (dracut-module/password-agent.8mandos.xhtml): - '' -
  (dracut-module/password-agent): - '' -
  (check): Add command to run tests of password-agent(8mandos).
  (install-client-nokey): Also install the dracut module directory,
                          its files, and the password-agent(8mandos)
                          manual page.
  (install-client): To update the initramfs image file, run
                    update-initramfs or dracut depending on what is
                    installed.
  (uninstall-client): - '' - and also uninstall the the files in the
                      dracut module directory, that directory itself,
                      and the password-agent(8mandos) manual page.
* debian/control (Build-Depends): Add "libglib2.0-dev (>=2.40)".
  (Package: mandos-client/Depends): Add "dracut (>= 044+241-3)" as an
                                    alternative dependency to
                                    initramfs-tools.
  (Package: mandos-client/Conflicts): New; set to
                                      "dracut-config-generic".
  (debian/mandos-client.README.Debian): Document alternative commands
                                        to update the initramfs image
                                        for when dracut is used.
* debian/mandos-client.postinst (update_initramfs): Use alternative
                                                    commands to update
                                                    the initramfs
                                                    image for when
                                                    dracut is used.
* debian/tests/control (password-agent, password-agent-suid): Add two
                                                              new tests.
* dracut-module/ask-password-mandos.path: New.
* dracut-module/ask-password-mandos.service: - '' -
* dracut-module/cmdline-mandos.sh: - '' -
* dracut-module/module-setup.sh: - '' -
* dracut-module/password-agent.c: - '' -
* dracut-module/password-agent.xml: - '' -
* initramfs-unpack: Use the dracut "skipcpio" command, if available.
                    Also be more flexible and try hard to detect where
                    compressed data starts.
* plugins.d/mandos-client.xml (SECURITY): Be more precise that the
                                          mandos-client binary might
                                          not always be setuid, but
                                          that the program assumes
                                          that it has been started
                                          that way.
* plugins.d/password-prompt.c: Add new "--prompt" option.
  (conflict_detection): First try to detect the new PID file of
                        plymouth.
  (main): Define and use new "prompt" variable.
* plugins.d/password-prompt.xml (SYNOPSIS): Show new --prompt option.
  (DESCRIPTION): Describe new behavior of looking for plymouth PID
                 file.
  (OPTIONS): Document new "--prompt" option.
  (ENVIRONMENT): Clarify that the CRYPTTAB_SOURCE and CRYPTTAB_NAME
                 environment variables are not used if the --prompt
                 option is used.  Remove unnecessarily specific
                 details about where the CRYPTTAB_SOURCE and
                 CRYPTTAB_NAME comes from, since this can now be
                 either initramfs-tools or dracut.
  (SEE ALSO): Remove superfluous crypttab(5) reference, and add commas
              to separate the other references.
* plugins.d/plymouth.c: Add new "--prompt" and "--debug" options.
  (debug): New global flag.
  (fprintf_plus): New function, used for debug output.
  (exec_and_wait): Add extra "const" to "argv" argument.
  (main): Define and use new "prompt" variable.  Add debug output.
  (main/options, main/parse_opt): New; used to parse options.
* plugins.d/plymouth.xml (SYNOPSIS): Show new options.
  (OPTIONS): Document new options.
  (ENVIRONMENT): Clarify that the cryptsource and crypttarget
                 environment variables are not used if the --prompt
                 option is used.  Remove unnecessarily specific
                 details about where the cryptsource and crypttarget
                 comes from, since this can now be either
                 initramfs-tools or dracut.
  (EXAMPLE): Add an example using an option.
  (SEE ALSO): Remove superfluous crypttab(5) reference.
* plugins.d/splashy.xml (ENVIRONMENT): Clarify that the cryptsource
                                       and crypttarget environment
                                       variables are not used if the
                                       --prompt option is used.
                                       Remove unnecessarily specific
                                       details about where the
                                       cryptsource and crypttarget
                                       comes from, since this can now
                                       be either initramfs-tools or
                                       dracut.
  (SEE ALSO): Remove superfluous crypttab(5) reference.
* plugins.d/usplash.xml (ENVIRONMENT): Clarify that the cryptsource
                                       and crypttarget environment
                                       variables are not used if the
                                       --prompt option is used.
                                       Remove unnecessarily specific
                                       details about where the
                                       cryptsource and crypttarget
                                       comes from, since this can now
                                       be either initramfs-tools or
                                       dracut.
  (SEE ALSO): Remove superfluous crypttab(5) reference.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
OPTIMIZE:=-Os -fno-strict-aliasing
43
43
LANGUAGE:=-std=gnu11
44
44
htmldir:=man
45
 
version:=1.8.5
 
45
version:=1.8.4
46
46
SED:=sed
47
47
 
48
48
USER:=$(firstword $(subst :, ,$(shell getent passwd _mandos \
50
50
GROUP:=$(firstword $(subst :, ,$(shell getent group _mandos \
51
51
        || getent group nogroup || echo 65534)))
52
52
 
53
 
LINUXVERSION:=$(shell uname --kernel-release)
54
 
 
55
53
## Use these settings for a traditional /usr/local install
56
54
# PREFIX:=$(DESTDIR)/usr/local
57
55
# CONFDIR:=$(DESTDIR)/etc/mandos
73
71
STATEDIR:=$(DESTDIR)/var/lib/mandos
74
72
LIBDIR:=$(shell \
75
73
        for d in \
76
 
        "/usr/lib/`dpkg-architecture \
77
 
                        -qDEB_HOST_MULTIARCH 2>/dev/null`" \
 
74
        "/usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null`" \
78
75
        "`rpm --eval='%{_libdir}' 2>/dev/null`" /usr/lib; do \
79
76
                if [ -d "$$d" -a "$$d" = "$${d%/}" ]; then \
80
77
                        echo "$(DESTDIR)$$d"; \
83
80
        done)
84
81
##
85
82
 
86
 
SYSTEMD:=$(DESTDIR)$(shell pkg-config systemd \
87
 
                        --variable=systemdsystemunitdir)
 
83
SYSTEMD:=$(DESTDIR)$(shell pkg-config systemd --variable=systemdsystemunitdir)
88
84
TMPFILES:=$(DESTDIR)$(shell pkg-config systemd --variable=tmpfilesdir)
89
85
 
90
86
GNUTLS_CFLAGS:=$(shell pkg-config --cflags-only-I gnutls)
316
312
        ./dracut-module/password-agent --test
317
313
 
318
314
# Run the client with a local config and key
319
 
run-client: all keydir/seckey.txt keydir/pubkey.txt \
320
 
                        keydir/tls-privkey.pem keydir/tls-pubkey.pem
321
 
        @echo '######################################################'
322
 
        @echo '# The following error messages are harmless and can  #'
323
 
        @echo '#  be safely ignored:                                #'
324
 
        @echo '## From plugin-runner:                               #'
325
 
        @echo '# setgid: Operation not permitted                    #'
326
 
        @echo '# setuid: Operation not permitted                    #'
327
 
        @echo '## From askpass-fifo:                                #'
328
 
        @echo '# mkfifo: Permission denied                          #'
329
 
        @echo '## From mandos-client:                               #'
330
 
        @echo '# Failed to raise privileges: Operation not permi... #'
331
 
        @echo '# Warning: network hook "*" exited with status *     #'
332
 
        @echo '# ioctl SIOCSIFFLAGS +IFF_UP: Operation not permi... #'
333
 
        @echo '# Failed to bring up interface "*": Operation not... #'
334
 
        @echo '#                                                    #'
335
 
        @echo '# (The messages are caused by not running as root,   #'
336
 
        @echo '# but you should NOT run "make run-client" as root   #'
337
 
        @echo '# unless you also unpacked and compiled Mandos as    #'
338
 
        @echo '# root, which is also NOT recommended.)              #'
339
 
        @echo '######################################################'
 
315
run-client: all keydir/seckey.txt keydir/pubkey.txt keydir/tls-privkey.pem keydir/tls-pubkey.pem
 
316
        @echo "###################################################################"
 
317
        @echo "# The following error messages are harmless and can be safely     #"
 
318
        @echo "# ignored:                                                        #"
 
319
        @echo "# From plugin-runner: setgid: Operation not permitted             #"
 
320
        @echo "#                     setuid: Operation not permitted             #"
 
321
        @echo "# From askpass-fifo:  mkfifo: Permission denied                   #"
 
322
        @echo "# From mandos-client:                                             #"
 
323
        @echo "#             Failed to raise privileges: Operation not permitted #"
 
324
        @echo "#             Warning: network hook \"*\" exited with status *      #"
 
325
        @echo "#                                                                 #"
 
326
        @echo "# (The messages are caused by not running as root, but you should #"
 
327
        @echo "# NOT run \"make run-client\" as root unless you also unpacked and  #"
 
328
        @echo "# compiled Mandos as root, which is also NOT recommended.)        #"
 
329
        @echo "###################################################################"
340
330
# We set GNOME_KEYRING_CONTROL to block pam_gnome_keyring
341
331
        ./plugin-runner --plugin-dir=plugins.d \
342
332
                --plugin-helper-dir=plugin-helpers \
382
372
        elif install --directory --mode=u=rwx $(STATEDIR); then \
383
373
                chown -- $(USER):$(GROUP) $(STATEDIR) || :; \
384
374
        fi
385
 
        if [ "$(TMPFILES)" != "$(DESTDIR)" \
386
 
                        -a -d "$(TMPFILES)" ]; then \
 
375
        if [ "$(TMPFILES)" != "$(DESTDIR)" -a -d "$(TMPFILES)" ]; then \
387
376
                install --mode=u=rw,go=r tmpfiles.d-mandos.conf \
388
377
                        $(TMPFILES)/mandos.conf; \
389
378
        fi
436
425
        install --mode=u=rwx,go=rx \
437
426
                --target-directory=$(LIBDIR)/mandos plugin-runner
438
427
        install --mode=u=rwx,go=rx \
439
 
                --target-directory=$(LIBDIR)/mandos \
440
 
                mandos-to-cryptroot-unlock
 
428
                --target-directory=$(LIBDIR)/mandos mandos-to-cryptroot-unlock
441
429
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
442
430
                mandos-keygen
443
431
        install --mode=u=rwx,go=rx \
506
494
        if command -v update-initramfs >/dev/null; then \
507
495
            update-initramfs -k all -u; \
508
496
        elif command -v dracut >/dev/null; then \
509
 
            for initrd in $(DESTDIR)/boot/initr*-$(LINUXVERSION); do \
 
497
            for initrd in $(DESTDIR)/boot/initr*-$(shell uname --kernel-release); do \
510
498
                if [ -w "$$initrd" ]; then \
511
499
                    chmod go-r "$$initrd"; \
512
500
                    dracut --force "$$initrd"; \
565
553
        if command -v update-initramfs >/dev/null; then \
566
554
            update-initramfs -k all -u; \
567
555
        elif command -v dracut >/dev/null; then \
568
 
            for initrd in $(DESTDIR)/boot/initr*-$(LINUXVERSION); do \
 
556
            for initrd in $(DESTDIR)/boot/initr*-$(shell uname --kernel-release); do \
569
557
                test -w "$$initrd" && dracut --force "$$initrd"; \
570
558
            done; \
571
559
        fi