Commit d93c737d authored by O'Reilly Media, Inc.'s avatar O'Reilly Media, Inc.
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading
+178 −0
Changes for 1398OT_Code/Chapter 1.txt: 178 added lines, 0 removed lines.
Original line number Diff line number Diff line
* To check the hostname in the fqdn format:
hostname --fqdn 

* Preparing the server:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libperl5.14 libgmp3c2 build-essential sqlite3 sysstat ntp
sudo /etc/init.d/apparmor stop
sudo /etc/init.d/apparmor teardown
sudo update-rc.d -f apparmor remove
sudo aptitude remove apparmor apparmor-utils

sudo vi /etc/network/interfaces
iface eth0 inet static
address 172.16.126.14
netmask 255.255.255.0
gateway 172.16.126.1
network 172.16.126.0
broadcast 172.16.126.255

sudo /etc/init.d/networking restart
ifconfig 

* DNS config:
sudo /etc/init.d/bind9 status
sudo apt-get install bind9

sudo vi /etc/hosts 
127.0.0.1		localhost.localdomain		localhost
172.16.126.14	mail.zimbra-essentials.com	mail

sudo vi /etc/hostname
mail.zimbra-essentials.com

sudo vi /etc/resolvconf/resolv.conf.d/base
nameserver 127.0.0.1
nameserver 172.16.126.11
nameserver 8.8.8.8
domain zimbra-essentials.com
search zimbra-essentials.com

sudo touch /var/cache/bind/db.zimbra-essentials.com
sudo touch /var/cache/bind/db.126.16.172   .in-addr.arpa
sudo cp /etc/bind/named.conf.options /etc/bind/named.conf.options.backup
sudo cp /etc/bind/named.conf.local /etc/bind/named.conf.local.backup
sudo cp /etc/bind/named.conf.default-zones /etc/bind/named.conf.default-zones.backup
sudo /etc/init.d/bind9 stop

sudo vi /etc/bind/named.conf.options 
options {
	directory "/var/cache/bind";
	query-source address * port 53;
	forwarders {
		8.8.8.8; # this is Google DNS
	}; 
# we use forwarders to forward DNS queries for external 
# DNS names to DNS servers outside of that network.
	auth-nxdomain no;	# conform to RFC1035
	listen-on-v6 { any; };
}; 

sudo vi /etc/bind/named.conf.local 
acl internals {
        127.0.0.0/8; # for localhost access
        172.16.126.0/24; # for access from my LAN, set yours
# you can add all internal networks you allow to 
# access your zimbra server in this section
};

view "internal" {
        match-clients { internals; };
        recursion yes;
        zone "zimbra-essentials.com" {
                type master;
                file "/var/cache/bind/db.zimbra-essentials.com";
        };
        zone "126.16.172.in-addr.arpa" {
                type master;
                file "/var/cache/bind/db.126.16.172.in-addr.arpa";
        };
}; 

sudo vi /var/cache/bind/db.126.16.172.in-addr.arpa 
$TTL 86400
@       IN      SOA     mail.zimbra-essentials.com.  admin.zimbra-essentials.com. (
                201305301916    ; Serial (increment after   edit)
                604800          ; Refresh
                86400           ; Retry
                2419200         ; Expire
                86400)          ; Negative Cache TTL
	NS	mail.zimbra-essentials.com.
1	PTR	mail.zimbra-essentials.com. 

sudo vi /var/cache/bind/db.zimbra-essentials.com 
; zimbra-essentials.com
$TTL    86400
@       IN      SOA             mail.zimbra-essentials.com. admin.zimbra-essentials.com. (
                                201305301921    ; Serial (increment after edit)
                                604800          ; Refresh
                                86400           ; Retry
                                2419200         ; Expire
                                604800)         ; Negative Cache TTL
; Define the nameservers and the mail servers
@       IN      NS              172.16.126.14.
        IN      MX      10      mail.zimbra-essentials.com.
        IN      A               172.16.126.14
mail    IN      A               172.16.126.14 

sudo vi /etc/bind/named.conf.default-zones 
acl internals-default {
	127.0.0.0/8; // for access from localhost
	172.16.126.0/24; // for access from my LAN, set yours
	};

view "internal-default" {
        match-clients { internals-default; };
        recursion yes;

	zone "." {
		type hint;
		file "/etc/bind/db.root";
	};

// be authoritative for the localhost forward and reverse zones, 
// and for broadcast zones as per RFC 1912

	zone "localhost" {
		type master;
		file "/etc/bind/db.local";
	};

	zone "127.in-addr.arpa" {
		type master;
		file "/etc/bind/db.127";
	};

	zone "0.in-addr.arpa" {
		type master;
		file "/etc/bind/db.0";
	};

	zone "255.in-addr.arpa" {
		type master;
		file "/etc/bind/db.255";
	};
}; 

sudo chown root:bind /var/cache/bind/db.*
sudo chmod 0644 /var/cache/bind/db.* 

sudo /etc/init.d/bind9 start

nslookup mail.zimbra-essentials.com

dig zimbra-essentials.com mx 

* Zimbra installation: 

wget http://files2.zimbra.com/downloads/8.0.3_GA/zcs-8.0.3_GA_5664.UBUNTU12_64.20130305090204.tgz

tar xzvf zcs-8.0.3_GA_5664.UBUNTU12_64.20130305090204.tgz

cd zcs-8.0.3_GA_5664.UBUNTU12_64.20130305090204

mv zcs-8.0.3_GA_5664.UBUNTU12_64.20130305090204 zcs
cd zcs/
sudo ./install

* Running Zimbra: 

sudo -i
su - zimbra
zmcontrol status 

Zmcontrol stop
Zmcontrol start 

+221 −0
Changes for 1398OT_Code/Chapter 2.txt: 221 added lines, 0 removed lines.
Original line number Diff line number Diff line
* To check the hostname in the fqdn format:
hostname --fqdn 

* Preparing the server:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libperl5.14 libgmp3c2 build-essential sqlite3 sysstat ntp
sudo /etc/init.d/apparmor stop
sudo /etc/init.d/apparmor teardown
sudo update-rc.d -f apparmor remove
sudo aptitude remove apparmor apparmor-utils

sudo vi /etc/network/interfaces
iface eth0 inet static
address 172.16.126.X
netmask 255.255.255.0
gateway 172.16.126.1
network 172.16.126.0
broadcast 172.16.126.255

sudo /etc/init.d/networking restart
ifconfig 

* DNS config:
sudo /etc/init.d/bind9 status

sudo apt-get install bind9

sudo vi /etc/hosts 
127.0.0.1		localhost.localdomain		localhost
172.16.126.140	ldap.zimbra-essentials.com	ldap

sudo vi /etc/hostname
ldap.zimbra-essentials.com

sudo vi /etc/resolvconf/resolv.conf.d/base
nameserver 127.0.0.1
nameserver 172.16.126.11
nameserver 8.8.8.8
domain zimbra-essentials.com
search zimbra-essentials.com

sudo touch /var/cache/bind/db.zimbra-essentials.com
sudo touch /var/cache/bind/db.126.16.172.in-addr.arpa
sudo cp /etc/bind/named.conf.options /etc/bind/named.conf.options.backup
sudo cp /etc/bind/named.conf.local /etc/bind/named.conf.local.backup
sudo cp /etc/bind/named.conf.default-zones /etc/bind/named.conf.default-zones.backup

sudo /etc/init.d/bind9 stop

sudo vi /etc/bind/named.conf.options 
options {
	directory "/var/cache/bind";
	query-source address * port 53;
	forwarders {
		8.8.8.8; # this is Google DNS
	};
# we use forwarders to forward DNS queries for external 
# DNS names to DNS servers outside of that network.
	auth-nxdomain no;	# conform to RFC1035
	listen-on-v6 { any; };
}; 

sudo vi /etc/bind/named.conf.local 
acl internals {
        127.0.0.0/8; # for localhost access
        172.16.126.0/24; # for access from my LAN, set yours
# you can add all internal networks you allow to 
# access your zimbra server in this section
};

view "internal" {
        match-clients { internals; };
        recursion yes;
        zone "zimbra-essentials.com" {
                type master;
                file "/var/cache/bind/db.zimbra-essentials.com";
        };
        zone "126.16.172.in-addr.arpa" {
                type master;
                file "/var/cache/bind/db.126.16.172.in-addr.arpa";
        };
}; 

sudo vi /var/cache/bind/db.126.16.172.in-addr.arpa 
$TTL 86400
@       IN      SOA     ldap.zimbra-essentials.com.  admin.zimbra-essentials.com. (
                201306181855    ; Serial (increment after edit)
                604800          ; Refresh
                86400           ; Retry
                2419200         ; Expire
                86400)          ; Negative Cache TTL
	NS	ldap.zimbra-essentials.com.
1	PTR	ldap.zimbra-essentials.com. 
2	PTR	mta.zimbra-essentials.com.

sudo vi /var/cache/bind/db.zimbra-essentials.com 
; zimbra-essentials.com
$TTL    86400
@       IN      SOA             ldap.zimbra-essentials.com. admin.zimbra-essentials.com. (
                                201306181901    ; Serial (increment after edit)
                                604800          ; Refresh
                                86400           ; Retry
                                2419200         ; Expire
                                604800)         ; Negative Cache TTL
; Define the nameservers and the mail servers
@       IN      NS              172.16.126.140.
        IN      MX      10      mta.zimbra-essentials.com.
        IN      A               172.16.126.140
ldap    IN      A               172.16.126.140 
mta     IN      A               172.16.126.141


sudo vi /etc/bind/named.conf.default-zones 
// prime the server with knowledge of the root servers

acl internals-default {
	127.0.0.0/8; // for access from localhost
	172.16.126.0/24; // for access from my LAN, set yours
	};

view "internal-default" {
        match-clients { internals-default; };
        recursion yes;

	zone "." {
		type hint;
		file "/etc/bind/db.root";
	};

// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912

	zone "localhost" {
		type master;
		file "/etc/bind/db.local";
	};

	zone "127.in-addr.arpa" {
		type master;
		file "/etc/bind/db.127";
	};

	zone "0.in-addr.arpa" {
		type master;
		file "/etc/bind/db.0";
	};

	zone "255.in-addr.arpa" {
		type master;
		file "/etc/bind/db.255";
	};
}; 

sudo chown root:bind /var/cache/bind/db.*
sudo chmod 0644 /var/cache/bind/db.* 

sudo /etc/init.d/bind9 start

nslookup ldap.zimbra-essentials.com
nslookup mta.zimbra-essentials.com

dig zimbra-essentials.com mx 

* Additional network configuration on MTA server:
sudo vi /etc/hosts 
127.0.0.1		localhost.localdomain		localhost
172.16.126.141	mta.zimbra-essentials.com	mta

sudo vi /etc/hostname
mta.zimbra-essentials.com

sudo vi /etc/resolvconf/resolv.conf.d/base
nameserver 172.16.126.140
nameserver 127.0.0.1
nameserver 172.16.126.11
nameserver 8.8.8.8
domain zimbra-essentials.com
search zimbra-essentials.com

nslookup mta.zimbra-essentials.com
nslookup ldap.zimbra-essentials.com
dig zimbra-essentials.com mx

* Syncing  Servers:
sudo apt-get install ntp

sudo vi /etc/ntp.conf

sudo service ntp restart

sudo ntpq -c lpeer

* Zimbra installation:
wget http://files2.zimbra.com/downloads/8.0.3_GA/zcs-8.0.3_GA_5664.UBUNTU12_64.20130305090204.tgz 
tar xzvf zcs-8.0.3_GA_5664.UBUNTU12_64.20130305090204.tgz
cd zcs-8.0.3_GA_5664.UBUNTU12_64.20130305090204

mv zcs-8.0.3_GA_5664.UBUNTU12_64.20130305090204 zcs
cd zcs/
sudo ./install.sh 

* Changing passwords:
sudo -s
su - zimbra
zmldappasswd -p postfixadmin
zmldappasswd -a amavisadmin

zmcontrol status

* Additional config:

zmupdateauthkeys 

/opt/zimbra/libexec/zmsyslogsetup 


vi /etc/rsyslog.conf 

service rsyslog restart
+88 −0
Changes for 1398OT_Code/Chapter 3.txt: 88 added lines, 0 removed lines.
Original line number Diff line number Diff line
* Enabling DSPAM:
sudo -i
su - zimbra

cd /opt/zimbra/conf/

more amavisd.conf.in | grep dspam 

more amavisd.conf | grep dspam

zmlocalconfig -e amavis_dspam_enabled=TRUE

zmamavisdctl reload

more amavisd.conf | grep dspam

* Updating ClamAV:
cp -a /opt/zimbra/clamav-X.Y.Z  ~/clamav-X.Y.Z.backup

tar -xvf clamav-0.97.8.tar.gz
cd clamav-0.97.8

./configure --prefix=/opt/zimbra/clamav-0.97.8 --with-user=zimbra --with-group=zimbra
make
sudo -i
make check  
make install

cd /opt/zimbra/clamav-0.97.8/etc/
diff clamd.conf ../../clamav/etc/clamd.conf
diff freshclam.conf ../../clamav/etc/freshclam.conf

mv clamd.conf clamd.conf.org
mv freshclam.conf freshclam.conf.org
cd /opt/zimbra/conf
cp clamd.conf /opt/zimbra/clamav-0.97.8/etc/
cp freshclam.conf /opt/zimbra/clamav-0.97.8/etc/

sudo -i
su - zimbra
zmcontrol stop 

cd /opt/zimbra
ls -la | grep clamav 

rm -rf clamav 
mv clamav clamav.old
ln -s /opt/zimbra/clamav-0.97.8 /opt/zimbra/clamav

mkdir /opt/zimbra/clamav/db
chown -R zimbra:zimbra /opt/zimbra/clamav-0.97.8
chmod a+r /opt/zimbra/clamav/etc/freshclam.conf

sudo -i
su - zimbra
/opt/zimbra/clamav/bin/freshclam
zmcontrol start

zmantivirusctl restart 
zmcontrol status 

* SPF activation:
sudo apt-get install libmail-spf-query-perl

* Installing razor2:
perl Makefile.PL
make
make install

mkdir /opt/zimbra/amavisd/.razor; chown -Rf zimbra:zimbra /opt/zimbra/amavisd/.razor

sudo -i
su - zimbra
razor-admin -home=/opt/zimbra/amavisd/.razor -create
razor-admin -home=/opt/zimbra/amavisd/.razor -discover
razor-admin -home=/opt/zimbra/amavisd/.razor -register

vi /opt/zimbra/conf/spamassassin/v310.pre

* Installing pyzor:
sudo apt-get install pyzor
mkdir /opt/zimbra/amavisd/.pyzor; chown zimbra:zimbra /opt/zimbra/amavisd/.pyzor

sudo -i
su - zimbra
pyzor --homedir /opt/zimbra/amavisd/.pyzor discover

+5 −0
Changes for 1398OT_Code/Chapter 6.txt: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
sudo -i
su - zimbra
zmcontrol
zmcontrol status
zmlocalconfig -e zimbra_swatch_notice_user=admin@zimbra-essentials.com
 No newline at end of file
+3 −0
Changes for 1398OT_Code/READ ME.txt: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
Chapter 4: No Code present

Chapter 5: No Code present
 No newline at end of file
Loading