version 1.1, 2002/03/03 04:29:10
|
version 1.32, 2010/05/04 01:45:31
|
Line 1
|
Line 1
|
|
<!DOCTYPE piml PUBLIC "-//TUX/DTD piml 1.0 Final//EN" |
|
"http://lpml.sourceforge.net/DTD/piml.dtd"> |
<!-- sanitycheck.piml --> |
<!-- sanitycheck.piml --> |
<!-- Scott Harrison --> |
|
|
|
<!-- $Id$ --> |
<!-- $Id$ --> |
|
|
Line 31 http://www.lon-capa.org/
|
Line 32 http://www.lon-capa.org/
|
<targetroot>/</targetroot> |
<targetroot>/</targetroot> |
<files> |
<files> |
<file> |
<file> |
<target dist='default'>/etc/httpd/conf/loncapa.conf</target> |
<target dist='default'>/etc/hosts</target> |
<perlscript mode='fg'> |
<perlscript mode='fg'> |
my $diff=`diff ../../loncom/loncapa.conf <TARGET />`; |
unless |
if ($diff) { |
(-e '<TARGET />') # Does file exist? |
print "**** ERROR **** There are unexpected differences for <TARGET />\n"; |
{ |
} |
print("**** ERROR **** Missing <TARGET />\n"); |
|
} |
|
else |
|
{ |
|
my $numentries = `grep -v '^#' <TARGET /> | grep -c '[[:alpha:]]'`; |
|
if ($numentries == 1) |
|
{ |
|
print("**** ERROR **** Malformatted <TARGET />\n"); |
|
print("<TARGET /> typically should have at least two entries, ". |
|
"e.g.:\n"); |
|
print("127.0.0.1 localhost.localdomain localhost\n"); |
|
print("35.8.63.26 s16.lite.msu.edu s16\n"); |
|
print("The <TARGET /> file on your machine looks like it was \n". |
|
"messed up due to a common bug with RedHat installations.\n". |
|
"(This weird bug is RedHat's fault, not LON-CAPA's.)\n"); |
|
print("Please read the man pages about \"hosts\" and fix your\n". |
|
"<TARGET /> file.\n"); |
|
} |
|
} |
</perlscript> |
</perlscript> |
</file> |
</file> |
<file> |
<file> |
<target dist='default'>/etc/httpd/conf/access.conf</target> |
<target dist='default'>/var/lib/mysql/mysql.sock</target> |
|
<target dist='suse11.2'>/var/run/mysql/mysql.sock</target> |
|
<target dist='debian5 ubuntu6 ubuntu8'>/var/run/mysqld/mysqld.sock</target> |
|
<perlscript mode='fg'> |
|
unless |
|
(-e '<TARGET />') # Does file exist? |
|
{ |
|
print("**** ERROR **** Missing <TARGET />\n"); |
|
} |
|
<!-- Commented out by Matthew since MySQL insists on doing things its own way |
|
else # It exists, so look at the file metadata more closely. |
|
{ |
|
my @s = stat('<TARGET />'); |
|
my $uid = $s[4]; |
|
my $mode = $s[2]; |
|
my $web_uid = getpwnam('www'); |
|
my $smode = sprintf("%04o",$mode & 07777); |
|
|
|
if ($uid ne $web_uid) # If file owned by someone else other than www. |
|
{ |
|
print('**** WARNING **** <TARGET /> should be owned by'. |
|
' www.'."\n".'Try these commands to make things right:'."\n". |
|
'chown www:www <TARGET />'."\n". |
|
'chmod a-rwx,u+rwx <TARGET />'."\n"); |
|
} |
|
else # Check permissions on the file to make sure it is private to www. |
|
{ |
|
$smode =~ /^.(.)..$/; |
|
my $wflag = $1; |
|
if ($wflag != 7) # Can www use this socket? (Hope so!) |
|
{ |
|
print('**** WARNING **** '. |
|
'<TARGET /> should be user "rwx" (by'. |
|
' www).'."\n".'Try these commands to make things right:'."\n". |
|
'chown www:www <TARGET />'."\n". |
|
'chmod a-rwx,u+rwx <TARGET />'."\n"); |
|
} |
|
$smode=~/^..(..)$/; |
|
$wflag=$1; |
|
if ($wflag ne "00") # Can others use this socket? (Hope not!) |
|
{ |
|
print('**** WARNING **** '. |
|
'<TARGET /> should not be group or everybody accessible'. |
|
'.'."\n".'Try these commands to make things right:'."\n". |
|
'chown www:www <TARGET />'."\n". |
|
'chmod a-rwx,u+rwx <TARGET />'."\n"); |
|
} |
|
} |
|
} |
|
--> |
|
</perlscript> |
|
</file> |
|
<file> |
|
<target dist='default'>/etc/httpd/conf/loncapa.conf</target> |
|
<target dist='sles10 sles11 suse10.1 suse10.2 suse10.3 suse11.1 suse11.2 debian5 ubuntu6 ubuntu8'>/etc/apache2/loncapa.conf</target> |
<perlscript mode='fg'> |
<perlscript mode='fg'> |
my $diff=`diff -y --suppress-common-lines ../access.conf <TARGET /> | grep -v PerlSetVar | grep -v 'Include conf/loncapa.conf'`; |
|
if ($diff) { |
|
print "**** ERROR **** There are unexpected differences for <TARGET />\n"; |
|
} |
|
open IN, "<<TARGET />"; |
open IN, "<<TARGET />"; |
my $hbug=-1; |
my $hbug=-1; |
my $dbug=-1; |
my $dbug=-1; |
Line 53 while (<IN>) {
|
Line 122 while (<IN>) {
|
if (/PerlSetVar\s+lonHostID\s+(\S+)/) { |
if (/PerlSetVar\s+lonHostID\s+(\S+)/) { |
my $v=$1; |
my $v=$1; |
$hbug=0; |
$hbug=0; |
$hbug=1 if $v=~/\W/; |
$hbug=1 if $v=~/[^\w.\-]/; |
$hbug=1 if $v=~/\_/; |
$hbug=1 if $v=~/_/; |
} |
} |
if (/PerlSetVar\s+lonDefDomain\s+(\S+)/) { |
if (/PerlSetVar\s+lonDefDomain\s+(\S+)/) { |
my $v=$1; |
my $v=$1; |
$dbug=0; |
$dbug=0; |
$dbug=1 if $v=~/\W/; |
$dbug=1 if $v=~/[^\w.\-]/; |
$dbug=1 if $v=~/\_/; |
$dbug=1 if $v=~/_/; |
|
# Avoid namespace conflicts under the web server's DocumentRoot. |
|
my @badnames=('raw','userfiles','priv','adm','uploaded'); |
|
foreach my $bad (@badnames) { |
|
$dbug=1 if $v eq $bad; |
|
} |
} |
} |
} |
} |
if ($hbug) { |
if ($hbug) { |
Line 78 my $rbug=0;
|
Line 152 my $rbug=0;
|
my $dbug=0; |
my $dbug=0; |
my $sbug=0; |
my $sbug=0; |
my $fbug=0; |
my $fbug=0; |
while (<IN>) { |
my %line; |
if (/\S/) { |
my $line=0; |
$rbug=1 if /\r/; |
while (my $l = <IN>) { |
my @a=split(/\:/,$_); |
$line++; |
$dbug=1 if $a[0]=~/\W/; |
next if ($l=~/^(\#|\s*$)/); |
$dbug=1 if $a[0]=~/\_/; |
if ($l=~/^\^/) { |
$dbug=1 if $a[1]=~/\_/; |
if ($l !~ /^\^[\w.\-]/) { |
$dbug=1 if $a[1]=~/\W/; |
$dns_bug = 1; |
$fbug=1 if @a!=5; |
push(@{$line{'dns'}},$line); |
$sbug=1 if /\s.+$/; |
} |
|
} elsif ($l=~/\S/) { |
|
if ($l=~/\r/) { $rbug=1; push(@{$line{'r'}},$line); } |
|
my @a=split(/:/,$l); |
|
if ($a[0]=~/[^\w\-.]/ || |
|
$a[1]=~/[^\w\-.]/ || |
|
$a[0]=~/\_/ || |
|
$a[1]=~/\_/ ) { $dbug=1; push(@{$line{'d'}},$line); } |
|
if (@a<4 || @a>5) { $fbug=1; push(@{$line{'f'}},$line); } |
|
my $expr='\s.+$'; |
|
if ($a[0] =~ /$expr/ || |
|
$a[1] =~ /$expr/ || |
|
$a[2] =~ /$expr/ || |
|
$a[3] =~ /$expr/ ) { $sbug=1; push(@{$line{'s'}},$line); } |
|
; |
} |
} |
} |
} |
close IN; |
close IN; |
if ($rbug) { |
if ($rbug) { |
print "**** ERROR **** <TARGET /> is DOS-formatted\n"; |
print "**** ERROR **** <TARGET /> is DOS-formatted (lines ".join(', ',@{$line{'r'}}).")\n"; |
} |
} |
if ($dbug) { |
if ($dbug) { |
print "**** ERROR **** <TARGET /> has invalid host id or domain id\n"; |
print "**** ERROR **** <TARGET /> has invalid host id or domain id (lines ".join(', ',@{$line{'d'}}).")\n"; |
} |
} |
if ($fbug) { |
if ($fbug) { |
print "**** ERROR **** <TARGET /> is lacking 5 columns for every row\n"; |
print "**** ERROR **** <TARGET /> is lacking 4 or 5 columns for every row (lines ".join(', ',@{$line{'f'}}).")\n"; |
} |
} |
if ($sbug) { |
if ($sbug) { |
print "**** ERROR **** <TARGET /> has illegal whitespace character\n"; |
print "**** ERROR **** <TARGET /> has illegal whitespace character (lines ".join(', ',@{$line{'s'}}).")\n"; |
|
} |
|
if ($dns_bug) { |
|
print "**** ERROR **** <TARGET /> host.tab server entry has characters (lines ".join(', ',@{$line{'dns'}}).")\n"; |
} |
} |
</file> |
</file> |
<file> |
<file> |
Line 110 open IN, "<<TARGET />";
|
Line 201 open IN, "<<TARGET />";
|
my $rbug=0; |
my $rbug=0; |
my $dbug=0; |
my $dbug=0; |
my $sbug=0; |
my $sbug=0; |
while (<IN>) { |
while (my $line = <IN>) { |
if (/\S/) { |
if ($line =~ /\S/) { |
$rbug=1 if /\r/; |
$rbug=1 if $line=~/\r/; |
$dbug=1 if $_=~/\W.*\n$/; |
if ($line =~ /\W.*\n/) { |
$dbug=1 if $_=~/\_/; |
$dbug=$line if ($line !~/\w:(?:primary|default)$/); |
$sbug=1 if /\s.+$/; |
} |
|
$dbug=$line if $line=~/\_/; |
|
$sbug=1 if $line=~/\s.+$/; |
} |
} |
} |
} |
close IN; |
close IN; |
Line 123 if ($rbug) {
|
Line 216 if ($rbug) {
|
print "**** ERROR **** <TARGET /> is DOS-formatted\n"; |
print "**** ERROR **** <TARGET /> is DOS-formatted\n"; |
} |
} |
if ($dbug) { |
if ($dbug) { |
print "**** ERROR **** <TARGET /> has invalid host id\n"; |
print "**** ERROR **** <TARGET /> has invalid host id ($dbug)\n"; |
} |
} |
if ($sbug) { |
if ($sbug) { |
print "**** ERROR **** <TARGET /> has illegal whitespace character\n"; |
print "**** ERROR **** <TARGET /> has illegal whitespace character\n"; |