EBox on FreeLink-Debian

From NAS-Central Buffalo - The Linkstation Wiki
Revision as of 01:51, 1 March 2007 by Davy gravy (Talk | contribs)

Jump to: navigation, search

Eboxstatus4.jpg

Contents

What is eBox?

Developed as a flexible server/NAS solution for small business and small offices, eBox Platform is a management tool that supplies the following services:

  • NAS
  • Samba Filesharing and Printer Sharing
  • Firewall
  • Transparent proxy via Squid
  • Content filter
  • NTP Server
  • Users and groups administration
  • Mail server
  • Backup of data and/or system

How does it compare to Webmin (on Debian/FreeLink) and the stock Buffalo Web Interface(on the stock firmware) ?

eBox is not a full-fledged replacement for Webmin, but it does handle some things very well. It may be a better alternative for Debian/FreeLink users who found Webmin either too slow or too complex for their liking. In short, it can do nearly everything the stock Buffalo webinterface can do, and as more modules are written by developers and contributors, it may broaden its scope and capability. In particular it:

  • has enough features to make it work well as a Network Attached Storage (NAS) device
  • has a lot of features that make it a good choice as a gateway
  • has better printer support (greater variety of printers supported) than the stockware
  • can be locked down tighter than the stockware
  • has less options than Webmin
  • seems like it can be locked down tighter/more securely than the stockware
  • is faster than Webmin, provided that you don't install to much on top of it; is not as fast as the stock web interface

Installation

Prerequisites

  • 2.6 kernel and modules available here
  • A fresh FreeLink/Debian installation available here - note that any previously existing configuration files in /home, /root, /var, /etc, and other locations may cause problems with an installation. Squid, in particular, is very picky about these things. It is recommended that you first install eBox, and then add other servers after you have it installed and customized for your network.
  • Hard drive space on hda1 - eBox needs
    • lots of space for the software and packages, so
    • either use a custom partition with all the space you need, or create symlinks as shown here - Freeing Up Space On hda1
    • in particular, eBox will build its Samba shares in /home, so do something like this:
       mv /home /mnt/
       cd /
       ln -s /mnt/home  home
  • A realization that eBox may move your box towards being a bit of a "dedicated box" with a strong firewall
  • Read over this excellent (yet slightly outdated - version 0.7.1) installation guide for eBox - it shows many of the key points - a few of the configuration options mentioned have changed
  • Read over the installation guide for desktop computers - see the Debian Packages section
  • Time = 40 minutes to an hour or more, depending on your internet connection (about 100MB has to be downloaded)
  • Decide whether you want your eBox to be more like a NAS with full access to Debian (install ebox, libebox, ebox-network, ebox-objects, ebox-firewall, ebox-logs, ebox-samba, ebox-dhcp, ebox-squid, ebox-usersandgroups, ebox-ntp, ebox-printers) or more like a dedicated, secured, enhanced gateway (the previous packages + ebox-jabber, ebox-software).

Debian packages/libs for PPC FreeLink

Download these three required Debian packages that were built on an LS-HG.

cd / 
wget http://downloads.linkstationwiki.net/uploads/ebox/libnet-arp-perl_0.8-1_powerpc.deb
wget http://downloads.linkstationwiki.net/uploads/ebox/libnet-cups-perl_0.37-1_powerpc.deb
wget http://downloads.linkstationwiki.net/uploads/ebox/libreadonly-xs-perl_1.04-1_powerpc.deb

Debian packages/libs ARM9/LS-Pro FreeLink

not yet available


General Installation Steps for all LS's

Below is a very basic script for PPC LS's (LS1 and HG, Kuros). The script works and has been tested several times on an HG running UBoot, but is alpha or pre-alpha in nature. To use it, adjust IP addresses, namerservers, search domain, and whatever else you want. Run it either as a script, or cut and paste commands as you like. Use at your own risk: You can now wget/download the latest version - if you do, please post feedback at the thread listed bottom-of-page. Good luck.

ARM ProLS users will have to build their own packages, and alter the script only slightly - but this script has not been tested on the Pro.

wget http://downloads.linkstationwiki.net/uploads/ebox/openeboxscript.sh
chmod a+x openeboxscript.sh
./openeboxscript.sh


#! 	/bin/bash
#	READ READ READ READ READ READ READ
#	Before running, make sure that you 
#     	check for a 2.6 kernel and matching modules 				*****
#     	2.6 kernel modules need to be there for the firewall to function 	*****
#     	This script is a work in progress.  Please give feedback at "eBox on PPC" thread at the linkstationwiki.net forums
#	Read it through before using... adjust to your settings and network

#	IP and HOSTNAME info
#	hostname will be set to eBoxLinkStation
#	fixed ip will be initially set to 10.0.1.6   eBoxLinkStation.dnmwireless.com     eBoxLinkStation
#	If your Linkstation currently has a dynamic IP, take note of it and set the static IP below identically
#
#
#	DOMAIN and NAMESERVER must be set to your own situation
#

#     	needs libreadonly-xs-perl_1.04-1_powerpc.deb  libnet-arp-perl_0.8-1_powerpc.deb  libnet-cups-perl_0.37-1_powerpc.deb
#     	already sitting at  / 


cd /


#########  		set hostname 			 #####
hostname "eBoxLinkStation"
export hosts
echo "eBoxLinkStation" > /etc/hostname



#########  EBOX REQUIRES A STATIC IP DURING INSTALLATION #####
#########  save original interfaces and make a static ip #####
#########  adjust to your needs and your network         #####

mv  /etc/network/interfaces /etc/network/pre-ebox-interfaces-backup
echo "# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)" > /etc/network/interfaces
echo "# The loopback interface"  >> /etc/network/interfaces
echo auto lo   >> /etc/network/interfaces
echo iface lo inet loopback  >> /etc/network/interfaces
echo "# The first network card - eth0 - this entry was created during the Debian installation"  >> /etc/network/interfaces
echo "# (network, broadcast and gateway are optional)"  >> /etc/network/interfaces
echo auto eth0   >> /etc/network/interfaces
echo iface eth0 inet static   >>  /etc/network/interfaces
echo         address 10.0.1.6     >>  /etc/network/interfaces
echo         netmask 255.255.255.0    >>  /etc/network/interfaces
echo         network 10.0.1.0   >>  /etc/network/interfaces
echo         broadcast 10.0.1.255   >>  /etc/network/interfaces
echo         gateway 10.0.1.1   >>  /etc/network/interfaces

echo  "* * * * * restarting networking * * * * *"
sleep  3

/etc/init.d/networking restart
sleep  3 

echo  "* * * * restarted networking  * * * *"





######         set up /etc/hosts 		   		######
######   customize for your own network 		######
######   make a note of your domain name       ######
######   SQUID IS VERY PICKY ABOUT THIS 		######
######   don't change the 127.0.0.1 line		######
######   only change "dnmwireless.com"  		######
######   to your choice or a dummy      		######
cp  /etc/hosts  /etc/pre-ebox-hosts-backup

echo  "127.0.0.1     localhost.localdomain  localhost"    >  /etc/hosts
echo  "10.0.1.6    eBoxLinkStation.dnmwireless.com     eBoxLinkStation"   >>  /etc/hosts











#######  set up /etc/resolv.conf             		#####
#######  edit the addresses to your needs            	#####
#######  change your nameservers and domain 		#####

#######	keep a copy of your old pre-ebox resolv.conf	#####

mv /etc/resolv.conf  /etc/pre-ebox-resolv.conf-backup

echo nameserver 216.165.129.157 > /etc/resolv.conf
echo nameserver 10.0.1.1 >> /etc/resolv.conf
echo domain tds.net  >> /etc/resolv.conf



#######	check to see if you are connected to the internet ####
####### and that DNS works for you			  ####
ping -q -c 10 yahoo.com



#######  remove old dhcpd and put in newer one ########################
#dpkg --purge dhcpcd 
#apt-get -y  install dhcp3-client




######## set up an eBox-platform compatible apt source.list     #####
#######	but keep a copy of your old list			#####
mv /etc/apt/sources.list  /etc/apt/pre-ebox-sources.backup-list



####### make the new sources.list, with testing branch optional #####
echo deb http://mirrors.kernel.org/debian/ stable main >> /etc/apt/sources.list
echo deb-src http://mirrors.kernel.org/debian/ stable main >> /etc/apt/sources.list
echo "####################################################" >> /etc/apt/sources.list
echo "##deb http://security.debian.org/ stable/updates main" >> /etc/apt/sources.list
echo "#######################################################" >> /etc/apt/sources.list
echo deb http://ebox-platform.com/debian/stable/ ebox/ >> /etc/apt/sources.list
echo deb http://ebox-platform.com/debian/stable/ extra/ >> /etc/apt/sources.list
echo deb http://ebox-platform.com/debian/sarge/stable/ security/ >> /etc/apt/sources.list
echo "########################################################" >> /etc/apt/sources.list
echo "##   testing branch  ####" >> /etc/apt/sources.list
echo "##   de-comment these lines to --temporarily enable the testing branch" >> /etc/apt/sources.list
echo "#deb http://http.us.debian.org/debian testing main contrib non-free" >> /etc/apt/sources.list
echo "#deb-src http://http.us.debian.org/debian testing main contrib non-free" >> /etc/apt/sources.list




######  update your Debian installation & install necessary packages 		#####
apt-get update
apt-get upgrade
apt-get install module-init-tools libperl5.8 perl perl-base perl-modules libterm-readline-gnu-perl libterm-readline-perl-perl libcupsys2-gnutls10  perl-doc ssh xfsprogs 



### change your unix password to ebox or something easy to remember ####
passwd



######  update your timezone configuration 		#####
tzconfig





######	remove exim4 as it is not compatible with eBox 	#####
apt-get remove exim4
apt-get update






######  install essential libs for eBox, built for PPC  ######

dpkg -i libreadonly-xs-perl_1.04-1_powerpc.deb
dpkg -i libnet-arp-perl_0.8-1_powerpc.deb
dpkg -i libnet-cups-perl_0.37-1_powerpc.deb
echo "* * * * * * * libs for ebox installed * * * * * * * "
sleep 3






######  install ebox and modules 			 ######

echo "* * * * * ** getting ebox & modules * * * * * * * * *"
sleep 3
apt-get install ebox libebox ebox-network ebox-objects ebox-firewall ebox-samba ebox-squid ebox-usersandgroups ebox-ntp ebox-printers ebox-dhcp




### apt-get install missing software packages 


####  make a sym link from /home/samba  to  /mnt###
#### optional  #####

echo "* * * * * * * * * * All done installing eBox * * * * * * * * * * * * * " 
echo "Point your browser to         https://<eBoxLinkStation's IP>         * "
echo "and configure your eBoxLinkStation to your liking...                 * "
echo "Remember to open up SSH access so that you can connect to do any     * "
echo "changes or installation that can't be handled through the web        * "
echo "interface.							    * "
echo "Please leave feedback and/or report any bugs or problems on the      * "
echo "eBox on PPC forum thread at...				            * "
echo "http://forum.linkstationwiki.net/index.php?action=vthread&topic=2397 * "
sleep 3


###### end of script ########

Configuring and Customizing

Package configuration

As the install script runs, or as you go through the steps manually, provide the natural answers. For some of the configuration, you will want to make specific choices:

For all of the questions of the form "After unpacking 299kB of additional disk space will be used.
Do you want to continue? [Y/n]" , answer y.
Allow SSH protocol 2 only?   <-------------------- Yes
Do you want /usr/lib/ssh-keysign to be installed SUID root?  <--------------------  Yes
Do you want to run the sshd server?  <--------------------  Yes
Enter new UNIX password:    <--------------------  (your choice)
Your current time zone is set to US/Eastern
Do you want to change that? [n]: <-------------------- (your choice)
The following packages will be REMOVED:
  exim4
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0B of archives.
After unpacking 32.8kB disk space will be freed.
Do you want to continue? [Y/n]  <-------------------- Y     Yes, since exim4 is not compatible w/ eBox's email client
Where should the PostgreSQL database be created?                          
 /var/lib/postgres/data_______________________________ 
                                                        <Ok>  <--------------------   <Ok> 
Should the data be purged as well as the package files?  <-------------------- No
Choose European or US day/month order in dates.            (your choice)    and       <Ok>
DNS domain name:     dnmwireless.com  (or whatever you set it to in the scripted commands) and <Ok>
Name of your organization:   dnmwireless.com  (or whatever you set it to in the previous line above) and <Ok>
LDAP Admin password:    (your choice)

Allow LDAPv2 protocol?          <No> 
Apache-Perl needs to be reconfigured.    <Ok>
Enable suExec?      <No>
Do you want the cdrecord binaries to be installed SUID root?         
                                                         <Yes, if you want users to be able to backup your data w/ a CD/DVD burner>
                                                         <No, otherwise>
Which paper size should be the system default?  (your choice: US uses letter, Europe, others use A4)
On what network interfaces should the DHCP server listen?       eth0       (Linkstations have only one ethernet port)
Please configure the DHCP server as soon as the installation finishes.       <Ok>
The version 3 DHCP server is now non-authoritative by default.                 <Ok>
You can run dpkg-reconfigure later,...           <Ok>
Do you want to entrust font management to defoma?   Yes
 Workgroup/Domain Name?            (your choice, or WORKGROUP)
 Use password encryption?            yes
Modify smb.conf to use WINS settings from DHCP?   No
How do you want to run Samba?   daemons
Create samba password database, /var/lib/samba/passdb.tdb?   No
LDAP server host address     127.0.0.1  
distinguished name of the search base             dc=dnmwireless,dc=com   (or a choice that agrees with your chosen domain name)
LDAP version to use        3
database requires login          no
make configuration readable/writeable by owner only    no
nsswitch.conf is not managed automatically...          <Ok>
Send daily reminders to users over quota   No
Configuration file `/etc/dhcp3/dhclient.conf'
 ==> File on system created by you or by a script.
 ==> File also in package provided by package maintainer.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : background this process to examine the situation
 The default action is to keep your current version.
 *** dhclient.conf (Y/I/N/O/D/Z) [default=N] ?               N

Post-install Options

SSH access after installation

During installation you may find that you lose your ssh connection toward the very end. This can be fixed by following these directions How to Enable SSH access. Once you have done this and saved changes, test it by opening a new terminal window and attempt to connect with SSH. Make sure you have connectivity before you reboot in the next step.


Initial Reboot

Before any changes are made to network or further settings, it seems to help to halt and cold boot again. Do this through the web interface. It may take some time (1-2 minutes) for everything to terminate, and another 2-3 minutes for it to boot.

HTTP Proxy settings

If you want to add software via apt-get or wget, your eBox will need http access. To do this, you may have to enable the Transparent Proxy.

  • Click on HTTP proxy -> General ;
  • choose
    • Service Configuration Enabled (Change) ,
    • Transparent Proxy - Enabled ,
    • Content threshold - Very Permissive,
    • Global policy - Allow (Change) and then
  • Save Changes (upper right hand corner).


Network Settings, DHCP and DNS Problems

In Network, fill in your settings for DNS and Gateways, and Apply & Save Changes on each.

You can check your connection through the Diagnosis page. If you can't ping yahoo.com for instance, go back and check your settings for the previous two pages.

If you are having trouble reaching sites like mirrors.kernel.org or your favorite CPAN mirror, you may want to go to Network->Interfaces and set eth0 to DHCP, change and Save Changes. Do not set eth0 to External. This will kill your connection. If this change doesn't remedy it, check to see that you have enabled the Transparent Proxy.

Firewall

eBox's firewall is very strong and integrated. It uses iptables and can be controlled to a great degree from the web interface. Security comes at a cost, so here is how to get around it to some extent.


How to add an Allowed Service to your eBox's Firewall

Do you want to add an FTP or HTTP server to your eBox? Do it the normal apt-get way, but you will have to make eBox aware of it so that traffic can get through the firewall. See this HOW-TO How to make your eBox aware of Additional Services


Opening up ports for Firefly/mt-daapd

This can be very tricky to do. Firefly requires access to ports 3689 (tcp) and 5353 (udp). Port 5353 is used by mDNS and handles multicasting traffic. First, check to see that you have Firefly installed properly. If you do, you should be able to do both of these:

  • open a browser to http://<ebox IP>:3689 and see the standard web page for Firefly
  • see port 3689 open using a port scanner pointed at your eBox.

You may have use the perl add-service-to-firewall script and then add a Service Allow via the eBox Firewall page.

In addition to that, you can allow multicasting and mDNS services with these commands:

iptables -A INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT 
iptables -A OUTPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT

Check your iptables now by issuing

iptables -L --line-numbers

and look for the lines marked with @@@@@@@@@ below

Chain INPUT (policy DROP)
num  target     prot opt source               destination         
1    ACCEPT     all  --  anywhere             anywhere            
2    ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
3    ACCEPT     icmp !f  anywhere             anywhere            
4    inospoof   all  --  anywhere             anywhere            
5    iexternalmodules  all  --  anywhere             anywhere            
6    inoexternal  all  --  anywhere             anywhere            
7    imodules   all  --  anywhere             anywhere            
8    iintservs  all  --  anywhere             anywhere            
9    iobjects   all  --  anywhere             anywhere            
10   iglobal    all  --  anywhere             anywhere            
11   idrop      all  --  anywhere             anywhere            
12   ACCEPT     udp  --  anywhere             224.0.0.251         udp dpt:5353<---------@@@@@@@@@
Chain FORWARD (policy DROP)
num  target     prot opt source               destination         
1    ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
2    ACCEPT     icmp !f  anywhere             anywhere            
3    fnospoof   all  --  anywhere             anywhere            
4    fredirects  all  --  anywhere             anywhere            
5    fmodules   all  --  anywhere             anywhere            
6    ffwdrules  all  --  anywhere             anywhere            
7    fnoexternal  all  --  anywhere             anywhere            
8    fdns       all  --  anywhere             anywhere            
9    fobjects   all  --  anywhere             anywhere            
10   fglobal    all  --  anywhere             anywhere            
11   fdrop      all  --  anywhere             anywhere            
Chain OUTPUT (policy DROP)
num  target     prot opt source               destination         
1    ACCEPT     all  --  anywhere             anywhere            
2    ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
3    ACCEPT     icmp !f  anywhere             anywhere            
4    omodules   all  --  anywhere             anywhere            
5    ACCEPT     udp  --  anywhere             10.0.1.1            state NEW udp dpt:domain 
6    ACCEPT     udp  --  anywhere             216.165.129.157     state NEW udp dpt:domain 
7    ACCEPT     udp  --  anywhere             anywhere            state NEW udp dpt:ntp 
8    ACCEPT     udp  --  anywhere             224.0.0.251         udp dpt:5353 <---------@@@@@@@@

Restart iTunes or check your Roku again and you should have streaming audio now. If it works, you can save it by issuing the command

iptables-save

This change may not show up in the web interface of eBox.

Dropping the Firewall completely

This should only be done only if you have some other protection between you and the internet, or only for a very brief time. To do this you will need to alter (ahem...dirty hack) some code:

nano -c /usr/share/perl5/EBox/Iptables.pm

Scan down to around line 550, until you find this:

# Method: start
#
#       Start firewall service
#
sub start
{
        my $self = shift;
 
        $self->setStructure();

        my @dns = @{$self->{net}->nameservers()};
        foreach (@dns) {
                $self->setDNS($_);
        }

and add this line of code (marked <-------------- here ##):

# Method: start
#
#       Start firewall service
#
sub start
{

        return; ## New code added  <-------------- here ##
        my $self = shift;
 
        $self->setStructure();

        my @dns = @{$self->{net}->nameservers()};
        foreach (@dns) {
                $self->setDNS($_);
        }

Save it and restart with

 /etc/init.d/ebox restart

Your Firewall should be completely disabled now. You may also have change the rules related to general policies with the following commands to free all firewall stuff from eBox:

iptables -I INPUT -j ACCEPT
iptables -I OUTPUT -j ACCEPT

Remember to reenable it when you are done with whatever you need to do. It can be reenabled by commenting out the line you just added in, and then restarting with /etc/init.d/ebox restart again.

Speed and Performance Tweaks

  • Add the IP address of any computer that you connect to your eBox with to /etc/hosts on the eBox, eg.
10.0.1.12 blueandwhiteG3
10.0.1.20 bobspowerbookG4

Add these lines (or lines like them with your hosts ip and name) by editting /etc/hosts w/ nano or your favorite editor, or simple issue a command like this:

echo "10.0.1.12 blueandwhiteG3" >> /etc/hosts
  • Drop the firewall completely. (see above)
  • Turn off any services that you don't use or need. (use web interface)

Links and References

eBox-Platform site pages

Linkstationwiki.net forum thread - eBox on PPC Linkstations