wiki.ipfire.org

The community-maintained documentation platform of IPFire

User Tools

Site Tools


addons:sidemenu_ex:start

IPFire SideMenü EX

Ipfire offers some Addons, which provide their own web interface for configuration. These are for example:

  • Cups
  • Openmailadmin
  • Mediatomb
  • BackupPC

They are by default not linked to the IPFire surface. A manual link on IPFire´s sidemenu is possible and will be explained here.

/var/ipfire contains a directory called “menu.d”. There are the menus of the IPFire located. In this directory we create a file named “EX-external.menu” with the following steps:

 touch /var/ipfire/menu.d/EX-external.menu
 chown nobody.nobody /var/ipfire/menu.d/EX-external.menu
 chmod 644 /var/ipfire/menu.d/EX-external.menu

This file becomes the following content (you can us vi or nano:

/var/ipfire/menu.d/EX-external.menu
    $subipfire->{'backuppc'} = {'caption' => BackupPC,
				  'uri' => '/cgi-bin/external.cgi?backuppc',
				  'title' => BackupPC,
				  'enabled' => 1,
				  };
    $subipfire->{'cups'} = {'caption' => Cups,
				  'uri' => '/cgi-bin/external.cgi?cups',
				  'title' => Cups,
				  'enabled' => 1,
				  };
    $subipfire->{'mediatomb'} = {'caption' => MediaTomb,
				  'uri' => '/cgi-bin/external.cgi?mediatomb',
				  'title' => Mediatomb,
				  'enabled' => 1,
				  };
    $subipfire->{'openmailadmin'} = {'caption' => OpenMailAdmin,
				  'uri' => '/cgi-bin/external.cgi?openmailadmin',
				  'title' => Mediatomb,
				  'enabled' => 1,
				  };

For this we need also a Perl-script in the CGI-directory of the Webserver. We create the script with the following steps:

 touch /srv/web/ipfire/cgi-bin/external.cgi
 chown root.root /srv/web/ipfire/cgi-bin/external.cgi
 chmod 755 /srv/web/ipfire/cgi-bin/external.cgi

and put the following content into it:

/srv/web/ipfire/cgi-bin/external.cgi
#!/usr/bin/perl
# Menüerweiterung für Ipfire
 
use strict;
use Switch;
 
switch ($ENV{'QUERY_STRING'}) {
 
    case "backuppc" {
 
	print "Content-type: text/html\n\n";
 
	print <<EOF
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="refresh" content="0; URL=http://$ENV{'SERVER_ADDR'}:1009/cgi-bin/BackupPC_Admin">
	</head>
EOF
	;
    }
 
    case "cups" {
 
	print "Content-type: text/html\n\n";
 
	print <<EOF
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="refresh" content="0; URL=https://$ENV{'SERVER_ADDR'}:631">
	</head>
EOF
	;
    }
 
    case "openmailadmin" {
 
	print "Content-type: text/html\n\n";
 
	print <<EOF
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="refresh" content="0; URL=http://$ENV{'SERVER_ADDR'}:1001">
	</head>
EOF
	;
    }
    case "mediatomb" {
 
	print "Content-type: text/html\n\n";
 
	print <<EOF
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="refresh" content="0; URL=http://$ENV{'SERVER_ADDR'}:49152">
	</head>
EOF
	;
    }
 
 
#############################################################################
#Hier weitere Einträge ergänzen!
 
 
 
#############################################################################
 
    else {
 
	print "Content-type: text/html\n\n";
 
	print <<EOF
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	</head>
	<Body>
	<h2>Für diesen Menüeintrag existiert keine Zuordnung in /srv/web/ipfire/cgi-bin/external.cgi!</h2>
	<h3>Ergänze einen Block $ENV{QUERY_STRING}:</h3>
	<p>
	<textarea readonly cols="120" rows="13">
 
case "$ENV{QUERY_STRING}" {
 
    print "Content-type: text/html\\n\\n";
 
    print <<EOF
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta http-equiv="refresh" content="0; URL=http://\$ENV{'SERVER_ADDR'}: Hier die Portnummer und Verzeichnis angeben">
    </head>
\EEOF
;
    }
	</textarea>
	</Body>
EOF
	;
    }
 
}

You should now see a new side menu with more items in IPFire (in the tab → ipfire) and the Addons can now be invoked directly by IPFire web interface. To open them in a extra tab, simply hold down the Strg-key while clicking the link.

addons/sidemenu_ex/start.txt · Last modified: 2018/09/23 21:16 by Jon