fbb start file for linux

Fbb start file

#! /bin/bash
### BEGIN INIT INFO
# Provides:          F6FBB Start-up
# Required-Start:    $remote_fs $syslog $network
# Required-Stop:     $remote_fs $syslog $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: FBB start up
# Description:       This script provides the start/stop control
#                    for the FBB BBS Packet Radio BBS.
### END INIT INFO

export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/etc/ax25:/usr/local/etc/ax25:/usr/local/xnet

base=${0##*/}
link=${base#*[SK][0-9][0-9]}

test $link = $base && START_FBB=yes
test "$START_FBB" = yes || exit 0
test -x /usr/local/sbin/fbb || exit 0

return="Done"
case "$1" in
start)
        echo "Starting FBB daemon "
        if [ -f /usr/local/etc/ax25/fbb/fbb.conf ] ; then
                /usr/local/sbin/fbb -s -a -l /etc/ax25/fbb.log || return=$rc_failed
        else
                echo  "/usr/local/etc/ax25/fbb/fbb.conf file not found"
                return="Failed"
        fi
        echo  " $1 $return"
        ;;
stop)
        echo "Shutting down FBB script"
        killall -KILL fbb || return="Failed"
        echo "Shutting down FBB daemon"
        killall -KILL xfbbd || return="Failed"
        sleep 4
        echo  " $1 $return"
        ;;
restart|reload)
        $0 stop && $0 start
        ;;
status)
        echo -n "Checking for FBB daemon: "
        PID=`/bin/pidof -x xfbbd`
        if [ -n "$PID" ]; then
                echo  "FBB is up"
         else
                echo "No FBB daemon"
        fi
        ;;


*)
        echo "Usage: $0 {start|stop|status|restart}"
        exit 1
esac

exit 0

ax25 start file

Ax25 start file die ik gebruik voor pi1lap/pi8lap/pd2lt
(nog toe te voegen start/stop/status)

#!/bin/sh
# Start AX25/Netrom networking daemons.
# Script written and modified by Niels pd2lt
# Date of last modification: 03-11-2017

### BEGIN INIT INFO
# Provides:       ax25
# Required-Start: $network $remote_fs $syslog
# Required-Stop:  $network $remote_fs $syslog
# Default-Start:  2 3 4 5
# Default-Stop:   0 1 6
# Description:    AX25 server
### END INIT INFO

set +e   # Don't exit on error status

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/xnet:/usr/local/etc/ax25

DESC="AX25 server"

ENABLED=1

        modprobe mkiss
        modprobe ax25
        modprobe netrom
        modprobe rose


        # Dual port TNC KPC-9612
        mkiss -s 9600 -x 2 /dev/ttyUSB0 > /tmp/unix98
        export PTS0=`more /tmp/unix98 | grep -w /dev | cut -b -11`
        export PTS1=`more /tmp/unix98 | grep -w /dev | cut -b 12-`
        sleep 1
        # Port 1k2 144.850Mhz
        kissattach $PTS0 ax0 > /tmp/ax25-config.tmp
        awk '/device/ { print $7 }' /tmp/ax25-config.tmp > /tmp/ax25-config-tmp
        read Device < /tmp/ax25-config-tmp

        ifconfig $Device 44.137.31.73 netmask 255.255.255.224
        sleep 2
        # Port 9k6 430.950Mhz
        kissattach $PTS1 ax1 > /tmp/ax25-config.tmp
        awk '/device/ { print $7 }' /tmp/ax25-config.tmp > /tmp/ax25-config-tmp
        read Device < /tmp/ax25-config-tmp

        ifconfig $Device 44.137.31.73 netmask 255.255.255.224
        sleep 5

        # attach rose port
        rsattach rose0
        ifconfig rose0 44.137.31.73 netmask 255.255.255.224
        rsparms -call PI1LAP-10

        # link local pi8lap (xnet)
        tmpfile="/tmp/$$.startax2.pts"
        kissnetd -p 2 > "$tmpfile" &
        sleep 2
        attachthem () {
                read PTS1 PTS2
                kissattach -l $PTS1 ax2 44.137.31.73
                ifconfig ax2 44.137.31.73 netmask 255.255.255.224 up
                sleep 1
                sed -i "s,attach sdev3 kiss 3 1 19200 /dev/.*$,attach sdev3 kiss 3 1 19200 $PTS2," /usr/local/xnet/AUTOBOOT.NET
        }

        tail -n 1 $tmpfile | attachthem
        rm $tmpfile
        sleep 3

        # Link local pi1lap-4 (xnet)
        tmpfile="/tmp/$$.startax3.pts"
        kissnetd -p 2 > "$tmpfile" &
        sleep 2
        attachthem () {
                read PTS1 PTS2
                kissattach -l $PTS1 ax3 44.137.31.73
                ifconfig ax3 44.137.31.73 netmask 255.255.255.224 up
                sleep 1
                sed -i "s,attach sdev4 kiss 4 1 19200 /dev/.*$,attach sdev4 kiss 4 1 19200 $PTS2," /usr/local/xnet/AUTOBOOT.NET
        }

        tail -n 1 $tmpfile | attachthem
        rm $tmpfile
        sleep 3

        # create slip link Linux <-> Xnet
        socat -d -d -ly PTY,link=/dev/ttyq1 PTY,link=/dev/ptyq1 &
        sleep 2
                slattach -s 38400 -p slip /dev/ptyq1 &
                sleep 1
                ifconfig sl0 44.137.31.69 netmask 255.255.255.255 pointopoint 44.137.31.70 mtu 236 up
                sleep 1

        # create axudp device
        socat -d -d -ly PTY,link=/dev/ttyq2 PTY,link=/dev/ptyq2 &
        sleep 2
                kissattach -m 256 /dev/ptyq2 ax4 44.137.31.73
                ax25udp -c /etc/ax25/ax25ipd-10093.conf > /tmp/axudp
                ifconfig ax4 44.137.31.73 netmask 255.255.255.224 up
        sleep 1

        # create axip device
        socat -d -d -ly PTY,link=/dev/ttyq3 PTY,link=/dev/ptyq3 &
        sleep 2
                kissattach -m 256 /dev/ptyq3 ax5 44.137.31.73
                ax25ipd -c /etc/ax25/ax25ipd-axip.conf > /tmp/axip
                ifconfig ax5 44.137.31.73 netmask 255.255.255.224 up
        sleep 1

        # create socat device (jnos-uro)
        socat -d -d -ly PTY,link=/dev/ttyq4 PTY,link=/dev/ptyq4 &
        sleep 2
                kissattach -m 256 /dev/ptyq4 ax6 44.137.31.73
                ifconfig ax6 44.137.31.73 netmask 255.255.255.224 up
        sleep 1

        # MFnos running in DOSEmu
        # Set the comport in de file /etc/dosemu/dosemu.comf $_com1 = "dev/ttyq5"
        #socat -d -d -ly PTY,link=/dev/ttyq5 PTY,link=/dev/ptyq5 &
        #       slattach -n -q -p slip -s 38400 /dev/ptyq5 &
        #sleep 2
        # KISS inteface for MFnos / slip
        #       kissattach /dev/ptyq5 ax6 44.137.31.73
        #       kissparms -p ax6 -c 1 -f y -t 10 -s 100 -r 255
        #       axparms -setcall ax6 pi1lap-10
        #
        #       ifconfig ax3 44.88.0.9 netmask 255.255.255.224 up
        #sleep 2

        # create nr0 device (lapuro/pi1lap-5) uronode
                ifconfig nr0 down
                nrattach -i 44.137.31.73 -m 512 nr0
                ifconfig nr0 44.137.31.73 netmask 255.255.255.224 hw netrom PI1LAP-5 up

        # create nr1 device (lapbbs/pi8lap) f6fbb
                ifconfig nr1 down
                nrattach -i 44.137.31.73 -m 512 nr1
                ifconfig nr1 44.137.31.73 netmask 255.255.255.224 hw netrom PI8LAP up

        # create nr2 device (lapdx/pi1lap-4) dxspider
                ifconfig nr2 down
                nrattach -i 44.137.31.73 -m 512 nr2
                ifconfig nr2 44.137.31.73 netmask 255.255.255.224 hw netrom PI1LAP-4 up

        # create nr3 device (lappac/pi1lap-7) fpac
                ifconfig nr3 down
                nrattach -i 44.137.31.73 -m 512 nr3
                ifconfig nr3 44.137.31.73 netmask 255.255.255.224 hw netrom PI1LAP-7 up

        # start xnet
        cd /usr/local/xnet
        rm *.CFG &> /dev/null
        sleep 2
        ./linuxnet < /dev/tty2 > /dev/tty2 2>&1 &
        ./rstatrxd /var/www/cgi-bin/postat/ &> /dev/null &
        sleep 2

        # route
        # Xnet route
        ip route add 44.137.31.70 dev sl0 table 44 src 44.137.31.69
        # Mfnos route to 192.168.1.110
        #route add 44.137.31.75 gw 192.168.1.112

        # beacons
        beacon -c PI1LAP-15 -t 10 -d  ID ax0 "Network node PI1LAP-15 Zeeland, JO11VN" &
        beacon -c PI1LAP-15 -t 10 -d  ID ax1 "Network node PI1LAP-15 Zeeland, JO11VN" &
        beacon -c PI1LAP-15 -t 10 -d  ID ax2 "Network node PI1LAP-15 Zeeland, JO11VN" &
        beacon -c PI1LAP-15 -t 10 -d  ID ax3 "Network node PI1LAP-15 Zeeland, JO11VN" &

        # start ax25 deamons
        /usr/local/sbin/ax25d
        /usr/local/sbin/mheardd
        /usr/local/sbin/ax25rtd
        /usr/local/sbin/flexd
        /usr/local/sbin/netromd -c -i -p 1 -t 15
        fbb -s -a -l /etc/ax25/fbb.log

ax25ipd-axip.conf

On my system i use axip and axudp. I start ax25ipd twice with different configuration files.

Example for a axip port

Start
ax25ipd -c /etc/ax25/ax25ipd-axip.conf

# ax25ipd configuration file Axip
#
socket ip
mode tnc
mycall pi1lap-9
device /dev/ttyq3
speed 19200
#
# loglevel 0 - no output
# loglevel 1 - config info only
# loglevel 2 - major events and errors
# loglevel 3 - major events, errors, and AX25 frame trace
# loglevel 4 - all events
# log 0 for the moment, syslog not working yet ...
#
loglevel 2
broadcast NODES

route n1uro 44.x.x.x b
route pi1bdg 44.x.x.x b

 

ax25ipd-10093.conf

On my system i use axip and axudp. I start ax25ipd twice with different configuration files.

Example for a axudp port on 10093

Start
ax25ipd -c /etc/ax25/ax25ipd-10093.conf

# ax25ipd configuration file 10093 udp
#
socket udp 10093
mode tnc
mycall pi1lap-8
device /dev/ttyq2
speed 19200
#
# loglevel 0 - no output
# loglevel 1 - config info only
# loglevel 2 - major events and errors
# loglevel 3 - major events, errors, and AX25 frame trace
# loglevel 4 - all events
# log 0 for the moment, syslog not working yet ...
#
loglevel 2
broadcast NODES

route sv1cmg-4 44.x.x.x udp 1093 b
route pd2lt-8 44.x.x.x udp 10093 b

ax25d.conf

ax25d.conf example file

# /etc/ax25/ax25d.conf
#
# ax25d Configuration File.
#
# AX.25 Ports begin with a '['.
#
[pi1lap-15 via ax0]
parameters      7   4   *  *  *  *  *
NOCALL          *   *   *  *  *  *  L
default         7   2   2  60  300  5  -   root /usr/local/sbin/uronode uronode
#
[lapuro via ax0]
parameters      7   4   *  *  *  *  *
NOCALL          *   *   *  *  *  *  L
default         7   2   2  60  300  5  -   root /usr/local/sbin/uronode uronode
#
[pi1lap-15 via ax1]
parameters      7   4   *  *  *  *  *
NOCALL          *   *   *  *  *  *  L
default         7   2   2  60  300  5  -   root /usr/local/sbin/uronode uronode
#
[lapuro via ax1]
parameters      7   4   *  *  *  *  *
NOCALL          *   *   *  *  *  *  L
default         7   2   2  60  300  5  -   root /usr/local/sbin/uronode uronode
#
[pi1lap-15 via ax2]
parameters      7   4   *  *  *  *  *
NOCALL          *   *   *  *  *  *  L
default         7   2   2  60  300  5  -   root /usr/local/sbin/uronode uronode
#
[lapuro via ax2]
parameters      7   4   *  *  *  *  *
NOCALL          *   *   *  *  *  *  L
default         7   2   2  60  300  5  -   root /usr/local/sbin/uronode uronode
#
[pi1lap-15 via ax3]
parameters      7   4   *  *  *  *  *
NOCALL          *   *   *  *  *  *  L
default         7   2   2  60  300  5  -   root /usr/local/sbin/uronode uronode
#
[lapuro via ax3]
parameters      7   4   *  *  *  *  *
NOCALL          *   *   *  *  *  *  L
default         7   2   2  60  300  5  -   root /usr/local/sbin/uronode uronode
#
[pi1lap-15 via ax4]
parameters      7   4   *  *  *  *  *
NOCALL          *   *   *  *  *  *  L
default         7   2   2  60  300  5  -   root /usr/local/sbin/uronode uronode
#
[lapuro via ax4]
parameters      7   4   *  *  *  *  *
NOCALL          *   *   *  *  *  *  L
default         7   2   2  60  300  5  -   root /usr/local/sbin/uronode uronode
#
[pi1lap-15 via ax5]
parameters      7   4   *  *  *  *  *
NOCALL          *   *   *  *  *  *  L
default         7   2   2  60  300  5  -   root /usr/local/sbin/uronode uronode
#
[lapuro via ax5]
parameters      7   4   *  *  *  *  *
NOCALL          *   *   *  *  *  *  L
default         7   2   2  60  300  5  -   root /usr/local/sbin/uronode uronode
#
[PI1LAP-7 via ax0]
NOCALL * * * * * * L
default    * * * * * * -    root /usr/local/sbin/fpacnode fpacnode -q %S
#
[LAPPAC via ax0]
NOCALL * * * * * * L
default    * * * * * * -    root /usr/local/sbin/fpacnode fpacnode -q %S
#
[PI1LAP-7 via ax1]
NOCALL * * * * * * L
default    * * * * * * -    root /usr/local/sbin/fpacnode fpacnode -q %S
#
[LAPPAC via ax1]
NOCALL * * * * * * L
default    * * * * * * -    root /usr/local/sbin/fpacnode fpacnode -q %S
#
[PI1LAP-4 via ax0]
parameters    2 1   6  900 *  15  0
NOCALL *  *  *  *  *  *  L
default  * * * * * *  - sysop /spider/src/client client %s ax25
#
[LAPDX via ax0]
parameters    2 1   6  900 *  15  0
NOCALL *  *  *  *  *  *  L
default  * * * * * *  - sysop /spider/src/client client %s ax25
#
[PI1LAP-4 via ax1]
parameters    2 1   6  900 *  15  0
NOCALL *  *  *  *  *  *  L
default  * * * * * *  - sysop /spider/src/client client %s ax25
#
[LAPDX via ax1]
parameters    2 1   6  900 *  15  0
NOCALL *  *  *  *  *  *  L
default  * * * * * *  - sysop /spider/src/client client %s ax25
#
[PI1LAP-4 via ax2]
parameters    2 1   6  900 *  15  0
NOCALL *  *  *  *  *  *  L
default  * * * * * *  - sysop /spider/src/client client %s ax25
#
[LAPDX via ax2]
parameters    2 1   6  900 *  15  0
NOCALL *  *  *  *  *  *  L
default  * * * * * *  - sysop /spider/src/client client %s ax25
#
[PI1LAP-4 via ax3]
parameters    2 1   6  900 *  15  0
NOCALL *  *  *  *  *  *  L
default  * * * * * *  - sysop /spider/src/client client %s ax25
#
[LAPDX via ax3]
parameters    2 1   6  900 *  15  0
NOCALL *  *  *  *  *  *  L
default  * * * * * *  - sysop /spider/src/client client %s ax25
#
#
# NET/ROM Ports begin with a '<'.
#
#
<nr2>
parameters 1  10 * * * * *
NOCALL     *  *  * * * * L
default    *  *  * * * * - sysop /spider/src/client client %s ax25
#
<nr0>
parameters 1  10 * * * 3 *
NOCALL     *  *  *  *  *  *  L
default    *  *  *  *  *  *  0  root  /usr/local/sbin/uronode  uronode
#
<nr1>
default  * * * * * *  * root  /usr/local/sbin/xfbbC -c  -i %S
#
<nr3>
parameters      1       10      *       *       *       *       *
NOCALL          *       *       *       *       *       *       L
default    * * * * * * -    root /usr/local/sbin/fpacnode fpacnode -q %S
#
{PI1LAP-15 via rose0}
default  * * * * * *   0    root /usr/local/sbin/uronode uronode

axports

axports file

# /etc/ax25/axports
#
# The format of this file is:
#
# name  callsign        speed   paclen  window  description
# ----- -----------     ------- ------- ------- ---------------------------
ax0     PI1LAP-1        9600    128     4       144.850Mhz 1k2
ax1     PI1LAP-2        9600    128     4       430.950Mhz 9k6
ax2     PI1LAP-3        19200   256     4       Link local BBS pi8lap
ax3     PI1LAP-6        19200   256     4       Link local Dx pi1lap-4
ax4     PI1LAP-8        19200   256     2       AX25/udp via pi1lap-8
ax5     PI1LAP-9        19200   256     2       AX25/ip via pi1lap-9
ax6     PD9Q-7          19200   256     2       Link local Jnos pd9q
rose0   PI1LAP-11       9600    128     4       Rose port

 

Linfbb port.sys

Voorbeeld van port.sys die ik gebruik voor pi8lap

# BBS port.sys
#
# Number of Com Ports (not including Com 0) and TNCs
  3      10
#
# Interface 7 = TCPIP
# Interface 9 = LINUX
#
#Com Interface Adress (Hex)  Baud
 1   9           0       115200
 2   9        189C         0
 3   9        189D:189E:77       0
#
# Maxframe: The maximum number of frames the TNC will send at a time.
# NbFwd   : Number of channels for OUTGOING forward at the same time.
# MxBloc  : Size of forward-block in Kb.
#
# M/P-Fwd : Minute of the hour for start of forward, and period
#           (how many minutes between each forward-start).
# Mode    : One of these:
#           B : BBS-mode.
#           G : "Guest"-mode.
#           U : Normal-mode.
# Type host-mode, one of these:
#           D : WA8DED
#           K : KAM hostmode.
#           M : Telephone-modem.
#           P : PK-232
#           Q : BPQ v 4.x
# Addition: One of these letters can be used too:
#           L : Send unproto beacon after each arriving mail.
#           Y : Yapp allowed on this QRG.
#           W : Gateway allowed TO this QRG.
#           R : Read-Only acces.
#           E : Recommanded by JP F6FBB
#
# Freq.   : Text to describe this port (max 9 characters, no space)
# Same number of lines as number of TNCs.
#
#TNC NbCh Com MultCh   Pacln Maxfr NbFwd MxBloc M/P-Fwd  Mode  Freq
  0   0    0   0        0     0     0     0      00/01   ----  File-fwd.
  1   4    1   ax0      128   4     2     10     15/60   XULWY 144.850
  2   4    1   ax1      128   4     2     10     15/60   XULWY 430.950
  3   4    1   ax2      128   4     2     10     15/60   XULWY Node
  4   10   2   0        250   7     4     10     15/15   TUY   Telnet
  5   10   1   nr1      250   4     2     10     30/15   XUWY  NetRom
  6   10   3   0        250   7     4     10     00/10   SU    Pop/smtp
  7   10   1   rose0    250   4     4     10     30/15   XUWY  Rose
  8   10   1   ax4      250   4     4     10     30/15   XUWY  Axudp
  9   10   1   ax5      250   4     4     10     30/15   XUWY  Axip
 10   10   1   ax6      250   4     4     10     30/15   XUWY  Jnos
#
# Special callsigns and modes for some channels
# TNC Nbs Callsign-SSID Mode
# 1    2   XXXXX-1       B
#
# End of file

 

Allowing traceroutes to succeed with iptables

Traceroute from Windows machines typically uses ICMP Type 8 packets.  Traceroute from Unixlike machines typically uses UDP packets with sequentially increasing destination ports, from 33434 to 33534.  So your server (the traceroute destination) must not drop incoming ICMP Type 8 or UDP 33434:33534.

Here’s where it gets tricky: it really doesn’t need to accept those packets either, which the vast majority of sites addressing this issue recommends.  It just needs to be able to reject them, which won’t happen if they’re being dropped.  If you implement the typical advice – accepting those packets – traceroute basically ends up sort of working by accident: those ports shouldn’t be in use by any running applications, and since nothing is monitoring them, the server will issue an ICMP Type 3 response (destination unreachable).  However, if you’re accepting packets to these ports, then a rogue application listening on those ports also becomes reachable – which is the sort of thing your firewall should be preventing in the first place.

The good news is, DROP and ACCEPT aren’t your only options – you can REJECT these packets instead, which will do exactly what we want here: allow traceroutes to work properly without also potentially enabling some rogue application to listen on those UDP ports.

So all you really need on your server to allow incoming traceroutes to work properly is:

# allow ICMP Type 8 (ping, ICMP traceroute)
-A INPUT -p icmp --icmp-type 8 -j ACCEPT
# enable UDP traceroute rejections to get sent out
-A INPUT -p udp --dport 33434:33523 -j REJECT