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

Diff of /data/checklist

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

revision 239 by joeyh, Wed Jan 5 10:34:41 2005 UTC revision 737 by joeyh, Sun Apr 3 22:36:50 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;
9    
10  my $html=0;  my $html=0;
11  if ($ARGV[0] eq 'html') {  if ($ARGV[0] eq 'html') {
# Line 11  if (! @ARGV) { Line 17  if (! @ARGV) {
17          die "usage: $0 [html] list\n";          die "usage: $0 [html] list\n";
18  }  }
19    
 if ($html) {  
         print "<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=1; #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 $unprop_all = 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 36  foreach my $list (@ARGV) { Line 47  foreach my $list (@ARGV) {
47          while (<IN>) {          while (<IN>) {
48                  chomp;                  chomp;
49                  if (/^\[/) {                  if (/^\[/) {
50                          ($id)=m/((?:DSA|CAN|CVE)-.*?) /;                          ($id)=m/((?:DSA|CAN|CVE)-[^\s]+) /;
51                  }                  }
52                  elsif (/^(DSA|CAN|CVE)-/) {                  elsif (/^((?:DSA|CAN|CVE)-[^\s]+)/) {
53                          $id=$_;                          $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                          if ($version=~/unfixed/) {  
59                                  print "<li>" if $html;                          if ($package=~/kernel-source-([0-9.]+)/) {
60                                  print formatout("$package $version for $id\n");                                  my $kernversion=$1;
61                                  $unprop++;                                  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;
68                            for (1..5) {
69                                    @maddy=`madison -s testing '$package'`;
70                                    if ($? & 127 || ($? >> 8 != 0 && $? >> 8 != 1)) {
71                                            # good old unrelaible newraff,
72                                            # home of our archive..
73                                            next;
74                                    }
75                                    last;
76                            }
77                            if ($? & 127) {
78                                    record($package, "<em>[madison segfaulted 5 times in a row.. Medic!]</em>", $id);
79                            }
80                            elsif ($? >> 8 != 0 && $? >> 8 != 1) {
81                                    record($package, "<em>[madison exited with ".($? >> 8)."]</em>", $id);
82                            }
83                            if (! @maddy) {
84                                  next;                                  next;
85                          }                          }
86                          my $maddy=`madison -s testing '$package'`;  
87                          if (length $maddy) {                          if ($version=~/unfixed/ || $version=~/pending/) {
88                                  my @fields = split(/\s*\|\s*/, $maddy);                                  record($package, $version, $id);
89                                  my $havver=$fields[1];                                  $unfixed++;
90                                  my $cmp=system("dpkg --compare-versions '$havver' '>=' '$version'");                          }
91                                  if ($cmp != 0) {                          else {
92                                          if ($html) {                                  foreach my $maddy (@maddy) {
93                                                  print "<li>";                                          my @fields = split(/\s*\|\s*/, $maddy);
94                                                  $havver='<a href="http://bjorn.haxx.se/debian/testing.pl?package='.$package.'">'.$havver.'</a>';                                          my $havver=$fields[1];
95                                            my $arches=$fields[3];
96                                            $version=~s/\s+//; # strip whitespace
97                                            $arches=~s/\s+$//;
98                                            my $cmp=system("dpkg --compare-versions '$havver' '>=' '$version'");
99                                            if ($cmp != 0) {
100                                                    if ($html) {
101                                                            $havver='<a href="http://bjorn.haxx.se/debian/testing.pl?package='.uri_escape($package).'">'.$havver.'</a>';
102                                                    }
103                                                    record($package, "$version needed, have $havver".(@maddy > 1 ? " [$arches]" : ""), $id);
104                                                    $unprop++;
105                                                    $unprop_all++ unless @maddy > 1;
106                                          }                                          }
                                         print formatout("$package $version needed, have $havver for $id\n");  
                                         $unfixed++;  
107                                  }                                  }
108                          }                          }
109                  }                  }
110                    elsif (/\s+TODO/) {
111                            $todos++;
112                    }
113            }
114    }
115    
116    
117    if ($html) {
118            print "<html><title>testing security issues</title>\n";
119            print "<ul>\n";
120    }
121    
122    foreach my $package (sort keys %data) {
123            foreach my $condition (sort keys %{$data{$package}}) {
124                    print "<li>" if $html;
125                    print "$package $condition for ";
126                    my $items=0;
127                    foreach my $item (sort @{$data{$package}{$condition}}) {
128                            print ", " if $items > 0;
129                            print $item;
130                            $items++;
131                    }
132                    print "\n";
133            }
134    }
135    
136    foreach my $version (sort keys %needkernel) {
137            my %images;
138    
139            if ($needkern{$version} eq "0") {
140                    next;
141            }
142    
143            my @dctrl;
144            if (defined $sources && length $sources) {
145                    my $cat=($sources=~/\.gz/) ? "zcat" : "cat";
146                    @dctrl=`$cat $sources | grep-dctrl -F Binary kernel-image-$version -s Package,Build-Depends -`;
147            }
148    
149            my $package="";
150            my $haveversion;
151    
152            foreach my $line (@dctrl) {
153                    chomp;
154                    if ($line=~/Package:\s*(\S+)/) {
155                            $package=$1;
156                            $haveversion="0";
157                    } elsif ($line=~/Build-Depends/) {
158                            if ($line=~/kernel-tree-$version-([^,\s]+)/) {
159                                    $haveversion="$version-$1";
160                            } elsif ($line=~/kernel-source-$version\s+\(>?=\s*([^\s\)]+)\)/) {
161                                    $haveversion="$1";
162                            }
163                    } else {
164                            if ($package=~/linux-kernel-di/ || $package eq "") {
165                                    next;
166                            }
167                            $images{$package}=$haveversion;
168                            $package="";
169                    }
170          }          }
171    
172            foreach $package (sort keys %images) {
173                    if ($images{$package} eq "0") {
174                            print "<li>" if ($html && $list_unknown);
175                            print "$package built from kernel-source-$version $needkernel{$version} needed, current version unknown\n" if $list_unknown;
176                    } elsif (!system("dpkg --compare-versions $needkernel{$version} gt $images{$package}")) {
177                    print "<li>" if $html;
178                            print "$package built from kernel-source-$version $needkernel{$version} needed, have $images{$package}\n";
179                            $need_rebuild++;
180                    }
181            }
182    
183    
184  }  }
185    
186    
187  if ($html) {  if ($html) {
188          print "</ul>\n";          print "</ul>\n";
189          print "<hr>\n";          print "<hr>\n";
190          print "Total unfixed: $unfixed\n";          print "Total holes unfixed: $unfixed<br>\n";
191          print "Total fixed in unstable but not testing: $unprop\n";          print "Total holes fixed in unstable but not testing: $unprop_all";
192          print "Last update: ".`date`;          if ($unprop_all != $unprop) {
193                    print " (".($unprop - $unprop_all)." on some arches)";
194            }
195            print "<br>\n";
196            print "Total number of kernel image packages not up to date: $need_rebuild<br>\n";
197            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";
198            print "Maintained by the <a href=\"http://secure-testing.alioth.debian.org/\">testing security team</a><br>\n";
199            print "Last update: ".`date`."<br>\n";
200            print "</html>\n";
201  }  }

Legend:
Removed from v.239  
changed lines
  Added in v.737

  ViewVC Help
Powered by ViewVC 1.1.5