Flussonic Media Server Documentation

Contents

Securing Flussonic

In this section you will learn how to limit access to the Flussonic administration panel and the server.

Very important! If hackers get access to your Flussonic administration UI, they will be able to read and modify any file on disk.

Login and password

Flussonic allows you to set two types of access in config: view_auth и edit_auth.

  • view_auth user password; is used for access to readonly API Flussonic functions: getting streams info, status, and statistics.

  • edit_auth user password; is used for full access to Flussonic.

Limiting access by an IP address

To restrict access by IP address, enable white list mode in the configuration file:

api_allowed_from 10.0.0.0/8 192.168.4.15;

A separate IP port for HTTP API

You can assign a separate IP port for HTTP API:

admin_http 8090;
admin_http 127.0.0.1:8091;
admin_https 8092;

Now the administrator UI and HTTP API are available only via these ports.

In cluster configuration, for the node with admin_http(s) enabled, you must specify these ports in peer and source directives.

Uploading SSL certificates

If you already have an SSL certificate for Flussonic issued by a third-party provider or generated by yourself, you can upload it from your computer to the server through the Flussonic's web interface.

  1. First, specify the port for HTTPS. Open the UI and go to Config > SSL-tunneled protocols and enter the port, for example, 443.

  2. Then in Config > SSL-tunneled protocols click Upload certificates and choose the files that contain the certificate and the key, and also the CA-certificate.

Any SSL certificates used by Flussonic are stored in a single folder — /etc/flussonic or /etc/streamer (in a cluster installation). Flussonic will automatically rename files into streamer.crt, streamer-ca.crt, and streamer.key.

To remove the uploaded files related to a certificate, click the recycle bin icon in Config > SSL-tunneled protocols next to the file list.

Generating SSL certificates

In order to switch the administrator's web interface to HTTPS, you need to enable the port for HTTPS in the Flussonic configuration. Open the web interface and specify the port for HTTPS in Config > SSL-tunneled protocols, for example, 443.

You can generate your own SSL certificate. To do so, use openssl commands and type the password flussonic for key and certificate generation.

Below are commands that you should run one by one to generate a Flussonic's own self-signed certificate. Each time the system prompts you to enter the password for the certificate, type flussonic.

cd /etc/flussonic

openssl genrsa -des3 -out streamer.key 1024

openssl req -new -key streamer.key -out streamer.csr

mv streamer.key streamer.key.org

openssl rsa -in streamer.key.org -out streamer.key

openssl x509 -req -days 365 -in streamer.csr -signkey streamer.key -out streamer.crt

Then put the resulting files to /etc/flussonic (/etc/flussonic/streamer.crt and /etc/flussonic/streamer.key). Alternatively, you can upload these files through the web interface. To do this, go to Config > SSL-tunneled protocols and click Upload certificates.

Intermediate and CA certificates will be taken from /etc/flussonic/streamer.crt.

For the most recent OpenSSL commands description, refer to the manual pages in the OpenSSL documentation.

LetsEncrypt certificates

LetsEncrypt is offering free SSL certificates with 1-month expiration since April 2016. The certificate is issued in automatic mode.

We have added the support for LetsEncrypt into Flussonic. How to setup LetsEncrypt

Protecting configuration file

You can prevent the configuration file from being modified via the API (web interface). JFor this you should create the file /etc/flussonic/flussonic.conf.locked by executing the following command:

touch /etc/flussonic/flussonic.conf.locked

With this file in place nobody will be able to change Flussonic settings via the web UI.

Running Flussonic as an unprivileged user

You can run Flussonic as an unprivileged user. Run the following commands:

adduser flussonic --home /var/lib/flussonic --disabled-password
chown -R flussonic /etc/flussonic/
chown -R flussonic /var/lib/flussonic/
echo flussonic > /etc/flussonic/run_as
chown root /etc/flussonic/run_as
chmod 0644 /etc/flussonic/run_as
chown -R flussonic /var/run/flussonic /var/log/flussonic /etc/flussonic/.erlang.cookie
setcap cap_net_bind_service=+ep /opt/flussonic/lib/erlang/erts-10.7.1/bin/x86_64-linux-gnu/beam.smp

Then create override systemd unit using systemctl edit flussonic command:

[Service]
User=flussonic
Group=flussonic

To make Flussonic run as 'root' again, empty override file.

Activating Flussonic via SOCKS5 proxy

Flussonic can use the SOCKS5 proxy server to communicate with the license server. To enable it, use the systemd's override mechanism:

# systemctl edit flussonic

This command opens a text editor (nano by default).

Add these lines in the opened file:

[Service]
Environment="PROXY=socks5://172.20.10.1:1080"

Press Ctrl-X, then Y to save and exit.

Restart Flussonic:

# service flussonic restart

Now Flussonic will use the configured proxy to communicate with the license server.

Protecting video from viewing by the administrator

By default, the users with Flussonic administrator rights can play back any stream by using the administration UI. The special administrator's authorization token is used for that.

You may want to prohibit viewing some streams by the administrator — streams protected by authorization.

To prevent the Flussonic administrator from playing back any stream that needs authorization:

  1. Edit Flussonic service unit file (/lib/systemd/system/flussonic.service) — do it by using the systemd's override mechanism.

    systemctl edit flussonic
    

    This command opens a text editor (nano by default).

  2. Add these lines:

    [Service]
    Environment=ADMIN_VIEW_DISABLE=true
    

    Press Ctrl-X, then Y to save and exit.

  3. Restart Flussonic:

    service flussonic restart
    

Now if a stream requires authorization, the player in the Flussonic UI will return a 403 error at the attempts to play the stream back with an administrator's token.

Streams without configured authorization will be played back as usual.

Protecting the file system from access via the UI

In the Flussonic UI, the user (administrator) sets paths to VOD, DVR, and cache. You can configure Flussonic to limit the user to certain directories, so that Flussonic will allow storing files only in that directories and subdirectories. For example, this allows you to protect the /root directory.

Flussonic checks the paths in file vod, dvr, cache, copy, and in the schemas playlist:/// and sqlite:///.

To configure this, add the environment variable FLUSSONIC_DATAPATH and specify the uppermost directory allowed for creating VOD, DVR, cache and so on.

Important! In order for Flussonic to restart successfully with the new settings, make sure the current configuration does not have paths to the directories located above the one specified in the FLUSSONIC_DATAPATH variable.

To add FLUSSONIC_DATAPATH, you can use the systemd's override mechanism:

systemctl edit flussonic

This command opens a text editor (nano by default).

Add directories in the following way:

[Service]
Environment=FLUSSONIC_DATAPATH=/storage:/mount:/copy

Press Ctrl-X, then Y and Enter to save and exit.

Restart Flussonic:

service flussonic restart

Users will be limited to /storage, /mount and /copy and their subdirectories.