Compare commits
No commits in common. "20222430c4f621a3d83e74d27dd0a8fb3881af99" and "4404131d2a4a10476ec68f52f93768e0f31a604c" have entirely different histories.
20222430c4
...
4404131d2a
1
Krp.secret-wg.org.+001+27900.key
Normal file
1
Krp.secret-wg.org.+001+27900.key
Normal file
@ -0,0 +1 @@
|
|||||||
|
rp.secret-wg.org. IN KEY 256 3 1 AQPkQwQiwlTBYvK8xOx18oOqSpLjuTDmDlfcVUd2Oy5ZWyG2PxN+jDW3 0PQo9Tme337mJfG4s/1m72FjK7xHbPyX
|
@ -1,5 +1,5 @@
|
|||||||
Private-key-format: v1.2
|
Private-key-format: v1.2
|
||||||
Algorithm: 5 (RSASHA1)
|
Algorithm: 1 (RSA)
|
||||||
Modulus: 5EMEIsJUwWLyvMTsdfKDqkqS47kw5g5X3FVHdjsuWVshtj8Tfow1t9D0KPU5nt9+5iXxuLP9Zu9hYyu8R2z8lw==
|
Modulus: 5EMEIsJUwWLyvMTsdfKDqkqS47kw5g5X3FVHdjsuWVshtj8Tfow1t9D0KPU5nt9+5iXxuLP9Zu9hYyu8R2z8lw==
|
||||||
PublicExponent: Aw==
|
PublicExponent: Aw==
|
||||||
PrivateExponent: mCytbIGN1kH3KINITqGtHDG3Qnt17rQ6kuOE+XzJkOYpffN+dJM8Xvz0+BNMSGQClHEWQ9jNRDN5sLLXkF0ICw==
|
PrivateExponent: mCytbIGN1kH3KINITqGtHDG3Qnt17rQ6kuOE+XzJkOYpffN+dJM8Xvz0+BNMSGQClHEWQ9jNRDN5sLLXkF0ICw==
|
@ -1 +0,0 @@
|
|||||||
rp.secret-wg.org. IN KEY 256 3 5 AQPkQwQiwlTBYvK8xOx18oOqSpLjuTDmDlfcVUd2Oy5ZWyG2PxN+jDW3 0PQo9Tme337mJfG4s/1m72FjK7xHbPyX
|
|
261
httpd.pl
Executable file
261
httpd.pl
Executable file
@ -0,0 +1,261 @@
|
|||||||
|
#!/usr/local/bin/perl
|
||||||
|
# httpdc
|
||||||
|
# a completely useless tool - a dc desk calculator in the url
|
||||||
|
# 2.3.+.dc.foor.bar will print out the html page
|
||||||
|
# "5"
|
||||||
|
#
|
||||||
|
# this code assumes that a real server lurks behind port 8080 on the local host
|
||||||
|
#
|
||||||
|
use Socket;
|
||||||
|
|
||||||
|
|
||||||
|
# the port I listen to
|
||||||
|
$port=80;
|
||||||
|
|
||||||
|
# the port I redirect all other requests to
|
||||||
|
$http_port = 80 ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$AF_INET = 2 ;
|
||||||
|
|
||||||
|
$SOCK_STREAM = 1 ;
|
||||||
|
|
||||||
|
$sockaddr = 'S n a4 x8';
|
||||||
|
|
||||||
|
($name, $aliases, $proto) = getprotobyname('tcp');
|
||||||
|
|
||||||
|
|
||||||
|
$this = pack($sockaddr, $AF_INET, $port, "\0\0\0\0");
|
||||||
|
|
||||||
|
socket(S, $AF_INET, $SOCK_STREAM, $proto) || die "socket: $!";
|
||||||
|
setsockopt(S, SOL_SOCKET, SO_REUSEADDR,1) ;
|
||||||
|
|
||||||
|
bind(S,$this) || die "Bind: $!";
|
||||||
|
listen(S,5) || die "Connect: $!";
|
||||||
|
|
||||||
|
my $runas = 'nobody';
|
||||||
|
# Change effective id
|
||||||
|
$> = getpwnam($runas);
|
||||||
|
|
||||||
|
|
||||||
|
use Tie::Syslog;
|
||||||
|
my $x=tie *LOG, 'Tie::Syslog', 'daemon.info','RPHTTPD','pid','unix';
|
||||||
|
#open(LOG,">>/root/RPNS/httpdc.log");
|
||||||
|
print(LOG "RPHTTPD Server Listening on port $port\n");
|
||||||
|
select(S); $|=1;
|
||||||
|
select(LOG); $|=1;
|
||||||
|
select(STDOUT);
|
||||||
|
|
||||||
|
for ($con = 1 ; ; $con++) {
|
||||||
|
sleep 1;
|
||||||
|
($addr = accept(NS,S)) || die $!;
|
||||||
|
if (($child = fork()) == 0) {
|
||||||
|
# &open_slave() ;
|
||||||
|
# if (($child = fork()) == 0) {
|
||||||
|
# select(NS); $|=1; select(STDOUT);
|
||||||
|
# read_slave() ;
|
||||||
|
# close(NS) ;
|
||||||
|
# exit ;
|
||||||
|
# }
|
||||||
|
select(NS); $|=1; select(STDOUT);
|
||||||
|
$host = "" ;
|
||||||
|
while ($line = <NS>) {
|
||||||
|
# print (LOG "LINE: $line\n");
|
||||||
|
if ($line =~ /^GET\s+(\S*)/) {
|
||||||
|
$url = $1 ;
|
||||||
|
}
|
||||||
|
elsif ($line =~ /^Host:\s+(.*)$/) {
|
||||||
|
$host = $1 ;
|
||||||
|
$host =~ s/\r// ;
|
||||||
|
$host =~ s/\n// ;
|
||||||
|
}
|
||||||
|
push(@lines,$line) ;
|
||||||
|
if ($line =~ /^\r*\n*$/) {
|
||||||
|
if ($host =~ /^(.*)\.rp\./i) {
|
||||||
|
process_host($host, $text);
|
||||||
|
close (NS);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# &write_slave() ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
close(NS);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# &close_slave() ;
|
||||||
|
close(NS) ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
exit ;
|
||||||
|
|
||||||
|
############################
|
||||||
|
sub process_host {
|
||||||
|
my($host,$text) = @_ ;
|
||||||
|
|
||||||
|
|
||||||
|
@types = ("text/html; charset=ISO-8859-1","text/plain;
|
||||||
|
charset=ISO-8859-1","application/pdf","application/ps") ;
|
||||||
|
@gmt = gmtime(time()) ;
|
||||||
|
$day = ("Sun","Mon","Tue","Wed","Thu","Fri","Sat")[$gmt[6]];
|
||||||
|
$mon =
|
||||||
|
("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")[$gmt[4]];
|
||||||
|
$gmt[5] += 1900 ;
|
||||||
|
$datestr = sprintf("%s, %02d %s %d %02d:%02d:%02d
|
||||||
|
GMT",$day,$gmt[3],$mon,$gmt[5],$gmt[2],$gmt[1],$gmt[0]) ;
|
||||||
|
|
||||||
|
# print(LOG "file: $host -> $text\n") ;
|
||||||
|
if ($host =~ /^(.*)\.rp\./i) {
|
||||||
|
$dcargs = $1;
|
||||||
|
$dcargs =~ tr/A-Z/a-z/ ;
|
||||||
|
$dcargs =~ s/\;// ;
|
||||||
|
$dcargs =~ s/\'// ;
|
||||||
|
$dcargs =~ s/\"// ;
|
||||||
|
$dcargs =~ s/\./ / ;
|
||||||
|
$dcargs .= " p" ;
|
||||||
|
$infile = "/tmp/dci.$$" ;
|
||||||
|
open(I,">$infile") ;
|
||||||
|
print(I "$dcargs\n") ;
|
||||||
|
close(I) ;
|
||||||
|
$outfile = "/tmp/dco.$$" ;
|
||||||
|
system("/usr/bin/dc <$infile >$outfile") ;
|
||||||
|
if (!(-s $outfile)) {
|
||||||
|
open(O,">$outfile") ;
|
||||||
|
print(O "Beats me. Try using your toes as well as your fingers.\n") ;
|
||||||
|
close(O) ;
|
||||||
|
}
|
||||||
|
$fout = "/tmp/dco.$$.html" ;
|
||||||
|
open(FO,">$fout");
|
||||||
|
print(FO "<html><head><title>DC</title></head>") ;
|
||||||
|
print(FO "<body BGCOLOR=\"\#FFFFFF\">\n") ;
|
||||||
|
print(FO "<pre>\n") ;
|
||||||
|
open(I,"$outfile") ;
|
||||||
|
while ($line = <I>) { print(FO $line) ; }
|
||||||
|
close(I) ;
|
||||||
|
print(FO "</pre></body></html>\n") ;
|
||||||
|
close(FO) ;
|
||||||
|
$size = -s $fout ;
|
||||||
|
|
||||||
|
print(NS "HTTP/1.1 200 OK\n") ;
|
||||||
|
print(NS "Date: $datestr\n") ;
|
||||||
|
print(NS "Server: The Bert reverse polish server\n") ;
|
||||||
|
print(NS "Accept-Ranges: bytes\n") ;
|
||||||
|
print(NS "Content-Length: $size\n") ;
|
||||||
|
print(NS "Keep-Alive: timeout=15, max=100\n") ;
|
||||||
|
print(NS "Connection: Keep-Alive\n") ;
|
||||||
|
print(NS "Context-Type: $types[$text]\n\n") ;
|
||||||
|
|
||||||
|
# print(LOG "HTTP/1.1 200 OK\n") ;
|
||||||
|
# print(LOG "Date: $datestr\n") ;
|
||||||
|
# print(LOG "Server: The Bert reverse polish server\n") ;
|
||||||
|
# print(LOG "Accept-Ranges: bytes\n") ;
|
||||||
|
# print(LOG "Content-Length: $size\n") ;
|
||||||
|
# print(LOG "Keep-Alive: timeout=15, max=100\n") ;
|
||||||
|
# print(LOG "Connection: Keep-Alive\n") ;
|
||||||
|
# print(LOG "Context-Type: $types[$text]\n\n") ;
|
||||||
|
open(I,"$fout") ;
|
||||||
|
while ($buffer = <I>) {
|
||||||
|
print(NS $buffer) ;
|
||||||
|
# print(LOG $buffer) ;
|
||||||
|
}
|
||||||
|
print(NS "\n") ;
|
||||||
|
unlink($infile) ;
|
||||||
|
unlink($outfile) ;
|
||||||
|
unlink($fout) ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$fout = "/tmp/404.$$.txt" ;
|
||||||
|
open(FO,">$fout");
|
||||||
|
print(FO "<HTML><HEAD>\n") ;
|
||||||
|
print(FO "<TITLE>NO CLUE</TITLE>\n") ;
|
||||||
|
print(FO "</HEAD><BODY>\n") ;
|
||||||
|
print(FO "<H1>Huh?</H1>\n") ;
|
||||||
|
print(FO "Beats me. Try using your toes as well as your fingers.<p>\n") ;
|
||||||
|
print(FO "</BODY></HTML>\n") ;
|
||||||
|
close(FO) ;
|
||||||
|
$size = -s $fout ;
|
||||||
|
$fulf = $fout ;
|
||||||
|
print(NS "HTTP/1.1 200 OK\n") ;
|
||||||
|
print(NS "Date: $datestr\n") ;
|
||||||
|
print(NS "Server: The Bert reverse polish server\n") ;
|
||||||
|
print(NS "Content-Length: $size\n") ;
|
||||||
|
print(NS "Keep-Alive: timeout=15, max=100\n") ;
|
||||||
|
print(NS "Connection: Keep-Alive\n") ;
|
||||||
|
print(NS "Content-Type: text/html; charset=iso-8859-1\n\n") ;
|
||||||
|
# print(LOG "HTTP/1.1 200 OK\n") ;
|
||||||
|
# print(LOG "Date: $datestr\n") ;
|
||||||
|
# print(LOG "Server: The Bert reverse polish server\n") ;
|
||||||
|
# print(LOG "Content-Length: $size\n") ;
|
||||||
|
# print(LOG "Keep-Alive: timeout=15, max=100\n") ;
|
||||||
|
# print(LOG "Connection: Keep-Alive\n") ;
|
||||||
|
# print(LOG "Content-Type: text/html; charset=iso-8859-1\n\n") ;
|
||||||
|
open(I,"$fulf") ;
|
||||||
|
while ($buffer = <I>) { print(NS $buffer) ; }
|
||||||
|
unlink($fulf) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub open_slave {
|
||||||
|
chop($http_hostname = `bert.secret-wg.org`);
|
||||||
|
$http_defhost = $http_hostname ;
|
||||||
|
$HTTP_AF_INET = 2 ;
|
||||||
|
$HTTP_SOCK_STREAM = 1 ;
|
||||||
|
$http_sockaddr = 'S n a4 x8';
|
||||||
|
|
||||||
|
|
||||||
|
($http_name, $http_aliases, $http_proto) = getprotobyname('tcp');
|
||||||
|
($http_name, $http_aliases, $http_type, $http_len, $http_thisaddr) =
|
||||||
|
gethostbyname($http_hostname);
|
||||||
|
(@http_v) = unpack('C4', $http_thisaddr);
|
||||||
|
($http_name, $http_aliases, $http_type, $http_len, $http_thataddr) =
|
||||||
|
gethostbyname($http_defhost);
|
||||||
|
(@http_w) = unpack('C4', $http_thataddr);
|
||||||
|
$http_this = pack($http_sockaddr, $HTTP_AF_INET, 0, $http_thisaddr);
|
||||||
|
$http_that = pack($http_sockaddr, $HTTP_AF_INET, $http_port,
|
||||||
|
$http_thataddr);
|
||||||
|
|
||||||
|
socket(H, $HTTP_AF_INET, $HTTP_SOCK_STREAM, $http_proto) || die "socket:
|
||||||
|
$!";
|
||||||
|
bind(H, $http_this) || die "bind: $!";
|
||||||
|
connect(H, $http_that) || die "connect: $!";
|
||||||
|
select(H) ; $| = 1 ; select(STDOUT);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sub read_slave {
|
||||||
|
while ($len = sysread(H, $buffer,16384)) {
|
||||||
|
print(NS $buffer);
|
||||||
|
print(LOG "$con:<-\t$buffer");
|
||||||
|
$offset = 0 ;
|
||||||
|
while($len) {
|
||||||
|
$written = syswrite(NS, $buffer, $len, $offset);
|
||||||
|
$offset += $written ;
|
||||||
|
$len -= $written ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close(H) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub write_slave {
|
||||||
|
select(H); $|=1; select(STDOUT);
|
||||||
|
foreach $line (@lines) {
|
||||||
|
print(LOG "$con:->\t$line");
|
||||||
|
print(H $line) ;
|
||||||
|
}
|
||||||
|
$#lines = -1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub close_slave {
|
||||||
|
if ($#lines >= 0) {
|
||||||
|
&write_slave() ;
|
||||||
|
}
|
||||||
|
close(H) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
67
ns.pl
67
ns.pl
@ -1,27 +1,22 @@
|
|||||||
#!/usr/local/bin/perl -Tw
|
#!/usr/bin/perl -Tw
|
||||||
use Proc::Daemon;
|
# $Id: ns.pl,v 1.6 2005/10/11 11:44:28 olaf Exp $
|
||||||
|
|
||||||
use Net::DNS;
|
use Net::DNS;
|
||||||
use Net::DNS::Nameserver;
|
use Net::DNS::Nameserver;
|
||||||
use Net::DNS::SEC;
|
use Net::DNS::SEC;
|
||||||
use File::Slurp;
|
|
||||||
use strict;
|
use strict;
|
||||||
use Math::RPN;
|
use Math::RPN;
|
||||||
my $versionstring='"BSRPDNSC version 0.2.5"';
|
my $versionstring='"BSRPDNSC version 0.2.4"';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
my $rpdomain=lc "rp.secret-wg.org.";
|
my $rpdomain=lc "rp.secret-wg.org.";
|
||||||
my $rp_ns_name=lc "ns.rp.secret-wg.org";
|
my $rp_ns_name=lc "ns.rp.secret-wg.org";
|
||||||
my $rp_ns_address="185.49.141.200";
|
my $rp_ns_address="213.154.224.43";
|
||||||
my $rp_ns_bind_address="185.49.141.200";
|
my $rp_ns_bind_address="213.154.224.43";
|
||||||
my $rp_ns_port="53";
|
my $rp_ns_port="53";
|
||||||
my $reply_ttl=10;
|
my $reply_ttl=10;
|
||||||
my $sig_val=60;
|
my $sig_val=60;
|
||||||
my $keypath="/home/olaf/RPNS/Krp.secret-wg.org.+005+27900.private";
|
my $keypath="/home/olaf/RPNS/Krp.secret-wg.org.+001+27900.private";
|
||||||
my $pubpath="/home/olaf/RPNS/Krp.secret-wg.org.+005+27900.key";
|
|
||||||
|
|
||||||
|
|
||||||
my $www_address="193.0.4.49";
|
my $www_address="193.0.4.49";
|
||||||
|
|
||||||
my $timeout=$sig_val*60-3*$reply_ttl; # resigns itself after so often
|
my $timeout=$sig_val*60-3*$reply_ttl; # resigns itself after so often
|
||||||
@ -29,21 +24,6 @@ my $timeout=$sig_val*60-3*$reply_ttl; # resigns itself after so often
|
|||||||
print "Using Net::DNS version ".$Net::DNS::VERSION."\n";
|
print "Using Net::DNS version ".$Net::DNS::VERSION."\n";
|
||||||
print "Using Net::DNS::SEC version ".$Net::DNS::SEC::VERSION."\n";
|
print "Using Net::DNS::SEC version ".$Net::DNS::SEC::VERSION."\n";
|
||||||
|
|
||||||
|
|
||||||
my $dnskeystring= read_file($pubpath);
|
|
||||||
# File should contain one key per line (not tested)
|
|
||||||
|
|
||||||
my $keyRR = Net::DNS::RR->new( $dnskeystring);
|
|
||||||
my $ds = Net::DNS::RR::DS->create(
|
|
||||||
$keyRR,
|
|
||||||
digtype => 'SHA256',
|
|
||||||
ttl => 3600
|
|
||||||
);
|
|
||||||
print "DS record for parent: \n " .$ds->string() ."\n";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
my %sigargs;
|
my %sigargs;
|
||||||
$sigargs{"ttl"} = $reply_ttl;
|
$sigargs{"ttl"} = $reply_ttl;
|
||||||
$sigargs{"sigval"}= $sig_val;
|
$sigargs{"sigval"}= $sig_val;
|
||||||
@ -57,9 +37,6 @@ use Tie::Syslog;
|
|||||||
my $x=tie *STDOUT, 'Tie::Syslog', 'daemon.info','RPNS','pid','unix';
|
my $x=tie *STDOUT, 'Tie::Syslog', 'daemon.info','RPNS','pid','unix';
|
||||||
|
|
||||||
|
|
||||||
my $daemon = Proc::Daemon->new();
|
|
||||||
my $childPID= $daemon->Init;
|
|
||||||
|
|
||||||
print "Restarting the server";
|
print "Restarting the server";
|
||||||
resign();
|
resign();
|
||||||
alarm $timeout;
|
alarm $timeout;
|
||||||
@ -80,18 +57,18 @@ $SIG{ALRM} = sub { print "alarm after $timeout seconds (to regenerate SIGs)\n";
|
|||||||
|
|
||||||
|
|
||||||
sub resign {
|
sub resign {
|
||||||
|
|
||||||
|
|
||||||
@keyRR= (
|
@keyRR= (
|
||||||
$keyRR
|
Net::DNS::RR->new( "rp.secret-wg.org. 10 IN DNSKEY 256 3 1 AQPkQwQiwlTBYvK8xOx18oOqSpLjuTDmDlfcVUd2Oy5ZWyG2PxN+jDW3 0PQo9Tme337mJfG4s/1m72FjK7xHbPyX")
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
$keySIGRR= create Net::DNS::RR::RRSIG(\@keyRR,
|
$keySIGRR= create Net::DNS::RR::RRSIG(\@keyRR,
|
||||||
$private,
|
$private,
|
||||||
%sigargs,
|
%sigargs,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@versionRR=(
|
@versionRR=(
|
||||||
Net::DNS::RR->new('version.bind 0 CH TXT '.$versionstring),
|
Net::DNS::RR->new('version.bind 0 CH TXT '.$versionstring),
|
||||||
@ -444,17 +421,15 @@ sub reply_handler {
|
|||||||
return ($rcode, \@ans, \@auth, \@add);
|
return ($rcode, \@ans, \@auth, \@add);
|
||||||
}
|
}
|
||||||
|
|
||||||
unless ( $childPID ) {
|
|
||||||
|
if ($ns) {
|
||||||
|
$ns->main_loop;
|
||||||
if ($ns) {
|
}
|
||||||
$ns->main_loop;
|
else {
|
||||||
}
|
die "couldn't create nameserver object\n";
|
||||||
else {
|
}
|
||||||
die "couldn't create nameserver object\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user