Authorization: Bearer <key>.
Why there is a login
An API key is a machine credential. It protects the port, and that is all it does. Pasted into a browser it is one shared secret: the node cannot tell one person from another, and revoking the key revokes everyone holding it. A login is the part that belongs to a person. Each person has their own name and password, their sessions are their own, and an admin can take one person’s access away without touching anybody else.
Both work at the same time on the same node. API keys
covers the key half.
The first account
Accounts are made on the master node, from the CLI, because the first one cannot be made from a page that needs an account to open.--password-stdin reads it from the
pipe instead:
Make the first account before you turn auth on. A node that requires auth
with no account is a node with a sign-in nobody can pass, and the way out is the
same command above, typed on the node itself.
On a fresh node
A fresh install already requires an API key, soainode auth enable has nothing
to do (see API keys). One command is the whole setup:
On a fleet that is already running
Run the same commands on the master. Accounts are managed there and replicated to every node in the cluster automatically, so you add a person once and they can sign in on any node. Sessions are per node. A replicated account is one account, but signing in creates a session on the node whose dashboard you opened. Open another node’s dashboard and you sign in again.Signing in
Open the node’s dashboard and type your name and password. That is the whole flow. The session lasts until you sign out, or until an admin revokes it. A revoked session ends wherever it was open.Your account page
Yours whatever your role:- Change your password.
- See your sessions and revoke them, one per browser you have signed in from. A machine you left signed in somewhere else is one click to end.
Managing users
Admins get a Users page: add an account, remove one, reset somebody’s password, disable an account and enable it again. Disabling keeps the account and refuses the sign-in, which is what you want for somebody who is coming back.
Two roles, and that is the whole list.
From the CLI
--help for its exact arguments. Run the user commands
on the master, since that is where accounts are managed. The ainode auth key
commands are unchanged and live on API keys.
Serve it over HTTPS
A sign-in over plain HTTP sends the password in the clear. Anything on the path between the browser and the node can read it, and on a LAN that is more machines than you think. So put the node behind HTTPS before you hand out accounts. TLS is one command. It serves HTTPS on its own port and leaves plain HTTP exactly where it was, so nothing else in the fleet has to change. The session cookie is marked Secure when the node is served over HTTPS, so on that port the browser will not send it back over a plain HTTP request.What is stored, and where
<AINODE_HOME> is ~/.ainode unless you moved it. Passwords are hashed with
scrypt.
What is in place
One line each:- The session cookie is HttpOnly, so no script on the page can read it.
- It is marked Secure over HTTPS, so it does not travel on a plain HTTP request to that node.
- Every write from the dashboard carries
X-AINode-Client: dashboard, a header a browser will not attach to a cross-site request. That is the CSRF guard: another site can make your browser send your cookie, it cannot make it send that header. - Ten failed sign-ins in five minutes pause that address. The pause lifts on its own, and how long it lasts is described in the release notes.
- Passwords are scrypt-hashed, so the file holds no password to steal.
The paths that stay open
With auth on, everything under/api and /v1 needs a credential. The
exceptions are the static shell and these paths, two of which the sign-in itself
needs:
Matching is on the path, for every method.
API keys carries the rest of the rule.
What ainode doctor says
ainode doctor has a Login check, printed with the other auth lines. What it
verdicts on is described in the release notes. See Doctor for the
rest of the report.
