/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: 2015-08-10 09:00:23 UTC
  • Revision ID: teddy@recompile.se-20150810090023-fz6vjqr7zf33e2tf
Support the standard org.freedesktop.DBus.ObjectManager interface.

Now that the D-Bus standard has an interface to keep track of new and
removed objects, use that instead of our own methods.  This deprecates
our D-Bus methods "GetAllClients" and "GetAllClientsWithProperties"
and the signals "ClientAdded" and "ClientRemoved", all on the server
interface "se.recompile.Mandos".

* DBUS-API: Removed references to deprecated methods and signals;
  insert reference to the org.freedesktop.DBus.ObjectManager
  interface.
* mandos (DBusObjectWithProperties._get_all_interface_names): New.
  (dbus.OBJECT_MANAGER_IFACE): If not present, monkey patch.
  (DBusObjectWithObjectManager): New.
  (main/MandosDBusService): Inherit from DBusObjectWithObjectManager.
  (main/MandosDBusService.ClientRemoved): Annotate as deprecated.
  (main/MandosDBusService.GetAllClients): - '' -
  (main/MandosDBusService.GetAllClientsWithProperties): Annotate as
                                                        deprecated.
                                                        Also only
                                                        return
                                                        properties on
                                                        client
                                                        interface.
  (main/MandosDBusService.RemoveClient): Call client_removed_signal
                                         instead of ClientRemoved.
  (main/MandosDBusService.GetManagedObjects): New.
  (main/MandosDBusService.client_added_signal): New.
  (main/MandosDBusService.client_removed_signal): - '' -
  (main/cleanup): Call "client_removed_signal" instead of sending
                  "ClientRemoved" signal directly.
  (main): Call "client_added_signal" instead of sending "ClientAdded"
          signal directly.
* mandos-ctl: Use GetManagedObjects instead of
              GetAllClientsWithProperties.  Also, show better error
              message in case of failure to connect to the D-Bus

* mandos-monitor (MandosClientPropertyCache.properties_changed):
  Bug fix; only update properties on client interface.
  (UserInterface.find_and_remove_client): Change to accept arguments
                                          from InterfacesRemoved
                                          signal.  Also, bug fix:
                                          working error message when
                                          removing unknown client.
  (UserInterface.add_new_client): Change to accept arguments from
                                  InterfacesRemoved signal.  Pass
                                  properties to MandosClientWidget
                                  constructor.
  (UserInterface.run): Connect find_and_remove_client method to
                       InterfacesRemoved signal and the add_new_client
                       method to the InterfacesAdded signal.

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
 
76
76
# Make directories
77
77
install --directory --mode=u=rwx,go=rx "${DESTDIR}${CONFDIR}" \
78
 
        "${DESTDIR}${MANDOSDIR}" "${DESTDIR}${HOOKDIR}"
 
78
        "${DESTDIR}${MANDOSDIR}" "${DESTDIR}${HOOKDIR}" \
 
79
        "${DESTDIR}${PLUGINHELPERDIR}"
79
80
install --owner=${mandos_user} --group=${mandos_group} --directory \
80
 
        --mode=u=rwx "${DESTDIR}${PLUGINDIR}" \
81
 
        "${DESTDIR}${PLUGINHELPERDIR}"
82
 
 
83
 
copy_exec "$libdir"/mandos/mandos-to-cryptroot-unlock "${MANDOSDIR}"
 
81
    --mode=u=rwx "${DESTDIR}${PLUGINDIR}"
84
82
 
85
83
# Copy the Mandos plugin runner
86
84
copy_exec "$libdir"/mandos/plugin-runner "${MANDOSDIR}"
142
140
# Get DEVICE from initramfs.conf and other files
143
141
. /etc/initramfs-tools/initramfs.conf
144
142
for conf in /etc/initramfs-tools/conf.d/*; do
145
 
    if [ -n "`basename \"$conf\" \
146
 
        | grep '^[[:alnum:]][[:alnum:]\._-]*$' \
147
 
        | grep -v '\.dpkg-.*$'`" ]; then
148
 
        [ -f "${conf}" ] && . "${conf}"
 
143
    if [ -n `basename \"$conf\" | grep '^[[:alnum:]][[:alnum:]\._-]*$' \
 
144
        | grep -v '\.dpkg-.*$'` ]; then
 
145
        [ -f ${conf} ] && . ${conf}
149
146
    fi
150
147
done
151
148
export DEVICE
160
157
    if [ -x "$hook" ]; then
161
158
        # Copy any files needed by the network hook
162
159
        MANDOSNETHOOKDIR=/etc/mandos/network-hooks.d MODE=files \
163
 
            VERBOSITY=0 "$hook" files | while read -r file target; do
 
160
            VERBOSITY=0 "$hook" files | while read file target; do
164
161
            if [ ! -e "${file}" ]; then
165
162
                echo "WARNING: file ${file} not found, requested by Mandos network hook '${hook##*/}'" >&2
166
163
            fi
172
169
        done
173
170
        # Copy and load any modules needed by the network hook
174
171
        MANDOSNETHOOKDIR=/etc/mandos/network-hooks.d MODE=modules \
175
 
            VERBOSITY=0 "$hook" modules | while read -r module; do
176
 
            force_load "$module"
 
172
            VERBOSITY=0 "$hook" modules | while read module; do
 
173
            if [ -z "${target}" ]; then
 
174
                force_load "$module"
 
175
            fi
177
176
        done
178
177
    fi
179
178
done
187
186
            copy_exec /usr/bin/gpgconf
188
187
        fi
189
188
        gpg="`/usr/bin/gpgconf|sed --quiet --expression='s/^gpg:[^:]*://p'`"
190
 
        gpgagent="`/usr/bin/gpgconf|sed --quiet --expression='s/^gpg-agent:[^:]*://p'`"
191
 
        # Newer versions of GnuPG 2 requires the gpg-agent binary
192
 
        if [ -e "$gpgagent" ] && [ ! -e "${DESTDIR}$gpgagent" ]; then
193
 
            copy_exec "$gpgagent"
194
 
        fi
195
189
    fi
196
190
elif dpkg --compare-versions "$libgpgme11_version" ge 1.4.1-0.1; then
197
191
    gpg=/usr/bin/gpg2
253
247
# initrd; it is intended to affect the initrd.img file itself, since
254
248
# it now contains secret key files.  There is, however, no other way
255
249
# to set the permission of the initrd.img file without a race
256
 
# condition.  This umask is set by "initramfs-tools-conf", installed
257
 
# as "/usr/share/initramfs-tools/conf.d/mandos-conf".)
 
250
# condition.  This umask is set by "initramfs-tools-hook-conf",
 
251
# installed as "/usr/share/initramfs-tools/conf-hooks.d/mandos".)
258
252
259
253
for full in "${MANDOSDIR}" "${CONFDIR}"; do
260
254
    while [ "$full" != "/" ]; do
272
266
done
273
267
for dir in "${DESTDIR}"/lib* "${DESTDIR}"/usr/lib*; do
274
268
    if [ -d "$dir" ]; then
275
 
        find "$dir" \! -perm -u+rw,g+r -prune -or \! -type l -print0 \
276
 
            | xargs --null --no-run-if-empty chmod a+rX --
 
269
        find "$dir" \! -perm -u+rw,g+r -prune -or -print0 \
 
270
            | xargs --null --no-run-if-empty chmod a+rX
277
271
    fi
278
272
done