{% extends "base.html" %} {% block title %}Data server settings · NEXXVU{% endblock %} {% block head %}{# A1: while root reads the certificate, or applies the approval and restarts the Portal, the page reloads by itself (the stopping process may serve it without its stylesheet; this reload needs neither). #} {% if admin and data and data.server and not data.server.approved and data.server.destination.pending %}{% set dp = data.server.destination %} {% if dp.pending.status != 'requested' %}{% elif not dp.observed %}{% endif %}{% endif %}{% endblock %} {% macro key_panel(k, role) %}
{{ k.get('id') }}{{ k.get('hint') }} (first and last four characters; the key itself is never shown)On the data server the same key ID is in /etc/nexxvu/data-server-key.json (root only), and the device's Tools → Data server check compares the two. To renew the key, run that check and apply: a new key is generated on the server and stored in this Portal.
No key recorded yet: use Generate a new key above.
{% endif %}A notice appears {{ 14 }} days before a key expires; once expired, PostgreSQL refuses it and readings wait on this Portal until it is renewed.
Settings
This Portal's own PostgreSQL server for monitoring history and logs, so pages stay fast, the history can grow, and updates stay small. Inventory and settings stay on the Portal.
Only Portal administrators manage the data server.
{% else %}{% set d0 = data %} {% set tab = tab if tab in ('overview', 'connection', 'history', 'logs', 'key') else 'overview' %} {% if tab == 'overview' %}{{ k.get('id') }}{% if k.get('expires') %} · until {{ k.get('expires')[:10] }}{% if k.get('days_left') is not none %} ({{ k.get('days_left') }} days){% endif %}{% endif %}{% endif %}
Logs
{% if logs_server and logs_server.server %}{% if logs_server.connected %}Logs data server{% else %}Logs data server not connected{% endif %} {{ logs_server.server_name }}{% else %}On the {{ 'data server' if d0.server else 'Portal' }}{% endif %}{% if history %} · kept {{ history.logs_retention_days }} days{% endif %}{% if history and history.remote %} · {{ (history.remote.logs_bytes / 1048576)|round(1) }} MB{% endif %}
Not set up The Portal keeps its monitoring history in its own database, as before.
Step by step, with the network rules: Installation guide › Data server.
{% elif d0.connected %}Connected {{ d0.server_name }} · {{ d0.server.address }}:{{ d0.server.port }} as {{ d0.server.username }}.
{% else %}Not connected yet {{ d0.last_check_detail or ('Approved: press Check connection.' if d0.server.approved else 'Approve the address below first.') }}
{% endif %} {% if d0.server %}| Database | Result | PostgreSQL | TLS | Size | Time |
|---|---|---|---|---|---|
{{ name }} | {% if r.ok %}Ready{% else %}Not ready {{ r.get('error') or 'this account may not create tables here' }}{% endif %} | {{ r.get('version') or '–' }} | {{ r.get('tls') or '–' }} | {% if r.get('bytes') is not none %}{{ (r.bytes / 1048576)|round(1) }} MB{% else %}–{% endif %} | {% if r.get('milliseconds') is not none %}{{ r.milliseconds }} ms{% else %}–{% endif %} |
{{ d0.server_name }} · {{ d0.server.address }}:{{ d0.server.port }}
{% if d0.server.approved %}Approved Only this Portal's own account may connect to this address, and only to this certificate.
{% if d.fingerprint %}{{ d.fingerprint }}This Portal does not use approved addresses, so the data server cannot be approved here.
{% elif d.pending and d.pending.status == 'requested' and d.observed %}Step 2 of 3 Compare the certificate with the data server, then approve the address.
{{ d.fingerprint }}On the data server: sudo openssl x509 -in /etc/ssl/certs/ssl-cert-snakeoil.pem -outform der | sha256sum
NEXXVU is reading the data server's certificate; this page refreshes by itself.
{% elif d.pending %}Approved. The Portal applies the address and restarts once; this page continues by itself.
{% else %}{% if d.latest and d.latest.status == 'failed' %}The data server could not be reached: {{ d.latest.failure }}. {% if d.latest.failure == 'connection_refused' %}{{ fresh_tag("data:order") }}The server answered, but nothing accepts connections on port {{ d0.server.port if d0.server else 5432 }} from this Portal: usually it was never made a data server, and its PostgreSQL listens only on the server itself. Add it as a device (Inventory › Add device › Ubuntu), then on that device choose Tools › Data server › Make this a data server; it sets PostgreSQL, TLS and the firewall and fills in this page.{% else %}Check the address, the port, that PostgreSQL has TLS on, and that your router lets this Portal reach it; then save again.{% endif %}
Only when the data server changed. The account and its password are already saved; Check connection above uses them.
{% endif %}The monitoring history is on this Portal. Moving it copies every reading and hourly summary to the data server, oldest first, while monitoring continues. When everything is copied and the counts match, the data server keeps the history and this Portal keeps only the last {{ hs.local_hours }} hours for its live pages; older readings are removed from the Portal only after the data server has them.
{% if d0.connected %} {% else %}Run Check connection first; the move starts only on a connected data server.
{% endif %} {% if hs.returned_at %}The history came back to this Portal on {{ hs.returned_at|replace('T',' ')|replace('Z',' UTC') }} ({{ '{:,}'.format(hs.returned_rows) }} readings).
{% endif %}NEXXVU forgets the data server: its approved address is revoked (the Portal restarts once) and its registration removed. Its databases stay on the server; remove its device from the inventory and the virtual machine yourself when you no longer need them.
Coming back Bringing readings back to this Portal{% if hs.progress is not none %}: {{ hs.progress }} %{% endif %} ({{ '{:,}'.format(hs.returned_rows) }}{% if hs.return_total %} of {{ '{:,}'.format(hs.return_total) }}{% endif %} readings since {{ (hs.return_cutoff or '')[:10] }}). Monitoring continues; this page refreshes by itself.
{% if hs.progress is not none %}{% endif %} {% if hs.error %}Waiting for the data server: {{ hs.error }}
{% endif %} {% elif hs.mode == 'moving' %}Moving Copying readings to the data server{% if hs.progress is not none %}: {{ hs.progress }} %{% endif %}. Monitoring continues; this page refreshes by itself.
{% if hs.progress is not none %}{% endif %}Waiting for the data server: {{ hs.error }}. Readings stay on this Portal and are copied when it answers again.
{% endif %} {% if hs.verification and not hs.verification.get('ok', True) %}Counts did not match yet ({{ '{:,}'.format(hs.verification.readings_on_data_server) }} of {{ '{:,}'.format(hs.verification.readings_on_portal) }}); copying continues.
{% endif %} {% else %}On the data server since {{ (hs.moved_at or '')|replace('T',' ')|replace('Z',' UTC') }}. This Portal keeps the last {{ hs.local_hours }} hours of readings for its live pages; longer periods are read from the data server.
The Portal sends new readings every few seconds and keeps the last {{ hs.local_hours }} hours. Waiting now: {{ '{:,}'.format(cu.to_send) }} readings to send, about {{ '{:,}'.format(cu.to_trim) }} older readings to remove from this Portal, {{ (cu.free_bytes / 1e9)|round(1) }} GB to give back to the disk.
{% if cu.running %}Moving now, without pauses, until nothing is left (at most until {{ (cu.until or '')|replace('T',' ')|replace('Z',' UTC') }}). Monitoring continues; this page refreshes by itself.
{% elif cu.to_send or cu.to_trim or cu.free_bytes %} {% else %}Nothing waiting: everything older than {{ hs.local_hours }} hours is on the data server.
{% endif %}The data server is not answering: {{ hs.error }}. Readings stay on this Portal and are sent when it is back.
{% endif %} {% if hs.remote_error %}The data server's figures are not available now: {{ hs.remote_error }}
{% endif %}Brings the last days of readings and every hourly summary back to this Portal; then the history is kept here again and the data server can be disconnected. Monitoring continues meanwhile.
{% if room %}{{ '{:,}'.format(room.readings) }} readings ({{ room.days }} days) need about {{ (room.bytes / 1e9)|round(1) }} GB on this Portal; {{ (room.free / 1e9)|round(1) }} GB is free{% if not room.enough %}: not enough with the reserve for updates. Choose fewer days or add disk first{% endif %}.
{% endif %}Connect and approve a data server first (Connection tab); the history stays on this Portal until you move it.
{% endif %}{% endif %} {% if tab == 'logs' %}{% if keep %}{% set life_names = {'attack': 'Attack', 'expected': 'Expected', 'unknown': 'Unknown', 'device': 'Device', 'earlier': 'Stored before classes'} %}Each class of log line has its own period, removed a whole day at a time, never longer than Keep logs for below or a device's own period on this Portal (Tools › Logs). A held device keeps everything. Lines and space: the last 30 days, all devices.
{% if keep.counting %}Counting the lines of the last 30 days; open this tab again in a minute to see them. The periods can be changed meanwhile.
{% endif %}For an investigation: a held device loses no log line - no class period, no release of attack lines, and on the data server its lines are kept aside when their day is dropped. When the hold ends, the normal periods apply again.
{% if keep.holds %}| Device | Held until | Reason | By | Actions |
|---|---|---|---|---|
| {{ h.name }} | {{ h.until|replace('T', ' ')|replace('Z', ' UTC') }} | {{ h.reason or '—' }} | {{ h.held_by }} | Download{% if history and history.mode != 'local' %} · Lines kept aside{% endif %} |
No device is held.
{% endif %}The nexxvu_logs database is ready for device logs (syslog arrives in a coming release){% if logs_server and logs_server.connected %}, on the logs data server {{ logs_server.server_name }}{% endif %}. To keep the logs on a second data server, add it as a device and choose Tools → Data server → Logs only. {% if hs.remote %}It holds {{ hs.remote.log_days }} days, {{ (hs.remote.logs_bytes / 1048576)|round(1) }} MB.{% endif %} Logs older than the period below are removed a whole day at a time.
{{ ls.server_name }} · {{ ls.server.address }}:{{ ls.server.port }} keeps this Portal's logs; the monitoring history stays {{ 'on the main data server' if d0.server else 'on this Portal' }}. {% if ls.connected %}Connected{% elif ls.server.approved %}Check the connection{% else %}Approve its address{% endif %}
{% if not ls.server.approved and ld.pending and ld.pending.status == 'requested' and ld.observed %}{{ ld.fingerprint }}NEXXVU is reading or applying the address; this page refreshes by itself.
{% endif %} {% if ls.server.approved %}{% endif %}New logs go to {{ 'the main data server' if d0.server else 'this Portal' }}; the logs already on this server stay there. Its approved address is revoked (the Portal restarts once) and it is no longer protected from removal.
For large log volumes, add another Ubuntu server as a device and choose Tools → Data server → Logs only.
{% endif %}{% endif %} {% if tab == 'key' %} {% if ds_device and ds_device.asset %}Generate a new key on {{ ds_device.asset.name }} with its root or sudo account, in the device's Tools → Data server
{% elif d0.server %}To generate a key, add the data server ({{ d0.server.address }}) as a device (Inventory → Add device → Ubuntu); its Tools → Data server then has a Generate button.
{% endif %} {% if d0.server %}Set up a data server first.
{% endif %}{% endif %} {% endif %}