/[secure-testing]/bin/checklist
ViewVC logotype

Diff of /bin/checklist

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 256 by joeyh, Sun Jan 9 06:11:50 2005 UTC revision 644 by joeyh, Fri Mar 25 02:44:18 2005 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl  #!/usr/bin/perl
2  # Must run on a machine with madison.  # Must run on a machine with madison.
3    #
4    # To check for un-updated binary kernel packages, also needs grep-dctrl
5    # and a Sources file for the distribution. Set the location of the Sources
6    # file in SOURCES_FILE in the environment.
7    #
8  use URI::Escape;  use URI::Escape;
9    
10  my $html=0;  my $html=0;
# Line 12  if (! @ARGV) { Line 17  if (! @ARGV) {
17          die "usage: $0 [html] list\n";          die "usage: $0 [html] list\n";
18  }  }
19    
 if ($html) {  
         print "<html><title>testing security issues</title>\n";  
         print "<ul>\n";  
 }  
20    
21  sub formatout {  my %data;
22          my $out=shift;  my %needkernel=qw/2.4.27 0 2.6.8 0/;
23    my $list_unknown=0; #set to 1 to display kernel images with unknown source version
24    my $sources=$ENV{SOURCES_FILE};
25    my $need_rebuild=0;
26    
27    my $unprop = my $unfixed = my $todos = 0;
28    
29    sub record {
30            my ($package, $condition, $item)=@_;
31    
32          if ($html) {          if ($html) {
33                  $out=~s#((?:CAN|CVE)-\d+-\d+)#<a href="http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=$1">$1</a>#g;                  $condition=~s{bug #(\d+)}{<a href="http://bugs.debian.org/$1">bug #$1</a>}g;
34                  $out=~s{bug #(\d+)}{<a href="http://bugs.debian.org/$1">bug #$1</a>}g;                  $condition=~s{unfixed}{<b>unfixed</b>}g;
35                    $item=~s#((?:CAN|CVE)-\d+-\d+)#<a href="http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=$1">$1</a>#g;
36          }          }
         return $out;  
 }  
37    
38  my $unprop = my $unfixed = 0;          push @{$data{$package}{$condition}}, $item;
39    }
40    
41  foreach my $list (@ARGV) {  foreach my $list (@ARGV) {
42          if (-d $list) {          if (-d $list) {
# Line 42  foreach my $list (@ARGV) { Line 52  foreach my $list (@ARGV) {
52                  elsif (/^((?:DSA|CAN|CVE)-[^\s]+)/) {                  elsif (/^((?:DSA|CAN|CVE)-[^\s]+)/) {
53                          $id=$1;                          $id=$1;
54                  }                  }
55                  elsif (/^\s+[!-]\s+(.*?)\s+(.*)$/) {                  elsif (/^\s+[!-]\s+(\S+)\s+(.*?)\s*$/) {
56                          my $package=$1;                          my $package=$1;
57                          my $version=$2;                          my $version=$2;
58    
59                            if ($package=~/kernel-source-([0-9.]+)/) {
60                                    my $kernversion=$1;
61                                    if (exists $needkernel{$kernversion} &&
62                                                    $version!~/\(/ ) {
63                                            $needkernel{$kernversion}=$version if !system("dpkg --compare-versions $needkernel{$kernversion} lt $version");
64                                    }
65                            }
66    
67                          my $maddy=`madison -s testing '$package'`;                          my $maddy=`madison -s testing '$package'`;
68                          next unless length $maddy; # skip if not in testing                          if ($? & 128) {
69                                    # good old newraff..
70                                    record($package, "madison segfaulted", $id);
71                            }
72                            elsif ($? >> 8 != 0 && $? >> 8 != 1) {
73                                    record($package, "<em>madison exited with ".($? >> 8)."</em>", $id);
74                            }
75                            if (! length $maddy) {
76                                    next;
77                            }
78    
79                          if ($version=~/unfixed/) {                          if ($version=~/unfixed/ || $version=~/pending/) {
80                                  print "<li>" if $html;                                  record($package, $version, $id);
81                                  print formatout("$package $version for $id\n");                                  $unfixed++;
                                 $unprop++;  
82                          }                          }
83                          else {                          else {
84                                  my @fields = split(/\s*\|\s*/, $maddy);                                  my @fields = split(/\s*\|\s*/, $maddy);
# Line 60  foreach my $list (@ARGV) { Line 86  foreach my $list (@ARGV) {
86                                  my $cmp=system("dpkg --compare-versions '$havver' '>=' '$version'");                                  my $cmp=system("dpkg --compare-versions '$havver' '>=' '$version'");
87                                  if ($cmp != 0) {                                  if ($cmp != 0) {
88                                          if ($html) {                                          if ($html) {
                                                 print "<li>";  
89                                                  $havver='<a href="http://bjorn.haxx.se/debian/testing.pl?package='.uri_escape($package).'">'.$havver.'</a>';                                                  $havver='<a href="http://bjorn.haxx.se/debian/testing.pl?package='.uri_escape($package).'">'.$havver.'</a>';
90                                          }                                          }
91                                          print formatout("$package $version needed, have $havver for $id\n");                                          record($package, "$version needed, have $havver", $id);
92                                          $unfixed++;                                          $unprop++;
93                                  }                                  }
94                          }                          }
95                  }                  }
96                    elsif (/\s+TODO/) {
97                            $todos++;
98                    }
99            }
100    }
101    
102    
103    if ($html) {
104            print "<html><title>testing security issues</title>\n";
105            print "<ul>\n";
106    }
107    
108    foreach my $package (sort keys %data) {
109            foreach my $condition (sort keys %{$data{$package}}) {
110                    print "<li>" if $html;
111                    print "$package $condition for ";
112                    my $items=0;
113                    foreach my $item (sort @{$data{$package}{$condition}}) {
114                            print ", " if $items > 0;
115                            print $item;
116                            $items++;
117                    }
118                    print "\n";
119            }
120    }
121    
122    foreach my $version (sort keys %needkernel) {
123            my %images;
124    
125            if ($needkern{$version} eq "0") {
126                    next;
127            }
128    
129            my @dctrl;
130            if (defined $sources && length $sources) {
131                    @dctrl=`grep-dctrl -F Binary kernel-image-$version -s Package,Build-Depends $sources`;
132            }
133    
134            my $package="";
135            my $haveversion;
136    
137            foreach my $line (@dctrl) {
138                    chomp;
139                    if ($line=~/Package:\s*(\S+)/) {
140                            $package=$1;
141                            $haveversion="0";
142                    } elsif ($line=~/Build-Depends/) {
143                            if ($line=~/kernel-tree-$version-([^,\s]+)/) {
144                                    $haveversion="$version-$1";
145                            } elsif ($line=~/kernel-source-$version\s+\(>=\s*([^\s\)])\)/) {
146                                    $haveversion="$1";
147                            }
148                    } else {
149                            if ($package=~/linux-kernel-di/ || $package eq "") {
150                                    next;
151                            }
152                            $images{$package}=$haveversion;
153                            $package="";
154                    }
155            }
156    
157            foreach $package (sort keys %images) {
158                    if ($images{$package} eq "0") {
159                            print "<li>" if ($html && $list_unknown);
160                            print "$package built from kernel-source-$version $needkernel{$version} needed, current version unknown\n" if $list_unknown;
161                    } elsif (!system("dpkg --compare-versions $needkernel{$version} gt $images{$package}")) {
162                    print "<li>" if $html;
163                            print "$package built from kernel-source-$version $needkernel{$version} needed, have $images{$package}\n";
164                            $need_rebuild++;
165                    }
166          }          }
167    
168    
169  }  }
170    
171    
172  if ($html) {  if ($html) {
173          print "</ul>\n";          print "</ul>\n";
174          print "<hr>\n";          print "<hr>\n";
175          print "Total unfixed: $unfixed<br>\n";          print "Total holes unfixed: $unfixed<br>\n";
176          print "Total fixed in unstable but not testing: $unprop<br>\n";          print "Total holes fixed in unstable but not testing: $unprop<br>\n";
177            print "Total number of kernel image source packages not up to date: $need_rebuild<br>\n";
178            print "Number of TODO lines in <a href=\"http://svn.debian.org/wsvn/secure-testing/sarge-checks/?rev=0&sc=0\">records</a>: $todos<br>\n";
179            print "Maintained by the <a href=\"http://secure-testing.alioth.debian.org/\">testing security team</a><br>\n";
180          print "Last update: ".`date`."<br>\n";          print "Last update: ".`date`."<br>\n";
181          print "</html>\n";          print "</html>\n";
182  }  }

Legend:
Removed from v.256  
changed lines
  Added in v.644

  ViewVC Help
Powered by ViewVC 1.1.5