~ubuntu-branches/ubuntu/saucy/nagios3/saucy

« back to all changes in this revision

Viewing changes to debian/nagios3-cgi.config

  • Committer: Package Import Robot
  • Author(s): Alexander Wirt
  • Date: 2013-07-21 12:02:14 UTC
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: package-import@ubuntu.com-20130721120214-me326vjoj80rfag3
Tags: 3.4.1-5
* [8b23685] Remove obsolete webapps configuration (Closes: #714707, #714258)
* [6abb302] Cleanup password handling
* [e4a9bf7] Fix password handling

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
. /usr/share/debconf/confmodule
4
4
 
5
 
# (taken from the webapps-common httpd functions)
6
 
# wc_httpd_installed: test for installed httpds
7
 
# usage:
8
 
#       wc_httpd_installed [ httpd1 httpd2 ... ]
9
 
#
10
 
# no arguments implies to test for all servers
11
 
wc_httpd_installed(){
12
 
        local httpds
13
 
        if [ "$*" ]; then
14
 
                httpds=$*
 
5
db_fget nagios3/adminpassword seen || true
 
6
password_seen="$RET"
 
7
 
 
8
if [ "$1" = "reconfigure" ]; then
 
9
        password_seen=false
 
10
fi
 
11
 
 
12
if [ "$rootpassword_seen" != "true" ]; then
 
13
    while [ ! "$passwordsmatch" ]; do
 
14
        db_input high nagios3/adminpassword || true
 
15
        db_input high nagios3/adminpassword-repeat || true
 
16
        db_go || true
 
17
        db_get nagios3/adminpassword
 
18
        p1="$RET"
 
19
        db_get nagios3/adminpassword-repeat
 
20
        p2="$RET"
 
21
        if [ "$p1" = "$p2" ]; then
 
22
            passwordsmatch="yes"
15
23
        else
16
 
                httpds=$wc_httpd_supported
 
24
            db_fset nagios3/adminpassword seen false
 
25
            db_fset nagios3/adminpassword-repeat seen false
 
26
            db_fset nagios3/adminpassword-mismatch seen false
 
27
            db_input critical nagios3/adminpassword-mismatch || true
17
28
        fi
18
 
        for f in $httpds; do
19
 
                if test -x /usr/sbin/$f; then
20
 
                        echo $f
21
 
                fi
22
 
        done
23
 
}
24
 
 
25
 
 
26
 
# list of installed servers to check for
27
 
default_servers=`wc_httpd_installed apache2 apache apache-ssl apache-perl`
28
 
# convert list to comma seperated list
29
 
server_list=`echo $default_servers | sed -e 's/[[:space:]][[:space:]]*/, /g'`
30
 
 
31
 
# if they haven't already been prompted, preseed the server selection
32
 
db_fget nagios3/httpd seen
33
 
if [ "$RET" = "false" ]; then
34
 
        db_set nagios3/httpd $server_list
35
 
fi
36
 
 
37
 
db_input medium nagios3/httpd || true
38
 
db_go || true
39
 
db_get nagios3/httpd
40
 
keepgoing="$RET"
41
 
 
42
 
if [ "$keepgoing" ]; then
43
 
        db_input medium nagios3/nagios1-in-apacheconf || true
44
 
 
45
 
        # the passwords are reset at the end of every postinst run,
46
 
        # however, they are left in the "seen" state so that the
47
 
        # admin is not prompted for them at every upgrade.
48
 
        while [ ! "$passwordsmatch" ]; do
49
 
                #only ask for a password if no htpasswd exists
50
 
                test -f /etc/nagios3/htpasswd.users && break 
51
 
                db_input high nagios3/adminpassword || true
52
 
                db_input high nagios3/adminpassword-repeat || true
53
 
                db_go || true
54
 
                db_get nagios3/adminpassword
55
 
                p1="$RET"
56
 
                db_get nagios3/adminpassword-repeat
57
 
                p2="$RET"
58
 
                if [ "$p1" = "$p2" ]; then
59
 
                        passwordsmatch="yes"
60
 
                else
61
 
                        db_fset nagios3/adminpassword seen false
62
 
                        db_fset nagios3/adminpassword-repeat seen false
63
 
                        db_fset nagios3/adminpassword-mismatch seen false
64
 
                        db_input critical nagios3/adminpassword-mismatch || true
65
 
                fi
66
 
        done
 
29
    done
67
30
fi
68
31
db_go || true