This file is indexed.

/usr/sbin/checksecurity is in checksecurity 2.0.16+nmu1.

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
#!/usr/bin/perl 
#
# Debian's checksecurity.
# Runs a set of plugins which check the security of an installed 
# system.
#
# (c) 2003-2005 Steve Kemp <skx@debian.org>, http://www.steve.org.uk 
# (c) 2005      Javier Fernandez-Sanguino <jfs@debian.org>
# Licensed under the GNU General Public License
#
# 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#

use strict;
use Env;
use Getopt::Long;
my $opt_debug = 0;
GetOptions(
  'debug!'   => \$opt_debug,
);

# Are we root?
if ( $> != 0 ) {
	print STDERR "Sorry, only root can run checksecurity";
	exit 1;
}

#
#  The fixed settings we work with.
#
my $CONFIG     = "/etc/checksecurity.conf";
my $PLUGIN_DIR = "/usr/share/checksecurity";
my $VERSION    = "2.0.7";

# Argument determine which checks will be run
my $period     = "all";
$period = $ARGV[0] if defined $ARGV[0];
# Accepted periods
if ( $period !~ /^(all|daily|weekly)$/ ) {
	print STDERR "Unknown period requested ($period) reverting to 'all'\n";
	$period = "all";
}


# Copy of the environmental variables.
my %SAFE_ENV   = %ENV;

# Environmental settings we read from the configuration file.
my %GLOBAL_ENV = ();

# The environment that we send to the plugins we call.
my %PLUGIN_ENV = ();



#
# Source the configuration file.
#
if ( -e $CONFIG )
{
    %GLOBAL_ENV = readConfig( $CONFIG );
}
else
{
    print <<E_O_F;
  The global configuration file that checksecurity wishes to read
 in order to know which plugins are enabled is missing.

  Please see man checksecurity(8) for details of the contents
 this file should have.

  Aborting.
E_O_F
}



#
# Look for plugins
#
foreach my $file (glob( $PLUGIN_DIR . "/check-*" ) )
{
    # Skip dotfiles.
    next if ( $file =~ /^\./ );

    my $name = "";

    if ( $file =~ /(.*)check-(.*)/ )
    {
	$name = $2;
    }

    $name = uc( $name );
    print "Checking plugin $name\n" if $opt_debug;

    # Are we configured to run it in this period?
    next if ( $period ne "all" && $GLOBAL_ENV{ "CHECK_".uc($period) } !~ /$name/ );

    # See if the plugin is enabled.
    if ( $GLOBAL_ENV{ "CHECK_$name" } eq "TRUE" ) 
    {
	# Determine the configuration file this plugin wishes to use.
	$name = lc( $name );
	my $conf = "/etc/checksecurity/check-$name.conf";

	# Reset to the known good environment.
	%ENV  = %SAFE_ENV;


	if ( -e $conf )
	{
	    %PLUGIN_ENV= &readConfig( $conf );
	}
	else
	{
	    %PLUGIN_ENV = ();
	}

	# Setup the environment
	foreach my $k ( keys( %PLUGIN_ENV) )
	{
	    $ENV{$k} = $PLUGIN_ENV{$k};
	}

        # We inherit the CHECKSECURITY_EMAIL environment from the global
        # file if the script does not redefine it.
        if ( ! defined $ENV{'CHECKSECURITY_EMAIL'} && defined $GLOBAL_ENV{'CHECKSECURITY_EMAIL'} ) {
            $ENV{'CHECKSECURITY_EMAIL'} = $GLOBAL_ENV{'CHECKSECURITY_EMAIL'};
        }

	# Execute the file.
        print "Executing plugin $name ($file)\n" if $opt_debug;
	system( $file );
    }
    else
    {
	print "Plugin $name Disabled\n" if $opt_debug;
        print "Value was ".$GLOBAL_ENV{ "CHECK_$name" } . "\n" if $opt_debug;
    }
}


#
#  Read a name=value configuration file, and return a hash containing
# each of values keys.
#
sub readConfig( $ )
{
    my ( $file ) = ( @_ );

    my %HASH;
    open( FILY, "<$file" ) or die "Cannot open file: $file - $!";

    my $line       = ""; 
    my $lineCount  = 0;

    while (defined($line = <FILY>) ) 
    {
        chomp $line;
	if ($line =~ s/\\$//) 
	{
	    $line .= <FILY>;
	    redo unless eof(FILY);
	}
      
	# Skip lines beginning with comments
	next if ( $line =~ /^([ \t]*)\#/ );

	# Skip blank lines
	next if ( length( $line ) < 1 );

	# Strip trailing comments.
	if ( $line =~ /(.*)\#(.*)/ )
	{
	    $line = $1;
	}

	# Find variable settings
	if ( $line =~ /([^=]+)=([^\n]+)/ )
	{
	    my $key = $1;
	    my $val = $2;

	    # Strip leading and trailing whitespace.
	    $key =~ s/^\s+//;
	    $key =~ s/\s+$//;
	    $val =~ s/^\s+//;
	    $val =~ s/\s+$//;
	    
	    # Strip enclosing "'s
	    if ( $val =~ /^['"](.*)['"]$/ )
	    {
		$val = $1;
	    }

	    # Store value.
	    $HASH{ $key } = $val;
	}
    }
    close(FILY);
    return(%HASH);
}