fix: the webui does not allow to disable the last admin now.
Release / release (push) Failing after 4s
Release / release (push) Failing after 4s
This commit is contained in:
1 parent
5fff009320
commit
ff0c93ed73
10 files changed
+46
-15
No files matched your search
@@ -327,6 +327,8 @@ creation, without a maximum, signed with the server's key; `/auth` never issues
|
||||
admin token may call everything, and only an admin token may change `admins`: create it, rename a
|
||||
group to it, change or remove it, add or take out its members, or remove a user who is a member
|
||||
of it. The first member is added with `linux-manager-group` on the server, which acts as root.
|
||||
The last enabled member of `admins` is not disabled, through the API or `linux-manager-user`, so
|
||||
an administrator who can sign in remains; another member is enabled or added first.
|
||||
|
||||
Consequences: Removing a user from `admins` takes effect at the next request, without waiting
|
||||
for the user's tokens to expire. Membership of `admins` changes only through root on the server.
|
||||
|
||||
@@ -752,7 +752,7 @@ linux-manager-user otp-remove alice
|
||||
| `update <name> [--first-name F] [--last-name L] [--email E]` | Changes the names or the e-mail address |
|
||||
| `update <name> [--display-name N] [--description D] [--email E] [--redirect-uri U ...] [--post-logout-redirect-uri U ...] [--allowed-group G ...] [--grant G ...] [--public-client yes\|no] [--client-scope R:S ...] [--resource-scope S ...]` | Changes the display name, the description, the e-mail address or the OpenID Provider settings of a service account; `''` removes one; a repeated option gives all values of its kind |
|
||||
| `passwd <name>` | Sets the password |
|
||||
| `disable <name>`, `enable <name>` | Locks the user out of OpenVPN and `/auth`, and lets the user in again |
|
||||
| `disable <name>`, `enable <name>` | Locks the user out of OpenVPN and `/auth`, and lets the user in again; the last enabled member of `admins` is not disabled |
|
||||
| `unlock <name>` | Ends a lockout after failed logins and clears the failure count; a disabled user stays disabled |
|
||||
| `remove <name>` | Takes the user out of its groups, revokes the certificate, renews the CRL and removes the user; refused while the user is the last member of a group |
|
||||
| `profile <name>` | The OpenVPN client profile, with the CA, the certificate and the key inline |
|
||||
@@ -1253,7 +1253,7 @@ and answer bodies are JSON; a request body is at most 65536 bytes.
|
||||
| `POST /users` | `{"name", "password", "first_name", "last_name", "email"}` for a VPN user; `{"name", "password", "email"?}` for a Manager-only account | 201 and the user |
|
||||
| `PUT /users/<name>` | any of `{"first_name", "last_name", "email", "wireguard_peers"}`; `wireguard_peers`, `[{"public_key", "ips"}]`, replaces a VPN user's WireGuard peers (see Configuration); for a Manager-only account only `{"email"}`, `""` removing it | the user |
|
||||
| `PUT /users/<name>/password` | `{"password": ...}` | the user |
|
||||
| `POST /users/<name>/disable` | | the user |
|
||||
| `POST /users/<name>/disable` | | the user; 409 for the last enabled member of `admins` |
|
||||
| `POST /users/<name>/enable` | | the user |
|
||||
| `POST /users/<name>/unlock` | | the user |
|
||||
| `DELETE /users/<name>` | | `{"name", "removed": true}` |
|
||||
|
||||
@@ -45,6 +45,10 @@ linux-manager (0.41.0-1) unstable; urgency=medium
|
||||
* The examples switch the router and the VPN on.
|
||||
* A NAT rule that the configuration no longer needs is removed from the
|
||||
running firewall at once, not only at the next boot.
|
||||
* The last enabled member of admins can no longer be disabled, through
|
||||
the API, the Manager or linux-manager-user (409, status 4).
|
||||
* The Users, Groups, Service accounts, Web Sites and Files pages keep a
|
||||
refused change's message above the list after they read it again.
|
||||
* tests/remote/run.py tests the components on Ubuntu 26.04 instances of an
|
||||
LXD remote, and tests/remote/vm.py starts and removes one server
|
||||
VM there to work with, reached through ports 7080, 7081 and 2222 (SSH)
|
||||
|
||||
@@ -765,9 +765,17 @@ def passwd(connection, name, password):
|
||||
|
||||
|
||||
def disable(connection, name):
|
||||
"""Lock the user out; the WireGuard peers of a disabled user are left out of wg0.conf."""
|
||||
"""Lock the user out; the WireGuard peers of a disabled user are left out of wg0.conf.
|
||||
|
||||
The last enabled member of admins is not disabled, so the server keeps an administrator who can sign in;
|
||||
Failure with status 4.
|
||||
"""
|
||||
current = entry(connection, name)
|
||||
if current.get('pwdAccountLockedTime') != [LOCKED]:
|
||||
admins = groups_of(connection, name).get(ADMIN_GROUP)
|
||||
if admins is not None and not any(entry(connection, member).get('pwdAccountLockedTime') != [LOCKED]
|
||||
for member in admins if member != name):
|
||||
raise Failure(f'{name} is the last enabled member of {ADMIN_GROUP} and cannot be disabled', 4)
|
||||
connection.modify_s(dn_of(name), [(ldap.MOD_REPLACE, 'pwdAccountLockedTime', [LOCKED])])
|
||||
if 'linuxManagerWireGuardPeer' in current:
|
||||
apply_wireguard()
|
||||
|
||||
+3
-1
@@ -22,7 +22,9 @@ The users of the server's directory, without the [service accounts](service-acco
|
||||
- **Add:** a VPN user, or with Manager access only a Manager-only account.
|
||||
- **Edit:** the names and the e-mail address of a VPN user, the e-mail address of a Manager-only
|
||||
account.
|
||||
- **Password**, **Disable**, **Enable**, **Unlock** after failed logins, and **Remove**.
|
||||
- **Password**, **Disable**, **Enable**, **Unlock** after failed logins, and **Remove**. The last
|
||||
enabled member of `admins` cannot be disabled, so the server keeps an administrator who can sign
|
||||
in.
|
||||
- **Profile:** downloads the OpenVPN client profile, while the server runs OpenVPN.
|
||||
- **Apple VPN profile** (Apple icon): downloads a `.mobileconfig` that sets up the server's IKEv2
|
||||
VPN on a Mac, iPhone or iPad, while the server runs IKEv2. The password you type protects the
|
||||
|
||||
@@ -58,13 +58,16 @@ export default function GroupsPanel() {
|
||||
/** Runs a change of a group, then reads the list again; a failure is shown above the list. */
|
||||
async function change(work: () => Promise<unknown>) {
|
||||
setBusy(true)
|
||||
let failure: string | null = null
|
||||
try {
|
||||
await work()
|
||||
setError(null)
|
||||
} catch (caught) {
|
||||
setError((caught as Error).message)
|
||||
failure = (caught as Error).message
|
||||
}
|
||||
await refresh()
|
||||
if (failure !== null) {
|
||||
setError(failure)
|
||||
}
|
||||
}
|
||||
|
||||
function remove(group: Group) {
|
||||
|
||||
@@ -95,13 +95,16 @@ export default function ServiceAccountsPanel() {
|
||||
/** Runs a change of an account, then reads the list again; a failure is shown above the list. */
|
||||
async function change(work: () => Promise<unknown>) {
|
||||
setBusy(true)
|
||||
let failure: string | null = null
|
||||
try {
|
||||
await work()
|
||||
setError(null)
|
||||
} catch (caught) {
|
||||
setError((caught as Error).message)
|
||||
failure = (caught as Error).message
|
||||
}
|
||||
await refresh()
|
||||
if (failure !== null) {
|
||||
setError(failure)
|
||||
}
|
||||
}
|
||||
|
||||
function remove(account: User) {
|
||||
|
||||
@@ -114,13 +114,16 @@ export default function SiteFiles(props: { site: string | null; onSite: (name: s
|
||||
/** Runs a change of the files, then reads the folder again; a failure is shown above the list. */
|
||||
async function change(work: () => Promise<unknown>) {
|
||||
setBusy(true)
|
||||
let failure: string | null = null
|
||||
try {
|
||||
await work()
|
||||
setError(null)
|
||||
} catch (caught) {
|
||||
setError((caught as Error).message)
|
||||
failure = (caught as Error).message
|
||||
}
|
||||
await refresh()
|
||||
if (failure !== null) {
|
||||
setError(failure)
|
||||
}
|
||||
}
|
||||
|
||||
/** Uploads the files one after the other into the folder shown, a zip archive extracted there while extract is on. */
|
||||
|
||||
@@ -79,13 +79,16 @@ export default function SitesPanel(props: { onOpenFiles: (name: string) => void
|
||||
/** Runs a change of a site, then reads the list again; a failure is shown above the list. */
|
||||
async function change(work: () => Promise<unknown>) {
|
||||
setBusy(true)
|
||||
let failure: string | null = null
|
||||
try {
|
||||
await work()
|
||||
setError(null)
|
||||
} catch (caught) {
|
||||
setError((caught as Error).message)
|
||||
failure = (caught as Error).message
|
||||
}
|
||||
await refresh()
|
||||
if (failure !== null) {
|
||||
setError(failure)
|
||||
}
|
||||
}
|
||||
|
||||
function remove(site: Site) {
|
||||
|
||||
@@ -97,16 +97,19 @@ export default function UsersPanel() {
|
||||
void refresh()
|
||||
}, [refresh])
|
||||
|
||||
/** Runs a change of a user, then reads the list again; a failure is shown above the list. */
|
||||
/** Runs a change of a user, then reads the list again; a failure is shown above the list after the reading. */
|
||||
async function change(work: () => Promise<unknown>) {
|
||||
setBusy(true)
|
||||
let failure: string | null = null
|
||||
try {
|
||||
await work()
|
||||
setError(null)
|
||||
} catch (caught) {
|
||||
setError((caught as Error).message)
|
||||
failure = (caught as Error).message
|
||||
}
|
||||
await refresh()
|
||||
if (failure !== null) {
|
||||
setError(failure)
|
||||
}
|
||||
}
|
||||
|
||||
async function download(name: string) {
|
||||
|
||||
Reference in new issue
Block a user