Commit cd2bc612 authored by Olav Kvittem's avatar Olav Kvittem
Browse files

tcpdump igmp support; add to sudoers

parent 3aeba608
......@@ -9,7 +9,7 @@ Scripts to run rude/crude, traceroute and collect results
apt install traceroute tcptraceroute
apt install libpcap-dev
git clone -b realtime git@scm.uninett.no:rude/rude.git
git clone https://scm.uninett.no/rude/rude.git
compile and link up in dragonlab/bin
ln -s ~/rude/rude/rude .
ln -s ~/rude/crude/crude .
......
......@@ -43,7 +43,7 @@ if ! pgrep -u $USER -f $vmstat >/dev/null; then
$vmstat 2> /dev/null > /dev/null&
fi
if ! pgrep -u $USER -f /usr/sbin/tcpdump >/dev/null; then
$HOME/dragonlab/bin/start-icmp
if ! pgrep -u root -f '/usr/sbin/tcpdump.* icmp' >/dev/null; then
$HOME/dragonlab/bin/start-icmp.sh
fi
echo add to /etc/sudoers.d/dragonlab
echo $USER ALL=(ALL) NOPASSWD: /usr/sbin/tcpdump
echo $USER 'ALL=(ALL) NOPASSWD: /usr/sbin/tcpdump'
echo touch $HOME/dragonlab/etc/tcpdump-imcp
\ No newline at end of file
#! /bin/sh
# dump igmp traffic to catch unreachables
. $HOME/dragonlab/etc/start.cfg
# pick interface with default route
IF=`ip route get 158.38.62.1 | perl -ne 'print $1 if / dev (\w+) /'`
if test "$IF" != "" && -f $HOME/dragonlab/etc/tcpdump-imcp ; then
tomidnight=$((`date --date 'tomorrow 00:00' +%s`-`date +%s` - 1))
sudo /usr/sbin/tcpdump -i $IF -G $tomidnight -W 1 -w ${logpath}/icmp-%F-%T.pcap icmp 2>> ${logpath}/icmp.log
fi
......@@ -105,10 +105,12 @@ close $rude;
foreach $name ( keys %port){
if ( (! $target) || ( $target eq $name ) ){
$outdir=$name;
open ( $start, ">$outdir/start.cfg") || die "Could not open ${outdir}/start.cfg : $!" ;
printf $start "crude_port=%s\n", $port{$name};
printf $start "%s", $startcfg;
close $start;
if ( -d $outdir ){
open ( $start, ">$outdir/start.cfg") || die "Could not open ${outdir}/start.cfg : $!" ;
printf $start "crude_port=%s\n", $port{$name};
printf $start "%s", $startcfg;
close $start;
}
}
}
......@@ -121,9 +123,11 @@ foreach $src ( keys %tracetarget ){
} else {
$outdir=$src;
}
open TRACE, ">$outdir/trace.cfg" || die "Could not open $outdir/start.cfg : $!" ;
print TRACE join("\n", @{$tracetarget{$src}} );
close TRACE;
if ( -d $outdir ){
open TRACE, ">$outdir/trace.cfg" || die "Could not open $outdir/start.cfg : $!" ;
print TRACE join("\n", @{$tracetarget{$src}} );
close TRACE;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment