]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
AWS: Hide certain things on the web UI
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 1 Jul 2018 11:15:00 +0000 (12:15 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 1 Jul 2018 11:15:00 +0000 (12:15 +0100)
Those are practically unusable on AWS.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/cfgroot/aws-functions.pl [new file with mode: 0644]
config/cfgroot/header.pl
config/rootfiles/common/configroot
lfs/configroot

diff --git a/config/cfgroot/aws-functions.pl b/config/cfgroot/aws-functions.pl
new file mode 100644 (file)
index 0000000..5fd9712
--- /dev/null
@@ -0,0 +1,34 @@
+#!/usr/bin/perl -w
+############################################################################
+#                                                                          #
+# This file is part of the IPFire Firewall.                                #
+#                                                                          #
+# IPFire is free software; you can redistribute it and/or modify           #
+# it under the terms of the GNU General Public License as published by     #
+# the Free Software Foundation; either version 2 of the License, or        #
+# (at your option) any later version.                                      #
+#                                                                          #
+# IPFire is distributed in the hope that it will be useful,                #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of           #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
+# GNU General Public License for more details.                             #
+#                                                                          #
+# You should have received a copy of the GNU General Public License        #
+# along with IPFire; if not, write to the Free Software                    #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
+#                                                                          #
+# Copyright (C) 2018 IPFire Team <info@ipfire.org>.                        #
+#                                                                          #
+############################################################################
+
+package AWS;
+
+sub running_on_ec2() {
+       if (-e "/var/run/aws-instance-id") {
+               return 1;
+       }
+
+       return 0;
+}
+
+1;
index 974c4d8b22458ab33d1a65044858804f040af9cc..7553b01ee16d55c33d6d54e9c07fb15fe9bdc5b7 100644 (file)
@@ -19,6 +19,8 @@ use Time::Local;
 
 $|=1; # line buffering
 
+require "/var/ipfire/aws-functions.pl";
+
 $Header::revision = 'final';
 $Header::swroot = '/var/ipfire';
 $Header::graphdir='/srv/web/ipfire/html/graphs';
@@ -161,6 +163,13 @@ sub genmenu {
     if ( $ethsettings{'RED_TYPE'} eq "PPPOE" && $pppsettings{'MONPORT'} ne "" ) {
         $menu->{'02.status'}{'subMenu'}->{'74.modem-status'}{'enabled'} = 1;
     }
+
+    # Disbale unusable things on EC2
+    if (&AWS::running_on_ec2()) {
+        $menu->{'03.network'}{'subMenu'}->{'30.dhcp'}{'enabled'} = 0;
+        $menu->{'03.network'}{'subMenu'}->{'80.macadressmenu'}{'enabled'} = 0;
+        $menu->{'03.network'}{'subMenu'}->{'90.wakeonlan'}{'enabled'} = 0;
+    }
   }
 }
 
index 73b7bc01f8ee22e9705128f1a62c756c57162622..87389915e4bf20e12990f19cb651259dc42daeee 100644 (file)
@@ -7,6 +7,7 @@ usr/sbin/firewall-policy
 var/ipfire/addon-lang
 var/ipfire/auth
 #var/ipfire/auth/users
+var/ipfire/aws-functions.pl
 #var/ipfire/backup
 var/ipfire/backup/exclude.user
 var/ipfire/backup/include.user
index a8a1774dc4265f1b90d70cccf7737bc29b9842e5..c2833fd4a782812aa4c8f21a33e36cdb590a543e 100644 (file)
@@ -79,6 +79,7 @@ $(TARGET) :
        cp $(DIR_SRC)/config/cfgroot/general-functions.pl       $(CONFIG_ROOT)/
        cp $(DIR_SRC)/config/cfgroot/network-functions.pl       $(CONFIG_ROOT)/
        cp $(DIR_SRC)/config/cfgroot/geoip-functions.pl         $(CONFIG_ROOT)/
+       cp $(DIR_SRC)/config/cfgroot/aws-functions.pl           $(CONFIG_ROOT)/
        cp $(DIR_SRC)/config/cfgroot/lang.pl                    $(CONFIG_ROOT)/
        cp $(DIR_SRC)/config/cfgroot/countries.pl               $(CONFIG_ROOT)/
        cp $(DIR_SRC)/config/cfgroot/graphs.pl                  $(CONFIG_ROOT)/