source: samba/trunk/fuentes/samba.postinst @ 4862

Last change on this file since 4862 was 4862, checked in by hectorgh, 4 years ago

samba.postinst changes

File size: 2.2 KB
Line 
1#!/bin/sh
2#
3# Post-installation script for the Samba package for Debian GNU/Linux
4#
5#
6
7set -e
8
9# We generate several files during the postinst, and we don't want
10#       them to be readable only by root.
11umask 022
12
13if dpkg --compare-versions "$2" gt 2:4.0 &&
14        dpkg --compare-versions "$2" lt-nl 2:4.0.11+dfsg ; then
15        # CVE-2013-4475
16        KEYFILE=/var/lib/samba/private/tls/key.pem
17        if [ -e $KEYFILE ]
18        then
19                KEYPERMS=`stat -c %a $KEYFILE`
20                if [ "$KEYPERMS" != "600" ]
21                then
22                        echo "moving world readable public key to /var/lib/samba/private/tls/CVE-2013-4475"
23                        mkdir -m 700 /var/lib/samba/private/tls/CVE-2013-4475
24                        mv -n /var/lib/samba/private/tls/*pem /var/lib/samba/private/tls/CVE-2013-4475
25                fi
26        fi
27fi
28
29if dpkg --compare-versions "$2" lt-nl 2:3.6.15-2; then
30        if [ -e /etc/default/samba ]; then
31                # this config file's one setting is now obsolete; remove it
32                # unconditionally
33                rm -f /etc/default/samba
34        fi
35
36        # Remove NetBIOS entries from /etc/inetd.conf
37        if [ -x /usr/sbin/update-inetd ]; then
38                update-inetd --remove netbios-ssn
39        fi
40fi
41
42if dpkg --compare-versions "$2" lt-nl 2:4.0.12+dfsg-2~; then
43        if update-alternatives --list smbstatus >/dev/null 2>&1; then
44                update-alternatives --remove-all smbstatus
45        fi
46fi
47
48if dpkg --compare-versions "$2" lt-nl 2:4.1.13+dfsg-2~; then
49        # on upgrades from wheezy to jessie, the samba init script should not stay
50        # active, see #766690
51        update-rc.d samba remove
52fi
53
54# add the sambashare group
55if ! getent group sambashare > /dev/null 2>&1
56then
57        addgroup --system sambashare
58        # Only on Ubuntu, use the "admin" group as a template for the
59        # initial users for this group; Debian has no equivalent group,
60        # so leaving the sambashare group empty is the more secure default
61        if [ -x "`which lsb_release 2>/dev/null`" ] \
62           && [ "`lsb_release -s -i`" = "Ubuntu" ]
63        then
64                OLDIFS="$IFS"
65                IFS=","
66                for USER in `getent group admin | cut -f4 -d:`; do
67                        adduser "$USER" sambashare \
68                        || ! getent passwd "$USER" >/dev/null
69                done
70                IFS="$OLDIFS"
71        fi
72fi
73
74if [ ! -e /var/lib/samba/usershares ]
75then
76        install -d -m 1770 -g sambashare /var/lib/samba/usershares
77fi
78
79# LLIUREX LLX
80
81if [ -e /lib/systemd/system/smbd.service ]; then
82        systemctl start smbd.service || true
83fi
84
85# DONE
86
87#DEBHELPER#
88
89exit 0
Note: See TracBrowser for help on using the repository browser.