This article shows how to set up the FTP server built into Red Lion devices running Crimson 3.2, with the FlexEdge™ DA50A/DA70A as the main example. It covers enabling the server, user accounts and rights, the folders you can reach, connecting with an FTP client, ports and firewall settings, encryption with TLS (FTPS), and common errors.
To make the device send files to an FTP server on a schedule instead, use the Sync Manager, Crimson's FTP client. It is not covered here.
Preparation
-
A Crimson 3.2 device:
- FlexEdge DA50A or DA70A. Crimson 3.2 also has the same FTP Server settings for the Data Station DA10D/DA30D, CR1000 and CR3000 HMIs, Graphite HMIs and the Graphite Edge Controller, so you can configure the FTP server on them as in Part 1. FTP and FTPS operation, folder names and storage locations in this article were checked on the FlexEdge only. The firewall step (Part 1, Step 3) applies to the FlexEdge only.
- Running Crimson 3.2 firmware. The procedures in this article were tested with Crimson 3.2.1060.0. Use the latest production release, and read the firmware notes below before you update.
- Reachable from your PC over Ethernet, with its IP address known. Link > Find Device in Crimson lists the devices on your local network.
-
Crimson 3.2:
- Installed on your PC, with the device's database open.
-
An FTP client:
- For example FileZilla or WinSCP, which both support FTP over TLS.
Before You Update the Firmware
The Crimson 3.2 release notes list these points. Check them before you update a device, especially an older FlexEdge:
- Firewall fix: Crimson 3.2.1045.0 fixed a potential bypass of firewall protection introduced in 3.2.1038. Builds before 3.2.1038 do not have this issue. If a device runs 3.2.1038.0 or 3.2.1039.0, update it.
- Older FlexEdge DA50/DA70 units: if digits 3 to 9 of the serial number give a date before October 1, 2022 (for example YU01OCT22xxxxx), the device must run Crimson 3.2.0050.0 or later before you update it to a later version. In rare cases, ignoring this can make the device permanently inoperable. Contact HMS Technical Support for Crimson 3.2.0050.0.
- No downgrade below 3.2.0071 (FlexEdge DA50A/DA70A): after an update to 3.2.0071 or later, the FlexEdge can't be downgraded to an earlier version. The unit must be on 3.2.0016 or later before you update to these versions. Products other than the FlexEdge can be upgraded and downgraded without these limits.
- Image files (FlexEdge, 3.2.1038 and later): image files are digitally signed. A FlexEdge running a version before 3.2.1038 can't be updated with a 3.2.1038 or later image file, and once it runs 3.2.1038 an image file can't downgrade it. Update over Ethernet or USB instead.
Example Setup
The steps below use these example values. Replace them with your own.
- FlexEdge: 192.168.1.20.
- PC with the FTP client: 192.168.1.100.
- FTP user: ftpuser.
- FTP port: 21 (the default).
Part 1: Configure the FTP Server in Crimson 3.2
In Crimson 3.2 the FTP server is part of the device configuration. It runs all the time, whether or not a database is running, and uses the accounts in the User Configuration. Earlier versions of Crimson ran the FTP server only while the database was running and took its accounts from the Security Manager.
Step 1: Enable the FTP Server
- Click the Device Configuration category and navigate to System Configuration > Services > FTP Server. On a FlexEdge you can make the same settings in its system web server.
- Set the following:
- Operation: Enabled. The default is Disabled.
- Anonymous Access: Disabled (the default). Read Only or Read-Write lets anyone log in without a password.
- TLS Support: Required. Enabled (the default) allows both encrypted and unencrypted connections; Required refuses clients that don't use TLS; Disabled turns encryption off.
- Port Number: 21 (the default). This is the TCP port for FTP commands.
Note: With TLS, the FTP server identifies itself with the device's default certificate, set by Default Cert under System Configuration > Network > Identity. See Part 2, Step 2 for what this means for the client.
Step 2: Create an FTP User
- Navigate to User Configuration > Local Users.
- Click the green pencil on an empty row to add a user, or on an existing row to edit it.
- Set the following:
- User Name: ftpuser.
- Password: a strong password.
- Access Level: Read Only, if this account is only for FTP. The access level also controls what the user can change in the system web server.
-
FTP Rights: the FTP access for this user:
- Based on Level (the default): users above Read Only get read-write access, Read Only users get read-only access.
- Disabled: no FTP access.
- Read Only: download files only.
- Read-Write: download and upload files.
- Click OK.
Note: By default the User Configuration is not included when Crimson downloads the database, so the users already on the device are kept. The Local Users page says "This element is excluded from download". Either create the user in the device's system web server, or click User Configuration and include it in the download.
Step 3 (FlexEdge): Allow FTP Through the Firewall
Skip this step if the FTP client connects through a trusted interface. FTP is not one of the predefined services in the FlexEdge firewall, so connections through an untrusted interface (for example a WAN connection) are blocked until you add an entry.
- Navigate to System Configuration > Network > Firewall > Untrusted Traffic and open the Custom tab.
- Click the green pencil to add an entry.
- Set the following:
- Label: FTP.
- Interface: the untrusted interface the client connects through, or All Interfaces.
- Protocol: TCP.
- Start Port: 21, or the Port Number set in Step 1.
- End Port: Single Port.
- White List: an access list holding only the addresses that need FTP access, if you have one under Firewall > Access Lists. Allow All lets in any address.
- Click OK.
For FTP over TLS through an untrusted interface you also need the passive data ports. See Part 3.
Step 4: Download the Configuration
- Save the database and download it to the device.
- To check the server quickly from Crimson, select Link > Find Device, select the device, and click Open FTP.
Part 2: Connect with an FTP Client
Step 1: Set Up the Connection
The setting names below are FileZilla's (File > Site Manager). Other clients have the same choices under similar names.
- Create a new site and set the following:
- Protocol: FTP - File Transfer Protocol. Don't choose SFTP: the Crimson FTP server doesn't support it (see Part 4).
- Host: 192.168.1.20. Port: 21.
- Encryption: Require explicit FTP over TLS. Use "Only use plain FTP (insecure)" only when TLS Support is Enabled or Disabled and the network is private.
- Logon Type: Normal, with User ftpuser and its password.
- On the Transfer Settings tab, set Transfer mode to Passive.
- Click Connect.
In WinSCP, choose File protocol FTP and Encryption TLS/SSL Explicit encryption. WinSCP uses passive mode by default (Advanced > Connection > Passive mode).
Step 2: Accept the Device Certificate
With TLS, the FTP server sends the device's default certificate (Default Cert) together with the certificate of the authority that issued it, and the client checks them. Unless your PC trusts the root certificate behind them (the C3.2 Local Root used by the automatic certificate options, or your own root), the client asks whether to trust the certificate. FileZilla shows an "Unknown certificate" dialog with the certificate's validity dates, fingerprints (SHA-256 and SHA-1), subject, alternative names, issuer and serial number.
- Check the certificate before you accept it: the device name and IP address it was issued to (the alternative names), the issuer, and the fingerprint. If you installed the certificate on the device yourself, compare the fingerprint with that certificate's. Don't accept a certificate you can't account for.
- Select Always trust this certificate in future sessions, then click OK.
To avoid the prompt, give the device a certificate signed by a certificate authority that your PC trusts, such as your own.
Note: After you log in, FileZilla shows "Insecure FTP data connection - This server does not support TLS session resumption on the data connection". Click OK to continue: folder listings and transfers then work. The warning appears on every new connection unless you select Always allow insecure data connections for this server in future sessions. FileZilla uses TLS session resumption to confirm that each data connection comes from the same client as the command connection; without it, the data is still encrypted, but that check can't be made. Select the option only for a device you have identified by its certificate, on a network you trust.
Step 3: Find Your Files
The FTP server gives access to the device's internal memory and to USB memory sticks and memory cards fitted to it. The folders you see depend on the device model and the storage media installed. On a FlexEdge DA50A/DA70A:
- Top folder (/): internal memory. Data logs stored there are in the LOGS folder, in a subfolder per log.
- DRIVE-D: the USB memory stick.
- DRIVE-E: the memory card.
Other products can use different folder names, so don't assume this layout applies to them.
On a FlexEdge, DRIVE-D and DRIVE-E are always listed. Opening one with nothing inserted fails with "550 Directory cannot be found".
Step 4: Download and Upload Files
- To download, drag a file or folder from the device's pane (right) to your PC's pane (left).
- To upload, drag a file from your PC's pane to a folder on the device. This needs Read-Write FTP rights.
- Check the transfer log at the bottom of the client: a successful transfer ends with "File transfer successful".
Note: Data log files are plain text (CSV). If you compare sizes, a client that transfers text files in ASCII mode can change the line endings, so the copy may be a different size from the original. Set the client to binary transfers if the files must stay identical (in FileZilla, Transfer > Transfer type > Binary). To confirm a transfer, compare a checksum (for example SHA-256) of the original and the copy: in binary mode over FTP over TLS they match.
Part 3: Ports, Firewalls and Active or Passive Mode
FTP uses two connections: a command connection to the server's port (21 by default), and a separate data connection for each file transfer and folder listing.
- Passive mode: the client asks the server for a port and opens the data connection to it. Use this mode: it works through firewalls and NAT on the client side. In our tests the FlexEdge used a different data port between 32768 and 60999 for each passive transfer.
- Active mode: the server opens the data connection back to the client, which a firewall or NAT on the client side usually blocks. With FTP over TLS, a NAT router can't correct the client's address in the encrypted PORT command either, so active mode from a client behind NAT fails with "425 Can't open data connection". Set the client to passive mode when you connect to a Crimson 3.2 device.
Firewall requirements on the FlexEdge, for clients that connect through an untrusted interface:
- Plain FTP: allow TCP 21 (Part 1, Step 3). The FlexEdge firewall follows the FTP commands and lets the passive data connections in on its own.
- FTP over TLS: the commands are encrypted, so the firewall can't read the passive port the server sends and can't open it for the data connection. With only TCP 21 allowed, the login works but the folder listing times out. The data connections need their own firewall entry for the passive port range, TCP 32768 to 60999 (Start Port 32768, End Port 60999), the range observed on the FlexEdge. Where you can, connect through a trusted interface or a VPN instead of opening this range.
A firewall between the client and the device needs the same ports. In its passive reply, the FlexEdge gives its own address on the interface the client reached. If the client reaches the FlexEdge through port forwarding on another router, that is a private address the client can't use; connect through a VPN instead.
Note: Don't expose the FTP server to the internet. Opening a range of nearly 30,000 ports is only reasonable with a White List limited to known addresses. For remote access, connect through a VPN (for example IPsec or OpenVPN on the FlexEdge) and use FTP over the tunnel.
Part 4: FTP, FTPS and SFTP
- FTP: supported. User names, passwords and files travel unencrypted.
- FTPS, explicit (FTP over TLS): supported. The client connects to the normal FTP port and switches to TLS (the AUTH TLS command) before logging in. The server also supports encrypted data connections (PROT P), so file transfers and listings can be encrypted too. This is what TLS Support controls.
- FTPS, implicit: the FTP Server page has no setting for implicit TLS, which normally uses port 990. Use explicit TLS.
- SFTP: a different protocol that runs over SSH, not FTP. SFTP is not supported. For encrypted file transfers, use explicit FTPS.
Part 5: Troubleshooting
Question: The client can't connect, or times out.
Answer: Check that Operation is Enabled and that the new configuration was downloaded. Check the IP address and port, and that you can reach the device (for example with Crimson's Link > Find Device on the same network). Through an untrusted FlexEdge interface, check the custom firewall entry from Part 1, Step 3, and its White List.
Question: The login fails.
Answer: Check the user name and password, and that the user's FTP Rights isn't Disabled. If you created the user in Crimson, check that the User Configuration was included in the download (Part 1, Step 2); otherwise the user doesn't exist on the device. With TLS Support set to Required, a client using plain FTP is refused with "421 TLS required so closing session": set the client to explicit FTP over TLS.
Question: The client warns about the certificate, or refuses it.
Answer: The client doesn't trust the device's certificate. Check the details and accept it (Part 2, Step 2), or install a certificate from your own certificate authority on the device and trust that authority on the PC. If the client reports a name mismatch, connect with a name or address the certificate contains. In a new Crimson 3.2 database, Default Cert is Automatic with Crimson Root and Automatic IPs is Included (System Configuration > Network > Identity), so the automatic certificate is made for the device's local IP addresses and its mDNS name. To connect through another name or address, such as a router's external address, add it in External Name or External IP on the same page. With the C3.2 Local Root, only names ending in .local and private IP addresses are accepted.
Question: The login works, but the folder listing fails or hangs.
Answer: The data connection is blocked. Use passive mode in the client: in active mode the error is often "425 Can't open data connection". With FTP over TLS through an untrusted interface or another firewall, open the passive port range (Part 3).
Question: FileZilla warns "Insecure FTP data connection" after every login.
Answer: The FTP server doesn't support TLS session resumption on the data connection. Click OK to continue; listings and transfers work. To stop the warning for this device, select Always allow insecure data connections for this server in future sessions (see the note in Part 2, Step 2).
Question: A command-line client lists the wrong folder.
Answer: The FlexEdge's FTP server lists the current folder and ignores a folder name given with the list command. Change to the folder first (cd), then list it.
Question: Opening DRIVE-D or DRIVE-E fails with "550 Directory cannot be found".
Answer: No USB memory stick (DRIVE-D) or memory card (DRIVE-E) is inserted, or the device can't read it.
Question: An upload fails with a permission error.
Answer: The server answers "550 Access is denied", and the listing shows the folders as dr--r--r--: the user has read-only FTP access. Set FTP Rights to Read-Write, or with Based on Level give the user an Access Level above Read Only.
Part 6: Security Recommendations
- Enable the FTP server only when you need it.
- Set TLS Support to Required, so passwords and files are never sent unencrypted.
- Keep Anonymous Access Disabled. Anonymous access accepts any password.
- Use a separate FTP account with the lowest rights it needs: Read Only FTP Rights if it only collects files.
- Don't open the FTP port on an internet-facing interface. Use a VPN, and limit the firewall entries with a White List.
- Use a certificate signed by a certificate authority your PCs trust, so users can verify the device instead of accepting an unknown certificate.
- Keep the firmware current, following the firmware notes in the Preparation section.
Part 7: Frequently Asked Questions (FAQ)
Question: Can the device send files to an FTP server on its own?
Answer: Yes, with the Sync Manager, Crimson's FTP client. For Crimson 3.0 and 3.1, see Crimson: FTP SyncManager (TNOI27).
Question: Do the users in the Crimson Security Manager work for FTP?
Answer: Not in Crimson 3.2. The FTP server uses the Local Users in the User Configuration. The Security Manager's users are the device's operators.
Question: Can I change the FTP port?
Answer: Yes, with Port Number (1 to 65535). Use the same port in the client and in any firewall entry.
Disclaimer
It is the customer's responsibility to review the advice provided herein and its applicability to the system. Red Lion makes no representation about specific knowledge of the customer's system or the specific performance of the system. Red Lion is not responsible for any damage to equipment or connected systems. The use of this document is at your own risk. Red Lion standard product warranty applies.
HMS Technical Support
If you have any questions or trouble contact HMS Technical Support by clicking here.