aboutsummaryrefslogtreecommitdiffstats
path: root/SiteSummary.pm
diff options
context:
space:
mode:
Diffstat (limited to 'SiteSummary.pm')
-rw-r--r--SiteSummary.pm27
1 files changed, 26 insertions, 1 deletions
diff --git a/SiteSummary.pm b/SiteSummary.pm
index f2c856f..bc8271f 100644
--- a/SiteSummary.pm
+++ b/SiteSummary.pm
@@ -35,6 +35,26 @@ my $pwd = "/var/lib/sitesummary/entries"; # Path to the entries
# File for debian-edu configuration
my $debian_edu_config = "/debian-edu/config";
+# Provide mechanism to remap host names for hosts private networks
+# available via tunnels.
+
+my $hostmapfile = "/etc/sitesummary/hostmap";
+my %hostmap;
+
+sub load_hostmap {
+ if (open(my $fh, '<', $hostmapfile)) {
+ %hostmap = (); # Clear hostmap
+ while (<$fh>) {
+ chomp;
+ my ($hostid, $newhostname) = split(/;/);
+ $hostmap{$hostid} = $newhostname;
+ }
+ close $fh;
+ } else {
+ return;
+ }
+}
+
sub get_filepath_current {
my ($hostid, $file) = @_;
return "$pwd/$hostid$file";
@@ -172,7 +192,11 @@ sub get_primary_macaddress {
#
sub get_hostname {
my $hostid = shift;
- return get_file_string($hostid, "/system/hostname");
+ if (exists $hostmap{$hostid}) {
+ return $hostmap{$hostid};
+ } else {
+ return get_file_string($hostid, "/system/hostname");
+ }
}
#
@@ -389,6 +413,7 @@ sub get_age_group {
return $thisgroup;
}
+load_hostmap();
1;
########################################################################