Welcome to the IPFire Wiki

This wiki is a community-maintained resource about everything there is to know about IPFire.

Please join in and help us improving it!

Differences in Revisions: IPFire SideMenü EX

»
Newer Revision
August 13 at 2:08 am
fix code blocks
# 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:
`/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:
 
```text
` touch /var/ipfire/menu.d/EX-external.menu`
touch /var/ipfire/menu.d/EX-external.menu
` chown nobody.nobody /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`
chmod 644 /var/ipfire/menu.d/EX-external.menu
```
 
This file becomes the following content (you can us [vi](wp>vi) or [nano](/addons/nano):
This file becomes the following content (you can us [vi](https://en.wikipedia.org/wiki/vi) or [nano](/addons/nano)):
 
<file text /var/ipfire/menu.d/EX-external.menu>
filename = /var/ipfire/menu.d/EX-external.menu
 
```text
` $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,`
` };`
</file>
```
 
For this we need also a Perl-script in the CGI-directory of the Webserver.
We create the script with the following steps:
 
```text
` touch /srv/web/ipfire/cgi-bin/external.cgi`
touch /srv/web/ipfire/cgi-bin/external.cgi
` chown root.root /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`
chmod 755 /srv/web/ipfire/cgi-bin/external.cgi
```
 
and put the following content into it:
 
<file text /srv/web/ipfire/cgi-bin/external.cgi>
filename = /srv/web/ipfire/cgi-bin/external.cgi
 
```text
#!/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
;
` }`
 
}
</file>
```
 
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.