Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/hardened-patchset:rsbac commit in: scripts/
Date: Wed, 21 Dec 2011 20:48:02
Message-Id: e2d85b736a62ecb4dd822ea13ea861d871d9bf89.blueness@gentoo
1 commit: e2d85b736a62ecb4dd822ea13ea861d871d9bf89
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Wed Dec 21 20:47:47 2011 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Wed Dec 21 20:47:47 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-patchset.git;a=commit;h=e2d85b73
7
8 Renamed rsbac pathset
9
10 ---
11 scripts/fetch_grsecurity_test.pl | 209 --------------------------------------
12 scripts/mk.rsbac.patch.sh | 2 +-
13 2 files changed, 1 insertions(+), 210 deletions(-)
14
15 diff --git a/scripts/fetch_grsecurity_test.pl b/scripts/fetch_grsecurity_test.pl
16 deleted file mode 100755
17 index 2211b63..0000000
18 --- a/scripts/fetch_grsecurity_test.pl
19 +++ /dev/null
20 @@ -1,209 +0,0 @@
21 -#!/usr/bin/perl -w
22 -
23 -# Fetches new released patches, tarballs, etc that have been
24 -# announced on a web page and stores them locally.
25 -#
26 -# Copyright (C) 2010, Anthony G. Basile <blueness@g.o>
27 -# Released under the GPLv2
28 -
29 -use strict ;
30 -use LWP::Simple ; ;
31 -use HTML::LinkExtor ;
32 -
33 -############################################################
34 -### Edit these to suit your needs ##########################
35 -############################################################
36 -
37 -my $storage_dir = "/home/basile/storage/grsecurity-test" ;
38 -my $upstream_url = "http://grsecurity.net/test.php" ;
39 -my @allowed_suffixes = ( ".patch", ".patch.sig", ".tar.gz", ".tar.gz.sig", ".asc" ) ;
40 -
41 -############################################################
42 -
43 -my $send_email = 1 ; # do you want to send email alerts
44 -
45 -my $sendmail = "/usr/sbin/sendmail -t" ;
46 -
47 -my $from = "From: " . "root\@opensource.dyc.edu\n" ;
48 -my $subject = "Subject: " . "New release from $upstream_url\n" ;
49 -my $reply_to = "Reply-to: " . "devnull\@localhost.invalid\n" ;
50 -my $send_to = "To: " . "basile\@opensource.dyc.edu\n" ;
51 -
52 -############################################################
53 -
54 -my %already_retrieved = () ; #set of already retreived files
55 -my %currently_available = () ; #set of currently available files
56 -
57 -
58 -sub sane
59 -{
60 - my ( $name ) = @_ ;
61 -
62 - return 0 if $name eq "" ; # no empty names
63 - return 0 if $name =~ / / ; # no blanks in names
64 -
65 - my $got_suffix = 0 ; # file must have legitimate suffix
66 - foreach my $suffix ( @allowed_suffixes )
67 - {
68 - $got_suffix = 1 if $name =~ /$suffix$/ ;
69 - }
70 -
71 - return $got_suffix ;
72 -}
73 -
74 -
75 -sub get_already_retrieved
76 -{
77 - if ( -d $storage_dir ) # check if storage_dir exists
78 - {
79 - my @file_names = `ls $storage_dir` ; # and get list of files
80 - foreach my $file_name ( @file_names )
81 - {
82 - chomp( $file_name ) ;
83 - $already_retrieved{ $file_name } = 1 if sane( $file_name ) ;
84 - }
85 - }
86 - else # else create a new storage_dir
87 - {
88 - mkdir $storage_dir || die "Sorry I can't make $storage_dir\n" ;
89 - print "\n\nCreated storage dir: $storage_dir\n\n" ;
90 - }
91 -
92 -}
93 -
94 -
95 -sub print_already_retrieved
96 -{
97 - print "\n\nAlready retrieved files from upstream:\n\n" ;
98 - foreach my $file_name ( sort keys %already_retrieved ) # go through hash of already_retrieved files
99 - {
100 - print "\t$file_name\n" ; # and print
101 - }
102 - print "\n\n" ;
103 -}
104 -
105 -
106 -sub get_currently_available
107 -{
108 - my $parser ;
109 - my @links ;
110 -
111 - $parser = HTML::LinkExtor->new( undef, $upstream_url ) ; # grab upstream web page
112 - $parser->parse( get( $upstream_url ) )->eof ;
113 -
114 - @links = $parser->links ; # grab the links out of it
115 -
116 - foreach my $ref ( @links )
117 - {
118 - my $file_url = ${$ref}[2] ; # get just the url part
119 - my $file_name = $file_url ;
120 - $file_name =~ s/^.*\/(.*)$/$1/ ; # parse out the file name from the url
121 -
122 - next unless sane( $file_name ) ; # if it fits the sane file names
123 -
124 - $currently_available{ $file_name } = $file_url ; # insert it and its url as key=>value in currently_available
125 - }
126 -}
127 -
128 -
129 -sub print_currently_available
130 -{
131 - print "\n\nCurrently available files from upstream:\n\n" ;
132 - foreach my $file_name ( sort keys %currently_available ) # go through hash of currently_available files
133 - {
134 - my $file_url = $currently_available{$file_name} ;
135 - print "\t$file_name\n" ; # and print
136 - #print "\t$file_name @ $file_url\n" ;
137 - }
138 - print "\n\n" ;
139 -}
140 -
141 -
142 -sub download_newly_available
143 -{
144 - my $downloads = "" ;
145 -
146 - chdir( $storage_dir ) ;
147 - foreach my $file_name ( sort keys %currently_available ) # go through each of the currently_available files
148 - {
149 - next if $already_retrieved{ $file_name } ; # and if its not in the already_retrieved
150 - print "\tDownloading $file_name ... " ;
151 - my $file_url = $currently_available{ $file_name } ;
152 - if ( getstore( $file_url, $file_name ) ) # download it and report success/failure
153 - {
154 - print "OK\n" ;
155 - $downloads .= "\t$file_name\n" ;
156 - }
157 - else
158 - {
159 - print "FAIL\n" ;
160 - }
161 - }
162 -
163 - return $downloads ;
164 -}
165 -
166 -
167 -sub print_successful_downloads
168 -{
169 - my ( $downloads ) = @_ ;
170 -
171 - if( $downloads ne "" )
172 - {
173 - print "\n\nSuccessfully downloaded files from upstream:\n\n" ;
174 - print $downloads ;
175 - print "\n\n" ;
176 - }
177 - else
178 - {
179 - print "\n\nNo files downloaded from upstream --- nothing to report.\n\n" ;
180 - print "\n\n" ;
181 - }
182 -}
183 -
184 -
185 -sub email_successful_downloads
186 -{
187 - my ( $downloads ) = @_ ;
188 -
189 - if( $send_email == 1 && $downloads ne "" )
190 - {
191 - print "\n\nEmailing notification of successfully downloaded files $send_to.\n\n" ;
192 -
193 - my $content = "\n\nSuccessfully downloaded files from upstream:\n\n" ;
194 - $content .= $downloads ;
195 - $content .= "\n\n" ;
196 -
197 - open (SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";
198 - print SENDMAIL $from ;
199 - print SENDMAIL $subject ;
200 - print SENDMAIL $reply_to ;
201 - print SENDMAIL $send_to;
202 - print SENDMAIL "Content-type: text/plain\n\n";
203 - print SENDMAIL $content;
204 - close(SENDMAIL);
205 - }
206 - else
207 - {
208 - print "\n\nNo files downloaded from upstream --- nothing to email.\n\n" ;
209 - print "\n\n" ;
210 - }
211 -}
212 -
213 -
214 -sub main
215 -{
216 - get_already_retrieved() ;
217 - print_already_retrieved() ;
218 -
219 - get_currently_available() ;
220 - print_currently_available() ;
221 -
222 - my $downloads = download_newly_available() ;
223 -
224 - print_successful_downloads( $downloads ) ;
225 - email_successful_downloads( $downloads ) ;
226 -}
227 -
228 -main() ;
229 -
230
231 diff --git a/scripts/mk.rsbac.patch.sh b/scripts/mk.rsbac.patch.sh
232 index 485f179..c929387 100755
233 --- a/scripts/mk.rsbac.patch.sh
234 +++ b/scripts/mk.rsbac.patch.sh
235 @@ -25,7 +25,7 @@ sanity() {
236 sanity
237
238 HGPV="${KERNEL_VER}-${HGPV_PATCH}"
239 -HGPV_TARBALL="hardened-rsbac-patches-${HGPV}.extras.tar.bz2"
240 +HGPV_TARBALL="rsbac-patches-${HGPV}.extras.tar.bz2"
241
242 $TAR jcvf ${HGPV_TARBALL} ${KERNEL_VER}