1. Introduction

This document covers changes in the fsserver for FS 10.0.0.

2. fsserver changes

These changes introduce new functionality to fsserver, as well as simplify some use cases.

2.1. Use one websocket

The first major change is that the server now only needs to use one socket when using websockets — addresses that start with ws:// (closing #29).

The new default base URL for all fsserver streams and control channels is now:

ws://127.0.0.1:7083

(70 83 are decimal ASCII encoding of F and S.)

This can be changed by editing FS_SERVER_URL_BASE in include/params.h; however, we will likely introduce command-line flag and/or environment variable to set this in the future.

This should be safe to expose on the network (rather than just the loop-back), but users may wish to use HTTPS proxying to provide some authentication/authorisation.

This was enabled by factoring out functionality spub into a reusable “buffered stream” library, which has been incorporated into fsserver. All the behaviour of streams are now managed within the fsserver process rather than an external spub instance.

2.2. FS log stream

The second major change of this patch is the addition of the FS log to the streams available from the server (closing #25).

Previously only the “display” was available, which has a reduced time-stamp format and filters some output. The log stream is available at

FS_SERVER_URL_BASE/log

that is, by default

ws://127.0.0.1:7083/log

2.3. Server continues running after FS termination

As of FS 10.2, this change has been reverted, i.e., the server will now shutdown on FS termination. For more information, please see the change Server shutdown in the FS 10.2-alpha2 Update Notes document.

The remainder of this subsection (in the grey shaded box) is relevant only for FS versions 10.0 and 10.1.

A third change is that the server now continues running after the FS is terminated.

This allows clients to detect the FS termination and prevents a socket conflict if the FS is terminated and restarted in quick succession. The only user visible impact will be a slight delay if the FS is restarted quickly after termination while the old session is finishing up.

Important
After an FS upgrade or changing FS runtime environment variable values, it’s necessary to either shutdown the server (fsserver stop) or reboot the system before re-starting the FS.
Important
If you run the FS under a different account than oper (perhaps prog), fsserver will remain a process of that account until it is stopped. Even if the FS is restarted, it will continue to run from the other account because fsserver will be its parent. This may result in unexpected behavior, such as oper not owning new files that are created and ssh commands run from the FS having a default identity other than oper. To avoid this, it is recommended to either reboot or run fsserver stop after using the FS from an account other than oper.

2.4. Server shuts down on FS termination

As of FS 10.2, the server shuts down when the FS is terminated. An interlock was introduced to prevent termination if it would also stop active autoftp and/or fs.prompt instances. A variable wait was introduced for FS startup to make sure the server has fully shutdown before starting it again. The maximum wait is two seconds. There is no wait unless the FS was restarted faster than that.

2.5. Server accepts SNAP commands

Fourth, the server can now accept snap commands to be sent to FS, e.g.:

fsserver fs snap "terminate"

This allows clients to interact with the FS directly through fsserver rather than needing access to inject_snap.

No filtering or authorisation is implemented on this command channel, so it effectively allows complete command execution privileges in the FS context to anyone with access to the socket. Note this is also true for inject_snap on a standard system. If a station wishes to limit local access they can use iptables/nftables, or use the server in UNIX socket mode and use file system permissions. Stations that would like to enable remote access should implement their own authentication/authorisation that suits their needs, e.g. SSH port forwarding or HTTPS proxying.

2.6. Updated nng library

The fifth and final major change is that this patch also upgrades the included messaging library nng to version 1.3.0. This brings with it some performance improvements and bug fixes.

Thanks to Jon Quick (HartRAO) for special effort fixing the Makefile for FSL8. He also added documentation file third_party/src/README_nng.make to assist with future upgrades of nng.

2.7. Bug fixes

  1. Fixed spub/ssub occasionally freezing (tentatively closing #69).

    This may have been caused be the byte order being wrong in buffered stream cb. The situation is still being monitored. Please report any instance of this problem that occurs. It happens very rarely so it is challenging to get enough usage to verify that it is not happening anymore. If it does happen, restarting the client has been a successful strategy for recovery.

  2. Fixed clean function in Makefile.

  3. Fixed sspub to support more than 232 messages.