Skip to content

Remote destinations#

Four file export destination types write to another machine without mounting anything on the backend's: the Windows shared folder (SMB), the SFTP server, the Amazon S3 bucket (or one of a compatible service) and the Azure Blob Storage container. This page explains what they need from the network, how each one is created, the fingerprint of an SFTP server, the credential and what to do when Test fails. What is common to all destinations (creation, the control file, retention and operation) is in File export.

Before you start#

  • Destinations are created by whoever has System administration, in Administration › Connections, File export block, with Add destination… (see Create a destination). In Type, choose Shared folder (SMB), SFTP, Amazon S3 or compatible or Azure Blob Storage.
  • You need an account on the server (or a key of the service) that can write to the folder, and the backend must reach it over the network (below).

The network#

These destinations need nothing in the installation: the destination carries the server, the folder and the account. But the backend must reach the server (port 445 in SMB, 22 in SFTP and 443 in S3 and Azure, or the one the destination says) from all its instances, because each run writes from the one that launches it. Connecting waits at most 30 s, and so does each response from the server (ecenter.file-exports.connect-timeout).

So that a destination or Test cannot be used to reach where it should not, the backend resolves the server name once, connects to that address and, without the list below, never connects:

  • to the machine itself (127.0.0.0/8, ::1, 0.0.0.0 and the addresses of its interfaces);
  • to a link-local address (169.254.0.0/16 and fe80::/10, where cloud metadata lives) or to fd00:ec2::254;
  • to a broadcast or multicast address;
  • to a name that resolves to any of them.

With ECENTER_FILE_EXPORTS_ALLOWED_HOSTS (ecenter.file-exports.allowed-hosts), remote destinations connect only to the servers in the list, also if they are among those above (an SFTP server on the same machine, for example). They are names (also *.domain), addresses or ranges, separated by commas:

ECENTER_FILE_EXPORTS_ALLOWED_HOSTS=files01.ejemplo.local,*.sftp.ejemplo.local,10.20.0.0/16

In S3, with the bucket in the server name (ventas-erp.s3.eu-west-1.amazonaws.com), the list must contain that name or *.amazonaws.com. With the list, the Server (or Service address) field of a destination's dialog reminds you of it (“The installation only allows connecting to: …”). A server that is not allowed fails without retries, also in Test: «La instalación no permite conectar con ese servidor» (the installation does not allow connecting to that server). An invalid range (10.20.0.0/40) or an abbreviated address (10.20, which would be the address 10.0.0.20 and not the 10.20.0.0/16 network) prevent the backend from starting, and it says which entry it is.

In production, set the list

Without it, whoever has System administration can make the server connect to any private address of its network and to any port, by creating a destination or with Test, which does not even save it. The addresses that are never allowed do not cover the internal network, because that is where file servers usually are. Each test is recorded in the audit with where it connected (File destination tested), and each change to a destination, with the place it pointed to and the one it points to now.

A Windows shared folder (SMB)#

ECenter connects to the shared folder over SMB 2 or 3, with NTLM and the destination's account, without mounting anything on the backend machine. It requires message signing: with a server that does not sign, Test fails. Nor does it follow DFS namespaces: type the server and the share that actually hold the folder.

Field What it is
UNC path Optional: the folder as written in Windows, \\server\share\folder (for example, \\files01.ejemplo.local\exports\erp). It fills in the Server, the Share and the Folder, and changing one of them rewrites it. It also accepts smb://server/share/folder and the port after the server (\\files01.ejemplo.local:4450\exports).
Server The name or address of the server, without \\ in front.
Port Optional. Empty, 445.
Share The name under which the folder is shared (exports).
Folder Optional: a folder within the share, with / or \ between folders (erp/ventas). Empty, the share itself. It is created if it does not exist.
Domain Optional: that of the Windows account, if it asks for it (EMPRESA).
User The account, without the domain: EMPRESA\usuario or usuario@empresa are not valid (“No spaces or “/”, “\” or “@”: the domain goes in its field.”).
Password That of the account (see The credential).

The account needs permission on the folder to create folders and to write, rename and delete files. Each file is written to a temporary .ecenter-<uuid>.part and renamed to its final name, replacing the previous one, as in the server folder: the system that collects the files must ignore the temporary ones.

Use an account the server knows. If the server turns a user it does not know into a guest, Test fails and it is not retried: a guest session does not sign the messages. Nor does it write through a link: if a folder of the path (that of the destination or those created by the file name) is a symbolic link or a Windows junction, the file fails. A Samba server that follows links internally presents them as ordinary folders and ECenter cannot tell them apart: if whoever can write to the share must not be able to divert the files, turn it off on the server (wide links = no).

An SFTP server#

Field What it is
Server The name or address of the server (sftp.ejemplo.local).
Port Optional. Empty, 22.
User The account it signs in with.
Folder Optional: on the server, absolute (/upload/ventas) or relative to the user's folder; empty, the user's. It is created if it does not exist.
Server key fingerprint The confirmed fingerprint (SHA256:…). It is not typed by hand: Confirm this fingerprint sets it (below). While there is none, it says “Not confirmed”.
How it signs in With a password or With a private key.
Password With a password: that of the account.
Private key With a private key: paste it or press Load the key from a file…. In PEM or in the OpenSSH format (RSA, ECDSA or Ed25519), up to 16 KB. A PuTTY key is first converted to the OpenSSH format with PuTTYgen, and a public key is not valid.
Key passphrase Optional: if the key is encrypted with a passphrase.

ECenter does not read the SSH configuration of the backend machine (neither ~/.ssh nor known_hosts): what it needs goes in the destination. It writes each file to a temporary .ecenter-<uuid>.part and renames it replacing the previous one; if the server does not support atomic renaming (OpenSSH's posix-rename@openssh.com extension), it deletes the previous one and renames, and Test says so.

An Amazon S3 bucket or one of a compatible service#

ECenter writes to a bucket of Amazon S3 or of a service with the same API (MinIO, Ceph, Wasabi and others), with an access key and its secret key.

Field What it is
Service address Optional. Empty, Amazon S3 in the Region. For another service, its address with the port if it has one and without a path (https://minio.ejemplo.local:9000).
Bucket The name of the bucket: from 3 to 63 lower-case letters, digits, dots or hyphens. It must exist: ECenter does not create it.
Region That of the bucket (eu-west-1). A compatible service usually accepts us-east-1.
Folder Optional: a folder within the bucket, with / between folders (erp/ventas). Empty, the root of the bucket.
The bucket goes in the address path Tick it if the service asks for it (MinIO and many compatible ones): ECenter connects to https://server/bucket instead of https://bucket.server.
Access key The key identifier (AKIA… in AWS).
Secret key The secret of that key (see The credential).

The key needs permission to write, read and delete objects in the destination's folder and to discard a half-finished upload (in AWS, s3:PutObject, s3:GetObject, s3:DeleteObject and s3:AbortMultipartUpload). An object store has no folders or renaming: each file is written directly with its name, replacing the previous one, and it only appears when it is complete, so there are no temporary files to ignore. A file larger than 8 MiB is uploaded in parts; if the upload is cut off halfway, ECenter discards it, and it is a good idea for the bucket to also have a lifecycle rule that deletes unfinished uploads.

An Azure Blob Storage container#

Field What it is
Storage account The name of the account (ventaserp): from 3 to 24 lower-case letters or digits.
Container The name of the container (exportes). It must exist: ECenter does not create it.
Folder Optional: a folder within the container, with / between folders. Empty, the root of the container.
Service address Optional. Empty, that of the account in Azure (https://ventaserp.blob.core.windows.net). Another one for another Azure cloud or a private endpoint.
How it signs in With the account key or With a SAS.
Account key One of the two keys under Access keys of the account in the Azure portal. It gives access to the whole account.
SAS A shared access signature: what goes after ? in its URL (the whole URL is also accepted). It must allow create, write, read and delete (sp=rcwd or more) and it expires: renew it before its date, or the files will fail.

As in S3, each file is written directly with its name and only appears whole, without temporary files.

Neither in S3 nor in Azure does ECenter use anything from the backend machine: not the ~/.aws profiles, nor the AWS_* variables, nor a proxy, nor the machine's cloud identities. The credential is the destination's. A Service address with http:// works (a service on the internal network), but the connection is not encrypted, and Test warns about it. In Azure, with http:// it can only sign in With the account key: a SAS would travel unencrypted in every request, and the destination is neither saved nor tested (a message asks you to use https:// or the account key).

The SFTP server fingerprint#

Before writing to an SFTP server, ECenter checks that it is the server you expect: it compares the key it presents with the fingerprint confirmed in the destination. Without a confirmed fingerprint, or if the server presents another one, it does not send it the credential or write to it.

  1. Fill in the destination, including the password or the private key, and press Test. ECenter connects, receives the server's key and stops there, without sending it the credential: “The server has given the fingerprint of its key (instance …): confirm it to test the folder.”. Below, Fingerprint not confirmed, with the Fingerprint (SHA256:…) and the Algorithm.
  2. A server usually has several keys, one of each type (Ed25519, ECDSA and RSA), and Test shows the fingerprint of one of them, with its type in Algorithm. Ask whoever administers the server for the fingerprint of the key of that type. On a server with OpenSSH, ssh-keygen -l gives it; with ssh-ed25519, for example:

    ssh-keygen -l -f /etc/ssh/ssh_host_ed25519_key.pub
    

    With ecdsa-sha2-nistp256 (or another ecdsa-…), that of /etc/ssh/ssh_host_ecdsa_key.pub, and with ssh-rsa, that of /etc/ssh/ssh_host_rsa_key.pub. You compare the part that starts with SHA256:; the fingerprint of a key of another type never matches.

  3. If it is the same, press Confirm this fingerprint. The fingerprint goes into the Server key fingerprint field and it is tested again, this time with the credential: Fingerprint confirmed. If it is not the same, do not confirm it.

  4. Press Create destination (or Save). The fingerprint is saved with the destination.

The destination can be saved without confirming the fingerprint, but its files fail until it is confirmed, and the list warns about it (“The server fingerprint is not confirmed: its files fail until it is confirmed with “Test” in “Edit…”.”). If the Server or the Port changes, the confirmed fingerprint is no longer valid (“The confirmed one was from another server or another port: “Test” will ask for this one's.”): repeat these steps.

If the server presents another key (because it has been reinstalled or its keys renewed, or because it is not that server), Test says “It does not work on instance …: the server key is not the confirmed one.” and The fingerprint is not the confirmed one, with the one it gives and The confirmed one. ECenter has not sent it the credential, and the files fail without retries with «La clave del servidor SFTP no es la confirmada: puede que otro servidor se haga pasar por él» (the SFTP server key is not the confirmed one: another server may be impersonating it). Confirm the new fingerprint first asks “Confirm the server's new fingerprint?”.

Warning

Confirm a new fingerprint only if whoever runs the server has told you that its key has changed and has given you that fingerprint. Otherwise, another server may be impersonating it and receive the credential and the files.

The credential#

The password, the private key (with its passphrase), the S3 secret key, the Azure account key or the SAS of a remote destination is stored encrypted with the installation key (ECENTER_SECRETS_KEY) and is not shown again: when you edit the destination, its field comes out empty, with the note “Saved: leave it empty to keep it.” (in SFTP, “There is a saved credential: leave it empty to keep it.”).

  • Leave it empty to keep it when changing the rest: the name, the folder, the roles or retention.
  • Type it again if where it connects changes: another Server, Port or User, or in SMB another Domain; in S3, another Service address, Region or Access key; in Azure, another Service address or Storage account. The bucket, the container and the folder do not count. In SFTP, also if the server's already confirmed fingerprint changes (confirming the first one does not require it). The note says so (“Where it connects changes: type it again (the saved one does not travel to another server).”) and, without it, the destination is not saved. That way a saved password is never sent to another server, nor to one that responds with another key.
  • If it cannot be decrypted, because ECENTER_SECRETS_KEY has changed, the list warns about it and so does the dialog (“The saved credential cannot be decrypted: the installation's encryption key has changed. Type it again; until then the files of this destination fail.”). Type it and press Save.
  • When a remote destination is changed to Server folder, its credential is deleted when it is saved, and the dialog warns about it.

The audit records that the credential changed, never its value.

What Test says#

Test connects to the server, signs in with the destination's credential (in SFTP, only if the fingerprint is the confirmed one) and does the same as in a server folder: it creates the folder, writes a test file, renames it and deletes it (see Test). In addition to what it says for any destination:

Result What it means
“It works on instance … With several instances, all of them must be able to reach the server.” All fine from that instance. With several, repeat the test from the others.
“The server has given the fingerprint of its key (instance …): confirm it to test the folder.” An SFTP server without a confirmed fingerprint: the folder has not been tested yet (see The SFTP server fingerprint).
“It does not work on instance …: the server key is not the confirmed one.” The SFTP server presents another key.
“It works on instance … A file only appears whole: whoever collects it will never see it half-written.” A bucket or a container: it writes, reads and deletes a test object. If it also says that the connection is not encrypted, the Service address starts with http://.

When writing the files, a destination failure is retried (see Whose failure it is), except what is not fixed by waiting. These reasons fail on the first attempt, and repeating the test does not help until what they say is corrected. The server gives them in Spanish:

Reason What to do
«La instalación no permite conectar con ese servidor» (the installation does not allow connecting to that server) Use another server or ask whoever installs to add it to ECENTER_FILE_EXPORTS_ALLOWED_HOSTS (see The network).
«El servidor no acepta el usuario y la contraseña» (or «… el usuario y la clave»: the server does not accept the user and the password, or the key) Check the User, the Domain in SMB and the password or the key, and type it again.
«No se puede leer la clave privada del destino (¿lleva frase?)» or «… (¿es su frase?)» (the private key cannot be read: does it have a passphrase, is it the right one?) Type the Key passphrase, or check that it is typed correctly and that the key is complete.
«El recurso compartido no existe» (the share does not exist) Check the Share (or the UNC path).
«No hay permiso para escribir en la carpeta» (no permission to write to the folder) Give the destination's account write permission on the folder.
«La clave del servidor SFTP no es la confirmada: puede que otro servidor se haga pasar por él» (the SFTP server key is not the confirmed one) See The SFTP server fingerprint.
«La credencial guardada del destino no se puede descifrar: vuelva a escribirla» (the saved credential cannot be decrypted) See The credential.
«El servicio no acepta la clave de acceso y la clave secreta» (the service does not accept the access key and the secret key) Check the Access key and type the Secret key again.
«El bucket no existe» or «El contenedor no existe» (the bucket, or the container, does not exist) Check the name: ECenter does not create them.
«El bucket está en otra región: escriba la suya» (the bucket is in another region) Type the bucket's region in Region.
«No hay permiso para escribir en el bucket» or «… en el contenedor» (no permission to write to the bucket or the container) Give the key (or the SAS) permission to write, read and delete.
«El servicio no acepta la clave de la cuenta o el SAS» (the service does not accept the account key or the SAS) Type the account key again, or paste a SAS that has not expired.
«El servicio rechaza la petición: revise la clave de la cuenta o el SAS y que la cuenta deje entrar desde la red de la instalación» (the service rejects the request) Besides the credential, check the network rules of the storage account in Azure.
«No se puede establecer la conexión segura con el servicio: su certificado no es de confianza para la instalación» (the secure connection cannot be established: its certificate is not trusted) The service's certificate is not signed by an authority the backend knows. Ask whoever installs to add theirs.

The others, such as «No se puede conectar con el servidor» (the server cannot be reached) or «No se encuentra el servidor» (the server cannot be found), are retried: the server may be off, the name misspelled or a firewall in between. No reason gives the server, the account or the remote server's error: the detail goes to the backend log.

See also#