/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 initramfs-tools-hook

  • Committer: Teddy Hogeborn
  • Date: 2008-12-29 02:44:54 UTC
  • Revision ID: teddy@fukt.bsnet.se-20081229024454-nbsei556dwy5azr1
* mandos (Client.timeout, Client.interval): Changed from being a
                                            property to be a normal
                                            attribute.
  (Client._timeout, Client._interval): Removed.
  (Client._timeout_milliseconds): Changed from being an attribute to
                                  be a method "timeout_milliseconds".
                                  All users changed.
  (Client._interval_milliseconds): Changed from being an attribute to
                                   be method "interval_milliseconds".
                                   All users changed.
  (Client.__init__): Take additional "use_dbus" keyword argument.
                     Only provide D-Bus interface if "use_dbus" is
                     True.
  (Client.use_dbus): New attribute.
  (Client.dbus_object_path): Changed to only be set if "self.use_dbus"
                             is True.
  (Client.enable, Client.disable, Client.checker_callback,
  Client.bump_timeout, Client.start_checker, Client.stop_checker):
  Only emit D-Bus signals if "self.use_dbus".
  (Client.SetChecker, Client.SetHost, Client.Enable): Bug fix: Emit
                                                      D-Bus signals.
  (Client.SetInterval, Client.SetTimeout): Changed to emit D-Bus
                                           signals.

  (main): Remove deprecated "default" keyword argument to "--check"
          option.  Added new "--no-dbus" option.  Added corresponding
          "use_dbus" server configuration option.  Only provide D-Bus
          interface and emit D-Bus signals if "use_dbus".  Pass
          "use_dbus" on to Client constructor.

* mandos-options.xml ([@id="dbus"]): New option.

* mandos.conf (use_dbus): New option.

* mandos.conf.xml (OPTIONS): New option "use_dbus".
  (EXAMPLE): - '' -

* mandos.xml (SYNOPSIS): New option "--no-dbus".
  (D-BUS INTERFACE): New section.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
    exit 1
41
41
fi
42
42
 
43
 
for d in /etc/keys/mandos /usr/local/lib/mandos/keys; do
 
43
for d in /etc/keys/mandos /etc/mandos/keys; do
44
44
    if [ -d "$d" ]; then
45
45
        keydir="$d"
46
46
        break
51
51
    exit 1
52
52
fi
53
53
 
 
54
mandos_user="`{ getent passwd _mandos \
 
55
                || getent passwd mandos \
 
56
                || getent passwd nobody \
 
57
                || echo ::65534::::; } \
 
58
        | awk --field-separator=: '{ print $3 }'`" 
 
59
mandos_group="`{ getent group _mandos \
 
60
                || getent group mandos \
 
61
                || getent group nogroup \
 
62
                || echo ::65534:; } \
 
63
        | awk --field-separator=: '{ print $3 }'`"
 
64
 
54
65
# The Mandos network client uses the network
55
66
auto_add_modules net
56
67
# The Mandos network client uses IPv6
62
73
PLUGINDIR="${MANDOSDIR}/plugins.d"
63
74
 
64
75
# Make directories
65
 
mkdir --parents "${DESTDIR}${CONFDIR}"
66
 
mkdir --parents "${DESTDIR}${PLUGINDIR}"
 
76
install --directory --mode=u=rwx,go=rx "${DESTDIR}${CONFDIR}" \
 
77
        "${DESTDIR}${MANDOSDIR}"
 
78
install --owner=${mandos_user} --group=${mandos_group} --directory \
 
79
    --mode=u=rwx "${DESTDIR}${PLUGINDIR}"
67
80
 
68
81
# Copy the Mandos plugin runner
69
82
copy_exec "$prefix"/lib/mandos/plugin-runner "${MANDOSDIR}"
78
91
        continue
79
92
    fi
80
93
    case "$base" in
81
 
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-new|*.dpkg-divert) : ;;
 
94
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert) : ;;
82
95
        "*") :;;
83
96
        *) copy_exec "$file" "${PLUGINDIR}";;
84
97
    esac
88
101
for file in /etc/mandos/plugins.d/*; do
89
102
    base="`basename \"$file\"`"
90
103
    case "$base" in
91
 
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-new|*.dpkg-divert) : ;;
 
104
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert) : ;;
92
105
        "*") :;;
93
106
        *) copy_exec "$file" "${PLUGINDIR}";;
94
107
    esac
95
108
done
96
109
 
97
110
# GPGME needs /usr/bin/gpg
98
 
if ! [ -e "${DESTDIR}/usr/bin/gpg" ] \
99
 
    && [ -n "`ls \"${DESTDIR}\"/usr/lib/libgpgme.so* 2>/dev/null`" ]; then
 
111
if [ ! -e "${DESTDIR}/usr/bin/gpg" \
 
112
    -a -n "`ls \"${DESTDIR}\"/usr/lib/libgpgme.so* \
 
113
                2>/dev/null`" ]; then
100
114
    copy_exec /usr/bin/gpg
101
115
fi
102
116
 
103
 
# Config files and key files 
104
 
for file in /etc/mandos/* "$keydir"/*; do
105
 
    if [ -d "$file" ]; then
106
 
        continue
107
 
    fi
108
 
    cp --archive --sparse=always "$file" "${DESTDIR}${CONFDIR}"
 
117
# Config files
 
118
for file in /etc/mandos/*; do
 
119
    if [ -d "$file" ]; then
 
120
        continue
 
121
    fi
 
122
    cp --archive --sparse=always "$file" "${DESTDIR}${CONFDIR}"
 
123
done
 
124
 
 
125
if [ ${mandos_user} != 65534 ]; then
 
126
    PLUGINRUNNERCONF="${DESTDIR}${CONFDIR}/plugin-runner.conf"
 
127
    echo "--userid=${mandos_user}" >> "$PLUGINRUNNERCONF"
 
128
fi
 
129
 
 
130
if [ ${mandos_group} != 65534 ]; then
 
131
    PLUGINRUNNERCONF="${DESTDIR}${CONFDIR}/plugin-runner.conf"
 
132
    echo "--groupid=${mandos_group}" >> "$PLUGINRUNNERCONF"
 
133
fi
 
134
 
 
135
# Key files 
 
136
for file in  "$keydir"/*; do
 
137
    if [ -d "$file" ]; then
 
138
        continue
 
139
    fi
 
140
    cp --archive --sparse=always "$file" "${DESTDIR}${CONFDIR}"
 
141
    chown ${mandos_user}:${mandos_group} \
 
142
        "${DESTDIR}${CONFDIR}/`basename \"$file\"`"
109
143
done
110
144
 
111
145
# /lib/mandos/plugin-runner will drop priviliges, but needs access to
120
154
# condition.  This umask is set by "initramfs-tools-hook-conf",
121
155
# installed as "/usr/share/initramfs-tools/conf-hooks.d/mandos".)
122
156
123
 
for full in "${PLUGINDIR}" "${CONFDIR}"; do
 
157
for full in "${MANDOSDIR}" "${CONFDIR}"; do
124
158
    while [ "$full" != "/" ]; do
125
159
        chmod a+rX "${DESTDIR}$full"
126
160
        full="`dirname \"$full\"`"
135
169
    fi
136
170
done
137
171
for dir in /lib /usr/lib; do
138
 
    find "${DESTDIR}$dir" \! -perm /u+rw,g+r -prune -o -print0 \
 
172
    find "${DESTDIR}$dir" \! -perm -u+rw,g+r -prune -or -print0 \
139
173
        | xargs --null --no-run-if-empty chmod a+rX
140
174
done