chiark / gitweb /
Merge branches 'idx/verh' and 'idx/qmqpc'
[qmail] / config.sh
1 ./hostname | tr '[A-Z]' '[a-z]' | (
2   if read host
3   then
4     echo Your hostname is "$host".
5     ./dnsfq "$host" | tr '[A-Z]' '[a-z]' | (
6       if read fqdn
7       then
8         echo Your host\'s fully qualified name in DNS is "$fqdn".
9         echo Putting "$fqdn" into control/me...
10         echo "$fqdn" > QMAIL/control/me
11         chmod 644 QMAIL/control/me
12         ( echo "$fqdn" | sed 's/^\([^\.]*\)\.\([^\.]*\)\./\2\./' | (
13           read ddom
14           echo Putting "$ddom" into control/defaultdomain...
15           echo "$ddom" > QMAIL/control/defaultdomain
16           chmod 644 QMAIL/control/defaultdomain
17         ) )
18         ( echo "$fqdn" | sed 's/^.*\.\([^\.]*\)\.\([^\.]*\)$/\1.\2/' | (
19           read pdom
20           echo Putting "$pdom" into control/plusdomain...
21           echo "$pdom" > QMAIL/control/plusdomain
22           chmod 644 QMAIL/control/plusdomain
23         ) )
24         echo ' '
25         echo Checking local IP addresses:
26         : > QMAIL/control/locals
27         chmod 644 QMAIL/control/locals
28         ( ./dnsip "$fqdn"
29           ./ipmeprint ) | sort -u | \
30         (
31           while read localip
32           do
33             echo "$localip: " | tr -d '\012'
34             ./dnsptr "$localip" 2>/dev/null | (
35               if read local
36               then
37                 echo Adding "$local" to control/locals...
38                 echo "$local" >> QMAIL/control/locals
39               else
40                 echo PTR lookup failed. I assume this address has no DNS name.
41               fi
42             )
43           done
44         )
45         echo ' '
46         echo If there are any other domain names that point to you,
47         echo you will have to add them to QMAIL/control/locals.
48         echo You don\'t have to worry about aliases, i.e., domains with CNAME records.
49         echo ' '
50         echo Copying QMAIL/control/locals to QMAIL/control/rcpthosts...
51         cp QMAIL/control/locals QMAIL/control/rcpthosts
52         chmod 644 QMAIL/control/rcpthosts
53         echo 'Now qmail will refuse to accept SMTP messages except to those hosts.'
54         echo 'Make sure to change rcpthosts if you add hosts to locals or virtualdomains!'
55       else
56         echo Sorry, I couldn\'t find your host\'s canonical name in DNS.
57         echo You will have to set up control/me yourself.
58       fi
59     )
60   else
61     echo Sorry, I couldn\'t find your hostname.
62     echo You will have to set up control/me yourself.
63   fi
64 )