mirror of
https://github.com/D-Modem/login.git
synced 2026-11-28 20:38:06 -08:00
dialup: callers on 100.77.0.0/24; empty firewall lists load
- the samples' subnet moves to 100.77.0.0/24, in RFC 6598's shared address space, which no home or office LAN uses (Tailscale's caveat noted) - an empty ALLOW_CIDRS (the default) or port list left a stray brace in the nftables rules, so modemmenu-dialup up failed: the set's elements line is now built apart Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRVTwDhoXdaYHRwQ4BT
This commit is contained in:
9 files changed
+53
-46
No files matched your search
@@ -13,9 +13,10 @@ VRF=dialup
|
||||
VRF_TABLE=77
|
||||
|
||||
# the callers' subnet: [ppp_pool] range is in it, and its local is
|
||||
# SERVER_ADDR. Pick one no network of the host uses.
|
||||
SUBNET=10.77.0.0/24
|
||||
SERVER_ADDR=10.77.0.1
|
||||
# SERVER_ADDR. Pick one no network of the host uses: 100.64.0.0/10
|
||||
# (RFC 6598, carrier-grade NAT) is not a LAN's, though Tailscale uses it.
|
||||
SUBNET=100.77.0.0/24
|
||||
SERVER_ADDR=100.77.0.1
|
||||
|
||||
# Where the callers' traffic leaves:
|
||||
# vlan a VLAN of its own on UPLINK (UPLINK.VLAN_ID), with its own
|
||||
|
||||
+12
-12
@@ -6,22 +6,22 @@
|
||||
# systemctl reload modemmenu-dns
|
||||
|
||||
# AIM and ICQ (OSCAR, TCP 5190)
|
||||
#address=/login.oscar.aol.com/10.77.0.1
|
||||
#address=/login.icq.com/10.77.0.1
|
||||
#address=/login.oscar.aol.com/100.77.0.1
|
||||
#address=/login.icq.com/100.77.0.1
|
||||
|
||||
# AOL's client (TCP 5190)
|
||||
#address=/americaonline.aol.com/10.77.0.1
|
||||
#address=/americaonline.aol.com/100.77.0.1
|
||||
|
||||
# MSN Messenger (TCP 1863), WebTV's Messenger too
|
||||
#address=/messenger.hotmail.com/10.77.0.1
|
||||
#address=/messenger.hotmail.com/100.77.0.1
|
||||
|
||||
# Yahoo! Messenger: the pager (TCP 5050, then 23, 25, 80), the capacity
|
||||
# lookup, rooms and files (HTTP); login.yahoo.com is Y!M 9's HTTPS login
|
||||
#address=/scs.msg.yahoo.com/10.77.0.1
|
||||
#address=/scsa.msg.yahoo.com/10.77.0.1
|
||||
#address=/vcs1.msg.yahoo.com/10.77.0.1
|
||||
#address=/vcs2.msg.yahoo.com/10.77.0.1
|
||||
#address=/insider.msg.yahoo.com/10.77.0.1
|
||||
#address=/filetransfer.msg.yahoo.com/10.77.0.1
|
||||
#address=/relay.msg.yahoo.com/10.77.0.1
|
||||
#address=/login.yahoo.com/10.77.0.1
|
||||
#address=/scs.msg.yahoo.com/100.77.0.1
|
||||
#address=/scsa.msg.yahoo.com/100.77.0.1
|
||||
#address=/vcs1.msg.yahoo.com/100.77.0.1
|
||||
#address=/vcs2.msg.yahoo.com/100.77.0.1
|
||||
#address=/insider.msg.yahoo.com/100.77.0.1
|
||||
#address=/filetransfer.msg.yahoo.com/100.77.0.1
|
||||
#address=/relay.msg.yahoo.com/100.77.0.1
|
||||
#address=/login.yahoo.com/100.77.0.1
|
||||
+2
-2
@@ -5,7 +5,7 @@
|
||||
|
||||
# on the callers' side only (dialup.conf's SERVER_ADDR), never the host's
|
||||
# own networks
|
||||
listen-address=10.77.0.1
|
||||
listen-address=100.77.0.1
|
||||
bind-interfaces
|
||||
pid-file=/run/modemmenu-dns.pid
|
||||
|
||||
@@ -20,7 +20,7 @@ cache-size=1000
|
||||
|
||||
# names of this system: bbs.dialup and the like, answered here only
|
||||
local=/dialup/
|
||||
address=/bbs.dialup/10.77.0.1
|
||||
address=/bbs.dialup/100.77.0.1
|
||||
|
||||
# the overrides for the services we provide: every *.conf here
|
||||
# (services.conf, and a file per front end)
|
||||
|
||||
@@ -32,24 +32,26 @@ egress_if() {
|
||||
|
||||
# a list of words as an nft set's elements
|
||||
elems() { echo "$*" | tr -s ' \t' ',' | sed 's/^,//; s/,$//'; }
|
||||
# a set's elements line, or nothing for an empty list
|
||||
elements() { local e; e=$(elems "$@"); [ -z "$e" ] || echo "elements = { $e }"; }
|
||||
|
||||
firewall() {
|
||||
local out allow block tcp udp internet=""
|
||||
out=$(egress_if)
|
||||
# shellcheck disable=SC2153 # INTERNET is dialup.conf's
|
||||
[ -z "$out" ] || [ "$INTERNET" != yes ] || internet="oifname \"$out\" accept"
|
||||
allow=$(elems "$ALLOW_CIDRS") block=$(elems "$BLOCK_CIDRS")
|
||||
tcp=$(elems "$HOST_TCP_PORTS") udp=$(elems "$HOST_UDP_PORTS")
|
||||
allow=$(elements "$ALLOW_CIDRS") block=$(elements "$BLOCK_CIDRS")
|
||||
tcp=$(elements "$HOST_TCP_PORTS") udp=$(elements "$HOST_UDP_PORTS")
|
||||
nft delete table inet $NFT_TABLE 2>/dev/null || true
|
||||
nft -f - <<NFT
|
||||
table inet $NFT_TABLE {
|
||||
# the callers' links, added and removed by ip-up.d / ip-down.d, and
|
||||
# the VRF device (the kernel names it as the way in of what it routes)
|
||||
set links { type ifname; elements = { "$VRF" } }
|
||||
set allow { type ipv4_addr; flags interval; ${allow:+elements = { $allow }} }
|
||||
set block { type ipv4_addr; flags interval; ${block:+elements = { $block }} }
|
||||
set tcp_ports { type inet_service; ${tcp:+elements = { $tcp }} }
|
||||
set udp_ports { type inet_service; ${udp:+elements = { $udp }} }
|
||||
set allow { type ipv4_addr; flags interval; $allow }
|
||||
set block { type ipv4_addr; flags interval; $block }
|
||||
set tcp_ports { type inet_service; $tcp }
|
||||
set udp_ports { type inet_service; $udp }
|
||||
|
||||
chain input {
|
||||
type filter hook input priority filter - 1; policy accept;
|
||||
|
||||
+17
-13
@@ -9,7 +9,7 @@ files are in [`dialup/`](../dialup); `make install-dialup` installs them.
|
||||
```
|
||||
caller ── modem ── D-Modem ── modemmenu ── pppd ── ppp0 ┐
|
||||
│ VRF "dialup" (table 77)
|
||||
10.77.0.1: DNS, BBS, front ends ─┤ 10.77.0.0/24
|
||||
100.77.0.1: DNS, BBS, front ends ─┤ 100.77.0.0/24
|
||||
└─ egress: eth0.77 (VLAN), eth0 (NAT) or none
|
||||
```
|
||||
|
||||
@@ -17,9 +17,9 @@ caller ── modem ── D-Modem ── modemmenu ── pppd ── ppp0 ┐
|
||||
|
||||
```
|
||||
[ppp_pool]
|
||||
local = 10.77.0.1
|
||||
range = 10.77.0.10-10.77.0.250
|
||||
;dns = 10.77.0.1
|
||||
local = 100.77.0.1
|
||||
range = 100.77.0.10-100.77.0.250
|
||||
;dns = 100.77.0.1
|
||||
```
|
||||
|
||||
A PPP command that names `{ppp_remote}` (or `{ppp_local}`, `{ppp_dns}`,
|
||||
@@ -42,10 +42,14 @@ command = exec /usr/sbin/pppd nodetach noauth local lock passive {ppp_local}:{pp
|
||||
`MODEM_PPP_DNS` and `MODEM_PPP_DNS2`.
|
||||
- A full pool refuses the call ("all N PPP addresses are in use").
|
||||
- D-Modem's own `[ppp]` profile runs pppd without modemmenu, so it has
|
||||
no pool: give it a fixed pair outside `range` (10.77.0.2 to .9).
|
||||
no pool: give it a fixed pair outside `range` (100.77.0.2 to .9).
|
||||
|
||||
Pick a subnet none of the host's networks use. 10.77.0.0/24 is the
|
||||
sample's.
|
||||
Pick a subnet none of the host's networks use. The sample's,
|
||||
100.77.0.0/24, is in 100.64.0.0/10, the shared address space of RFC 6598
|
||||
(carrier-grade NAT): home and office LANs don't use it, so it doesn't
|
||||
clash with them. Tailscale also hands out addresses in 100.64.0.0/10:
|
||||
on a host that runs it, check `tailscale status` for a clash, or pick
|
||||
another /24.
|
||||
|
||||
## Isolation: `modemmenu-dialup`
|
||||
|
||||
@@ -56,13 +60,13 @@ up, from `/etc/modemmenu/dialup.conf`:
|
||||
it, so the host's routes, and its LANs, are not theirs. A lookup that
|
||||
finds nothing there is unreachable; it never falls through to the
|
||||
host's table.
|
||||
- **`dialup0`**, a dummy interface holding `SERVER_ADDR` (10.77.0.1), so
|
||||
- **`dialup0`**, a dummy interface holding `SERVER_ADDR` (100.77.0.1), so
|
||||
the DNS server has its address while no caller is on.
|
||||
- **An egress** (`EGRESS`):
|
||||
- `vlan`: `UPLINK.VLAN_ID` (`eth0.77`), in the VRF, with its own
|
||||
address and gateway. Dial-up traffic leaves on a VLAN of its own and
|
||||
never shares the host's LAN. `NAT=no` when the router on that VLAN
|
||||
routes 10.77.0.0/24 back itself.
|
||||
routes 100.77.0.0/24 back itself.
|
||||
- `uplink`: out of the host's interface through its gateway,
|
||||
masqueraded. Simpler, and filtered like the VLAN.
|
||||
- `none`: no internet; the host's services only.
|
||||
@@ -75,7 +79,7 @@ up, from `/etc/modemmenu/dialup.conf`:
|
||||
- callers are isolated from each other: anything from one caller to
|
||||
`SUBNET` (another caller) is dropped, before and whatever
|
||||
`ALLOW_CIDRS` says. They still meet in the host's services (the BBS,
|
||||
the messengers) on 10.77.0.1.
|
||||
the messengers) on 100.77.0.1.
|
||||
- onward: `BLOCK_CIDRS` are dropped (every private range, link-local
|
||||
and multicast, by default), so the host's LANs are out of reach,
|
||||
except `ALLOW_CIDRS`, which the sysop opens:
|
||||
@@ -89,7 +93,7 @@ up, from `/etc/modemmenu/dialup.conf`:
|
||||
- a source address outside `SUBNET` is dropped, and IPv6 too.
|
||||
- `net.ipv4.ip_forward=1`, and `tcp_l3mdev_accept`/`udp_l3mdev_accept`,
|
||||
so the host's services (listening in no VRF) answer callers on
|
||||
10.77.0.1.
|
||||
100.77.0.1.
|
||||
|
||||
pppd's `ip-up.d/modemmenu-dialup` moves a link whose local address is
|
||||
`SERVER_ADDR` into the VRF, putting it on the firewall's list first;
|
||||
@@ -100,7 +104,7 @@ VRF, its routes and the callers' links.
|
||||
|
||||
## DNS: `modemmenu-dns`
|
||||
|
||||
`modemmenu-dns.service` runs dnsmasq inside the VRF, on 10.77.0.1 only,
|
||||
`modemmenu-dns.service` runs dnsmasq inside the VRF, on 100.77.0.1 only,
|
||||
with [`dnsmasq.conf`](../dialup/dnsmasq.conf): no DHCP, upstream
|
||||
servers of its own (the host's `127.0.0.53` is not in the VRF), and the
|
||||
names of this system under `.dialup` (`bbs.dialup`).
|
||||
@@ -114,7 +118,7 @@ the rest). A front end can drop its own file instead:
|
||||
|
||||
```
|
||||
# /etc/modemmenu/dns.d/oscar.conf
|
||||
address=/login.oscar.aol.com/10.77.0.1
|
||||
address=/login.oscar.aol.com/100.77.0.1
|
||||
```
|
||||
|
||||
`address=/name/ip` answers the name and every name under it. Then
|
||||
|
||||
+3
-3
@@ -207,9 +207,9 @@ The PPP callers' addresses: a command that names {ppp_remote} (or {ppp_local}, {
|
||||
|
||||
| key | sample | what it does |
|
||||
|---|---|---|
|
||||
| `local` | `10.77.0.1` | See the section above. |
|
||||
| `range` | `10.77.0.10-10.77.0.250` | See the section above. |
|
||||
| `dns` | `10.77.0.1` | See the section above. |
|
||||
| `local` | `100.77.0.1` | See the section above. |
|
||||
| `range` | `100.77.0.10-100.77.0.250` | See the section above. |
|
||||
| `dns` | `100.77.0.1` | See the section above. |
|
||||
|
||||
## `[autoppp]`
|
||||
|
||||
|
||||
+2
-2
@@ -101,8 +101,8 @@ detection off; D-Modem's line check page lists what is still in the way.
|
||||
## The menu
|
||||
|
||||
- **PPP**: dial-up networking. `apt install ppp` first. Each caller
|
||||
gets an address of `[ppp_pool]` (10.77.0.10 to .250, the server is
|
||||
10.77.0.1). For DNS, the internet and keeping callers off your LAN,
|
||||
gets an address of `[ppp_pool]` (100.77.0.10 to .250, the server is
|
||||
100.77.0.1). For DNS, the internet and keeping callers off your LAN,
|
||||
`make install-dialup` ([the dial-up network](../docs/dialup-network.md)).
|
||||
Windows' Dial-Up Networking logs in
|
||||
with PAP instead of at the prompt: turn on `[autoppp]` and install
|
||||
|
||||
@@ -85,8 +85,8 @@ max_sessions = 8
|
||||
; the PPP callers' addresses, one each (several lines at once): see
|
||||
; docs/dialup-network.md for their network, DNS and firewall
|
||||
[ppp_pool]
|
||||
local = 10.77.0.1
|
||||
range = 10.77.0.10-10.77.0.250
|
||||
local = 100.77.0.1
|
||||
range = 100.77.0.10-100.77.0.250
|
||||
|
||||
; Windows' Dial-Up Networking starts PPP at once and logs in with PAP.
|
||||
; enabled = yes takes those callers to pppd, with the login checked against
|
||||
|
||||
@@ -262,9 +262,9 @@ max_sessions = 32
|
||||
; host's networks use. No range: no pool. The scripts see MODEM_PPP_LOCAL,
|
||||
; MODEM_PPP_REMOTE, MODEM_PPP_DNS and MODEM_PPP_DNS2
|
||||
[ppp_pool]
|
||||
local = 10.77.0.1
|
||||
range = 10.77.0.10-10.77.0.250
|
||||
;dns = 10.77.0.1
|
||||
local = 100.77.0.1
|
||||
range = 100.77.0.10-100.77.0.250
|
||||
;dns = 100.77.0.1
|
||||
|
||||
; AutoPPP: a dialer that starts PPP at once (Windows' Dial-Up Networking,
|
||||
; most others) sends a PPP frame where the login prompt wants a name; then
|
||||
|
||||
Reference in new issue
Block a user