Skip to main content

Database, SFTP and email connections

Not every service is an HTTP API. Blokkio also stores connections to databases, SFTP servers and mail servers. Each of these kinds has a fixed set of fields, and its password-like fields are stored encrypted and never sent back to the browser.

KindApps in the catalogueUsed by
DatabasePostgreSQL, MySQL, Microsoft SQL ServerDatabase Query (all three), Database Row Trigger (PostgreSQL only)
SFTPSFTPSFTP File Trigger
IMAPIMAPEmail Trigger (IMAP)
SMTPSMTPSend Email

Each of these blocks and triggers has a connection picker that only lists connections of the matching kind, for example Database connection or SMTP connection. The Database Row Trigger's PostgreSQL connection picker only lists PostgreSQL connections. If a workflow's trigger still points at a connection of another kind or engine, publishing reports an error such as 'Orders DB' is not supported here: PostgreSQL connection accepts PostgreSQL connections only.

These connections always come from the official apps; custom apps are HTTP only.

Creating a connection​

  1. Go to Apps, open the Databases, Files or Email category, and click Connect on the app, for example PostgreSQL.
  2. Enter a name and fill in the fields below. Fields marked with * are required.
  3. Click Save & test. Blokkio saves the connection, connects to the server and shows the result in the dialog, for example Connected to PostgreSQL at db.example.com. Fix the values and click Save & test again until it succeeds, then click Done. Create saves without testing.

Any text or password field can use Use secret to reference a project secret (secret://NAME) instead of holding the value. See Secrets vs. connections.

When you edit a connection later, stored passwords, keys and passphrases are not shown. Leave them empty to keep the stored value.

Database​

Used for PostgreSQL, MySQL (and MariaDB) and Microsoft SQL Server (and Azure SQL). The app you connect decides the database engine.

FieldKeyRequiredDefaultDescription
HosthostYes—Host name or IP address, for example db.example.com
PortportNo5432 / 3306 / 1433Left empty, the engine's default port is used
DatabasedatabaseYes—Database name
UsernameusernameYes—Database user
PasswordpasswordNo—Stored encrypted
SSL modesslModeNoprefer (SQL Server: require)disable, prefer, require, verify-ca or verify-full (see below)
SSL modePostgreSQL and MySQLSQL Server
disableNo TLS.Encrypt only if the server requires it (shown as Optional).
preferUse TLS when the server offers it; the certificate isn't verified.Not offered; treated as disable.
requireAlways encrypt, but don't verify the server's certificate.Always encrypt, trust the server certificate without verifying it.
verify-caAlways encrypt, and verify that the certificate is signed by a trusted CA. The host name isn't checked.Not offered; treated as verify-full.
verify-fullAlways encrypt, and verify the certificate and that it matches the host name.Always encrypt, and verify the certificate and the host name.

require protects the traffic from eavesdropping but not from a server that impersonates yours. For databases reached over the internet, use verify-full (or verify-ca when the certificate is trusted but its name doesn't match the host you connect to).

Connections time out after 15 seconds. Create a dedicated database user with only the rights your workflows need, for example a read-only user for the Database Row Trigger.

SFTP​

FieldKeyRequiredDefaultDescription
HosthostYes—For example sftp.example.com
PortportNo22SSH port
UsernameusernameYes—SSH user
PasswordpasswordOne of password or key—Stored encrypted
Private keyprivateKeyOne of password or key—PEM or OpenSSH private key, pasted in full. Stored encrypted
Key passphrasepassphraseNo—Only if the private key is encrypted. Stored encrypted
Host key fingerprinthostKeyFingerprintNo—The server's SHA256 host key fingerprint, for example SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8

A password or a private key is required; with both, Blokkio tries the key first. Saving without either fails with A password or a private key is required.

Set Host key fingerprint whenever you can. Without it, Blokkio accepts any host key. With it, the connection is refused when the server presents a different key:

SFTP host key fingerprint mismatch (expected SHA256:nThbg6…, got SHA256:Qm1x…).

To read the fingerprint, run ssh-keyscan sftp.example.com | ssh-keygen -lf - on a trusted machine, or ask the server's administrator.

IMAP​

FieldKeyRequiredDefaultDescription
HosthostYes—For example imap.example.com
PortportNo993Left empty: 993 for SSL/TLS, otherwise 143
SecuritysecurityNosslssl (SSL/TLS), starttls or none (unencrypted)
UsernameusernameYes—Usually the email address
PasswordpasswordYes—The password, or an app password for providers with two-factor sign-in (for example Gmail or Outlook)

SMTP​

FieldKeyRequiredDefaultDescription
HosthostYes—For example smtp.example.com
PortportNo587Left empty: 465 for SSL/TLS, otherwise 587
SecuritysecurityNostarttlsssl (SSL/TLS), starttls or none (unencrypted)
UsernameusernameNo—Leave empty for a relay that doesn't require sign-in
PasswordpasswordNo—Stored encrypted
From addressfromAddressYes—Sender address of every email, for example robot@example.com
From namefromNameNo—Sender display name. The Send Email block can override it

Use port 465 with SSL/TLS, or port 587 with STARTTLS.

Testing​

Save & test in the dialog, and ⋯ → Test connection on the Connections page, check the connection against the real server:

KindWhat the test doesSuccess message
DatabaseConnects and runs SELECT 1Connected to PostgreSQL at db.example.com.
SFTPConnects, checks the host key and signs inConnected to sftp.example.com (working directory /home/acme).
IMAPConnects and signs inSigned in to imap.example.com.
SMTPConnects and signs in (when a username is set)Signed in to smtp.example.com. or Connected to smtp.example.com (no username configured, so no sign-in was attempted).

The test gives up after about 20 seconds with The server did not answer in time. If the server rejects the username or password, the result starts with The server rejected the credentials (or The database rejected the credentials) and the connection is marked Auth failed. Other errors, such as an unknown host or a TLS problem, are shown but don't change the connection's status.

To check the values a run in an environment uses, choose ⋯ → Test connection → In … for that environment, or Test in the Environment overrides dialog. Such a test applies the environment's override and secret values; its result is shown but doesn't change the connection's status.

Network protection​

The host of a database, SFTP, IMAP or SMTP connection must resolve to a public address. Hosts that resolve to private or internal addresses (localhost, 10.0.0.0/8, 192.168.0.0/16, cloud metadata endpoints and so on) and Unix socket paths are refused, in tests and in runs. Blokkio connects to the address it checked, so a second DNS answer can't redirect the connection.

To reach a server in a private network, expose it through a public, firewalled address.

Self-hosted workers​

Database Query and Send Email need the connection's decrypted fields, which never leave Blokkio. They always run on Blokkio's hosted workers, even when the project is assigned to a self-hosted worker pool; the other nodes of the workflow still run on your pool. The database or mail server must therefore be reachable from Blokkio (see Network protection).

The Database Row, Email and SFTP triggers always run on Blokkio's side, so they work for every project.

Triggers created before connections​

The Database Row, Email and SFTP triggers used to take a host, username and secrets directly on the node. Existing workflows with these inline settings keep working, but new triggers should use a connection: the settings are shared, tested and can differ per environment.