iac/ansible/roles/monitoring/files/dashboards/Security/security.json
Sergei Poljanski ebd4f110f4
Some checks failed
deploy / ansible (push) Failing after 41s
monitoring: alert on unknown servers in the Hetzner project
The VPC ping sweep misses a server that drops ICMP or is not attached
to the private network. Prometheus now lists the project's servers from
the Hetzner API with a read-only token and marks each one known or not
against monitoring_hcloud_servers.

Nothing is scraped from the servers: every discovered target is
Prometheus itself with all samples dropped, which leaves one `up`
series per server. A second alert fires when the list stops updating,
so a revoked token does not silently disable the check.

Assisted-by: Claude:fable-5-2
2026-11-16 00:13:00 +04:00

2168 lines
49 KiB
JSON

{
"uid": "asxpio-security",
"title": "Security",
"tags": [
"asxpio",
"security"
],
"timezone": "browser",
"editable": false,
"refresh": "1m",
"time": {
"from": "now-24h",
"to": "now"
},
"schemaVersion": 39,
"graphTooltip": 1,
"links": [
{
"title": "Dashboards",
"type": "dashboards",
"asDropdown": true,
"includeVars": false,
"keepTime": true,
"tags": []
}
],
"panels": [
{
"type": "row",
"title": "Unexpected (each of these alerts)",
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 0
},
"panels": [],
"id": 1
},
{
"type": "stat",
"title": "WireGuard peers",
"description": "Peers not in wireguard_clients",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "count(security_wg_peer_info{known=\"false\"}) or vector(0)",
"refId": "A",
"instant": true,
"range": false
}
],
"gridPos": {
"h": 4,
"w": 3,
"x": 0,
"y": 1
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"noValue": "0",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 1
}
]
}
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"colorMode": "background",
"graphMode": "none",
"textMode": "value"
},
"id": 2
},
{
"type": "stat",
"title": "VPC devices, servers",
"description": "Addresses answering ping on the private network that are not in security_vpc_hosts, plus servers in the Hetzner project that are not in monitoring_hcloud_servers",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "(count(group by (ip) (security_vpc_host_info{known=\"false\"})) or vector(0)) + (count(up{job=\"hcloud\",known=\"false\"}) or vector(0))",
"refId": "A",
"instant": true,
"range": false
}
],
"gridPos": {
"h": 4,
"w": 3,
"x": 3,
"y": 1
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"noValue": "0",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 1
}
]
}
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"colorMode": "background",
"graphMode": "none",
"textMode": "value"
},
"id": 3
},
{
"type": "stat",
"title": "Accounts",
"description": "Login accounts, and members of sudo or docker, outside the baseline",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "count(security_user_info{known=\"false\"} or security_group_member_info{known=\"false\"}) or vector(0)",
"refId": "A",
"instant": true,
"range": false
}
],
"gridPos": {
"h": 4,
"w": 3,
"x": 6,
"y": 1
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"noValue": "0",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 1
}
]
}
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"colorMode": "background",
"graphMode": "none",
"textMode": "value"
},
"id": 4
},
{
"type": "stat",
"title": "Listening ports",
"description": "",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "count(security_listening_port_info{known=\"false\"}) or vector(0)",
"refId": "A",
"instant": true,
"range": false
}
],
"gridPos": {
"h": 4,
"w": 3,
"x": 9,
"y": 1
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"noValue": "0",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 1
}
]
}
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"colorMode": "background",
"graphMode": "none",
"textMode": "value"
},
"id": 5
},
{
"type": "stat",
"title": "Containers",
"description": "Privileged, host network or PID, host root or the Docker socket, outside the baseline",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "count(security_container_privileged_info{known=\"false\"}) or vector(0)",
"refId": "A",
"instant": true,
"range": false
}
],
"gridPos": {
"h": 4,
"w": 3,
"x": 12,
"y": 1
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"noValue": "0",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 1
}
]
}
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"colorMode": "background",
"graphMode": "none",
"textMode": "value"
},
"id": 6
},
{
"type": "stat",
"title": "File changes (24 h)",
"description": "accounts, sudoers, sshd, wireguard, authorized_keys",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(changes(security_fileset_hash[24h]))",
"refId": "A",
"instant": true,
"range": false
}
],
"gridPos": {
"h": 4,
"w": 3,
"x": 15,
"y": 1
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"noValue": "0",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "orange",
"value": 1
}
]
}
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"colorMode": "background",
"graphMode": "none",
"textMode": "value"
},
"id": 7
},
{
"type": "stat",
"title": "SSH logins (24 h)",
"description": "",
"datasource": {
"type": "loki",
"uid": "loki"
},
"targets": [
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"expr": "sum(count_over_time({job=\"journal\", unit=\"ssh.service\"} |~ `Accepted \\S+ for ` [24h]))",
"refId": "A",
"instant": true,
"range": false,
"queryType": "instant"
}
],
"gridPos": {
"h": 4,
"w": 3,
"x": 18,
"y": 1
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"noValue": "0",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "blue",
"value": null
}
]
}
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"colorMode": "background",
"graphMode": "none",
"textMode": "value"
},
"id": 8
},
{
"type": "stat",
"title": "Failed SSH (24 h)",
"description": "",
"datasource": {
"type": "loki",
"uid": "loki"
},
"targets": [
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"expr": "sum(count_over_time({job=\"journal\", unit=\"ssh.service\"} |~ `Failed \\S+ for |Invalid user |Connection closed by (authenticating|invalid) user ` [24h]))",
"refId": "A",
"instant": true,
"range": false,
"queryType": "instant"
}
],
"gridPos": {
"h": 4,
"w": 3,
"x": 21,
"y": 1
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"noValue": "0",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "blue",
"value": null
}
]
}
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"colorMode": "background",
"graphMode": "none",
"textMode": "value"
},
"id": 9
},
{
"type": "row",
"title": "Networks",
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 5
},
"panels": [],
"id": 10
},
{
"type": "table",
"title": "WireGuard peers",
"description": "",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "security_wg_peer_last_handshake_seconds * 1000 * on (host, interface, peer) group_left (allowed_ips, known) security_wg_peer_info",
"refId": "A",
"instant": true,
"range": false,
"format": "table"
}
],
"gridPos": {
"h": 8,
"w": 10,
"x": 0,
"y": 6
},
"fieldConfig": {
"defaults": {
"custom": {
"filterable": true
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "known"
},
"properties": [
{
"id": "mappings",
"value": [
{
"type": "value",
"options": {
"true": {
"text": "yes",
"color": "green"
},
"false": {
"text": "NO",
"color": "red"
}
}
}
]
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
},
{
"id": "custom.width",
"value": 80
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value"
},
"properties": [
{
"id": "displayName",
"value": "last handshake"
},
{
"id": "unit",
"value": "dateTimeFromNow"
},
{
"id": "mappings",
"value": [
{
"type": "value",
"options": {
"0": {
"text": "never"
}
}
}
]
}
]
}
]
},
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"__name__": true,
"instance": true,
"job": true
},
"indexByName": {
"host": 0,
"interface": 1,
"peer": 2,
"allowed_ips": 3,
"known": 4,
"Value": 5
}
}
}
],
"options": {
"showHeader": true,
"cellHeight": "sm"
},
"id": 11
},
{
"type": "table",
"title": "WireGuard endpoints",
"description": "Where each peer last connected from. A network (/16) not seen for that peer in 14 days alerts.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "security_wg_peer_endpoint_info",
"refId": "A",
"instant": true,
"range": false,
"format": "table"
}
],
"gridPos": {
"h": 8,
"w": 7,
"x": 10,
"y": 6
},
"fieldConfig": {
"defaults": {
"custom": {
"filterable": true
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "known"
},
"properties": [
{
"id": "mappings",
"value": [
{
"type": "value",
"options": {
"true": {
"text": "yes",
"color": "green"
},
"false": {
"text": "NO",
"color": "red"
}
}
}
]
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
},
{
"id": "custom.width",
"value": 80
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value"
},
"properties": [
{
"id": "custom.hidden",
"value": true
}
]
}
]
},
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"__name__": true,
"instance": true,
"job": true
},
"indexByName": {
"host": 0,
"peer": 1,
"endpoint": 2,
"net": 3
}
}
}
],
"options": {
"showHeader": true,
"cellHeight": "sm"
},
"id": 12
},
{
"type": "table",
"title": "Private network (VPC) devices",
"description": "Ping sweep of the VPC from both hosts, every minute. A device that drops ICMP is not seen.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "group by (ip, known) (security_vpc_host_info)",
"refId": "A",
"instant": true,
"range": false,
"format": "table"
}
],
"gridPos": {
"h": 8,
"w": 7,
"x": 17,
"y": 6
},
"fieldConfig": {
"defaults": {
"custom": {
"filterable": true
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "known"
},
"properties": [
{
"id": "mappings",
"value": [
{
"type": "value",
"options": {
"true": {
"text": "yes",
"color": "green"
},
"false": {
"text": "NO",
"color": "red"
}
}
}
]
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
},
{
"id": "custom.width",
"value": 80
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value"
},
"properties": [
{
"id": "custom.hidden",
"value": true
}
]
}
]
},
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"__name__": true,
"instance": true,
"job": true
},
"indexByName": {
"ip": 0,
"known": 1
}
}
}
],
"options": {
"showHeader": true,
"cellHeight": "sm"
},
"id": 13
},
{
"type": "table",
"title": "Hetzner project servers",
"description": "Servers the Hetzner API lists for the project, refreshed every minute. Catches a server that drops ping or is not attached to the VPC.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "group by (server, type, status, public_ip, private_ip, known) (up{job=\"hcloud\"})",
"refId": "A",
"instant": true,
"range": false,
"format": "table"
}
],
"gridPos": {
"h": 4,
"w": 24,
"x": 0,
"y": 14
},
"fieldConfig": {
"defaults": {
"custom": {
"filterable": true
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "known"
},
"properties": [
{
"id": "mappings",
"value": [
{
"type": "value",
"options": {
"true": {
"text": "yes",
"color": "green"
},
"false": {
"text": "NO",
"color": "red"
}
}
}
]
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
},
{
"id": "custom.width",
"value": 80
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value"
},
"properties": [
{
"id": "custom.hidden",
"value": true
}
]
}
]
},
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"__name__": true,
"instance": true,
"job": true
},
"indexByName": {
"server": 0,
"type": 1,
"status": 2,
"public_ip": 3,
"private_ip": 4,
"known": 5
}
}
}
],
"options": {
"showHeader": true,
"cellHeight": "sm"
},
"id": 31
},
{
"type": "table",
"title": "Listening ports",
"description": "Outside loopback. Known entries show the allowlist entry (a range or *), others the port.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "security_listening_port_info",
"refId": "A",
"instant": true,
"range": false,
"format": "table"
}
],
"gridPos": {
"h": 9,
"w": 24,
"x": 0,
"y": 18
},
"fieldConfig": {
"defaults": {
"custom": {
"filterable": true
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "known"
},
"properties": [
{
"id": "mappings",
"value": [
{
"type": "value",
"options": {
"true": {
"text": "yes",
"color": "green"
},
"false": {
"text": "NO",
"color": "red"
}
}
}
]
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
},
{
"id": "custom.width",
"value": 80
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value"
},
"properties": [
{
"id": "displayName",
"value": "sockets"
}
]
}
]
},
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"__name__": true,
"instance": true,
"job": true
},
"indexByName": {
"host": 0,
"scope": 1,
"proto": 2,
"port": 3,
"process": 4,
"known": 5,
"Value": 6
}
}
}
],
"options": {
"showHeader": true,
"cellHeight": "sm"
},
"id": 14
},
{
"type": "row",
"title": "Accounts and keys",
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 27
},
"panels": [],
"id": 15
},
{
"type": "table",
"title": "Login accounts",
"description": "",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "security_user_info",
"refId": "A",
"instant": true,
"range": false,
"format": "table"
}
],
"gridPos": {
"h": 8,
"w": 8,
"x": 0,
"y": 28
},
"fieldConfig": {
"defaults": {
"custom": {
"filterable": true
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "known"
},
"properties": [
{
"id": "mappings",
"value": [
{
"type": "value",
"options": {
"true": {
"text": "yes",
"color": "green"
},
"false": {
"text": "NO",
"color": "red"
}
}
}
]
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
},
{
"id": "custom.width",
"value": 80
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value"
},
"properties": [
{
"id": "custom.hidden",
"value": true
}
]
}
]
},
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"__name__": true,
"instance": true,
"job": true
},
"indexByName": {
"host": 0,
"user": 1,
"uid": 2,
"shell": 3,
"known": 4
}
}
}
],
"options": {
"showHeader": true,
"cellHeight": "sm"
},
"id": 16
},
{
"type": "table",
"title": "sudo and docker members",
"description": "",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "security_group_member_info",
"refId": "A",
"instant": true,
"range": false,
"format": "table"
}
],
"gridPos": {
"h": 8,
"w": 6,
"x": 8,
"y": 28
},
"fieldConfig": {
"defaults": {
"custom": {
"filterable": true
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "known"
},
"properties": [
{
"id": "mappings",
"value": [
{
"type": "value",
"options": {
"true": {
"text": "yes",
"color": "green"
},
"false": {
"text": "NO",
"color": "red"
}
}
}
]
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
},
{
"id": "custom.width",
"value": 80
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value"
},
"properties": [
{
"id": "custom.hidden",
"value": true
}
]
}
]
},
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"__name__": true,
"instance": true,
"job": true
},
"indexByName": {
"host": 0,
"group": 1,
"user": 2,
"known": 3
}
}
}
],
"options": {
"showHeader": true,
"cellHeight": "sm"
},
"id": 17
},
{
"type": "table",
"title": "authorized_keys",
"description": "",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "security_authorized_keys",
"refId": "A",
"instant": true,
"range": false,
"format": "table"
}
],
"gridPos": {
"h": 8,
"w": 10,
"x": 14,
"y": 28
},
"fieldConfig": {
"defaults": {
"custom": {
"filterable": true
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "known"
},
"properties": [
{
"id": "mappings",
"value": [
{
"type": "value",
"options": {
"true": {
"text": "yes",
"color": "green"
},
"false": {
"text": "NO",
"color": "red"
}
}
}
]
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
},
{
"id": "custom.width",
"value": 80
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value"
},
"properties": [
{
"id": "displayName",
"value": "keys"
}
]
}
]
},
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"__name__": true,
"instance": true,
"job": true
},
"indexByName": {
"host": 0,
"user": 1,
"file": 2,
"Value": 3
}
}
}
],
"options": {
"showHeader": true,
"cellHeight": "sm"
},
"id": 18
},
{
"type": "table",
"title": "Watched files: last change",
"description": "",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "security_fileset_mtime_seconds * 1000",
"refId": "A",
"instant": true,
"range": false,
"format": "table"
}
],
"gridPos": {
"h": 7,
"w": 8,
"x": 0,
"y": 36
},
"fieldConfig": {
"defaults": {
"custom": {
"filterable": true
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "known"
},
"properties": [
{
"id": "mappings",
"value": [
{
"type": "value",
"options": {
"true": {
"text": "yes",
"color": "green"
},
"false": {
"text": "NO",
"color": "red"
}
}
}
]
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
},
{
"id": "custom.width",
"value": 80
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value"
},
"properties": [
{
"id": "displayName",
"value": "changed"
},
{
"id": "unit",
"value": "dateTimeFromNow"
},
{
"id": "mappings",
"value": [
{
"type": "value",
"options": {
"0": {
"text": "never"
}
}
}
]
}
]
}
]
},
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"__name__": true,
"instance": true,
"job": true
},
"indexByName": {
"host": 0,
"set": 1,
"Value": 2
}
}
}
],
"options": {
"showHeader": true,
"cellHeight": "sm"
},
"id": 19
},
{
"type": "table",
"title": "Open sessions",
"description": "",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "security_sessions",
"refId": "A",
"instant": true,
"range": false,
"format": "table"
}
],
"gridPos": {
"h": 7,
"w": 6,
"x": 8,
"y": 36
},
"fieldConfig": {
"defaults": {
"custom": {
"filterable": true
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "known"
},
"properties": [
{
"id": "mappings",
"value": [
{
"type": "value",
"options": {
"true": {
"text": "yes",
"color": "green"
},
"false": {
"text": "NO",
"color": "red"
}
}
}
]
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
},
{
"id": "custom.width",
"value": 80
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value"
},
"properties": [
{
"id": "displayName",
"value": "sessions"
}
]
}
]
},
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"__name__": true,
"instance": true,
"job": true
},
"indexByName": {
"host": 0,
"user": 1,
"origin": 2,
"Value": 3
}
}
}
],
"options": {
"showHeader": true,
"cellHeight": "sm"
},
"id": 20
},
{
"type": "table",
"title": "Containers with host access",
"description": "",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "security_container_privileged_info",
"refId": "A",
"instant": true,
"range": false,
"format": "table"
}
],
"gridPos": {
"h": 7,
"w": 10,
"x": 14,
"y": 36
},
"fieldConfig": {
"defaults": {
"custom": {
"filterable": true
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "known"
},
"properties": [
{
"id": "mappings",
"value": [
{
"type": "value",
"options": {
"true": {
"text": "yes",
"color": "green"
},
"false": {
"text": "NO",
"color": "red"
}
}
}
]
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
},
{
"id": "custom.width",
"value": 80
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value"
},
"properties": [
{
"id": "custom.hidden",
"value": true
}
]
}
]
},
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"__name__": true,
"instance": true,
"job": true
},
"indexByName": {
"host": 0,
"name": 1,
"flags": 2,
"known": 3
}
}
}
],
"options": {
"showHeader": true,
"cellHeight": "sm"
},
"id": 21
},
{
"type": "row",
"title": "SSH",
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 43
},
"panels": [],
"id": 22
},
{
"type": "timeseries",
"title": "Logins by user and source",
"datasource": {
"type": "loki",
"uid": "loki"
},
"targets": [
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"expr": "sum by (host, user, src) (count_over_time({job=\"journal\", unit=\"ssh.service\"} |~ `Accepted \\S+ for ` | regexp `Accepted \\S+ for (?P<user>\\S+) from (?P<src>\\S+)` [$__interval]))",
"legendFormat": "{{host}}: {{user}} from {{src}}",
"refId": "A",
"instant": false,
"range": true
}
],
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 44
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"drawStyle": "bars",
"fillOpacity": 60,
"stacking": {
"mode": "normal"
}
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"id": 23
},
{
"type": "timeseries",
"title": "Failed logins",
"datasource": {
"type": "loki",
"uid": "loki"
},
"targets": [
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"expr": "sum by (host) (count_over_time({job=\"journal\", unit=\"ssh.service\"} |~ `Failed \\S+ for |Invalid user |Connection closed by (authenticating|invalid) user ` [$__interval]))",
"legendFormat": "{{host}}",
"refId": "A",
"instant": false,
"range": true
}
],
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 44
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"drawStyle": "bars",
"fillOpacity": 60,
"stacking": {
"mode": "normal"
}
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"id": 24
},
{
"type": "logs",
"title": "Logins",
"datasource": {
"type": "loki",
"uid": "loki"
},
"targets": [
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"expr": "{job=\"journal\", unit=\"ssh.service\"} |~ `Accepted \\S+ for `",
"refId": "A",
"instant": false,
"range": true
}
],
"gridPos": {
"h": 9,
"w": 12,
"x": 0,
"y": 51
},
"options": {
"showTime": true,
"showLabels": false,
"wrapLogMessage": true,
"sortOrder": "Descending",
"enableLogDetails": true
},
"id": 25
},
{
"type": "logs",
"title": "sudo, su and account changes",
"datasource": {
"type": "loki",
"uid": "loki"
},
"targets": [
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"expr": "{job=\"journal\"} |~ `sudo:.*COMMAND|su\\[\\d+\\]|useradd|usermod|userdel|groupadd|gpasswd|chpasswd|passwd\\[\\d+\\]`",
"refId": "A",
"instant": false,
"range": true
}
],
"gridPos": {
"h": 9,
"w": 12,
"x": 12,
"y": 51
},
"options": {
"showTime": true,
"showLabels": false,
"wrapLogMessage": true,
"sortOrder": "Descending",
"enableLogDetails": true
},
"id": 26
},
{
"type": "row",
"title": "Forgejo and web logins",
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 60
},
"panels": [],
"id": 27
},
{
"type": "stat",
"title": "Forgejo",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"description": "Growth in users, admins, keys or runners alerts.",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "security_forgejo_objects",
"legendFormat": "{{kind}}",
"refId": "A",
"instant": true,
"range": false
}
],
"gridPos": {
"h": 7,
"w": 8,
"x": 0,
"y": 61
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "fixed",
"fixedColor": "blue"
}
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"colorMode": "value",
"graphMode": "none",
"textMode": "value_and_name"
},
"id": 28
},
{
"type": "timeseries",
"title": "Failed web logins",
"datasource": {
"type": "loki",
"uid": "loki"
},
"targets": [
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"expr": "sum(count_over_time({container=\"forgejo\"} |= `Failed authentication attempt` [$__interval]))",
"legendFormat": "Forgejo",
"refId": "A",
"instant": false,
"range": true
},
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"expr": "sum(count_over_time({job=\"traefik-access\"} |= `\"grafana@docker\"` |~ `\"POST /login HTTP/[0-9.]+\" 401 ` [$__interval]))",
"legendFormat": "Grafana",
"refId": "B",
"instant": false,
"range": true
},
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"expr": "sum(count_over_time({job=\"traefik-access\"} |= `\"asxpio@docker\"` |~ `\"POST /admin/login HTTP/[0-9.]+\" (401|429) ` [$__interval]))",
"legendFormat": "asxp.io admin",
"refId": "C",
"instant": false,
"range": true
}
],
"gridPos": {
"h": 7,
"w": 16,
"x": 8,
"y": 61
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"drawStyle": "bars",
"fillOpacity": 60,
"stacking": {
"mode": "normal"
}
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"id": 29
},
{
"type": "logs",
"title": "Failed web logins",
"datasource": {
"type": "loki",
"uid": "loki"
},
"targets": [
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"expr": "{container=\"forgejo\"} |= `Failed authentication attempt`",
"refId": "A",
"instant": false,
"range": true
},
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"expr": "{job=\"traefik-access\"} |~ `\"POST /(admin/)?login HTTP/[0-9.]+\" (401|429) `",
"refId": "B",
"instant": false,
"range": true
}
],
"gridPos": {
"h": 8,
"w": 24,
"x": 0,
"y": 68
},
"options": {
"showTime": true,
"showLabels": false,
"wrapLogMessage": true,
"sortOrder": "Descending",
"enableLogDetails": true
},
"id": 30
}
]
}