projects
/
bak-git.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
37e41a4
)
added peer IP address validation
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sat, 29 Aug 2020 06:20:18 +0000
(08:20 +0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sat, 29 Aug 2020 06:20:18 +0000
(08:20 +0200)
bak-git-server.pl
patch
|
blob
|
history
diff --git
a/bak-git-server.pl
b/bak-git-server.pl
index
fac76b7
..
b4c7eec
100755
(executable)
--- a/
bak-git-server.pl
+++ b/
bak-git-server.pl
@@
-180,7
+180,14
@@
sub mkbasedir {
while (my $client = $server->accept()) {
my $line = <$client>;
chomp($line);
- warn "<<< $line\n";
+
+ my $peerhost = $client->peerhost;
+ if ( $peerhost !~ m/^(10\.13\.37\.|10\.60\.0\.)/ ) {
+ print $client "$peerhost not allowed\n";
+ next;
+ }
+
+ warn "<<< $peerhost $line\n";
my ($user,$hostname,$pwd,$command,$rel_path,$message) = split(/\s+/,$line,6);
$hostname =~ s/\..+$//;