Skip to content

Commit

Permalink
display public ips on debug page
Browse files Browse the repository at this point in the history
  • Loading branch information
FreddleSpl0it committed Sep 26, 2022
1 parent 3b8e17c commit 4387e47
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
18 changes: 17 additions & 1 deletion data/web/debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,32 @@
$containers[$container]['State']['StartedAtHR'] = $started;
}

// get mailconf data
// get mailcow data
$hostname = getenv('MAILCOW_HOSTNAME');
$timezone = getenv('TZ');
// get public ips
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'http://ipv4.mailcow.email');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 0);
$ipv4 = curl_exec($curl);
curl_setopt($curl, CURLOPT_URL, 'http://ipv6.mailcow.email');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 0);
$ipv6 = curl_exec($curl);
$ips = array(
"ipv4" => $ipv4,
"ipv6" => $ipv6
);
curl_close($curl);

$template = 'debug.twig';
$template_data = [
'log_lines' => getenv('LOG_LINES'),
'vmail_df' => $vmail_df,
'hostname' => $hostname,
'timezone' => $timezone,
'ips' => $ips,
'solr_status' => $solr_status,
'solr_uptime' => round($solr_status['status']['dovecot-fts']['uptime'] / 1000 / 60 / 60),
'clamd_status' => $clamd_status,
Expand Down
7 changes: 7 additions & 0 deletions data/web/templates/debug.twig
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@
<p><b>{{ hostname }}</b></p>
</div></td>
</tr>
<tr>
<td>IPs</td>
<td class="text-break">
<span class="d-block">{{ ips.ipv4 }}</span>
<span class="d-block">{{ ips.ipv6 }}</span>
</td>
</tr>
<tr>
<td>Version</td>
<td class="text-break"><div>
Expand Down

0 comments on commit 4387e47

Please sign in to comment.