Re: listen on tcp port and log input ??
Marcel Welschbillig <email@example.com> writes:
> Dose anybody know of any programs i could use to open a port on a
> debian box and log the data that comes in to a file ??
> What i want to do is have a CISCO router send data that it recieves on
> an AUX port to a tcp port on a linux machine and log the data to a
> file. The data will be PBX billing data from a remote site.
> Any clues would be great !
$ port="the port you want your cisco box to connect to"
$ host="the IP address your cisco box is going to be connecting from"
$ cat > /usr/local/bin/cisco-log <<EOD
exec 2> >(while read line; do logger -i "\$line"; done)
exec cat >> /tmp/cisco-log
$ cat >> /etc/services <<EOD
cisco-log $port/tcp # Cisco log
$ cat >> /etc/hosts.allow <<EOD
$ cat >> /etc/hosts.deny <<EOD
$ cat >> /etc/inetd.conf <<EOD
cisco-log stream tcp wait nobody /usr/sbin/tcpd /usr/local/bin/cisco-log
$ /etc/init.d/inetd reload
Here you go.
Note that if you type in the script in an editor, don't escape the
dollar in $line. It's escaped to avoid expansion in the here-document.