This file is indexed.

/usr/lib/tiger/systems/Linux/2/check_xinetd is in tiger 1:3.2.3-12.

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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
#!/bin/sh
#
#     tiger - A UN*X security checking system
#     Copyright (C) 2003 Michael Sconzo, Javier Fernandez-Sanguino Peña,
#                        Ryan Bradetich
#
#    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 1, 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.
#
#     Please see the file `COPYING' for the complete copyright notice.
#
#  check_xinetd - 02/11/2003
# 
#  Checks which xinetd services are enabled or disabled.
#
#  05/02/2004 jfs  Try to avoid eval problems if handling variables with
#                 special characters (such as space)
#  01/15/2004 - jfs - Fixed syntax error (at least in RH 8) and added TODO
#  11/19/2003 - jfs - Linux-specific version based on patch from Ryan
#      Bradetich which introduces many more checks for services and
#      configuration (but still more is needed). Added many TODOs.
#  08/19/2003 - jfs - Allow override of XINETDCONF and fix error
#  08/12/2003 - jfs - Now write messages for disabled services too. Also
#               fixed some errors.
#  08/11/2003 - jfs - Fixed dependancies. Now uses XINETDFILE instead of 
#               hardcoding the location. Added additional checks
#               to avoid errors and use message instead of echo.
#
#-----------------------------------------------------------------------------
# TODO:
#
# - this script can emit false positives for services that are redirected
#   (i.e. no 'server' flag but a 'redirect' flag)
# - it could warn for servers that are not restricted by TCP wrappers
#   (nees to check if server = tcpd)
# - should check whether some services use log_on_failure or log_on_success
# - info for services that are chrooted (server = chroot)
# - do not warn for services which are bound to 127.0.0.1?
# - xinetd checks should determine if insecure services are active or
#   running as root when not needed.
# - should check the server binaries it points to. Are they properly
#   owned?
# - consider generating a file based on the xinetd.conf similar to 
#   how it's done with GEN_INETD_SERVICES
# - it could also check vs the tiger's provided operating system's
#   XINETDFILE to determine changes in services just as check_inetd does
#
#-----------------------------------------------------------------------------
#
TigerInstallDir="/usr/lib/tiger"

#
# Set default base directory.
# Order or preference:
#      -B option
#      TIGERHOMEDIR environment variable
#      TigerInstallDir installed location
#
basedir=${TIGERHOMEDIR:=$TigerInstallDir}

for parm
do
   case $parm in
   -B) basedir=$2; break;;
   esac
done
#
# Verify that a config file exists there, and if it does
# source it.
#
[ ! -r $basedir/config ] && {
  echo "--ERROR-- [init002e] No 'config' file in \`$basedir'."
  exit 1
}
. $basedir/config

. $BASEDIR/initdefs
#
# If run in test mode (-t) this will verify that all required
# elements are set.
#
[ "$Tiger_TESTMODE" = 'Y' ] && {
  haveallcmds LS || exit 1
  haveallfiles BASEDIR || exit 1
  
  echo "--CONFIG-- [init003c] $0: Configuration ok..."
  exit 0
}

#------------------------------------------------------------------------
haveallcmds LS || exit 1
haveallfiles BASEDIR || exit 1

echo
echo "# Performing check of 'xinetd' related services..."

# Set the default location for xinetd.conf if not specified.
[ -z "$XINETDCONF" ] && XINETDCONF="/etc/xinetd.conf"

check_file_perms()
{
	getpermit $1 |
	while read _namefile _owner _group ur uw ux gr gw gx or ow ox suid sgid stk
	do
		eval "case \"$_owner\" in
			$Tiger_ROOT_PATH_OK_Owners)
				;;
			*)
				message FAIL inet020f \"\" \"$_namefile does not have proper ownership (owned by $_owner).\"
				;;
		esac"

		[ "$ur$uw$ux$gr$gw$gx$or$ow$ox" != '110000000' ] && \
			message WARN inet017w "" "$_namefile permissions are not 600."

		eval "case \"$_group\" in
			$Tiger_ROOT_PATH_OK_Group_Write)
				gw=0
		esac"

		[ "$gw" != '0' ] && \
			message WARN inet018w "" "$_namefile has non-administrative group ($_group) write access."

		[ "$ow" != '0' ] && \
			message ALERT inet019a "" "$_namefile public write access."
	done
}

parse_service_block()
{
	service=$1
	enabled='Y'
	proto='all'
	
	while read line 
	do
		line="${line%%\#*}"
		[ -z "$line" ] && continue

		line=`echo $line`
		attrib="${line%% *}"

		case "$attrib" in
			flags)
				for flag in $line
				do
					[ $flag = 'DISABLE' ] && enabled='N'
				done
				;;	

			disable)
				[ "${line##* }" = 'yes' ] && enabled='N'
				;;
	
			protocol)
				proto=${line#*= }
				;;
			\})
				break
				;;
		esac
	done

	if [ "$service" = 'rexd' -a $enabled = 'Y' ]; then
		message FAIL inet006f "" "'rexd' service is enabled, consider disabling it."
	elif [ "$service" = 'exec' -a $enabled = 'Y' ]; then
		message FAIL inet006f "" "'$service' service is enabled, consider disabling it."
	elif [ "$service" = 'sysstat' -a $enabled = 'Y' ]; then
		message WARN inet012w "" "'sysstat' service is enabled, consider disabling it."
	elif [ "$service" = 'netstat' -a $enabled = 'Y' ]; then
		message WARN inet013w "" "'netstat' service is enabled, consider disabling it."
	elif [ "$service" = 'linuxconf' -a $enabled = 'Y' ]; then
		message WARN inet026w "" "'linuxconf' service is enabled, consider disabling it."
	elif [ "$service" = 'auth' -a $enabled = 'Y' ]; then
		message WARN inet027w "" "The 'identd or auth' service is enabled, consider disabling it."
	elif [ "$service" = 'telnet' -a $enabled = 'Y' ]; then
		message WARN inet098w "" "The 'telnet' server is enabled, consider using ssh instead."
	elif [ "$service" = 'ftp' -a $enabled = 'Y' ]; then
		message WARN inet098w "" "The 'ftp' server is enabled, consider using ssh/sftp instead."
	elif [ "$service" = 'login' -a $enabled = 'Y' ]; then
		message WARN inet098w "" "The 'login' server is enabled, consider using ssh/sftp instead."
	elif [ "$service" = 'shell' -a $enabled = 'Y' ]; then
		message WARN inet098w "" "The 'rsh' server is enabled, consider using ssh/sftp instead."
	elif [ "$service" = 'tftp' -a $enabled = 'Y' ]; then
		message WARN inet022w "" "The 'tftpd' server is enabled, consider disabling it"
	elif [ "$service" = 'finger' -a $enabled = 'Y' ]; then
		message WARN inet023w "" "The 'finger' server is enabled, consider disabling it"
	elif [ "$service" = 'rusers' -a $enabled = 'Y' ]; then
		message WARN inet024w "" "The 'rusers' server is enabled, consider disabling it"
	elif [ "$service" = 'echo' -a $proto = 'udp' -a $enabled = 'Y' ]; then
		message WARN inet025w "" "The 'echo' udp server is enabled, consider disabling it"
	elif [ "$service" = 'chargen' -a $proto = 'udp' -a $enabled = 'Y' ]; then
		message WARN inet025w "" "The 'chargen' udp server is enabled, consider disabling it"
	fi 
}

parse_defaults_block()
{
	logging='N'

	while read line
	do
		line="${line%%\#*}"
		[ -z "$line" ] && continue

		line=`echo $line`
		attrib="${line%% *}"

		case "$attrib" in
			log_*)
				logging='Y'
				;;
			\})
				break;
				;;
		esac
	done
	
	[ $logging != 'Y' ] &&
		message WARN inet100w "" "xinetd is not configured with logging enabled."
}

parse_file()
{
	file=$1

	while read line
	do
		line="${line%%\#*}"
		[ -z "$line" ] && continue

		line=`echo $line`
		attrib="${line%% *}"

		case "$attrib" in
			includedir)
				[ $file = $XINETDCONF ] && dirs="$dirs ${line#* }"
				continue
				;;

			defaults)
				parse_defaults_block
				continue
				;;

			service)
				parse_service_block ${line#* }
				continue
				;;
		esac
	done < $file
}

# Does the XINETDCONF file exist?
[ ! -r "$XINETDCONF" ] && exit 0

check_file_perms $XINETDCONF
parse_file $XINETDCONF

for dir in $dirs
do
	[ ! -d "$dir/" ] && {
		message FAIL xnet002f "The directory ($dir) included by $XINETDCONF is not a directory."
		continue
	}
		
	$LS $dir/ 2>/dev/null |
	while read path
	do
		check_file_perms $dir/$path
		parse_file $dir/$path
	done
done