Configuration reference¶
SKA reads its settings from config/config.ini in the application directory (/srv/keys/config/config.ini
in the Docker image). The file is not part of the repository. Start from config/config.ini.example, which
contains every section described here except [session].
File format and loading¶
The file is parsed with PHP's parse_ini_file() with sections enabled. Some consequences:
- Unquoted
on,yesandtruebecome1; unquotedoff,no,false,noneandnullbecome an empty string.default_key_supervision = offrelies on this. - Quote values that contain anything other than letters, digits and simple punctuation. Characters such as
!,{,},(,),&,|,~and^have a meaning of their own in unquoted INI values. The example quotesuser_active_bitmask = '!2'for this reason. - A value that contains double quotes, such as the HTML in
[web] footer, can be wrapped in single quotes. ;starts a comment.
When the settings are read:
- The web interface reads the file on every request, so changes apply to the next page load.
scripts/ldap_update.php,scripts/supervise_external_keys.phpand eachscripts/sync.phprun read it when they start.- The sync daemon
scripts/syncd.phpreads it once at startup. It starts a freshsync.phpfor each server, which reads the file again, but the daemon itself keeps its own copy. Restart the daemon after changing[general] timeout_util.
Required keys and defaults¶
In the tables below, If missing is what the code does when the key is absent, which is not always the
value in the example file. "Required" means the code reads the key without a fallback. SKA turns PHP
warnings into errors, so a missing required key makes the page or script that reads it stop with an error. The same applies to a whole section that the code reads
as a unit ([email], [inventory]).
The settings whose built-in default differs from the example file:
| Setting | Example file | If missing |
|---|---|---|
[monitoring] status_file_timeout |
93600 |
7200 |
[privacy] history_username_env_default |
1 |
disabled |
[session] timeout |
not present | PHP's own session.gc_maxlifetime |
Web¶
| Key | Type | If missing | Description |
|---|---|---|---|
enabled |
0 or 1 |
web interface off | When empty or 0, the web interface answers with a 503 "Down for maintenance" page (visitors who are not logged in are first redirected to the login page). Cron jobs and the sync daemon are not affected. |
baseurl |
URL | required | Public URL of SKA, without a trailing slash. |
logo |
URL path | no logo | Image shown at the top left of every page, 40 by 40 pixels. |
footer |
HTML | required | Footer text of every page. %v is replaced by the version. |
baseurl is used in two ways:
- As the absolute prefix of links SKA writes outside the browser: in emails, in the header of every key
file (
## Do not edit this file! Modify at ...), and in key comments when[privacy] comment_key_filesis2. - Its path part is the prefix of every link and redirect in the web interface. The shipped web server
configurations and the installation guides serve SKA at the root of its host name, with no path in
baseurl. The home link next tologoalways points to/, whatever the path inbaseurl.
logo must be served from the same origin as SKA. Every page is sent with
Content-Security-Policy: default-src 'self', so an image from another host is blocked by the browser.
Leaving logo empty also removes the "SSH Key Authority" home link next to it.
footer is printed as HTML without escaping. Escape a literal &, ", < or > as &, ",
< and >. The version that replaces %v comes from the VERSION file in the image, or from
git describe on a checkout, else dev.
[web]
enabled = 1
baseurl = https://ska.example.com
logo = /logo-header.svg
footer = 'SSH Key Authority version %v'
General¶
| Key | Type | If missing | Description |
|---|---|---|---|
timeout_util |
GNU coreutils or BusyBox |
required by the sync daemon and by sync.php --all or --host |
Which timeout program is installed on the SKA host. |
default_key_supervision |
full, rootonly or off |
required when a server is added | The "key supervision" setting that new servers start with. |
The sync daemon, and sync.php --all or --host, start the sync of each server as a separate
sync.php --id process under /usr/bin/timeout with a limit of 60 seconds. With BusyBox, SKA calls
timeout -t 60; with any other value it calls timeout 60s (GNU syntax). sync.php --id run by hand is
not wrapped. Run timeout --version on
the SKA host to see which one you have.
default_key_supervision applies to servers added through the web form and through the bulk import. It
does not change existing servers, whose setting is changed on each server's settings page.
full: the unmanaged-key scan reads the keys of root and of all other user accounts.rootonly: only the keys of the root account are read.off: no keys are read.
Any value other than rootonly or an empty value is treated as full. Write off unquoted: the INI
parser turns it into an empty value, but a quoted "off" stays the text off and counts as full. See
Unmanaged keys.
[general]
timeout_util = GNU coreutils
default_key_supervision = full
Security¶
| Key | Type | If missing | Description |
|---|---|---|---|
session_timeout |
seconds | 28800 |
Log a user out after this long without a request. 0 disables the timeout. |
host_key_reset_restriction |
0 or 1 |
1 |
Who can clear a server's stored SSH host key. |
host_key_collision_protection |
0 or 1 |
1 |
Refuse to sync servers that share an SSH host key. |
hostname_verification |
0 to 3 |
0 |
Extra check that the sync reached the intended server. |
min_rsa_bits |
bits | 4096 |
Minimum size of RSA keys. |
min_ecdsa_bits |
bits | 384 |
Minimum size of ECDSA keys. |
min_ed25519_bits |
bits | 256 |
Minimum size of Ed25519 keys. |
Session timeout¶
session_timeout is measured from the user's last request, not from login. The PHP session file can still
be removed earlier by PHP's session garbage collection (see Session), so the PHP side has to
allow at least the same lifetime.
Host key settings¶
The sync connects to a server only if its SSH host key matches the one SKA stored on the first connection.
host_key_reset_restriction:
1: only SKA administrators can clear the stored host key.0: server leaders also get a "Host key" field with a "Clear" button on the settings of servers they lead. After clearing, the next sync accepts and stores whatever host key the server presents.
host_key_collision_protection:
1: if another server with key management enabled has the same host key, the sync of the server aborts with "Multiple hosts with same host key."0: the sync proceeds. Any value other than1disables the check.
Independently of these settings, the sync always refuses a server when another managed server resolves to the same IP address with the same port and jumphosts.
Hostname verification¶
hostname_verification compares the hostname registered in SKA with what the target server says about
itself:
| Value | Check |
|---|---|
0 |
No hostname check. |
1 |
The output of /bin/hostname -f on the server must equal the hostname in SKA. |
2 |
The hostname must be one of the lines of /var/local/keys-sync/.hostnames. If that file cannot be read, hostname -f is used instead. |
3 |
As 2, but the sync aborts if /var/local/keys-sync/.hostnames cannot be read. |
A failed check aborts the sync with "Hostname check failed (allowed: ...)". Level 3 means a server is only
synced if it was explicitly prepared for it. See
Prepare target servers.
Key size minimums¶
The minimums are checked when a key is added. Keys must start with ssh-rsa, ssh-dss,
ecdsa-sha2-nistp* or ssh-ed25519 and must be readable by the installed ssh-keygen; ssh-dss keys
are held to min_rsa_bits. The key size is the one reported by ssh-keygen -l. Ed25519 keys are always 256 bits, so a min_ed25519_bits above 256 rejects every Ed25519
key.
- Keys added on the home page or on a user's key page are always rejected below the minimum.
- On a server account's page, an administrator can tick "Allow weak (< 4096 bits) key" to accept a key below the minimum, whatever the key type and configured value.
- Raising a minimum does not remove existing keys. The "Public keys" list (
/pubkeys) marks keys below the minimum. For that marking only, a configured value below 2048 (RSA) or 256 (ECDSA, Ed25519) is ignored and the built-in default is used.
[security]
session_timeout = 28800
host_key_reset_restriction = 1
host_key_collision_protection = 1
hostname_verification = 2
min_rsa_bits = 4096
min_ecdsa_bits = 384
min_ed25519_bits = 256
Session¶
This section is not in the example file.
| Key | Type | If missing | Description |
|---|---|---|---|
timeout |
seconds | PHP's session.gc_maxlifetime |
Lifetime of PHP session data for garbage collection. |
When the value is numeric, SKA sets PHP's session.gc_maxlifetime to it. A value of 0 or below sets it to 28800. When the
key is missing, the PHP setting is left alone; in a stock php.ini it is 1440 seconds. SKA also runs PHP's
session garbage collection on about one request in a thousand, and that collection deletes sessions idle
for longer than gc_maxlifetime. Without this key, a user can therefore be logged out after about 24
minutes of inactivity even though [security] session_timeout allows 8 hours.
This key is not enough on Debian-based systems, including the Docker image: the PHP package's own cleanup
job deletes session files according to the php.ini value and does not see the value SKA sets at run
time. Set session.gc_maxlifetime in a PHP ini file as well, as described in
Security.
[session]
timeout = 28800
Privacy¶
| Key | Type | If missing | Description |
|---|---|---|---|
comment_key_files |
0, 1 or 2 |
required | How much information the synced key files contain. |
history_username_env_default |
0 or 1 |
disabled | Whether user key lines get an environment="..." option by default. |
history_username_env_format |
string | BASH_HISTORY_USERNAME={uid} |
The NAME=value that the option sets. |
Key file comments¶
comment_key_files controls the files under /var/local/keys-sync/ on target servers:
| Value | Content |
|---|---|
0 |
Key lines without comments. |
1 |
Each key's comment is the owner's name (for a server account's key, account@hostname) and the key's creation date. The file also has comment lines naming each rule's user, server account or group with who granted it and when, the members of each group between start and end markers, the groups through which the account's rules apply, # Account disabled for inactive users and # Inactive group for inactive groups. |
2 |
Each key's comment is the URL of the key's page in SKA. No other comment lines. |
At every level, each file starts with two header lines built from [web] baseurl: they name the account
and link to its page in SKA (for an LDAP user's key file, the link is baseurl itself). An example of a level 1 file is in
How keys reach servers.
History username environment¶
When enabled, SKA adds environment="<format with {uid} replaced>" to every key line that belongs to a
user, in account key files and in LDAP user key files. Key lines of server accounts do not get it. The
intended use is to tell shared-account sessions apart, for example in shell history.
history_username_env_default = 1turns it on for all servers. In a server's settings, "History username env" can be set to "Inherit global default", "Force enabled" or "Force disabled", and "Format override (optional)" sets a format for that server.history_username_env_formatmust contain=and{uid}, may contain only letters, digits, spaces and. _ - @ : + =besides{uid}, and no other braces or quotes. An invalid format is replaced byBASH_HISTORY_USERNAME={uid}.- If the value for a particular user is not valid after
{uid}is replaced, that user's key lines get noenvironmentoption.
Note
sshd ignores environment="..." unless PermitUserEnvironment allows it on the target server. See
Prepare target servers.
[privacy]
comment_key_files = 1
history_username_env_default = 1
history_username_env_format = "BASH_HISTORY_USERNAME={uid}"
Monitoring¶
| Key | Type | If missing | Description |
|---|---|---|---|
status_file_path |
path | /var/local/keys-sync.status |
Status file written on each target server. |
status_file_timeout |
seconds | 7200 |
Added to the current time to give the file's expire value. |
SKA writes the status file over SSH at the end of each sync and after each unmanaged-key scan of the
server. It is a single JSON object with the fields warn_below_version, sync_status,
sync_status_message, key_supervision_error, accounts_with_unnoticed_keys and expire (a date in RFC 2822 format). A
monitoring check on the target can raise an alert when expire has passed, which means SKA has not reached
the server for that long. Choose a timeout longer than the interval between syncs and scans.
The keys-sync user must be able to write the file. If writing fails, the error is added to the server's
key supervision error in SKA. See Monitoring and logs.
[monitoring]
status_file_path = "/var/local/keys-sync.status"
status_file_timeout = 93600
Defaults¶
| Key | Type | If missing | Description |
|---|---|---|---|
account_groups[<account>] |
group name | required | An account that every new server gets, and the group it is added to. |
When a server is added, SKA creates each listed account for it in SKA and adds the account to the named group. A group that does not exist yet is created. The entries can be repeated:
[defaults]
account_groups[root] = "root-accounts"
account_groups[deploy] = "deploy-accounts"
Limits and caveats:
- Only servers added after the change get the accounts. Existing servers are not changed.
- An account with a listed name cannot be deleted or set inactive, on any server.
- Keep at least one entry. The code that saves a server account reads
account_groupswithout checking that it exists, so removing every entry makes saving an account fail.
Email¶
| Key | Type | If missing | Description |
|---|---|---|---|
enabled |
0 or 1 |
no mail sent | When empty or 0, mails are built but not sent. |
from_address |
address | required | Sender address of SKA's mails. |
from_name |
text | required | Sender name. |
report_address |
address | required | Receives security notifications. |
report_name |
text | required | Name for report_address. |
admin_address |
address | required | Where users are told to ask for help. |
admin_name |
text | required | Name for admin_address. |
reroute |
address | not used | Send all mail to this one address instead. |
SKA sends mail with PHP's mail() function, so the host needs a working sendmail-compatible MTA. The
Docker image does not install one.
report_addressis a recipient or copy recipient of notifications about changes that affect access: new keys, access granted to server accounts and groups, additions to groups, new leaders of servers, server accounts and groups, unmanaged keys found on servers or allowed by an administrator, and servers left without an active leader.admin_addressis the Reply-To of many mails, appears in mail texts as the contact for help, and is shown on the help page and the error pages.- With
rerouteset, every mail goes only to that address. The original To, Cc and Bcc recipients are listed at the top of the body. This is meant for testing. - On a server's "Contact" tab, the mail form lets a user send either as themselves or as
from_name <from_address>with Reply-Toadmin_address.
[email]
enabled = 1
from_address = ssh-key-authority@example.com
from_name = "SSH Key Authority system"
report_address = reports@example.com
report_name = "SSH Key Authority reports"
admin_address = admin@example.com
admin_name = "SSH Key Authority administrators"
;reroute = test@example.com
Database¶
All keys are required.
| Key | Type | Description |
|---|---|---|
hostname |
host name | MySQL or MariaDB server. In the example compose setup this is the database container's name. |
port |
number | Port of the database server, normally 3306. |
username |
text | Database user. |
password |
text | Password of the database user. |
database |
text | Name of the database. |
[database]
hostname = ska-db
port = 3306
username = ska-user
password = change-me
database = ska-db
LDAP¶
How these settings work together, with complete examples for Active Directory and OpenLDAP, is described in LDAP and Active Directory.
Connection¶
| Key | Type | If missing | Description |
|---|---|---|---|
host |
LDAP URI | required | For example ldaps://ldap.example.com:636 or ldap://ldap.example.com:389. |
starttls |
0 or 1 |
required | Use StartTLS on the connection. Use with ldap://, not with ldaps://. |
follow_referrals |
0 or 1 |
off | Let the LDAP library follow referrals. With Active Directory this can cause errors when searching the whole tree. |
bind_dn |
DN | required, may be empty | Service account for searches. Empty means no bind (anonymous). |
bind_password |
text | required, may be empty | Password of bind_dn. |
dn_user |
DN | required | Subtree that contains user entries. |
dn_group |
DN | required | Subtree that contains group entries. |
Certificates for ldaps:// and StartTLS are verified with the trust settings of the system's LDAP library
(/etc/ldap/ldap.conf). The Docker image points it at the system CA bundle.
User attributes¶
| Key | Type | If missing | Description |
|---|---|---|---|
user_id |
attribute | required | Username attribute, for example sAMAccountName or uid. |
user_name |
attribute | required | Display name, for example cn. |
user_email |
attribute | required | Email address. A user without one cannot log in. |
user_superior |
attribute | not used | Attribute holding the username of the user's manager. |
At login, SKA searches dn_user for an entry whose user_id equals the typed username and checks the
password by binding as that entry's DN. Exactly one entry must match.
user_superior is optional. When it is set, the LDAP update job records each user's superior. The value is
looked up as an SKA username (a user_id value), so an attribute that holds a DN does not work. It is used
when a user who was the last active leader of a server becomes inactive: the "server has been orphaned" mail
goes to the first active superior up the chain, with a copy to report_address. Without a superior, the mail
goes to report_address alone.
Account status¶
| Key | Type | If missing | Description |
|---|---|---|---|
user_active |
attribute | every user active | Attribute that tells whether a user is active. |
user_active_true |
value | - | Active if user_active equals this value. |
user_active_false |
value | - | Active unless user_active equals this value. |
user_active_bitmask |
[!]number |
- | user_active holds bit flags; check the given bit. |
Set user_active and exactly one of the other three. If more than one is set, user_active_true is used
first, then user_active_false, then user_active_bitmask.
- With
user_active_true, an entry without the attribute is inactive. - With
user_active_false, an entry without the attribute is active. - With
user_active_bitmask, the number is a mask that is ANDed with the attribute value (2tests the bit with value 2). Without!the user is active when a bit of the mask is set; a leading!means the user is disabled when it is set.'!2'withuser_active = userAccountControlis the usual Active Directory setting. An entry without the attribute cannot be evaluated: that user cannot log in, and the LDAP update job leaves the user unchanged. - If
user_activeis set but none of the three are, or the bitmask is not of the form[!]number, every user is treated as inactive.
user_active = userAccountControl
user_active_bitmask = '!2'
Groups¶
| Key | Type | If missing | Description |
|---|---|---|---|
group_member |
attribute | required | Group attribute that lists the members, for example member or memberUid. |
group_member_value |
attribute | required | User attribute whose value appears in group_member: dn for group-of-names groups, uid for POSIX groups. |
group_class |
objectClass | required for the LDAP group browser | objectClass of group entries, for example group or posixGroup. |
group_id |
attribute | required | Group name attribute. |
group_num |
attribute | required | Attribute that identifies a group permanently, for example objectGUID. |
admin_group_cn |
text | required | Members of the group with this cn are SKA administrators. |
indirect_group_memberships |
0 or 1 |
required | Also find groups a user belongs to through other groups. |
A user's groups are found by searching dn_group for entries whose group_member contains the user's
group_member_value. This search sets the administrator flag and the membership of LDAP-linked groups.
indirect_group_memberships = 1adds the Active Directory matching rule1.2.840.113556.1.4.1941to that search. OpenLDAP does not support it; set0there.admin_group_cnis compared, case-sensitively, with thecnattribute of the user's groups. The LDAP update job also creates a local group with this name and links it to the LDAP group found bygroup_id.group_numvalues are always decoded as a 16-byte binary GUID, the format of Active Directory'sobjectGUID.group_classis used by the browser for adding LDAP groups on the Groups page. That browser is written for Active Directory: it walks organizational units and looks entries up by their GUID.
group_member = member
group_member_value = dn
group_class = group
group_id = sAMAccountName
group_num = objectGUID
admin_group_cn = "Key Admins"
indirect_group_memberships = 1
Inventory¶
| Key | Type | If missing | Description |
|---|---|---|---|
url |
URL with %s |
no link | Link from a server's page to an inventory system. |
During each sync, SKA reads /etc/uuid on the target server, if it exists, and stores its content. When
url is set and a server has a stored value, the server's page shows it as a link: %s is replaced by the
value and a / is appended.
Keep the [inventory] section in the file even when url is not set. The server page reads the section
without a fallback.
[inventory]
url = "https://inventory.example.com/device/%s"
GPG¶
| Key | Type | If missing | Description |
|---|---|---|---|
key_id |
key fingerprint | mails unsigned | Key used to sign outgoing mails as OpenPGP/MIME. |
Mails are signed only when all of these hold:
key_idis present. An emptykey_id =line also counts as present, so comment the line out instead.- The PHP
gnupgextension is loaded. The Docker image does not install it. - The mail is sent as
[email] from_address. A mail that a user sends as themselves from a server's page is not signed.
The key must be available to the GnuPG keyring of the user that the PHP process runs as.
[gpg]
key_id = 0123456789ABCDEF0123456789ABCDEF01234567