mirror of
https://github.com/D-Modem/login.git
synced 2026-11-28 20:38:06 -08:00
- [ppp_pool]: each PPP caller gets its own address of a range
({ppp_local}, {ppp_remote}, {ppp_dns}, {ppp_dns2} and MODEM_PPP_*),
as flock'd lock files in state_dir/ppp-pool shared by every modemmenu
and -serve session, so several lines can run PPP at once. The samples
move to 10.77.0.0/24 with the pool.
- dialup/: modemmenu-dialup puts the callers' links in a VRF of their
own, egress by a VLAN, the host's uplink (NAT) or none, with an
nftables firewall: only the listed service ports of the host, no
private range (host LANs, other callers) unless ALLOW_CIDRS opens it.
pppd's ip-up.d/ip-down.d hooks attach each link.
- modemmenu-dns: dnsmasq in the VRF on 10.77.0.1, with overrides from
/etc/modemmenu/dns.d/*.conf (AIM/ICQ, AOL, MSN, Yahoo names ready).
- make install-dialup, docs/dialup-network.md; confref reads section
names with underscores.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRVTwDhoXdaYHRwQ4BT
87 lines
4.2 KiB
Makefile
87 lines
4.2 KiB
Makefile
# modemmenu: the login and menu of a dial-up line (Go 1.22 or later)
|
|
#
|
|
# make build, with PAM when libpam's headers are there,
|
|
# and the pppd plugin when pppd's are (ppp-dev)
|
|
# make PAM=0 without PAM (PAM=1: with, or fail)
|
|
# make PPPD=0 without the pppd plugin (PPPD=1: with, or fail)
|
|
# make test the tests
|
|
# make install into $(BINDIR), samples into $(CONF_DIR), the
|
|
# plugin into pppd's plugin directory
|
|
# make install-freepbx into $(BINDIR), freepbx/'s samples into
|
|
# /etc/modemmenu and modemmenu.service into systemd
|
|
# make install-dialup the PPP callers' network (docs/dialup-network.md):
|
|
# modemmenu-dialup, pppd's hooks, the units, and
|
|
# dialup.conf, dnsmasq.conf, dns.d/ in /etc/modemmenu
|
|
|
|
GO ?= go
|
|
BINDIR ?= /usr/local/bin
|
|
CONF_DIR ?= /etc/asterisk
|
|
PAM ?= $(shell [ -e /usr/include/security/pam_appl.h ] && echo 1 || echo 0)
|
|
TAGS := $(if $(filter 1,$(PAM)),-tags pam)
|
|
CC ?= cc
|
|
CFLAGS ?= -O2 -g
|
|
PPPD ?= $(shell [ -e /usr/include/pppd/pppd.h ] && echo 1 || echo 0)
|
|
PPPD_VERSION ?= $(shell sed -n 's/^\#define VERSION[^"]*"\(.*\)"/\1/p' /usr/include/pppd/patchlevel.h 2>/dev/null)
|
|
PPPD_PLUGIN_DIR ?= /usr/lib/pppd/$(PPPD_VERSION)
|
|
|
|
all: modemmenu $(if $(filter 1,$(PPPD)),pppd/modemmenu.so)
|
|
|
|
# AutoPPP's PAP logins: pppd's plugin, for the pppd of these headers
|
|
pppd/modemmenu.so: pppd/modemmenu.c
|
|
$(CC) $(CFLAGS) -Wall -fPIC -shared -o $@ $<
|
|
|
|
# -buildvcs=false: nothing reads the VCS stamp, and git refuses a checkout
|
|
# owned by another user (sudo make in your own clone), which fails the build
|
|
modemmenu: FORCE
|
|
$(GO) build -buildvcs=false $(TAGS) -o $@ ./cmd/modemmenu
|
|
|
|
test:
|
|
$(GO) vet $(TAGS) ./...
|
|
$(GO) test $(TAGS) ./...
|
|
|
|
install: all
|
|
install -D -m 755 modemmenu $(DESTDIR)$(BINDIR)/modemmenu
|
|
[ -e $(DESTDIR)$(CONF_DIR)/modemmenu.conf ] || \
|
|
install -D -m 640 samples/modemmenu.conf.sample $(DESTDIR)$(CONF_DIR)/modemmenu.conf
|
|
[ -e $(DESTDIR)$(CONF_DIR)/modemmenu.users ] || \
|
|
install -D -m 600 samples/modemmenu.users.sample $(DESTDIR)$(CONF_DIR)/modemmenu.users
|
|
[ $(PAM) != 1 ] || [ -e $(DESTDIR)/etc/pam.d/modemmenu ] || \
|
|
install -D -m 644 samples/modemmenu.pam.sample $(DESTDIR)/etc/pam.d/modemmenu
|
|
[ $(PPPD) != 1 ] || \
|
|
install -D -m 644 pppd/modemmenu.so $(DESTDIR)$(PPPD_PLUGIN_DIR)/modemmenu.so
|
|
|
|
# FreePBX (freepbx/README.md): the files in /etc/modemmenu, out of
|
|
# fwconsole chown's way; files already there are kept
|
|
FREEPBX_CONF_DIR ?= /etc/modemmenu
|
|
install-freepbx: all
|
|
install -D -m 755 modemmenu $(DESTDIR)$(BINDIR)/modemmenu
|
|
[ -e $(DESTDIR)$(FREEPBX_CONF_DIR)/modemmenu.conf ] || \
|
|
install -D -m 644 freepbx/modemmenu.conf $(DESTDIR)$(FREEPBX_CONF_DIR)/modemmenu.conf
|
|
[ -e $(DESTDIR)$(FREEPBX_CONF_DIR)/modemmenu.users ] || \
|
|
install -D -m 600 freepbx/modemmenu.users $(DESTDIR)$(FREEPBX_CONF_DIR)/modemmenu.users
|
|
[ -e $(DESTDIR)/etc/systemd/system/modemmenu.service ] || \
|
|
install -D -m 644 freepbx/modemmenu.service $(DESTDIR)/etc/systemd/system/modemmenu.service
|
|
[ $(PPPD) != 1 ] || \
|
|
install -D -m 644 pppd/modemmenu.so $(DESTDIR)$(PPPD_PLUGIN_DIR)/modemmenu.so
|
|
|
|
clean:
|
|
rm -f modemmenu pppd/modemmenu.so
|
|
|
|
FORCE:
|
|
.PHONY: all test install install-freepbx install-dialup clean FORCE
|
|
|
|
# the PPP callers' network: files already in /etc/modemmenu are kept
|
|
SBINDIR ?= /usr/local/sbin
|
|
install-dialup:
|
|
install -D -m 755 dialup/modemmenu-dialup $(DESTDIR)$(SBINDIR)/modemmenu-dialup
|
|
install -D -m 755 dialup/ip-up $(DESTDIR)/etc/ppp/ip-up.d/modemmenu-dialup
|
|
install -D -m 755 dialup/ip-down $(DESTDIR)/etc/ppp/ip-down.d/modemmenu-dialup
|
|
install -D -m 644 dialup/modemmenu-dialup.service $(DESTDIR)/etc/systemd/system/modemmenu-dialup.service
|
|
install -D -m 644 dialup/modemmenu-dns.service $(DESTDIR)/etc/systemd/system/modemmenu-dns.service
|
|
[ -e $(DESTDIR)$(FREEPBX_CONF_DIR)/dialup.conf ] || \
|
|
install -D -m 644 dialup/dialup.conf.sample $(DESTDIR)$(FREEPBX_CONF_DIR)/dialup.conf
|
|
[ -e $(DESTDIR)$(FREEPBX_CONF_DIR)/dnsmasq.conf ] || \
|
|
install -D -m 644 dialup/dnsmasq.conf $(DESTDIR)$(FREEPBX_CONF_DIR)/dnsmasq.conf
|
|
[ -e $(DESTDIR)$(FREEPBX_CONF_DIR)/dns.d/services.conf ] || \
|
|
install -D -m 644 dialup/dns.d/services.conf $(DESTDIR)$(FREEPBX_CONF_DIR)/dns.d/services.conf
|