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

Support not using IPv6 in server:

* mandos (AvahiService.__init__): Take new "protocol" parameter.  All
                                  callers changed.
  (IPv6_TCPServer.__init__): Take new "use_ipv6" parameter.  All
                             callers changed.
  (IPv6_TCPServer.server_bind): Create IPv4 socket if not using IPv6.
  (main): New "--no-ipv6" command line option.  New "use_ipv6" config
          option.
* mandos-options.xml ([@id="address"]): Document conditional IPv4
                                        address support.
  ([@id="ipv6"]): New paragraph.
* mandos.conf (use_ipv6): New config option.
* mandos.conf.xml (OPTIONS): Document new "use_dbus" option.
  (EXAMPLE): Changed to use IPv6 link-local address.  Added "use_ipv6"
             option.
* mandos.xml (SYNOPSIS): New "--no-ipv6" option.
  (OPTIONS): Document new "--no-ipv6" option.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
    exit 1
52
52
fi
53
53
 
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"
 
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 }'`"
61
64
 
62
65
# The Mandos network client uses the network
63
66
auto_add_modules net
68
71
CONFDIR="/conf/conf.d/mandos"
69
72
MANDOSDIR="/lib/mandos"
70
73
PLUGINDIR="${MANDOSDIR}/plugins.d"
71
 
HOOKDIR="${MANDOSDIR}/network-hooks.d"
72
74
 
73
75
# Make directories
74
76
install --directory --mode=u=rwx,go=rx "${DESTDIR}${CONFDIR}" \
89
91
        continue
90
92
    fi
91
93
    case "$base" in
92
 
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert)
93
 
            : ;;
94
 
        "*") echo "W: Mandos client plugin directory is empty." >&2 ;;
 
94
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert) : ;;
 
95
        "*") : ;;
95
96
        *) copy_exec "$file" "${PLUGINDIR}" ;;
96
97
    esac
97
98
done
100
101
for file in /etc/mandos/plugins.d/*; do
101
102
    base="`basename \"$file\"`"
102
103
    case "$base" in
103
 
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert)
104
 
            : ;;
 
104
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert) : ;;
105
105
        "*") : ;;
106
106
        *) copy_exec "$file" "${PLUGINDIR}" ;;
107
107
    esac
108
108
done
109
109
 
110
 
# Copy network hooks
111
 
for hook in /etc/mandos/network-hooks.d/*; do
112
 
    case "`basename \"$hook\"`" in
113
 
        "*") continue ;;
114
 
        *[!A-Za-z0-9_-]*) continue ;;
115
 
        *) test -d "$hook" || copy_exec "$hook" "${HOOKDIR}" ;;
116
 
    esac
117
 
    # Copy any files needed by the network hook
118
 
    MANDOSNETHOOKDIR=/etc/mandos/network-hooks.d MODE=files \
119
 
        "$hook" files | while read file target; do
120
 
        if [ -z "${target}" ]; then
121
 
            copy_exec "$file"
122
 
        else
123
 
            copy_exec "$file" "$target"
124
 
        fi
125
 
    done
126
 
done
127
 
 
128
110
# GPGME needs /usr/bin/gpg
129
111
if [ ! -e "${DESTDIR}/usr/bin/gpg" \
130
112
    -a -n "`ls \"${DESTDIR}\"/usr/lib/libgpgme.so* \
133
115
fi
134
116
 
135
117
# Config files
136
 
for file in /etc/mandos/plugin-runner.conf; do
 
118
for file in /etc/mandos/*; do
137
119
    if [ -d "$file" ]; then
138
120
        continue
139
121
    fi
141
123
done
142
124
 
143
125
if [ ${mandos_user} != 65534 ]; then
144
 
    sed --in-place --expression="1i--userid=${mandos_user}" \
145
 
        "${DESTDIR}${CONFDIR}/plugin-runner.conf"
 
126
    PLUGINRUNNERCONF="${DESTDIR}${CONFDIR}/plugin-runner.conf"
 
127
    cat <<-EOF >> "$PLUGINRUNNERCONF"
 
128
        
 
129
        --userid=${mandos_user}
 
130
EOF
146
131
fi
147
132
 
148
133
if [ ${mandos_group} != 65534 ]; then
149
 
    sed --in-place --expression="1i--groupid=${mandos_group}" \
150
 
        "${DESTDIR}${CONFDIR}/plugin-runner.conf"
 
134
    PLUGINRUNNERCONF="${DESTDIR}${CONFDIR}/plugin-runner.conf"
 
135
    cat <<-EOF >> "$PLUGINRUNNERCONF"
 
136
        
 
137
        --groupid=${mandos_group}
 
138
EOF
151
139
fi
152
140
 
153
 
# Key files
 
141
# Key files 
154
142
for file in "$keydir"/*; do
155
143
    if [ -d "$file" ]; then
156
144
        continue