Migrate access-list basic auth to a middleware¶
Convert a deprecated AccessList.basicAuth block into an auth middleware in
basic mode, in a single commit.
Converts one list in a single commit: creates the middleware, attaches it wherever the list is referenced, and clears the deprecated fields.
What the migration writes¶
- The middleware. A
type: auth,mode: basicobject named<list>-basic, carrying the same usernames and bcrypt hashes. - The attachment. Every proxy host and location that referenced the list
gains the middleware, listed in the plan's
attachTo. - The exemption. A
satisfyAnylist's allow rules become the middleware'sallowFrom: the networks that previously satisfied the list instead of a password become the networks exempt from it. - The detach, when the swap is complete. If the list set
satisfyAnyand every rule moved intoallowFrom, the access list is also detached from the hosts and locations that gained the middleware (detachAccessList: truein the plan). Leaving it attached would turn the old "IP match OR password" into "IP match AND password" and refuse every password user outside the allow rules. - Nothing detached otherwise. A list that still carries a deny rule, a source-backed rule or geo rules stays attached, and the plan carries an explicit warning that its remaining rules become mandatory alongside the password.
Run ?plan=1 and read detachAccessList and warnings before applying.
Prerequisites¶
- An access list that still has
basicAuthusers. - A caller with the
adminscope (one call rewrites access lists, middlewares and proxy hosts together). - No existing middleware named
<list>-basic.
Steps¶
- Preview the change:
curl -sS -X POST "https://gpm.example.com/api/access-lists/legacy/migrate-basic-auth?plan=1"
- Read the
attachTolist (every host and location that gains the middleware), theallowFromlist,detachAccessList, and anywarnings. - Apply it:
curl -sS -X POST https://gpm.example.com/api/access-lists/legacy/migrate-basic-auth
Verify¶
GET /api/middlewares/legacy-basicreturnstype: auth,mode: basicand the same usernames.GET /api/access-lists/legacyshows nobasicAuthand nosatisfyAny; therulesare untouched.- When the plan reported
detachAccessList: true, the hosts inattachTono longer reference the list: the middleware is the only gate, and a password user outside the old allow rules can still sign in. - The load-time
WARNno longer names the list after the next reload. - An unauthenticated request to a gated host still gets
401with aWWW-Authenticate: Basic realm="legacy"challenge.
Troubleshooting¶
| Symptom | Cause | Fix |
|---|---|---|
409, "middleware ... already exists" |
Something already owns the derived name. | Rename or delete that middleware, or migrate by hand. |
400, "has no basicAuth users to migrate" |
Already migrated, or the list never had users. | Nothing to do. |
warnings names a source- or paths-scoped allow rule |
An auth exemption is a fixed, host-wide CIDR list; those rules are neither. | Leave the access list attached so the rule keeps working, or write the exemption explicitly in allowFrom. |
| A LAN client is now prompted for a password | The list did not set satisfyAny, so it required both the IP and the password, and no allowFrom was copied. |
If the LAN really should skip the password, add the CIDR to the middleware's allowFrom deliberately. |
| Every password user off the allow-listed networks is refused after migrating | The access list stayed attached, so "IP match OR password" became "IP match AND password" | Check detachAccessList in the plan; a list with a deny, source or geo rule is kept attached on purpose: detach it by hand, or keep the remaining rules as a deliberate second gate. |