; ; modemmenu.conf - the login and menu of a dial-up line ; ; app_dmodem runs it on the caller's line (dmodem.conf): ; ; [menu] ; mode = exec ; command = exec /usr/local/bin/modemmenu -config /etc/asterisk/modemmenu.conf ; ; or one modemmenu -serve serves every call on a unix socket ([server]): ; ; [menu] ; mode = unix ; path = /run/modemmenu/modemmenu.sock ; header = yes ; ; Values may be "quoted" to keep spaces at their ends; \r \n \t \e and \xHH ; are those bytes in the texts of [general] and [menu] and in send. ; Comments start with ; or #, on a line of their own or after a value ; (after a space: "key = P ; PPP"); \; and \# are the characters. ; ; The selection gets the session as {placeholders} in its command, send, ; run_as and the rlogin fields, and as MODEM_* in its environment. In a ; command a placeholder is a quoted shell word already: write {user}, not ; "{user}" (or "$MODEM_USER" from the environment). ; ; {user} MODEM_USER the user name the caller logged in with ; {password} MODEM_PASSWORD their password (pass_password = no: empty ; and not in the environment) ; {auth} MODEM_AUTH the backend that accepted it: file, ldap, sql ; {dialed} MODEM_DIALED the number the caller dialed ; {callerid} MODEM_CALLERID the caller's number ; {baud} MODEM_BAUD the connect rate towards the caller, bit/s ; {rate} MODEM_RATE both rates, tx/rx bit/s (app_dmodem's) ; {tx_rate} MODEM_TX_RATE to the caller ; {rx_rate} MODEM_RX_RATE from the caller ; {date} MODEM_DATE the date of the connection, 2006-01-02 ; {time} MODEM_TIME its time, 15:04:05 (local) ; {datetime} MODEM_DATETIME both, RFC 3339 with the zone ; {epoch} MODEM_EPOCH seconds since 1970 ; {channel} MODEM_CHANNEL the Asterisk channel ; {profile} MODEM_PROFILE the dmodem.conf profile ; {selection} MODEM_SELECTION the [item ...] chosen ; ; The rate, dialed number and caller ID come from app_dmodem's DMODEM_RATE, ; DMODEM_DIALED and DMODEM_CALLERID, or -rate, -dialed and -callerid. [general] ; syslog (auth facility), a file, or none. Never the line: stderr is the ; caller's screen log = syslog ; the backends, asked in this order: file, ldap, sql, system (PAM). A ; backend that does not know the user passes to the next; a wrong password ; stops there auth = file banner = "\r\nWelcome to D-Modem.\r\n" ;banner_file = /etc/asterisk/modemmenu.banner login_prompt = "\r\nlogin: " password_prompt = "Password: " ; after the banner, before the login prompt: the connect rate ({speed}: ; "33600 bit/s", or "50666 bit/s down, 31200 bit/s up"); left out when it ; is not known; "" for none connect_message = "\r\nConnected at {speed}.\r\n" welcome = "\r\nHello {user}, on {date} at {time}.\r\n" ; the message of the day, after the welcome and before the menu: motd, ; then the file (read at each login), {placeholders} in both ;motd = "\r\nThe line is down for maintenance on Sunday.\r\n" ;motd_file = /etc/motd goodbye = "\r\nGoodbye.\r\n" ; the echo of each password character, or none password_echo = * ; logins before the call is hung up, seconds after a wrong one attempts = 3 fail_delay = 3 ; seconds to log in, to choose in the menu login_timeout = 90 idle_timeout = 300 ; user names taken (others are refused without asking a backend) user_pattern = ^[A-Za-z0-9][A-Za-z0-9._@-]{0,63}$ ; the longest line the caller may type at a prompt: a user name or a menu ; choice (a password twice as long) ;max_input = 64 ; time limits (0: none), from the login: a call, and a user's calls in a ; day (kept in state_dir/usage). A selection is hung up at the limit. ; {time_left} (whole minutes) shows what is left, e.g. in [menu] prompt time_limit = 0 daily_limit = 0 state_dir = /var/lib/modemmenu ; these long before the limit, the message is written on the line in the ; middle of a running selection (not one with time_warning = no), once ; for each: 5m 1m warns at 5 minutes and at 1 minute left; 0: none. ; {time_left} is in minutes, {seconds_left} in seconds; \a beeps time_warning = 5m 1m time_warning_message = "\r\n\r\n*** {time_left} minute(s) left in this call ***\r\n" ; the caller's terminal, asked before the banner: ANSI (and its size), ; VT52, what an ANSI terminal is (xterm, a VT220, SyncTERM...), and a ; Commodore by its keys at the login. {terminal}, {term}, {term_name}, ; {rows} and {cols} in the selections (TERM for exec items) [terminal] detect = yes ; auto: watch the login for a Commodore's keys; yes: every caller is one petscii = auto ; for each question a terminal may not answer timeout = 2s ; groups of users for the items' groups = (members of system groups count ; too, for logins by auth = system) [groups] sysops = alice ;dialup = alice bob carol ; a guest account: its name at the login prompt, no password; it sees only ; the items with guest = yes, for time_limit at most [guest] enabled = no name = guest time_limit = 15m ; new accounts: the name at the login prompt starts a signup, which adds ; user:bcrypt to the users file (auth must have file). pending = yes locks ; the account (user:!hash) until the sysop removes the ! [signup] enabled = no name = new pending = yes min_password = 8 ;file = /etc/asterisk/modemmenu.users ;message = "\r\nNew account. Choose a user name and a password.\r\n" ; caller ID: numbers or patterns (* and ? as in file names; anonymous: no ; caller ID). With allow, only those numbers; deny refuses some [callerid] ;allow = 555* 1800* ;deny = 1900* 5550000 anonymous = yes deny_message = "\r\nThis line does not take your call.\r\n" ; a number of its own: deny = yes refuses it; user = logs it in as that ; user without a password (caller ID can be forged: only where the network ; vouches for it); item = starts that item at once after the login ;[number 5551234] ;user = alice ;item = ppp ; users in a text file: user:hash, # comments. hash: bcrypt ($2b$..., ; modemmenu -hash makes one), {SHA256}hex, {SHA512}hex, {SSHA256}base64, ; {SSHA512}base64 or {PLAIN}text (hash = plain: the rest of the line, as is) [file] path = /etc/asterisk/modemmenu.users hash = auto ; LDAP: a bind as the user. Either bind_dn with {user} in it, or a search ; for the user's entry (search_base, search_filter) as search_bind_dn, then ; a bind as the entry found. Restrict who may log in in the filter, e.g. ; (&(uid={user})(memberOf=cn=dialup,ou=groups,dc=example,dc=com)) [ldap] url = ldaps://ldap.example.com ;url = ldap://ldap.example.com:389 ;starttls = yes ;ca_file = /etc/ssl/certs/example-ca.pem ;insecure_skip_verify = no timeout = 10 ;bind_dn = uid={user},ou=people,dc=example,dc=com search_base = ou=people,dc=example,dc=com search_filter = (&(objectClass=posixAccount)(uid={user})) ;search_bind_dn = cn=modem,ou=services,dc=example,dc=com ;search_bind_password = secret ; groups for the items' groups = (no group_base: LDAP has none): a group ; is an entry under group_base that group_filter finds, {group} the item's ; group, {dn} the caller's entry, {user} their name; searched as ; search_bind_dn, else as the caller ;group_base = ou=groups,dc=example,dc=com ;group_filter = (&(cn={group})(|(member={dn})(uniqueMember={dn})(memberUid={user}))) ; how mode = passwd changes a password: exop (Password Modify, RFC 3062; ; OpenLDAP, 389 DS and most), or ad (Active Directory's unicodePwd, over ; ldaps:// or starttls only) ;password_change = exop ; system: the accounts of this machine, by PAM: the auth and account stacks ; of pam_service (modemmenu.pam.sample as /etc/pam.d/modemmenu), so local ; accounts, sssd, Kerberos, whatever PAM is set up for. Needs a build with ; PAM (make finds libpam's headers), and root for pam_unix. Accounts with ; a uid below min_uid are not let in, nor root unless allow_root; with ; groups, only their members [system] pam_service = modemmenu min_uid = 1000 allow_root = no ;groups = dialup ; SQL: query gets args (user, password, in that order of placeholders) and ; returns one column: the stored password, checked as hash says (auto: by ; its prefix as in [file]; or bcrypt, sha256, sha512, plain). hash = none: ; any row means the login is right (the query checks the password itself) [sql] ; mysql (or mariadb), postgres, sqlite driver = mysql dsn = modem:secret@tcp(127.0.0.1:3306)/bbs query = SELECT password FROM users WHERE username = ? AND enabled = 1 args = user hash = auto ; mode = passwd items: update_query sets the password, with update_args ; (user, password, old_password, in the order of its placeholders); ; update_hash = bcrypt stores a bcrypt hash, none the password as typed ; (for a query that hashes it). Without update_query, SQL passwords ; cannot be changed from the menu update_query = UPDATE users SET password = ? WHERE username = ? update_args = password user update_hash = bcrypt ;driver = postgres ;dsn = postgres://modem:secret@127.0.0.1/bbs?sslmode=disable ;query = SELECT 1 FROM users WHERE username = $1 AND password = crypt($2, password) ;args = user password ;hash = none ;update_query = UPDATE users SET password = crypt($1, gen_salt('bf')) WHERE username = $2 ;update_args = password user ;update_hash = none ;driver = sqlite ;dsn = /var/lib/asterisk/users.db ;query = SELECT password FROM users WHERE username = ? ; modemmenu -serve: one modemmenu for all calls, on a unix socket (or ; tcp:host:port). Each connection gets a session of its own on a new pty, ; as app_dmodem's mode = exec would give it [server] listen = /run/modemmenu/modemmenu.sock ; the socket's permissions: who may connect (app_dmodem: Asterisk's group) socket_mode = 0660 ;socket_group = asterisk ; the call's details come first on each connection, NAME=value lines and an ; empty line: app_dmodem's header = yes (DMODEM_*), or a menu item's ; header = yes (MODEM_*). no: the caller's bytes from the start. A ; header from app_dmodem's handoff = yes brings the modem's line with it ; (SCM_RIGHTS): the session runs on that terminal itself, nothing copied header = yes header_timeout = 10 ; yes: a header with MODEM_USER (another modemmenu's item, header = yes) ; logs the caller in without asking again. Only for a socket that nothing ; but trusted menus can connect to trust_user = no ; connections at once; more are told the lines are busy max_sessions = 32 ; The auth socket: the BBS's other logins (telnet, SSH, the web) ask the ; backends above for a user's password through it, so that it is the same ; one. Answered by -serve, or by -authd alone. Who may ask: socket_mode ; and socket_group, and allow_users (the peer's user) ;[authd] ;listen = /run/modemmenu/auth.sock ;socket_mode = 0660 ;socket_group = bbs ;allow_users = bbs ; requests at once ;max_clients = 16 ; The PPP callers' addresses: a command that names {ppp_remote} (or ; {ppp_local}, {ppp_dns}, {ppp_dns2}) takes the first free address of range ; for the call, so that several lines run PPP at once, and gives it back when ; pppd ends. They are lock files in state_dir/ppp-pool (each with who has ; it), shared by every modemmenu on the host. local is the server's end of ; every link; dns, the DNS servers offered (ms-dns), local by default (the ; resolver of dialup/: docs/dialup-network.md). Pick a subnet none of the ; 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 = 100.120.224.1 range = 100.120.224.10-100.120.255.254 ;dns = 100.120.224.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 ; command runs on the line instead (pppd), and its modemmenu.so plugin ; (make builds it with ppp-dev's headers; make install puts it in pppd's ; plugin directory) asks this call's auth socket for the PAP login: the ; backends check it as at the prompt, then item's access rules, then the ; time limits, whose time left becomes pppd's maxconnect. PAP only: CHAP ; needs the passwords kept where they can be read back. Fix the addresses ; (local:remote, from [ppp_pool]): the plugin lets the peer have the one ; pppd gives it [autoppp] enabled = no command = exec /usr/sbin/pppd nodetach lock passive local {ppp_local}:{ppp_remote} ms-dns {ppp_dns} ms-dns {ppp_dns2} require-pap refuse-chap refuse-mschap refuse-mschap-v2 refuse-eap plugin modemmenu.so ipparam autoppp ; the access rules (groups, min_baud, callerids...) a PPP login must pass item = ppp ; drop files for doors (an exec item's dropfile =): what they say of the ; BBS, and how the door reaches the caller. The defaults are what ; Synchronet writes for a door on stdin and stdout [dropfile] bbs_name = modemmenu sysop = Sysop ; the callers' security level (an item's security = overrides it) security = 10 ; auto (ASCII for a terminal detected without ANSI: VT52, PETSCII, a ; plain one; ANSI otherwise), ansi or ascii emulation = auto ; DOOR32.SYS's comm type: 0 local (stdin and stdout: a door on the line), ; 1 serial, 2 telnet; its handle (-1 for 0, else 0 by default) comm_type = 0 ;comm_handle = -1 ; DOOR.SYS's and DORINFO's port: COM1: (COM0: is local); a DOS door under ; DOSEMU wants the port DOSEMU gives it, with a FOSSIL driver (DORINFO's ; FOSSIL flag) com_port = COM1: fossil = yes ; the rate the files give: a FOSSIL's rate (doors built on DMlib refuse ; others, such as a modem's 26400), or connect for the modems' rate = 38400 ; MM/DD/YYYY instead of MM/DD/YY in DOOR.SYS (some newer doors) four_digit_years = no ; doors running at once, each on a node of its own (state_dir/nodes); ; 15 at most with dorinfo#.def max_nodes = 64 [menu] title = "\r\nMain menu\r\n" prompt = "\r\nSelection: " ; the items in order (default: every [item ...] in file order) items = bbs ppp shell passwd ; the caller types a choice and Enter: an item's key, its name or one of ; its aliases, in any case (P, p, ppp). ? shows the menu again. What hangs ; up (the first one is shown in the menu): hangup = G goodbye bye logoff ; yes: one key selects at once, without Enter (one-character keys only) hotkeys = no ; An item: ; key = B its key in the menu, one or more characters ; (default: its name's first letter) ; aliases = ... more words that select it (its name always does) ; label = ... its line in the menu ; mode = exec a program on the line: command (by /bin/sh -c) ; passwd built in: the caller changes their password ; (min_password = 8 characters) ; callers built in: the last callers (count = 10), the time, ; user and rate of each login (state_dir/callers, ; the latest 200; kept only with such an item) ; tcp a TCP server, raw: host, port; send is sent first ; unix a server on a unix socket, raw: path; send too ; (tcp, telnet and rlogin take a path as well, for ; their protocol on a unix socket) ; telnet a telnet server: host, port (23), terminal (ANSI) ; rlogin an rlogin server: host, port (513), and ; rlogin_client_user ({password}), rlogin_server_user ; ({user}), rlogin_terminal (ansi/{baud}) ; run_as = {user} exec as this system user (modemmenu must be root) ; tty = raw the line as app_dmodem has it; sane: cooked, echo, ; CR to LF, for programs that want a terminal ; pass_password = yes the password in {password} and MODEM_PASSWORD ; session_file = no yes: the session as JSON in a 0600 file, its path ; in MODEM_SESSION_FILE (removed after) ; after = hangup when the item ends: hang up, or back to the menu ; connect_timeout = 10 seconds to reach a server ; terminal = ANSI telnet: the terminal type it tells the server ({term} ; and the other placeholders work) ; header = no tcp, unix, telnet, rlogin: yes sends the session ; first, MODEM_* NAME=value lines and an empty line ; (the password only with pass_password), for ; modemmenu -serve or any program that reads it ; handoff = no unix with header = yes: yes hands the server the ; caller's line itself (SCM_RIGHTS, with the header) ; instead of copying bytes to it; the server gives ; it back by closing the connection (the bbs's ; listen with handoff = yes takes it) ; ; Who sees an item (all that are set must pass; the others neither see nor ; can choose it): ; users = alice bob these users ... ; groups = sysops ... or members of these groups ([groups], or the ; system's for auth = system) ; min_baud = 9600 the connect rate at least this (unknown: no) ; callerids = 555* the caller ID matching one of these ; guest = no yes: guests see it too ; ; A door (mode = exec) and its drop files: ; dropfile = door32.sys door.sys dorinfo1.def dorinfo#.def ; written before the program starts, removed after, ; with the user, the rate and the time left; the ; node, the directory and the first file are ; {node}, {dropfile_dir} and {dropfile} in command, ; MODEM_NODE, MODEM_DROPFILE_DIR and MODEM_DROPFILE ; in the environment. dorinfo#.def: DORINFO1.DEF to ; DORINFOF.DEF by the node ; dropfile_dir = where (e.g. /srv/doors/node{node}); default: a new ; directory each time ; dropfile_lowercase = no yes: door32.sys..., for doors on Linux ; door_sys_lines = 52 31: the old DOOR.SYS (the rest blank), for doors ; that do not take the longer one ; security = 0 the drop files' security level ([dropfile]'s if 0) ; A BBS by rlogin: Synchronet and Mystic log the caller in with the user ; name as the server user and the password as the client user [item bbs] key = B label = Bulletin board mode = rlogin host = 127.0.0.1 port = 513 rlogin_client_user = {password} rlogin_server_user = {user} rlogin_terminal = ansi/{baud} after = menu ; or a BBS that reads its login from the line: ;mode = tcp ;port = 2323 ;send = "{user}\r{password}\r" ; PPP: pppd on the line. The caller is logged in already: noauth, and ; ipparam hands the user to /etc/ppp/ip-up (as $6), which also sees MODEM_*. ; Each caller gets an address of [ppp_pool] [item ppp] key = P aliases = dialup net min_baud = 9600 label = PPP (dial-up networking) ; no time warning in the middle of PPP's frames time_warning = no mode = exec command = exec /usr/sbin/pppd nodetach noauth local lock passive {ppp_local}:{ppp_remote} ms-dns {ppp_dns} ms-dns {ppp_dns2} ipparam {user} ; the caller's password changed where their account is: the users file, ; SQL (update_query), LDAP (Password Modify, as the user) or the system ; (PAM's password stack). after = menu by default [item passwd] key = PW label = Change your password mode = passwd min_password = 8 ; a shell of the caller's account (modemmenu runs as root for run_as) [item shell] key = S label = Shell groups = sysops mode = exec run_as = {user} tty = sane pass_password = no command = exec "$SHELL" -l after = menu ; another menu: a modemmenu -serve with trust_user, which takes the caller ; as logged in here ;[item more] ;key = M ;label = More services ;mode = unix ;path = /run/modemmenu/more.sock ;header = yes ;after = menu ; the BBS with the caller's line itself (the bbs's [listen] handoff = yes): ; nothing copied between them ;[item bbs] ;key = B ;label = The BBS ;mode = unix ;path = /run/bbs/handoff.sock ;header = yes ;handoff = yes ;after = menu ; More items, to copy into items = above. Each needs its program installed; ; run_as = {user} (modemmenu as root) keeps callers in their own accounts. ; who called last ; a DOS door under DOSEMU (its command line depends on your DOSEMU's ; version and setup: an example to adapt) ;[item lord] ;key = L ;label = Legend of the Red Dragon ;dropfile = door.sys dorinfo1.def ;dropfile_dir = /srv/doors/lord/node{node} ;tty = sane ;command = cd /srv/doors/lord && exec dosemu -dumb -E "lord.bat $MODEM_NODE" ;after = menu ;[item callers] ;key = LC ;label = Last callers ;mode = callers ;count = 10 ; files by ZMODEM (lrzsz): rz receives what the caller's terminal sends, ; binary, restricted to the directory, renaming rather than overwriting ;[item upload] ;key = U ;label = Upload a file (ZMODEM) ;run_as = {user} ;command = cd "$HOME/uploads" && exec rz -b -R -E ;after = menu ; files by Kermit (C-Kermit): a Kermit server in the caller's files; their ; terminal's Kermit GETs and SENDs, then FINISH returns to the menu ;[item kermit] ;key = K ;label = Kermit file server ;run_as = {user} ;tty = sane ;command = cd "$HOME" && exec kermit -Y -x ;after = menu ; the web as text: lynx with the anonymous account's restrictions (no ; shell, no saving files); w3m is the other choice ;[item web] ;key = W ;label = The web (lynx) ;run_as = {user} ;tty = sane ;command = exec lynx -anonymous https://example.org/ ;after = menu ; mail and news in the caller's account ;[item mail] ;key = M ;label = Mail ;groups = dialup ;run_as = {user} ;tty = sane ;pass_password = no ;command = exec mutt ;after = menu ;[item news] ;key = N ;label = Usenet news ;run_as = {user} ;tty = sane ;command = exec tin -r ;after = menu ; chat among callers on your own IRC server ;[item chat] ;key = C ;label = Chat (IRC) ;run_as = {user} ;tty = sane ;command = exec irssi -c 127.0.0.1 -n {user} ;after = menu ; Gopher: quick even at 2400 bit/s ;[item gopher] ;key = GO ;label = Gopherspace ;run_as = {user} ;tty = sane ;command = exec lynx -anonymous gopher://gopher.floodgap.com/ ;after = menu