NobGit
public nobgit read

NobMail

Based on mailcow: dockerized

Languages

Repository composition by tracked source files.

PHP
PHP 49% JavaScript 35% HTML 9% CSS 4% Shell 2% Python 1% Lua 0% Perl 0% Ruby 0% SCSS 0%
Create file Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git

Commit

display public ips on debug page

4387e476
FreddleSpl0it <[email protected]> 3 years, 10 months ago
data/web/debug.php            | 18 +++++++++++++++++-
 data/web/templates/debug.twig |  7 +++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

Diff

diff --git a/data/web/debug.php b/data/web/debug.php
index e263e181..e9b426c4 100644
--- a/data/web/debug.php
+++ b/data/web/debug.php
@@ -44,9 +44,24 @@ foreach ($containers as $container => $container_info) {
   $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 = [
@@ -54,6 +69,7 @@ $template_data = [
   '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,
diff --git a/data/web/templates/debug.twig b/data/web/templates/debug.twig
index 3465da6e..64a3376e 100644
--- a/data/web/templates/debug.twig
+++ b/data/web/templates/debug.twig
@@ -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>