Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 26c27513bb
Fetching contributors…

Cannot retrieve contributors at this time

file 42 lines (30 sloc) 1.132 kb
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
#!/usr/local/bin/perl -w
######################################################################
# Copyright (c) 2012, Yahoo! Inc. All rights reserved.
#
# This program is free software. You may copy or redistribute it under
# the same terms as Perl itself. Please see the LICENSE.Artistic file
# included with this project for the terms of the Artistic License
# under which this project is licensed.
######################################################################


use strict;

my $tcprules;
my $os_arch = qx/uname -p/;
chomp($os_arch);

if( $os_arch eq "x86_64" ) {
    $tcprules = "/bin64/tcprules";
} else {
    $tcprules = "/bin/tcprules";
}

my $tmp_file = "/tmp/sanity_rules.txt";

my @allowed_clients = split( /,/, $ENV{"allowed_clients"} );

open( my $rules_file, '>', $tmp_file ) or die "could not open file for write: $!\n";

foreach my $line (@allowed_clients) {
   print $rules_file $line . ":allow\n";
}

# add final deny rule
print $rules_file ":deny\n";

close $rules_file;

# now run through tcprules
system("$tcprules /var/chisel/sanity.cdb /var/chisel/sanity.cdb.tmp < $tmp_file");

unlink $tmp_file;
Something went wrong with that request. Please try again.