~ubuntu-branches/ubuntu/oneiric/openbsd-inetd/oneiric

« back to all changes in this revision

Viewing changes to debian/openbsd-inetd.preinst

  • Committer: Bazaar Package Importer
  • Author(s): Marco d'Itri
  • Date: 2005-01-02 02:40:43 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050102024043-e58kyd2n8kdrslea
Tags: 0.20040915-1
* New CVS snapshot.
  + Fixes gcc 4.0 FTBFS. (Closes: #287860)
* Made the init script source /etc/default/openbsd-inetd, if present.
  (Closes: #251224)
* Documented in inetd(8) that switching between binding to INADDR_ANY and
  to a specific address requires restarting the daemon. (Closes: #242392)
* Added code to create the requested type of IPv6 socket using
  setsockopt(IPPROTO_IPV6). This requires a modern 2.4 or 2.6 kernel.
* Added Conflicts+Replaces+Provides: netkit-inetd to fully replace it.
  prerm will unlink netkit-inetd's conffiles and the init script is
  named openbsd-inetd to allow purging netkit-inetd.
  Alternative solutions to both issues are welcome.
* Changed the default inetd.conf to satisfy people who think that every
  listening socket is a security hole: no internal services are enabled
  by default. This means that the daemon will not even be started by the
  init script until some service is enabled in inetd.conf.
* Removed from the default inetd.conf the already-commented examples
  of the internal services which are actually dangerous to run.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh -e
 
2
 
 
3
# create a new /etc/inetd.conf file if it doesn't already exist
 
4
create_inetd() {
 
5
  [ -e /etc/inetd.conf ] && return 0
 
6
 
 
7
  cat <<EOF > /etc/inetd.conf
 
8
# /etc/inetd.conf:  see inetd(8) for further informations.
 
9
#
 
10
# Internet superserver configuration database
 
11
#
 
12
#
 
13
# Lines starting with "#:LABEL:" or "#<off>#" should not
 
14
# be changed unless you know what you are doing!
 
15
#
 
16
# If you want to disable an entry so it isn't touched during
 
17
# package updates just comment it out with a single '#' character.
 
18
#
 
19
# Packages should modify this file by using update-inetd(8)
 
20
#
 
21
# <service_name> <sock_type> <proto> <flags> <user> <server_path> <args>
 
22
#
 
23
#:INTERNAL: Internal services
 
24
#discard                stream  tcp     nowait  root    internal
 
25
#discard                dgram   udp     wait    root    internal
 
26
#daytime                stream  tcp     nowait  root    internal
 
27
#time           stream  tcp     nowait  root    internal
 
28
 
 
29
#:STANDARD: These are standard services.
 
30
 
 
31
#:BSD: Shell, login, exec and talk are BSD protocols.
 
32
 
 
33
#:MAIL: Mail, news and uucp services.
 
34
 
 
35
#:INFO: Info services
 
36
 
 
37
#:BOOT: TFTP service is provided primarily for booting.  Most sites
 
38
#       run this only on machines acting as "boot servers."
 
39
 
 
40
#:RPC: RPC based services
 
41
 
 
42
#:HAM-RADIO: amateur-radio services
 
43
 
 
44
#:OTHER: Other services
 
45
 
 
46
EOF
 
47
 
 
48
  chmod 644 /etc/inetd.conf
 
49
}
 
50
 
 
51
upgrade_from_old_inetd() {
 
52
  if [ "$2" ] && dpkg --compare-versions "$2" ge 0.20040915-1; then
 
53
    return 0
 
54
  fi
 
55
 
 
56
  # XXX the binary will change after removing the diversions, so we want
 
57
  # to be sure that the daemon has been stopped by that time
 
58
  start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/inetd.pid
 
59
 
 
60
  # remove the diversions created by old versions of this package
 
61
  DIVERT="/usr/sbin/inetd /usr/share/man/man8/inetd.8.gz /usr/share/man/man5/inetd.conf.5.gz"
 
62
  for file in $DIVERT; do
 
63
    [ -e $file.netkit ] || continue
 
64
    rm -f $file
 
65
    dpkg-divert --package openbsd-inetd --remove --divert $file.netkit $file
 
66
  done
 
67
}
 
68
 
 
69
case "$1" in
 
70
    install)
 
71
    create_inetd
 
72
    ;;
 
73
 
 
74
    upgrade|abort-upgrade)
 
75
    upgrade_from_old_inetd "$@"
 
76
    ;;
 
77
 
 
78
    *)
 
79
    echo "$0 called with unknown argument '$1'" >&2
 
80
    exit 1
 
81
    ;;
 
82
esac
 
83
 
 
84
#DEBHELPER#
 
85