mirror of
https://github.com/D-Modem/login.git
synced 2026-11-28 20:38:06 -08:00
A signup made the account in the users file only. Now it makes the account in each backend of [general] auth that is set up to make accounts: the users file, SQL ([sql] insert_query), LDAP ([ldap] add_dn, added as add_bind_dn, the password set by Password Modify or unicodePwd for AD) and system accounts ([system] create_command, with a useradd sample script). [signup] backends limits the list. Before the account is made, each backend checks that the name is free. If one backend fails, the accounts already made are taken back (delete_query, entry delete, remove_command). With pending = yes, each backend must lock the account, or dmodem-login does not start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRRfuh3h6uNuHtaugux
28 lines
897 B
Bash
Executable File
28 lines
897 B
Bash
Executable File
#!/bin/sh
|
|
# Copyright (C) 2026 D-Modem Authors
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
#
|
|
# dmodem-login-useradd USER PENDING: makes the system account of a
|
|
# signup. [system] create_command runs it:
|
|
#
|
|
# create_command = /usr/local/sbin/dmodem-login-useradd {user} {pending}
|
|
# remove_command = userdel -r {user}
|
|
#
|
|
# The password comes on the standard input. PENDING = yes locks the
|
|
# account until the sysop unlocks it (usermod -U USER). Change GROUP and
|
|
# SHELL for your system. dmodem-login must run as root for useradd.
|
|
set -eu
|
|
user=$1
|
|
pending=$2
|
|
GROUP=${GROUP:-dialup}
|
|
SHELL_=${SHELL_:-/usr/sbin/nologin}
|
|
|
|
IFS= read -r password
|
|
getent group "$GROUP" >/dev/null || groupadd "$GROUP"
|
|
useradd --create-home --shell "$SHELL_" --gid "$GROUP" \
|
|
--comment "dmodem-login signup" "$user"
|
|
printf '%s:%s\n' "$user" "$password" | chpasswd
|
|
if [ "$pending" = yes ]; then
|
|
usermod --lock "$user"
|
|
fi
|