/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 init.d-mandos

  • Committer: Teddy Hogeborn
  • Date: 2015-07-20 03:03:33 UTC
  • Revision ID: teddy@recompile.se-20150720030333-203m2aeblypcsfte
Bug fix for GnuTLS 3: be compatible with old 2048-bit DSA keys.

The mandos-keygen program in Mandos version 1.6.0 and older generated
2048-bit DSA keys, and when GnuTLS uses these it has trouble
connecting using the Mandos default priority string.  This was
previously fixed in Mandos 1.6.2, but the bug reappeared when using
GnuTLS 3, so the default priority string has to change again; this
time also the Mandos client has to change its default, so now the
server and the client should use the same default priority string:

SECURE256:!CTYPE-X.509:+CTYPE-OPENPGP:!RSA:+SIGN-DSA-SHA256

* mandos (main/server_defaults): Changed default priority string.
* mandos-options.xml (/section/para[id="priority_compat"]): Removed.
  (/section/para[id="priority"]): Changed default priority string.
* mandos.conf ([DEFAULT]/priority): - '' -
* mandos.conf.xml (OPTIONS/priority): Refer to the id "priority"
                                      instead of "priority_compat".
* mandos.xml (OPTIONS/--priority): - '' -
* plugins.d/mandos-client.c (main): Changed default priority string.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
### BEGIN INIT INFO
 
3
# Provides:          mandos
 
4
# Required-Start:    $remote_fs $syslog avahi-daemon
 
5
# Required-Stop:     $remote_fs $syslog avahi-daemon
 
6
# Default-Start:     2 3 4 5
 
7
# Default-Stop:      0 1 6
 
8
# Short-Description: Mandos server
 
9
# Description:       Server of encrypted passwords to Mandos clients
 
10
### END INIT INFO
 
11
 
 
12
# Author: Teddy Hogeborn <teddy@recompile.se>
 
13
# Author: Björn Påhlsson <belorn@recompile.se>
 
14
#
 
15
# Please remove the "Author" lines above and replace them
 
16
# with your own name if you copy and modify this script.
 
17
 
 
18
# Do NOT "set -e"
 
19
 
 
20
# PATH should only include /usr/* if it runs after the mountnfs.sh script
 
21
PATH=/sbin:/usr/sbin:/bin:/usr/bin
 
22
DESC="Mandos root file system password server"
 
23
NAME=mandos
 
24
DAEMON=/usr/sbin/$NAME
 
25
DAEMON_ARGS=""
 
26
if [ -d /run/. ]; then
 
27
    PIDFILE=/run/$NAME.pid
 
28
else
 
29
    PIDFILE=/var/run/$NAME.pid
 
30
fi
 
31
SCRIPTNAME=/etc/init.d/$NAME
 
32
 
 
33
# Exit if the package is not installed
 
34
[ -x "$DAEMON" ] || exit 0
 
35
 
 
36
# Read configuration variable file if it is present
 
37
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
 
38
 
 
39
if [ -n "$CONFIGDIR" ]; then
 
40
   DAEMON_ARGS="$DAEMON_ARGS --configdir $CONFIGDIR"
 
41
fi
 
42
 
 
43
# Load the VERBOSE setting and other rcS variables
 
44
. /lib/init/vars.sh
 
45
 
 
46
# Define LSB log_* functions.
 
47
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
 
48
# and status_of_proc is working.
 
49
. /lib/lsb/init-functions
 
50
 
 
51
#
 
52
# Function that starts the daemon/service
 
53
#
 
54
do_start()
 
55
{
 
56
        # Return
 
57
        #   0 if daemon has been started
 
58
        #   1 if daemon was already running
 
59
        #   2 if daemon could not be started
 
60
        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
 
61
                || return 1
 
62
        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
 
63
                $DAEMON_ARGS \
 
64
                || return 2
 
65
        # Add code here, if necessary, that waits for the process to be ready
 
66
        # to handle requests from services started subsequently which depend
 
67
        # on this one.  As a last resort, sleep for some time.
 
68
}
 
69
 
 
70
#
 
71
# Function that stops the daemon/service
 
72
#
 
73
do_stop()
 
74
{
 
75
        # Return
 
76
        #   0 if daemon has been stopped
 
77
        #   1 if daemon was already stopped
 
78
        #   2 if daemon could not be stopped
 
79
        #   other if a failure occurred
 
80
        start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
 
81
        RETVAL="$?"
 
82
        [ "$RETVAL" = 2 ] && return 2
 
83
        # Wait for children to finish too if this is a daemon that forks
 
84
        # and if the daemon is only ever run from this initscript.
 
85
        # If the above conditions are not satisfied then add some other code
 
86
        # that waits for the process to drop all resources that could be
 
87
        # needed by services started subsequently.  A last resort is to
 
88
        # sleep for some time.
 
89
        start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
 
90
        [ "$?" = 2 ] && return 2
 
91
        # Many daemons don't delete their pidfiles when they exit.
 
92
        rm -f $PIDFILE
 
93
        return "$RETVAL"
 
94
}
 
95
 
 
96
#
 
97
# Function that sends a SIGHUP to the daemon/service
 
98
#
 
99
do_reload() {
 
100
        #
 
101
        # If the daemon can reload its configuration without
 
102
        # restarting (for example, when it is sent a SIGHUP),
 
103
        # then implement that here.
 
104
        #
 
105
        start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
 
106
        return 0
 
107
}
 
108
 
 
109
case "$1" in
 
110
  start)
 
111
        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
 
112
        do_start
 
113
        case "$?" in
 
114
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
 
115
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
 
116
        esac
 
117
        ;;
 
118
  stop)
 
119
        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
 
120
        do_stop
 
121
        case "$?" in
 
122
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
 
123
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
 
124
        esac
 
125
        ;;
 
126
  status)
 
127
        status_of_proc "$DAEMON" "$NAME" -p "$PIDFILE" && exit 0 || exit $?
 
128
        ;;
 
129
  #reload|force-reload)
 
130
        #
 
131
        # If do_reload() is not implemented then leave this commented out
 
132
        # and leave 'force-reload' as an alias for 'restart'.
 
133
        #
 
134
        #log_daemon_msg "Reloading $DESC" "$NAME"
 
135
        #do_reload
 
136
        #log_end_msg $?
 
137
        #;;
 
138
  restart|force-reload)
 
139
        #
 
140
        # If the "reload" option is implemented then remove the
 
141
        # 'force-reload' alias
 
142
        #
 
143
        log_daemon_msg "Restarting $DESC" "$NAME"
 
144
        do_stop
 
145
        case "$?" in
 
146
          0|1)
 
147
                do_start
 
148
                case "$?" in
 
149
                        0) log_end_msg 0 ;;
 
150
                        1) log_end_msg 1 ;; # Old process is still running
 
151
                        *) log_end_msg 1 ;; # Failed to start
 
152
                esac
 
153
                ;;
 
154
          *)
 
155
                # Failed to stop
 
156
                log_end_msg 1
 
157
                ;;
 
158
        esac
 
159
        ;;
 
160
  *)
 
161
        #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
 
162
        echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
 
163
        exit 3
 
164
        ;;
 
165
esac
 
166
 
 
167
: