Files
crowdsec-dashy/web/templates/pages/geoip.html
T

120 lines
5.1 KiB
HTML

{{template "base" .}}
{{define "content"}}
<div style="max-width:900px">
<div style="margin-bottom:16px">
<div class="page-title">GeoIP Database</div>
<div class="page-sub">Automatic download and refresh of ipinfo.io MMDB database for CrowdSec enrichment</div>
</div>
<div class="panel" style="margin-bottom:16px">
<div class="panel-header"><span class="panel-title">Database Status</span></div>
<div class="panel-body">
<table style="width:100%;border-collapse:collapse">
<tr>
<td style="padding:8px 0;color:var(--muted);width:180px;font-size:13px">File</td>
<td style="font-family:'JetBrains Mono',monospace;font-size:13px">{{.Status.DBFile}}</td>
</tr>
<tr>
<td style="padding:8px 0;color:var(--muted);font-size:13px">Destination path</td>
<td style="font-family:'JetBrains Mono',monospace;font-size:13px">{{.Status.DBPath}}</td>
</tr>
<tr>
<td style="padding:8px 0;color:var(--muted);font-size:13px">DB exists</td>
<td>
{{if .Status.DBExists}}
<span class="badge badge-green">Yes</span>
<span style="font-size:12px;color:var(--muted);margin-left:8px">{{.Status.DBSizeHuman}}</span>
{{else}}
<span class="badge badge-red">No</span>
{{end}}
</td>
</tr>
<tr>
<td style="padding:8px 0;color:var(--muted);font-size:13px">Last updated</td>
<td style="font-size:13px">
{{if .Status.LastUpdated.IsZero}}
<span style="color:var(--muted)">Never</span>
{{else}}
{{.Status.LastUpdated.Format "2006-01-02 15:04:05 UTC"}}
{{end}}
</td>
</tr>
<tr>
<td style="padding:8px 0;color:var(--muted);font-size:13px">Next refresh</td>
<td style="font-size:13px">
{{if .Status.NextRefresh.IsZero}}
<span style="color:var(--muted)"></span>
{{else}}
{{.Status.NextRefresh.Format "2006-01-02 15:04:05 UTC"}}
<span style="color:var(--muted);font-size:12px;margin-left:8px">(every {{.Status.RefreshDays}} days)</span>
{{end}}
</td>
</tr>
<tr>
<td style="padding:8px 0;color:var(--muted);font-size:13px">Token configured</td>
<td>
{{if .Status.TokenSet}}
<span class="badge badge-green">Yes</span>
{{else}}
<span class="badge badge-red">No</span>
<span style="font-size:12px;color:var(--muted);margin-left:8px">Set ipinfo_token in app_config.conf</span>
{{end}}
</td>
</tr>
{{if .Status.Updating}}
<tr>
<td style="padding:8px 0;color:var(--muted);font-size:13px">Status</td>
<td><span class="badge badge-amber">Downloading...</span></td>
</tr>
{{end}}
{{if .Status.LastErrMsg}}
<tr>
<td style="padding:8px 0;color:var(--muted);font-size:13px">Last error</td>
<td style="font-size:12px;color:var(--threat)">{{.Status.LastErrMsg}}</td>
</tr>
{{end}}
</table>
</div>
</div>
{{if .Status.TokenSet}}
<div class="panel" style="margin-bottom:16px">
<div class="panel-header"><span class="panel-title">Manual Refresh</span></div>
<div class="panel-body">
<p style="font-size:13px;color:var(--muted);margin:0 0 16px 0">
Downloads <strong style="color:var(--text)">{{.Status.DBFile}}</strong> from ipinfo.io
and saves it to <code style="font-family:'JetBrains Mono',monospace">{{.Status.DBPath}}</code>.
CrowdSec will use the new file automatically — no restart needed.
</p>
<form method="POST" action="/geoip/refresh">
<input type="hidden" name="_csrf" value="{{.CSRFToken}}">
<button type="submit" class="btn-primary"
{{if .Status.Updating}}disabled{{end}}
data-confirm="Download {{.Status.DBFile}} from ipinfo.io now?" data-confirm-label="Download">
{{if .Status.Updating}}Downloading...{{else}}Refresh Now{{end}}
</button>
</form>
</div>
</div>
{{end}}
<div class="panel">
<div class="panel-header"><span class="panel-title">Setup Notes</span></div>
<div class="panel-body" style="font-size:13px;color:var(--muted);line-height:1.7">
<p>1. Get a free token at <strong style="color:var(--text)">ipinfo.io/signup</strong></p>
<p>2. Add to <code style="font-family:'JetBrains Mono',monospace">app_config.conf</code>:</p>
<pre style="background:var(--surface);border:1px solid var(--border);padding:12px;border-radius:4px;font-size:12px;margin:8px 0 16px">ipinfo_token = your-token-here
ipinfo_db_file = asn.mmdb
ipinfo_db_path = /var/lib/crowdsec/data/GeoLite2-ASN.mmdb
ipinfo_refresh_days = 7</pre>
<p>3. Restart crowdsec-dashy and click <strong style="color:var(--text)">Refresh Now</strong></p>
<p>4. For country enrichment, also download <code style="font-family:'JetBrains Mono',monospace">country.mmdb</code> and configure CrowdSec to use it</p>
</div>
</div>
</div>
{{end}}
{{define "scripts"}}{{end}}