This file is indexed.

/usr/share/doc/samhain/examples/chroot.sh is in samhain 3.1.0-5ubuntu1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#! /bin/sh

# NOTE: tested on Debian Linux
# 
# NO WARRANTY - may or may not work on your system
#

# Copyright Rainer Wichmann (2003)
#
# License Information:
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#


CHROOT=$1

SYSTEM=`uname -s`

if test "x$SYSTEM" = xLinux; then
    :
else
    echo "This script will fail on systems other than Linux,"
    echo "mainly because of the mknod commands to create devices"
    echo "in the chroot jail."
    exit 1
fi

if test "x$CHROOT" = x; then
    echo "Usage: chroot.sh chroot_dir"
    echo "Purpose: prepare a chroot jail for yule"
    echo
    echo "NOTE: tested on Debian Linux"
    echo "NO WARRANTY - may or may not work on your system"
    exit 1
fi

#
#  Link configuration file
#
echo " Link configuration file:"
echo " ln -s ${CHROOT}/etc/yulerc /etc/yulerc"

ln -s -f ${CHROOT}/etc/yulerc /etc/yulerc
echo


#
#  Create passwd file
#
echo " Create passwd file"
echo " grep root   /etc/passwd >  ${CHROOT}/etc/passwd"
echo " grep daemon /etc/passwd >> ${CHROOT}/etc/passwd"
echo " grep yule   /etc/passwd >> ${CHROOT}/etc/passwd"

grep root /etc/passwd > ${CHROOT}/etc/passwd
grep daemon /etc/passwd >> ${CHROOT}/etc/passwd
grep yule /etc/passwd >> ${CHROOT}/etc/passwd
echo


#
#  Create group file
#
echo " Create group file"
echo " grep root   /etc/group >  ${CHROOT}/etc/group"
echo " grep daemon /etc/group >> ${CHROOT}/etc/group"
echo " grep yule   /etc/group >> ${CHROOT}/etc/group"

grep root   /etc/group >  ${CHROOT}/etc/group
grep daemon /etc/group >> ${CHROOT}/etc/group
grep yule   /etc/group >> ${CHROOT}/etc/group
echo

#
#  Create devices
#
echo " Create devices"
echo " mkdir ${CHROOT}/dev"
echo " mknod -m 444 ${CHROOT}/dev/urandom c 1 9"
echo " mknod -m 666 ${CHROOT}/dev/random  c 1 8"
echo " mknod -m 666 ${CHROOT}/dev/null    c 1 3"
echo " mknod -m 666 ${CHROOT}/dev/null    c 1 5"

mkdir ${CHROOT}/dev
mknod -m 444 ${CHROOT}/dev/urandom c 1 9
mknod -m 666 ${CHROOT}/dev/random  c 1 8
mknod -m 666 ${CHROOT}/dev/null    c 1 3
mknod -m 666 ${CHROOT}/dev/zero    c 1 5
echo

#
#  DNS
#
echo " Copy files for DNS"
echo " cp -p /etc/nsswitch.conf ${CHROOT}/etc/"
echo " cp -p /etc/hosts         ${CHROOT}/etc/"
echo " cp -p /etc/host.conf     ${CHROOT}/etc/"
echo " cp -p /etc/resolv.conf   ${CHROOT}/etc/"
echo " cp -p /etc/services      ${CHROOT}/etc/"
echo " cp -p /etc/protocols     ${CHROOT}/etc/"

cp -p /etc/nsswitch.conf ${CHROOT}/etc/
cp -p /etc/hosts         ${CHROOT}/etc/
cp -p /etc/host.conf     ${CHROOT}/etc/
cp -p /etc/resolv.conf   ${CHROOT}/etc/
cp -p /etc/services      ${CHROOT}/etc/
cp -p /etc/protocols     ${CHROOT}/etc/

echo "----------------------------------------------------"
echo
echo " You may want to review ${CHROOT}/etc/passwd"
echo " to replace passwords with a *, and to fix the"
echo " path to the home directory of the yule user."
echo
echo " If using a signed configuration file, you need"
echo " a working copy of GnuPG inside the chroot jail."
echo
echo "----------------------------------------------------"