/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: 2009-09-16 23:28:39 UTC
  • Revision ID: teddy@fukt.bsnet.se-20090916232839-3o7i8qmcdcz5j1ya
* init.d-mandos (Required-Start, Required-Stop): Bug fix: Added
                 "$syslog", thanks to Petter Reinholdtsen
                 <pere@hungry.com> (Debian bug #546928).

* initramfs-tools-script: Removed erroneous comment.

* plugins.d/askpass-fifo.c: Removed TEMP_FAILURE_RETRY since it is
                            not needed.

* plugins.d/mandos-client.c (main): Bug fix: Initialize
                                    "old_sigterm_action".

* plugins.d/splashy.c (main): Bug fix: really check return value from
                              "sigaddset".  Fix some warnings on
                              64-bit systems.

* plugins.d/usplash.c (termination_handler, main): Save received
                                                   signal and
                                                   re-raise it on
                                                   exit.
  (usplash_write): Do not close FIFO, instead, take an additional file
                   descriptor pointer to it and open only when needed
                   (all callers changed).  Abort immediately on EINTR.
                   Bug fix:  Add NUL byte on single-word commands.
                   Ignore "interrupted_by_signal".
  (makeprompt, find_usplash): New; broken out from "main()".
  (find_usplash): Bug fix: close /proc/<pid>/cmdline FD on error.
  (main): Reorganized to jump to a new "failure" label on any error.
          Bug fix: check return values from sigaddset.
          New variable "usplash_accessed" to flag if usplash(8) needs
          to be killed and restarted.  Removed the "an_error_occured"
          variable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 }'`"
 
54
set `{ getent passwd _mandos \
 
55
    || getent passwd nobody \
 
56
    || echo ::65534:65534:::; } \
 
57
    | cut --delimiter=: --fields=3,4 --only-delimited \
 
58
    --output-delimiter=" "`
 
59
mandos_user="$1"
 
60
mandos_group="$2"
64
61
 
65
62
# The Mandos network client uses the network
66
63
auto_add_modules net
91
88
        continue
92
89
    fi
93
90
    case "$base" in
94
 
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert) : ;;
95
 
        "*") :;;
96
 
        *) copy_exec "$file" "${PLUGINDIR}";;
 
91
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert)
 
92
            : ;;
 
93
        "*") echo "W: Mandos client plugin directory is empty." >&2 ;;
 
94
        *) copy_exec "$file" "${PLUGINDIR}" ;;
97
95
    esac
98
96
done
99
97
 
101
99
for file in /etc/mandos/plugins.d/*; do
102
100
    base="`basename \"$file\"`"
103
101
    case "$base" in
104
 
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert) : ;;
105
 
        "*") :;;
106
 
        *) copy_exec "$file" "${PLUGINDIR}";;
 
102
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert)
 
103
            : ;;
 
104
        "*") : ;;
 
105
        *) copy_exec "$file" "${PLUGINDIR}" ;;
107
106
    esac
108
107
done
109
108
 
123
122
done
124
123
 
125
124
if [ ${mandos_user} != 65534 ]; then
126
 
    PLUGINRUNNERCONF="${DESTDIR}${CONFDIR}/plugin-runner.conf"
127
 
    echo "--userid=${mandos_user}" >> "$PLUGINRUNNERCONF"
 
125
    sed --in-place --expression="1i--userid=${mandos_user}" \
 
126
        "${DESTDIR}${CONFDIR}/plugin-runner.conf"
128
127
fi
129
128
 
130
129
if [ ${mandos_group} != 65534 ]; then
131
 
    PLUGINRUNNERCONF="${DESTDIR}${CONFDIR}/plugin-runner.conf"
132
 
    echo "--groupid=${mandos_group}" >> "$PLUGINRUNNERCONF"
 
130
    sed --in-place --expression="1i--groupid=${mandos_group}" \
 
131
        "${DESTDIR}${CONFDIR}/plugin-runner.conf"
133
132
fi
134
133
 
135
134
# Key files 
136
 
for file in  "$keydir"/*; do
 
135
for file in "$keydir"/*; do
137
136
    if [ -d "$file" ]; then
138
137
        continue
139
138
    fi
168
167
        chmod a+rX "${DESTDIR}$dir"
169
168
    fi
170
169
done
171
 
for dir in /lib /usr/lib; do
172
 
    find "${DESTDIR}$dir" \! -perm -u+rw,g+r -prune -or -print0 \
173
 
        | xargs --null --no-run-if-empty chmod a+rX
 
170
for dir in "${DESTDIR}"/lib* "${DESTDIR}"/usr/lib*; do
 
171
    if [ -d "$dir" ]; then
 
172
        find "$dir" \! -perm -u+rw,g+r -prune -or -print0 \
 
173
            | xargs --null --no-run-if-empty chmod a+rX
 
174
    fi
174
175
done