Worked examples

The examples use the John Smith Ltd setup. Passwords are always asked with ask or read from a file: no example writes one. Since there is no test console…

The examples use the John Smith Ltd setup. Passwords are always asked with ask or read from a file: no example writes one. Since there is no test console here, the commands and what they do are shown; the output is described only where the command’s help or the page defines it.

1. A new hire: the account and the group (ad)

Situation. Helen Gale joins administration with the temporary login new.hire (this is the scenario A new hire, here in one line).

Create the account. You type the password on the terminal, without echo (with ad users generate-password you can have one generated that meets the domain policy):

atlas ad users add new.hire --first-name Helen --last-name Gale \
  --mail helen.gale@johnsmith.test --description Administration \
  --imap-quota 5120 --home-drive Z: --script-path logon.bat --home-quota-mb 5120 \
  --password ask

The defaults are those of the console’s «New user» form (mailbox and mail sending on, display name composed from first and last name). A field the page refuses makes the command exit with status 3 and the name of its option.

Then put her in the group administration. --members replaces the whole list, so start from the current members:

atlas ad groups show administration
atlas ad groups set administration --members jgreen,jbrown,new.hire

Check. atlas ad users show new.hire shows the account; atlas ad groups show administration lists the members. At the first handover remind Helen to change her password.

2. A share with a quota (ad)

Situation. John Smith Ltd wants \\atlas\administration: administration writes, management reads, the folder is the K: drive, at most 50 GB (scenario Shared folders by department).

atlas ad shares folders
atlas ad shares add administration --description "Administration documents" \
  --group-read-write administration --group-read-only management \
  --drive-letter K --quota 51200
atlas ad shares show administration

folders lists the folders already on the disk that a share with the same name would take over as they are. To remove the space limit just atlas ad shares set administration --quota 0: the rest of the share stays as it was.

3. A mail domain and the SPF/DKIM panel (mail)

Situation. The company adds the second domain johnsmith.example (scenario A second mail domain).

atlas mail domains add johnsmith.example
atlas mail domains dkim generate johnsmith.example
atlas mail domains show johnsmith.example

show is the page’s authentication panel: it asks the public DNS what the receiving servers find (it takes a few seconds) and prints the SPF, DKIM, DMARC, PTR and MX records to publish. Atlas never changes the public DNS: you publish the records at the domain’s provider. Once the DKIM key is published, you turn signing on:

atlas mail domains dkim enable johnsmith.example
atlas mail domains show johnsmith.example

The second show repeats the check. Postfix accepts the new domain’s mail when the SMTP service restarts.

4. An internal site with the reverse proxy (web)

Situation. The intranet intranet.johnsmith.test (10.20.0.5, port 80) must open only from inside, with a self-signed certificate (scenario Publishing an internal site with the reverse proxy).

atlas web proxy add intranet --domains intranet.johnsmith.test \
  --upstream 10.20.0.5:80 --tls self-signed
atlas web proxy list

The deploy restarts nginx and the command waits for it to finish; with --no-wait it returns at once and you can ask atlas web proxy status whether a deploy is running. The letsencrypt mode is allowed only if you have enabled it in System → Settings → TLS certificates. To add WebSockets to an existing site: atlas web proxy set intranet --websocket.

5. A DNS record (dns)

Situation. The name intranet is needed in the domain’s zone, pointing to 10.20.0.5.

atlas dns zones records add corp.johnsmith.test intranet --type A --value 10.20.0.5
atlas dns zones records list corp.johnsmith.test --search intranet

The type selects the value’s options: A and AAAA take --value, MX takes --priority and --target, SRV also --weight and --port. Changes apply at once. To delete a record you need its number in the zone’s list:

atlas dns zones records delete corp.johnsmith.test 7

The command asks for confirmation (or --yes, in a script).

6. A backup schedule and a run now (backup)

Situation. Backups start at 22:30 from Monday to Friday, «No rotation» on the NAS Office NAS (scenario Backing up servers and PCs). The storage already exists (Backup → Storage).

atlas backup storage test "Office NAS"
atlas backup settings set --time 22:30 --days mon,tue,wed,thu,fri \
  --ds --ds-storage "Office NAS"
atlas backup settings show

storage test checks that the storage is reachable and still has its identity. --ds turns «No rotation» on; as in the console, the other cycles stay as they are (--weekly, --daily, --monthly turn them on or off separately) and start one after the other. To try at once without waiting for 22:30:

atlas backup settings run

With no options the first cycle of the schedule starts on the first enabled storage; with --cycle ds --storage "Office NAS" you choose. To follow it: atlas backup jobs list. The archives’ encryption password is set once with atlas backup settings set-password --password @file. For a client, for instance the business server, the backup starts at its next contact: atlas backup clients run srv-erp.

7. A PBX extension (pbx)

Situation. Helen Gale also gets an extension, 206, with voicemail (scenario PBX: extensions, provider line…).

atlas pbx extensions add 206 --kind user --user new.hire --voicemail --vm-pin @/root/pin.txt \
  --vm-email helen.gale@johnsmith.test
atlas pbx extensions list

You read the mailbox PIN (up to 10 digits) from a file; the console accepts only numbers from 200 to 299. Dedicated hours, for example: --hours-mon 09:00-13:00,14:00-18:00. An extension with no user (a device, such as the reception phone) is atlas pbx extensions add 250 --kind device --label "Reception".

8. A user’s second factor (tools mfa)

Situation. Jack Green turns on the OTP code (scenario Setting up your second factor).

atlas tools mfa enroll jgreen --qr /root/jgreen-qr.png

The command shows the token’s serial and the otpauth address, which contains the secret: the page shows it once only, and so does the command. With --qr it also saves the QR image in a file (mode 600) for the user to scan with their app. Then activate the token with the code the app shows, passed from stdin or the terminal:

atlas tools mfa verify jgreen --otp ask
atlas tools mfa show jgreen

If the user locks the token with too many wrong attempts: atlas tools mfa unlock jgreen; to remove it: atlas tools mfa revoke jgreen.

Warning The otpauth address and the QR file contain the token’s secret. Delete the file as soon as the user is done, and do not paste the full command output into a ticket.

9. The settings: System blocks (system settings)

Situation. You set up automatic updates and check the host name.

atlas system settings list
atlas system settings updates show
atlas system settings updates set --enabled --reboot-time 03:30 --automatic-reboot \
  --mail lwhite@johnsmith.test
atlas system settings hosts show

list lists the blocks of the System → Settings page and says whether they are offered: a block of a module that is not installed does not appear. Every block is a group with show and set; set changes only the options named. To add a line to the hosts file: atlas system settings hosts set --add-entry '192.168.10.41 srv-erp'. The Internet name (settings mailname set) is a job of several minutes that moves every service: the command first lists what it touches and asks for confirmation.

10. A script that loops over users with --json and jq

Situation. Every month the administrator archives the second-factor state of all users.

#!/bin/sh
set -eu
out=/root/mfa-$(date +%F)
mkdir -p "$out"
atlas --json ad users list | jq -r '.[].id' | while read -r login; do
  atlas --json tools mfa show "$login" > "$out/$login.json" || echo "mfa: $login: status $?" >&2
done

atlas --json ad users list prints a single document: the list of users as the page receives it, with id (the login), name.displayName, contact.mail, features.disabled. A CSV list of the enabled accounts:

atlas --json ad users list | jq -r '.[] | select(.features.disabled | not) | [.id, .name.displayName, (.contact.mail // "")] | @csv'

With set -e the script stops at the first command that exits with a status other than 0; for single errors check $? (3 refused by the page, 4 not found). --json never mixes notes and data: warnings go to stderr.

11. A firewall rule with the confirmation window (network firewall)

Situation. The partner’s office (198.51.100.25) must reach the appliance’s port 443. This is the local firewall (Network → Local firewall): a change is loaded at once and must be confirmed in time, otherwise the previous rules come back.

atlas network firewall add --protocol tcp --ports 443 --source 198.51.100.25 --comment "Studio del partner"

On a terminal the command asks for confirmation and, depending on the answer, keeps or cancels. From a script, without a terminal, it leaves the window open: another session decides.

atlas network firewall confirm    # keeps the rule
atlas network firewall cancel     # back to the previous rules at once

--confirm confirms at once and gives up the protection: use it only where losing the connection you are working on does not matter. The rules apply before the active services and do not touch SSH (22) or the transient bridge (8000). To list them: atlas network firewall list.

12. The appliance’s state (system stats)

atlas system stats show
atlas system stats disks
atlas --json system stats show > /root/state.json

show prints first four lines of label-value pairs, like the console’s «Hardware» card («Up», «CPU», «Memory», «Network»), then the disk table, with the columns «Disk», «Used / total», «%» and «Device»: one row per mount point (System, Boot, Shares, Email, Runtime). The other commands of the page (services, mailboxes, smtp, antispam…) each print one of the cards. With --json you get the page’s data, suited to a monitoring script.

13. The console’s assistant (system settings assistant)

Situation. You enter the instance key, accept the terms, turn the assistant on and, at some point, top up the credits.

atlas system settings assistant show
atlas system settings assistant key --key @/root/assistant.key
atlas system settings assistant accept-terms
atlas system settings assistant set --enabled --retention-days 60
atlas system settings assistant refresh
atlas system settings assistant topup --pack extra-1000   # the id as show lists it

show prints the state of the System → Settings → AI assistant block: whether it is on, the retention days, whether a key is saved (never the key), and the subscription as it was last read: customer, instance, plan, credits, renewal, the version of the terms in effect and who accepted it (with «accepted tacitly» when it is so) and the top-ups offered, each with its id. The group’s commands:

Command What it does
show the state and the subscription, as above
set [--enabled | --no-enabled] [--retention-days N] turns the assistant on or off and changes the retention days (1 to 3650); it changes only what you name. Turning on needs a key the service accepts and the terms accepted: the page refuses otherwise
key --key <source> saves the instance key; the source is - (standard input), @file or ask, never the key on the line (see Secrets do not go on the command line). The console checks it with the service before keeping it
key-remove removes the key and turns the assistant off; asks for confirmation
refresh reads the subscription again from the Edon AI service and waits for the answer
accept-terms [--terms-version V] accepts the terms of the subscription, the data processing agreement included, on behalf of the customer: asks for confirmation (--yes skips it) and records who, when and which version. By default it accepts the version in effect read from the subscription, the only one the service accepts (it refuses any other); the option is called --terms-version because --version is a global option
topup --pack <id> [--order <id>] orders a pack of credits, billed to the customer, after a confirmation. If the service did not answer the order, the command prints the order’s id: to ask for that same order (never a second one) repeat it with --order <id>

Warning What the assistant reads leaves the appliance: the model runs at the Edon AI service’s providers (see System). accept-terms, topup and key-remove ask for confirmation; in a script without a terminal they need --yes, and only if that is what you want.

LET’S TALK INFRASTRUCTURE

Control starts with a conversation.

Tell us about your infrastructure. Let’s start with what you actually need.

Talk to an engineer