Jnos start with screen

Jimmy K3CHB, Was looking at how he could get a restart option in Jnos in combination with “screen”.

Below how he did it.

Startnos

#!/bin/bash
echo "Starting [JNOS-2.0n.beta-IHM$]"
screen -d -m -S jnos-console ./nos.loop exit 0

Nos.loop

#!/bin/bash
# JNOS 2.0 Loop script by K3CHB

exit_code=-1
killall -KILL jnos 2> /dev/null
 
while [ $exit_code -ne 0 ]
do
     cd /jnos
     rm -f /jnos/spool/mqueue/*.lck 2> /dev/null
     rm -f /jnos/spool/mail/*.lck 2> /dev/null
     rm -f /jnos/spool/ptmx_direwolf.cfg 2> /dev/null
     sleep 2
     grep -o "/dev/pts/." /jnos/direwolf.log > /jnos/spool/ptmx_direwolf.cfg 
     sleep 2
     export TZ=EST5EDT
     export TERM=xterm-color
     /jnos/jnos -g2 -i -d/jnos && exit_code=0
done
 
exit 0

 

Jnos NNTP(s) Server

Jean VE2PKT helpt me to get things going. Thank you Jean. I really appreciate it.

I first have to compile a new Jnos version with the NNTP(s) enabled, edit your config.h and define NNTPS.
(#define NNTPS   /* Netnews client and server */)
I had problems if I wanted to connect the NNTP server. Jnos crached right away. After a distro update of my linux version from “Stretch” to “Buster” all went fine.

Autoexec.nos

# NNTP server/client
start nntp
nntp profile fullname "Niels PD9Q"
nntp profile host jnos.packet-radio.nl
nntp profile organ "Amateur Radio"
nntp profile reply [email protected]
nntp profile user pd9q
#
nntp access off
nntp firstpoll 5
nntp ihave 0
nntp lzw on
nntp quiet 2

Fist create newsgroups on the Jnos prompt

jnos>
jnos> nntp create ng.bpq y
jnos>

nntp create <news.group.name> [y|n]

Updates the /spool/news/active file, which must have an entry for each news group you wish to receive.  Choose y to permit posting to this group, or n to deny posting.  y is assumed if nothing is specified.  The /spool/news/pointer file is also updated with the path to the directory which will contain the articles. Articles will be stored as separate files, named by an integer corresponding to their arrival order.

The NNTPS software includes a mail-to-news feature, such that email with a To: address that begins with “!” is passed to the NNTPS module.  The remainder of the To: address is interpreted as a newsgroup name, with the name truncated at the first occurrence of one of “%@.,/”, and with “!” translated to “.” and “+” to “,”. An alias is usually used to provide this special name. For example, to route all NLD bulletins to both the NLD area, and the NG.NLD newsgroup, use the alias:

/jnos/alias
#News groups
nld     nld     !ng!nld

My alias file looks like this
nld     nld     !ng!nld
bpq     bpq     !ng!bpq
7plus   7plus   !ng!7plus
ww      ww      !ng!ww
eu      eu      !ng!eu
aprs    aprs    !ng!aprs
local   local   !ng!local
prop    prop    !ng!prop

The NNTPS software includes a news-to-mail feature, such that news articles can be emailed to local or remote destinations after they are processed by nntp. This would allow, for example, emailing to a public area, so that BBS users too could read news articles. JNOS must be compiled with NNTPS and NEWS_TO_MAIL #define’d and a file /spool/news/gateway must exist to define the mapping from a newsgroup to an SMTP To: address. Each non-comment line in the gateway file must begin with a newsgroup name (starnames OK), followed by spaces or tabs, followed by the email To: address.

/jnos/spool/news/gateway
ng.nld  [email protected]
ng.nld  [email protected]
ng.nld  [email protected]
ng.nld  [email protected]
ng.7plus        [email protected]
ng.ww   [email protected]
ng.eu   [email protected]
ng.local        [email protected]
ng.bpq  [email protected]

Expire time of bulletins or newsgroup messages.

/jnos/spool/expire.dat
# bulletins received from AX25 network
#
nld 90
bpq 60
7plus 30
eu 30
check 45
ww 30
prop
#
#  NNTP
!ng.nld 90
!ng.bpq 60
!ng.7plus 30
!ng.check 30
!ng.eu 30
!ng.prop 30
!ng.ww 30

I’m using Thunderbird to read and post messages as bulletin and newsgroup mail.

mail.log

Fri Feb 21 20:22:46 2020 queue job 2333 To: !ng!local From: [email protected]
Fri Feb 21 20:22:46 2020 queue job 2333 To: local From: [email protected]
Fri Feb 21 20:26:50 2020 deliver Msg-Id: [email protected] To: local From: [email protected] Subject: Test ng.local
Received: by jnos.packet-radio.nl with NNTP
        id AA2332 ; Fri, 21 Feb 2020 20:22:46 CET
Newsgroups: ng.local
From: Niels PD9Q <[email protected]
Subject: Test ng.local
Message-ID: <[email protected]>
Date: Fri, 21 Feb 2020 20:22:41 +0100
Errors-To:  sysop
To: [email protected]

Test the ng.local newsgroup.
Newsgroups: ng.local
X-Mozilla-News-Host: news://192.168.1.101:119
From: Niels PD9Q <[email protected]>
Path: jnos.packet-radio.nl!not-for-mail
Subject: Test ng.local
Message-ID: <[email protected]>
Date: Fri, 21 Feb 2020 20:22:41 +0100
User-Agent: Thunderbird/60.9.1
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: nl
Content-Transfer-Encoding: 7bit
Lines: 1

Test the ng.local newsgroup.
Path: [email protected]!jnos
From: [email protected]
Newsgroups: ng.local
Subject: Test [email protected]
Message-ID: <[email protected]>
Sender: [email protected]
Comments: Article created from mail
X-Mozilla-News-Host: news://192.168.1.101:119
To: [email protected]
Date: Fri, 21 Feb 2020 20:53:28 +0100
User-Agent: Thunderbird/60.9.1
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: nl
Content-Transfer-Encoding: 7bit

Test [email protected] bulletin

73 Niels

That’s look pretty cool, isn’t it?

 

Jnos colors are back

For the Raspberry Pi users among us, Maiko has found a solution for the Colors in Jnos and the NNTP server and probably even more stability issues.
For a long time we had to miss the colors, but I immediately imagine myself back in the 90s.

The Solution…..

JNOS is doing strange things on PI platforms. Because gcc in the ARM processors are forcing CHAR variables to be UNSIGNED, not SIGNED!

Until I find a better solution (long term), you must add :

     -fsigned-char

to the CFLAGS in the makefile.

CFLAGS = -DUNIX $(DEBUG) $(PATCHES) $(WARNINGS) -fsigned-char
make clean
./configure
make

Thank you Maiko….

Start Jnos with Systemd

# Starting Jnos at boot, and restart when fail
# Jnos is running in the background

cd /lib/systemd/system
sudo nano jnos.service

Add to the file

[Unit]
Description=Jnos Daemon
After=network.target
After=sound.target
After=syslog.target

[Service]
Type=simple
Restart=always
RestartSec=5
ExecStart=/bin/bash /home/pd9q/jnos/startnos
WorkingDirectory=/home/pd9q/jnos

[Install]
WantedBy=multi-user.target
Alias=jnos.service

save

sudo systemctl enable jnos.service

startnos

# Jnos start file
cd /home/pd9q/jnos
sleep 2
rm -f /home/pd9q/jnos/spool/mqueue/*.lck 2> /dev/null
rm -f /home/pd9q/jnos/jnos/spool/mail/*.lck 2> /dev/null
sleep 1
TZ='Europe/Amsterdam'; export TZ
export TERM=linux
exec ./jnos2.0m.1rc -C -wf+b -u3 -fnos.cfg -i  </dev/tty2>/dev/tty2 2>&1

sudo apt-get install conspy
sudo conspy 2

And there is jnos….. Hit a couple off times [esc] to exit conspy

sudo systemctl status jnos

[email protected]:~/jnos/logs $ sudo systemctl status jnos
● jnos.service - Jnos Daemon
Loaded: loaded (/lib/systemd/system/jnos.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2020-02-08 07:36:44 CET; 6h ago
Main PID: 525 (jnos2.0m.1rc)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/jnos.service
└─525 ./jnos2.0m.1rc -C -wf b -u3 -fnos.cfg -i

Feb 08 07:36:44 packet-jnos systemd[1]: Started Jnos Daemon.
[email protected]:~/jnos/logs $

 

Jnos2.0m.1rc

Maiko has been busy again to make some adjustments in Jnos. A friend of mine had asked if it was possible to save a Most Heard list. A few days later it was already done. Fantastic. It is also possible to leave the file ftpusers and use hashed passwords.

Read change.2.0m.1.txt for al the new options.

Jnos Download

Save and Load ax25 Heard List
 -----------------------------

 The ax25 heard list can now be saved to a file or loaded (restored) from a file.

 Decided to also revamp the 'ax heard' command at the JNOS console, since there are
 now several commands available, all of which really should be categorized as being
 subcommands of 'ax heard' - so with this update, the new syntax is as follows :

     Usage : ax heard < show | dest > [<iface>]
             ax heard < save | load >

 The 'dest' and 'hearddest' commands are gone, absorbed by the above syntax.

 The heard data is kept in a new 'AxHeardFile' in the JNOS root directory.

 There are two files to update (ax25cmd.c and axheard.c), they have been added
 to the patch file noted further down (under the Password Management section),
 so if you're not interested in the password code, just extract the 2 files.

 Add '#define BACKUP_AXHEARD' to your config.h, then :

    rm ax25cmd.o axheard.o ; make

 

Write to Jnos UDP port.

I was reading in the release notes of NOSAprs and found something to play with.

Release 1.15b5 (patch)
======================

  • June 24, 2003
  •  DID YOU KNOW – You can send aprs data to NOSaprs using UDP port 16161, and it will go out the APRS rf port. It’s actually been like that for quite some time.

This are two ways to write data to the udp port 16161

#!/bin/bash
exec 3<>/dev/udp/192.168.1.101/16161
echo -e "writing to udp port 16161 Jnos" >&3
exec 3>&-

Sun Dec 22 20:59:52 2019 – ax0 sent:
KISS: Port 0 Data
AX25: PD9Q-10->APZ200 v WIDE1-1 UI pid=Text
0000 …writing to udp port 16161 Jnos…

#!/bin/bash
ver=$(uptime)
echo -n “$ver” | nc -4u -w1 192.168.1.101 16161

Sun Dec 22 20:59:56 2019 – ax0 sent:
KISS: Port 0 Data
AX25: PD9Q-10->APZ200 v WIDE1-1 UI pid=Text
0000 … 20:59:56 up 6:03, 2 users, load average: 0.16, 0.17, 0.17…

Nice let`s think about that

Jnos 2.0m run as NON-Root user

From version 2.0m it is possible to run Jnos as a NON-Root user.

The changelog from the website of Maiko.

a) create a new JNOS user and group

       jnos:x:1001:1001::/home/jnos:/bin/bash
       jnos:x:1001:

  b) change ownership of the entire JNOS runtime area

       chown -R jnos:jnos /jnos/rte

  c) as root user, configure a tunN interface, and just leave it there forever.

       ip tuntap add mode tun dev tun4

       ifconfig tun4 192.168.200.200 pointopoint 192.168.200.201 mtu 1500 up

     WARNING : make sure you pick a number N that does not conflict with any
               other tun interfaces that might be running - OpenVPN comes to
               mind for example, some VM subsystems might use tun as well ?

   d) modify autoexec.nos, add an extra parameter to the 'attach tun' entry,
      and make sure to comment out the point to point ifconfig.

      So what was previously run as root, for example, below :

       attach tun tun0 1500 0

       shell ifconfig tun0 192.168.200.200 pointopoint 192.168.200.201 mtu 1500 up

      will now just become a one line entry, below :

       attach tun tun0 1500 0 tun4

I have add some of the stuff in my /etc/rc.local file.

# Jnos
sysctl -w net.ipv4.ip_forward=1
ip tuntap add mode tun dev tun4
ifconfig tun4 192.168.1.100 pointopoint 192.168.1.101 mtu 1500 up

# Put a "Proxy ARP" on the Linux Ethernet so that it can answer any
# querries for the JNOS addres
/usr/sbin/arp -i eth0 -Ds 192.168.1.101 eth0 pub

This is what i have in the autoexec.nos

attach tun tun0 1500 0 tun4
#
ifconfig tun0 ipaddress 192.168.1.101
ifconfig tun0 netmask 0xfffffffc
ifconfig tun0 mtu 1500

Now you can run Jnos as a “normal” user.

Direwolf and Jnos (review)

In the previous post about Direwolf and jnos i use Direwolf-1.3 and does not know about the SERIALKISS port.
John WQ6N point it out to me… Tnx John WQ6N. Nice one.
Read the previous post.
So maybe I wrote that script for nothing. This is working pretty simple 🙂

In Direwolf 1.5-beta is it possible to use SERIALKISS to connect com to com.
I have try to use a PTY pair created with socat.

# Create pty pair
socat -d -d -ly PTY,link=/dev/ttyq1 PTY,link=/dev/ptyq1 &
sleep 2
# Start Direwolf
direwolf -d kn -c /direwolf/direwolf.conf &> /var/log/direwolf.log >/dev/tty3 &
sleep 2

Direwolf.conf
SERIALKISS  /dev/ttyq1 19200

# Jnos autoexec.nos
attach asy ptyq1 - ax25 ax0 4096 256 19200

Fireup Jnos
./jnos -C -g2 -u3 -f nos.cfg -i

I use conspy to look at the output of Direwolf. apt-get install conspy
Use it just like this “conspy 3” The number 3 stands for the tty were Direwolf is running on /dev/tty3.
Hit the escape button a couple of times to exit.

Here is the output of Direwolf

>>> Data frame to KISS client application, port 0, total length = 82
  000:  c0 00 92 88 40 40 40 40 e0 9c 98 70 b4 b4 8a 60  [email protected]@@@...p...`
  010:  ae 92 88 8a 62 40 63 03 f0 43 6f 6e 6e 65 63 74  [email protected]
  020:  20 4e 4c 36 5a 5a 45 20 66 6f 72 20 74 68 65 20   PD2LT-6 for the
  030:  4a 4e 4f 53 20 43 6f 6e 76 65 72 73 20 28 6c 69  JNOS Convers (li
  040:  6e 6b 65 64 20 77 69 74 68 20 6f 74 68 65 72 73  nked with others
  050:  29 c0

Ok that is working quit well.
I start Direwolf with the option “-d kn” So you can look at the kiss communication between Direwolf and Jnos.

Some text out of the User-Guide.pdf.
“Up to 3 concurrent TCP KISS client applications are allowed at the same time.
You can raise this limit by increasing the value of MAX_NET_CLIENTS, in source file kissnet.c and recompiling.”

Whoooo thats nice up to 3 (and more) applications can connect to Direwolf on the KISSPORT.
And there is also the AGW and the SERIALKISS port. Men where do I start.

John WQ6N

John WQ6N has found something that is useful. He use a Legacy BSD pseudo pair.
There are no Legacy BSD pseudo pairs in Linux any more. But it is possible to create some.

/etc/default/grub:
Change line from:
GRUB_CMDLINE_LINUX=""
to:
GRUB_CMDLINE_LINUX="pty.legacy_count=10"
(Where 10 is the number of pty legacy devices you require.)
This created 10 ptypX/ttypX terminal pairs.

After editing the grub file run the command “update-grub” and reboot.

So now it`s time to set Direwolf and Jnos to use the pty Legacy devices.

The Direwolf SERIALKISS 
SERIALKISS /dev/ptyp0 19200

The associated JNOS2 attach line:
attach asy ttyp0 - ax25 hfgw 4096 256 19200

Direwolf and Jnos

#!/bin/bash
# 6 march 2018
# Wrote a small script to get the shittie PTS to a file where its belongs.
# Yes you can also use the agw driver from Direwolf for Jnos.
# Now its also possible to "sed" the right PTS to your ax25 start file
#
# socat -d -d -lf /tmp/socat.pts PTY,link=/tmp/kisstnc TCP4:127.0.0.1:8001 &
# sleep 2
# grep -o "/dev/pts/." /tmp/socat.pts > /tmp/devs.pts
# attachthem () {
# read PTS1
# sed -i "s,kissattach -m 256 /dev/.*$,kissattach -m 256 $PTS1 ax0 44.137.31.73," /etc/ax25/ax-start
#
# }
#
# tail -n 1 /tmp/devs.pts | attachthem
# rm /tmp/socat.pts
# rm /tmp/devs.pts
# sleep 3
#
# Or use it with (X)net.
# sed -i "s,attach sdev4 kiss 4 1 19200 /dev/.*$,attach sdev4 kiss 4 1 19200 $PTS1," /usr/local/xnet/AUTOBOOT.NET
#
# Or with BPQ
# sed -i "s,COMPORT=/dev/.*$,COMPORT=$PTS1," /usr/local/linbpq/bpq32.cfg
#
# Oo well maybe work this better
# IPADDR=127.0.0.1
# TCPPORT=8001
#
# Yes there are many way`s to do this, but i had some fun to play with it.
# Maybe it is useful for someone.
#################################################################################################

The scipt…. Small but work quit well

#!/bin/bash
echo "Starting direwolf with socat for jnos/ax25"
# Set the path to direwolf and some stuff
PATH=/direwolf:/usr/bin:/bin:/usr/local/bin
# Start Direwolf
direwolf -c /direwolf/direwolf.conf &> /var/log/direwolf.log >/dev/tty3 &
sleep 3
# Socat kisstnc link with a PTS
socat -d -d -lf /tmp/socat.pts PTY,link=/tmp/kisstnc TCP4:127.0.0.1:8001 &
sleep 2
grep -o "/dev/pts/." /tmp/socat.pts > /home/pd2lt/jnos/spool/ptmx_radio.cfg
echo "Direwolf is connect to" `cat /home/pd2lt/jnos/spool/ptmx_radio.cfg`
echo "Now Jnos is ready to Rock and Roll :)"
rm /tmp/socat.pts
# Dont delete ptmx_radio.cfg before starting Jnos
rm /home/pd2lt/jnos/spool/ptmx_radio.cfg
sleep 1

This is what i found in the change.log of Jnos

Better support for PTY98 (/dev/ptmx, /dev/pts/N) pseudo devices. Bob (VE3TOK)
   asked for this a long time ago, so I figured I better get it implemented.

   Note : Technically one can use the new jnos 'attach baycom' and go direct to
   a kernel KISS type interface, meaning you don't need to run an intermediary
   program (kissattach or net2kiss) anymore. Try it, let me know how it works.

   COMPILE : Make sure '#define JNOSPTY98' exists in your config.h file.

   The best way for me to show how this feature works is by example. One way of
   getting JNOS to use a linux AX25 device is through the 'kissattach' program,
   but get the one from F6BVP (it has a mod that actually outputs the name of
   the slave device after you run the program). The stock ax25 utilities will
   not tell you that (you have to look for a new /dev/pts/N to appear then).

      kissattach /dev/ptmx radio > /jnos/spool/ptmx_radio.cfg

   The issue here is you don't know what slave device you will get, it could
   change each time you run kissattach, there may be no consistent device name
   for you to depend on when running 'attach asy' in the JNOS autoexec.nos.

   Now in JNOS (autoexec.nos), suppose we have this entry below :

      attach asy ptmx_radio - ax25 ax0 4096 256 9600

   I have added a feature where if the 3rd argument starts with 'ptmx_', then
   JNOS will look for a corresponding *.cfg file, and extract the slave device
   name from it, and then attach using that instead of the original argument.

This is some monitor output of Direwolf.

Dire Wolf version 1.3

Reading config file /direwolf/direwolf.conf
Audio device for both receive and transmit: plughw:0,0 (channel 0)
Channel 0: 1200 baud, AFSK 1200 & 2200 Hz, E+, 44100 sample rate.
Ready to accept AGW client application 0 on port 8000 …
Use -p command line option to enable KISS pseudo terminal.
Ready to accept KISS client application on port 8001 …

Connected to KISS client application …

[0L] PD2LT-2>NODES:<0xfe>
[0L] PD2LT-9>NODES:<0xff>LAPNOS
[0L] PD2LT-9>NODES:<0xfe>LAPNOS

PD2LT-2 audio level = 14(3/3) [NONE] |||||||__
[0.3] PD2LT-2>NODES:<0xfe>

PD2LT-9 audio level = 14(3/3) [NONE] ||||||||_
[0.3] PD2LT-9>NODES:<0xff>LAPNOS

Jnos link local

Setup a local link in jnos to uronode.

[email protected]:/etc/ax25# cat axports
# /etc/ax25/axports
#
# The format of this file is:
#
# name  callsign        speed   paclen  window  description
# ----- -----------     ------- ------- ------- ---------------------------
ax6     PD2LT-7         19200   256     2       Link local Jnos pd2lt

[email protected]:/etc/ax25# cat nrbroadcast
# /etc/ax25/nrbroadcast
#
# The format of this file is:
#
# ax25_name min_obs def_qual worst_qual verbose
#
ax6     5       203     192     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

Autoexec.nos

attach asy ttyq4 - ax25 lap 4096 256 19200
ifconfig lap description "Link uronode"
#
ifconfig lap ax25 maxframe 2
ifconfig lap ax25 paclen 256
#ifconfig lap ipadd 44.137.31.81
#
at 15 "mbox kick pi8lap+"
#
arp eaves lap on
arp poll lap on

ip hp lap on
mbox mport lap on

# pi1lap
ax25 bc lap on
ax25 heard lap
ax25 hport lap on
ax25 bcport lap on

netrom  interface       lap 203 201
netrom  bcpoll          lap
netrom  bcnodes         lap
inp     ifaces          lap

trace lap 0111