Faraday Advanced Installation with Websockets Notifications¶
Faraday, as a powerful security platform, supports sending notifications through websockets, a crucial feature also utilized by Faraday Agents. To enable and properly configure websockets in an on-premises installation, follow the comprehensive guide below.
Prerequisites¶
Before proceeding with this advanced installation, ensure you have:
- A working Faraday server installation (see our basic installation guides)
- Root or sudo privileges on your system
- A domain name or FQDN configured for your Faraday instance (in the example below,
faraday.local
) - Basic understanding of NGINX configuration
- SSL certificate requirements (self-signed or CA-issued)
Install NGINX:¶
sudo apt install nginx
The following NGINX configuration enables SSL termination, websockets support, and proper security headers for Faraday. Key components explained:
- SSL Configuration: Terminates SSL/TLS at the proxy level
- WebSocket Support: Essential for real-time notifications and agent communication
- Security Headers: Implements modern security best practices
- File Upload Support: Configured for large file uploads (500MB limit)
Important: Replace faraday.local
with your actual FQDN and 127.0.0.1:5985
with your Faraday server address throughout the configuration.
# Expires map
map $sent_http_content_type $expires {
default off;
text/html max;
text/css max;
application/javascript max;
~image/ max;
}
server {
server_name faraday.local; # change with your FQDN
listen 443 ssl;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
add_header X-XSS-Protection "1; mode = block";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options nosniff;
client_max_body_size 500M;
# ssl on;
ssl_session_cache shared:SSL:50m;
ssl_certificate /etc/ssl/faraday.local.crt;
ssl_certificate_key /etc/ssl/faraday.local.key;
gzip on;
gzip_types application/javascript text/css;
expires $expires;
index index.html index.htm;
location / {
alias /home/faraday/faraday/faraday/frontend/www/;
try_files $uri $uri/ /index.html;
}
location /_api {
proxy_pass http://127.0.0.1:5985/_api; # replace 127.0.0.1 with your faraday-server ip addr
proxy_redirect http:// $scheme://;
proxy_read_timeout 300;
proxy_cookie_path / "/; secure";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /socket.io {
# proxy params
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://127.0.0.1:5985; # replace 127.0.0.1 with your faraday-server ip addr
}
}
server {
server_name faraday.local; # replace with with your FQDN
listen 80 ;
listen [::]:80 ;
# https redirect
if ($host = faraday.local) { # replace with with your FQDN
return 301 https://$host$request_uri;
}
return 404;
}
Place it in /etc/nginx/sites-available
with the name faraday.local
and enable it with sudo ln -s /etc/nginx/sites-available/faraday.local /etc/nginx/sites-enabled/faraday.local
.
Certificate Management¶
Self-Signed Certificates (Development/Testing)¶
For development or internal testing environments:
# Generate a private key
sudo openssl genrsa -out /etc/ssl/faraday.local.key 2048
# Create a certificate signing request (CSR)
sudo openssl req -new -key /etc/ssl/faraday.local.key -out /etc/ssl/faraday.local.csr
# Generate the self-signed certificate
sudo openssl x509 -req -days 365 -in /etc/ssl/faraday.local.csr -signkey /etc/ssl/faraday.local.key -out /etc/ssl/faraday.local.crt
# Set appropriate permissions
sudo chmod 600 /etc/ssl/faraday.local.key
sudo chmod 644 /etc/ssl/faraday.local.crt
Important: When prompted for the Common Name (CN), use your exact FQDN (e.g., faraday.local
).
Production Certificates¶
For production deployments, use certificates from a trusted Certificate Authority.
Restart NGINX:
sudo systemctl restart nginx
After this local configuration, you should see https://faraday.local
with websockets up and running.
In case faraday.local
is not resolved, check /etc/hosts
for the line:
127.0.0.1 faraday.local
We highly recommend you to check our First Steps guide.