Initial commit

This commit is contained in:
John Burwell 2025-04-25 19:11:33 -05:00
commit d3299f8848
11 changed files with 226 additions and 0 deletions

0
LICENSE Normal file
View File

0
README.md Normal file
View File

120
ansible/playbook.yml Normal file
View File

@ -0,0 +1,120 @@
---
- name: Ham Hotspot Bootstrap
hosts: localhost
become: yes
vars_files:
- ../config/desired_state.yml
tasks:
- name: Install base apt packages
apt:
name:
- ax25-tools
- ax25-apps
- libax25
- dnsmasq
- hostapd
- python3-flask
- build-essential
- cmake
- git
state: present
update_cache: yes
- name: Clone Direwolf from GitHub
git:
repo: 'https://github.com/wb2osz/direwolf.git'
dest: /usr/local/src/direwolf
update: no
- name: Build Direwolf
shell: |
mkdir -p /usr/local/src/direwolf/build
cd /usr/local/src/direwolf/build
cmake ..
make -j4
args:
chdir: /usr/local/src/direwolf
creates: /usr/local/src/direwolf/build/direwolf
- name: Install Direwolf
shell: |
cd /usr/local/src/direwolf/build
make install
args:
chdir: /usr/local/src/direwolf/build
creates: /usr/local/bin/direwolf
- name: Copy systemd service templates
copy:
src: ../systemd/
dest: /lib/systemd/system/
mode: '0644'
owner: root
group: root
- name: Deploy Direwolf configuration
template:
src: ../templates/direwolf.conf.j2
dest: /etc/ham-hotspot/direwolf-{{ radio.port_name }}.conf
mode: '0644'
- name: Deploy hostapd configuration
template:
src: ../templates/hostapd.conf.j2
dest: /etc/hostapd/hostapd.conf
mode: '0644'
- name: Deploy dnsmasq configuration
template:
src: ../templates/dnsmasq.conf.j2
dest: /etc/dnsmasq.d/ham-hotspot.conf
mode: '0644'
- name: Deploy axports configuration
template:
src: ../templates/axports.j2
dest: /etc/ax25/axports
mode: '0644'
- name: Enable IP forwarding
copy:
dest: /etc/sysctl.d/ham-hotspot.conf
content: |
net.ipv4.ip_forward=1
mode: '0644'
- name: Reload systemd daemon
systemd:
daemon_reload: yes
- name: Enable and start Direwolf instance
systemd:
name: direwolf@radio0.service
enabled: yes
state: started
- name: Enable and start KISS TNC instance
systemd:
name: kisstnc@radio0.service
enabled: yes
state: started
- name: Enable and start AX.25 daemon
systemd:
name: ax25d.service
enabled: yes
state: started
- name: Enable and start hostapd
systemd:
name: hostapd.service
enabled: yes
state: started
- name: Enable and start dnsmasq
systemd:
name: dnsmasq.service
enabled: yes
state: started

17
config/desired-state.yml Normal file
View File

@ -0,0 +1,17 @@
# Configuration state for Ham Hotspot
wifi:
ssid: HamHotspot
password: change_me_now
channel: 6
network:
lan_subnet: 192.168.73.0/24
lan_gateway: 192.168.73.1
radio:
device: plughw:CARD=CODEC,DEV=0
speed: 1200
mycall: KI5QKX-11
port_name: radio0
ip_address: 44.31.1.1

14
systemd/ax25d.service Normal file
View File

@ -0,0 +1,14 @@
[Unit]
Description=AX.25 Daemon (ax25d)
After=network.target syslog.target
Requires=network.target
[Service]
Type=simple
ExecStart=/usr/sbin/ax25d -l
ExecReload=/bin/kill -SIGHUP $MAINPID
ExecStop=/bin/kill -SIGQUIT $MAINPID
Restart=on-failure
[Install]
WantedBy=multi-user.target

20
systemd/direwolf@.service Normal file
View File

@ -0,0 +1,20 @@
[Unit]
Description=Direwolf %I soundcard modem
After=network.target
[Service]
Type=simple
PrivateTmp=true
StateDirectory=direwolf
ExecStart=/usr/local/bin/direwolf -t 0 -p -c /etc/ham-hotspot/direwolf-%i.conf -q h -q d
Restart=unless-stopped
# Relocate /tmp/kisstnc symlink to /run/direwolf/<instance name>.
ExecStartPre=/usr/bin/mkdir -p /run/direwolf
ExecStartPost=/bin/timeout 10 /bin/sh -c 'while ! test -c /tmp/kisstnc; do sleep 1; done; cp -a /tmp/kisstnc /run/direwolf/%i'
# Clean up symlink on exit.
ExecStopPost=/bin/rm -f /run/direwolf/%i
[Install]
WantedBy=multi-user.target

14
systemd/kisstnc@.service Normal file
View File

@ -0,0 +1,14 @@
[Unit]
Description=Attach AX.25 KISS device %I
Requires=direwolf@%i.service
After=direwolf@%i.service
AssertPathExists=/run/direwolf/%i
[Service]
Type=oneshot
ExecStart=/usr/sbin/kissattach /run/direwolf/%i %i
ExecStartPost=/usr/sbin/kissparms -c 1 -p %i
RemainAfterExit=true
[Install]
WantedBy=multi-user.target

1
templates/axports.j2 Normal file
View File

@ -0,0 +1 @@
radio0 {{ radio.mycall }} 0 255 1 PiRadio AX.25 port

View File

@ -0,0 +1,22 @@
# Template: direwolf.conf.j2
# Auto-generated by Ansible based on desired_state.yml
# Audio input device
ADEVICE {{ radio.device }}
# Set the call sign
MYCALL {{ radio.mycall }}
# Define the modem type (assuming a basic 1200 or 9600 baud AFSK modem)
MODEM {{ radio.speed }}
# Optional: AX.25 parameters (could fine-tune later)
TXDELAY 30
TXTAIL 10
DWAIT 0
SLOTTIME 100
PERSIST 63
FIX_BITS 1 AX25
# Log settings
LOGDIR /var/log/direwolf

View File

@ -0,0 +1,4 @@
interface=wlan0
dhcp-range={{ network.lan_gateway | regex_replace('\.1$', '.100') }},{{ network.lan_gateway | regex_replace('\.1$', '.200') }},12h
dhcp-option=3,{{ network.lan_gateway }}
dhcp-option=6,8.8.8.8

14
templates/hostapd.conf.j2 Normal file
View File

@ -0,0 +1,14 @@
interface=wlan0
driver=nl80211
ssid={{ wifi.ssid }}
hw_mode=g
channel={{ wifi.channel }}
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase={{ wifi.password }}
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP