Wednesday, March 18, 2009

mail dengan squirrelmail

Langkah-langkah:

1. Cek apakah postfix, courier-pop dan courier-imap dalam keadaan baik-baik saja.
#telnet localhost 25
#telnet localhost 110

2. Cek juga apakah web servernya dalam keaadaan baik.
#telnet localhost 80

3. Install squirrelmail
#apt-get install squirrelmail

4. copy source code squirrelmail ke server web
#cp /usr/share/squirrelmail /var/www -R

5. Konfigurasi squirrelmail
#squirrelmail-configure
Gantilah nama lembaga disesuaikan dengan kelompok. Untuk memilih menu tuliskan nomor menu dan enter. Kalau sudah dikonfigurasi simpan.

6. Mencoba squirrelmail
#http://localhost/squirrelmail

Sunday, February 22, 2009

Membuat DHCP server 2

##########################################
#####----- Global Configuration -----#####
##########################################
ddns-updates off;
option T150 code 150 = string;
deny client-updates;
#one-lease-per-client false;
#allow bootp;

ddns-update-style none;

option domain-name "vlan.local";
option domain-name-servers 210.56.15.1, 231.117.250.27;

default-lease-time 6000;
max-lease-time 7200;

authoritative;
##############################################
#####----- End Global Configuration -----#####
##############################################

###############################################
#####----- Start Modem Configuration -----#####
###############################################
subnet 192.168.1.0 netmask 255.255.255.0 {
interface eth0;
}
#############################################
#####----- End Modem Configuration -----#####
#############################################

####################################################
#####----- Start Downstairs Configuration -----#####
####################################################
subnet 192.168.0.0 netmask 255.255.255.0 {
interface eth1;
default-lease-time 6000;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option routers 192.168.0.254;
option broadcast-address 192.168.0.255;
}
##################################################
#####----- End Downstairs Configuration -----#####
##################################################

##################################################
#####----- Start Upstairs Configuration -----#####
##################################################
subnet 10.0.0.0 netmask 255.255.255.0 {
interface eth2;
default-lease-time 6000;
max-lease-time 7200;
range 10.0.0.100 10.0.0.200;
option subnet-mask 255.255.255.0;
option routers 10.0.0.254;
option broadcast-address 10.0.0.255;
}
################################################
#####----- End Upstairs Configuration -----#####
################################################

#####################################################################
#####----- Start Server and Fixed IP Address Configuration -----#####
#####################################################################
group{
###--- Any global server settings should go here ---###

#- Printer -#
host printer {
hardware ethernet 00:00:00:00:00:00;
fixed-address 10.0.0.25;
}
#- J computer -#
host j {
hardware ethernet 00:00:00:00:00:00;
fixed-address 10.0.0.105;
}
#- TServer computer -#
host tserver {
hardware ethernet 00:00:00:00:00:00;
fixed-address 10.0.0.110;
}
#- Windows 2008 Server -#
host win2008server {
hardware ethernet 00:00:00:00:00:00;
fixed-address 10.0.0.115;
}
#- Asterisk Box -#
host asterisk {
hardware ethernet 00:00:00:00:00:00;
fixed-address 10.0.0.120;
}
#- WWW Server -#
host www2 {
hardware ethernet 00:00:00:00:00:00;
fixed-address 10.0.0.125;
}
}
###################################################################
#####----- End Server and Fixed IP Address Configuration -----#####
###################################################################

(di kutip dari smkn1-tuban.sch.id)

Membuat DHCP server 1

1. Langkah Pertama
Mencari paket program, lakukan dengan perintah berikut
~# apt-cache search dhcp

dhcp - DHCP server for automatic IP address assignment

2. Langkah Kedua
Installasi Program DHCP
~# apt-get install dhcp

3. Langkah Ketiga
Konfigurasi program
3.1 edit file /etc/default/dhcp
isikan interface yang akan digunakan untuk broadcast IP-DHCP
INTERFACES=”eth1″ dalam hal ini saya gunakan interface eth1.
3.2 edit file /etc/dhcpd.conf
isikan file konfigurasinya sbb,
# option definitions common to all supported networks…
option domain-name “ptpn-11.com”;
option domain-name-servers 192.168.11.1, 192.168.11.254;
#allow client-updates;

option subnet-mask 255.255.255.0;
default-lease-time 600;
max-lease-time 7200;

# Segment10
subnet 192.168.10.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.10.100 192.168.10.200;
option domain-name-servers 192.168.10.1,192.168.10.254;
option broadcast-address 192.168.10.255;
option routers 192.168.10.1;
option subnet-mask 255.255.255.0;
}

# Segment11
subnet 192.168.11.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.11.100 192.168.11.200;
option domain-name-servers 192.168.11.1,192.168.11.254;
option broadcast-address 192.168.11.255;
option routers 192.168.11.1;
option subnet-mask 255.255.255.0;
}

# Segment12
subnet 192.168.12.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.12.100 192.168.12.200;
option domain-name-servers 192.168.12.1,192.168.12.254;
option broadcast-address 192.168.12.255;
option routers 192.168.12.1;
option subnet-mask 255.255.255.0;
}

# Segment13
subnet 192.168.17.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.17.100 192.168.17.200;
option domain-name-servers 192.168.17.1,192.168.17.254;
option broadcast-address 192.168.17.255;
option routers 192.168.17.1;
option subnet-mask 255.255.255.0;
}

5. Langkah Kelima

Menambahkan list interface di /etc/default/dhcp, secara default dhcp-server hanya bisa melayani sebuah interface card, untuk menambahkan lebih dari satu interface card maka kita tambahkan routing untuk interface yang lain dengan perintah

Root~# route add -host 255.255.255.255 dev eth0

dalam kasus ini saya jalankan VLAN dengan ID, 11,12,13,14,15,16 maka kita tambahkan routingnya
Root~# route add -host 255.255.255.255 dev eth1.11

Root~# route add -host 255.255.255.255 dev eth1.12

Root~# route add -host 255.255.255.255 dev eth1.13

Root~# route add -host 255.255.255.255 dev eth1.14

kemudian kita check table routingnya

root@ptpn:~# netstat -nr | grep eth1.11
255.255.255.255 0.0.0.0 255.255.255.255 UH 0 0 0 eth1.11

4. Langkah Keempat

Lakukan Starting DHCP –> /etc/init.d/dhcp restart
Jika terjadi kegagalan silahkan lakukan check di syslog, dengan perintah tail -f /var/log/syslog

Membuat DNS multiple Host server

Langkah-langkah Membuat DNS Multiple HOST

1. Edit hostname
debianserver:/etc/bind# vim /etc/hostname
debianserver
esc:wq

2. Edit hosts
#vim /etc/hosts

127.0.0.1 localhost.localdomain localhost debianserver ns

#The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

3. Edit named.conf.local
//
// Do any local configuration here
//

zone “imron.com” IN {
type master;
file “/etc/bind/db.imron”;
allow-query {any;};
};

zone “2.168.192.in-addr.arpa” IN {
type master;
file “/etc/bind/rev.imron”;
};

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include “/etc/bind/zones.rfc1918″;

4. Edit db.imron
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA imron.com. root.imron.com. (
336 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
IN NS imron.com.
IN MX 10 imron.com.

dns IN A 192.168.2.15
ftp IN A 192.168.2.16
mail IN A 192.168.2.17

5. Edit rev.imron
;
; BIND reverse data file for local loopback interface
;
$TTL 604800
@ IN SOA imron.com. root.imron.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
IN NS imron.com.

15 IN PTR imron.com.
15 IN PTR serverdebian.
16 IN PTR ftp.imron.com.
17 IN PTR mail.imron.com.

6. Edit resolv.conf
#/bin/bash: indent: command not found
search .
domain imron.com
nameserver localhost
nameserver 192.168.2.15

7. Restrat DNS
debianserver:/etc/bind# /etc/init.d/bind9 restart
Stopping domain name service…: bind.
Starting domain name service…: bind.
debianserver:/etc/bind#

8. Pengujian

Menggunakan nslookup
debianserver:/etc/bind# nslookup
> localhost
Server: 192.168.2.15
Address: 192.168.2.15#53

Name: localhost
Address: 127.0.0.1
> 127.0.0.1
Server: 192.168.2.15
Address: 192.168.2.15#53

1.0.0.127.in-addr.arpa name = localhost.
> ftp
Server: 192.168.2.15
Address: 192.168.2.15#53

Name: ftp.imron.com
Address: 192.168.2.16
> mail
Server: 192.168.2.15
Address: 192.168.2.15#53

Name: mail.imron.com
Address: 192.168.2.17
> 192.168.2.17
Server: 192.168.2.15
Address: 192.168.2.15#53

17.2.168.192.in-addr.arpa name = mail.imron.com.
>

Menggunakan ping
> debianserver:/etc/bind# ping ftp.imron.com
PING ftp.imron.com (192.168.2.16) 56(84) bytes of data.

— ftp.imron.com ping statistics —
3 packets transmitted, 0 received, 100% packet loss, time 2010ms

debianserver:/etc/bind# ping mail.imron.com
PING mail.imron.com (192.168.2.17) 56(84) bytes of data.

— mail.imron.com ping statistics —
3 packets transmitted, 0 received, 100% packet loss, time 1999ms

debianserver:/etc/bind#

(di kutip dari smkn1-tuban.sch.id)

Membuat MAIL server

1. Konfigurasi IP Mail Server
#vim /etc/network/interfaces

iface eth0 inet static
address
network
netmask
gateway

esc : wq

2. Merestart Network
#/etc/init.d/ networking restart

3. Cek IP
masterweb:~# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:55:D0:E4:8D:12
inet addr:118.98.171.230 Bcast:118.98.171.231 Mask:255.255.255.248
inet6 addr: fe80::255:d0ff:fee4:8d12/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:99557 errors:0 dropped:0 overruns:0 frame:0
TX packets:53553 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9569291 (9.1 MiB) TX bytes:45473091 (43.3 MiB)
Interrupt:185 Base address:0xc800

masterweb:~# apt-get install postfix
Reading package lists… Done
Building dependency tree… Done
The following extra packages will be installed:
openssl ssl-cert
Suggested packages:
ca-certificates postfix-mysql postfix-pgsql postfix-ldap postfix-pcre
sasl2-bin libsasl2-modules resolvconf postfix-cdb
The following packages will be REMOVED:
exim4-base exim4-config exim4-daemon-light
The following NEW packages will be installed:
openssl postfix ssl-cert
0 upgraded, 3 newly installed, 3 to remove and 57 not upgraded.
Need to get 2102kB of archives.
After unpacking 1212kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
WARNING: The following packages cannot be authenticated!
openssl ssl-cert postfix
Install these packages without verification [y/N]? Y
Get:1 ftp://118.98.171.229 etch/main openssl 0.9.8c-4etch3 [1001kB]
Get:2 ftp://118.98.171.229 etch/main ssl-cert 1.0.14 [11.1kB]
Get:3 ftp://118.98.171.229 etch/main postfix 2.3.8-2+etch1 [1090kB]
Fetched 2102kB in 0s (6942kB/s)
Preconfiguring packages …
dpkg: exim4-base: dependency problems, but removing anyway as you request:
exim4-daemon-light depends on exim4-base (>= 4.63).
(Reading database … 21519 files and directories currently installed.)
Removing exim4-base …
Stopping MTA: exim4_listener.
Removing exim4-config …
dpkg: exim4-daemon-light: dependency problems, but removing anyway as you request:
at depends on mail-transport-agent; however:
Package mail-transport-agent is not installed.
Package exim4-daemon-light which provides mail-transport-agent is to be removed.
mailx depends on exim4 | mail-transport-agent; however:
Package exim4 is not installed.
Package mail-transport-agent is not installed.
Package exim4-daemon-light which provides mail-transport-agent is to be removed.
mutt depends on exim4 | mail-transport-agent; however:
Package exim4 is not installed.
Package mail-transport-agent is not installed.
Package exim4-daemon-light which provides mail-transport-agent is to be removed.
Removing exim4-daemon-light …
Stopping MTA:.
Selecting previously deselected package openssl.
(Reading database … 21385 files and directories currently installed.)
Unpacking openssl (from …/openssl_0.9.8c-4etch3_i386.deb) …
Creating directory /etc/ssl
Selecting previously deselected package ssl-cert.
Unpacking ssl-cert (from …/ssl-cert_1.0.14_all.deb) …
Selecting previously deselected package postfix.
Unpacking postfix (from …/postfix_2.3.8-2+etch1_i386.deb) …
Setting up openssl (0.9.8c-4etch3) …

Setting up ssl-cert (1.0.14) …

Setting up postfix (2.3.8-2+etch1) …
Adding group `postfix’ (GID 106) …
Done.
Adding system user `postfix’ (UID 105) …
Adding new user `postfix’ (UID 105) with group `postfix’ …
Not creating home directory `/var/spool/postfix’.
Creating /etc/postfix/dynamicmaps.cf
Adding tcp map entry to /etc/postfix/dynamicmaps.cf
Adding group `postdrop’ (GID 107) …
Done.

4. Konfigurasi file main.cf
copy main cf ke main.cf_asli
cp /etc/postfix/main.cf /etc/postfix/main.cf_asli

#vim /etc/postfix/main.cf

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
mydomain = smkn1-tuban.sch.id
myhostname = smkn1-tuban.sch.id
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $mydomain, localhost, mail.smkn1-tuban.sch.id, smkn1-tuban.sch.id
home_mailbox = Maildir/
relayhost =
mynetworks = 127.0.0.0/8, 192.168.2.0/25
#mailbox_command = procmail -a “$EXTENSION”
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

5. Restart Postfix

#/etc/init.d/postfix restart

6. Install courier POP & IMAP

#apt-get install courier-pop
#apt-get install courier-imap

7. Membuat Maildir

masterweb:/etc/postfix# cd /etc/skel/
masterweb:/etc/skel# maildirmake Maildir

8. Membuat user

masterweb:/etc/skel/Maildir# adduser student
Adding user `student’ …
Adding new group `student’ (1001) …
Adding new user `student’ (1001) with group `student’ …
Creating home directory `/home/student’ …
Copying files from `/etc/skel’ …
Enter new UNIX password:
Retype new UNIX password:
Sorry, passwords do not match
passwd: Authentication information cannot be recovered
passwd: password unchanged
Try again? [Y/n] Y
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for student
Enter the new value, or press ENTER for the default
Full Name []: student smkn 1 tuban
Room Number []: 1
Work Phone []: 1
Home Phone []: 1
Other []: 1
Is the information correct? [y/N] Y
masterweb:/etc/skel/Maildir# adduser student
adduser: The user `student’ already exists.
masterweb:/etc/skel/Maildir# adduser teacher
Adding user `teacher’ …
Adding new group `teacher’ (1002) …
Adding new user `teacher’ (1002) with group `teacher’ …
Creating home directory `/home/teacher’ …
Copying files from `/etc/skel’ …
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for teacher
Enter the new value, or press ENTER for the default
Full Name []: teacher smkn 1 tuban
Room Number []: 1
Work Phone []: 1
Home Phone []: 1
Other []: 1
Is the information correct? [y/N] Y

9. Cek apakah user sudah punya direktori Maildir

masterweb:/etc/skel/Maildir# cd /home/student/
masterweb:/home/student# ls
Maildir

10. Cek port yang terbuka (25 , 110, 143)

masterweb:/home/student# netstat -tapn
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2136/portmap
tcp 0 0 0.0.0.0:113 0.0.0.0:* LISTEN 2735/inetd
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 6400/master
tcp 0 0 0.0.0.0:46207 0.0.0.0:* LISTEN 2781/rpc.statd
tcp6 0 0 :::110 :::* LISTEN 6588/couriertcpd
tcp6 0 0 :::143 :::* LISTEN 6648/couriertcpd
tcp6 0 0 :::80 :::* LISTEN 2814/apache2
tcp6 0 0 :::22 :::* LISTEN 2762/sshd
tcp6 0 144 ::ffff:118.98.171.23:22 ::ffff:118.98.171:36542 ESTABLISHED6014/0

11. Mengirim Surat

masterweb:/home/student# telnet localhost 25
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 smkn1-tuban.sch.id ESMTP Postfix (Debian/GNU)
mail from: student
250 2.1.0 Ok
rcpt to: teacher
250 2.1.5 Ok
data
354 End data with .
Yth Guru SMKN 1 Tuban
Berikut kami kirimkan tugas membuat mail server
.
250 2.0.0 Ok: queued as 096C52E81EF
quit
221 2.0.0 Bye
Connection closed by foreign host.

12. Cek surat yang masuk

masterweb:/home/student# cd /home/teacher/
masterweb:/home/teacher# ls
Maildir
masterweb:/home/teacher# cd Maildir/

masterweb:/home/teacher/Maildir# ls
cur new tmp
masterweb:/home/teacher/Maildir# cd new/
masterweb:/home/teacher/Maildir/new# ls
1234389182.V801I2e81f1M658392.masterweb
masterweb:/home/teacher/Maildir/new# vim 1234389182.V801I2e81f1M658392.masterweb

13. Melihat surat menggurakan POP

masterweb:/home/teacher/Maildir/new# telnet localhost 110
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
+OK Hello there.
user teacher
+OK Password required.
pass teacher
+OK logged in.
list
+OK POP3 clients that break here, they violate STD53.
1 517
.
retr 1
+OK 517 octets follow.
Return-Path:
X-Original-To: teacher
Delivered-To: teacher@smkn1-tuban.sch.id
Received: from localhost (localhost [127.0.0.1])
by smkn1-tuban.sch.id (Postfix) with SMTP id 096C52E81EF
for ; Thu, 12 Feb 2009 04:51:58 +0700 (WIT)
Message-Id: <20090211215218.096c52e81ef@smkn1-tuban.sch.id>
Date: Thu, 12 Feb 2009 04:51:58 +0700 (WIT)
From: student@smkn1-tuban.sch.id
To: undisclosed-recipients:;

Yth Guru SMKN 1 Tuban
Berikut kami kirimkan tugas membuat mail server
.
quit

quit
Connection closed by foreign host.

(di kutip dari smkn1-tuban.sch.id)

Membuat PROXY server

This summary is not available. Please click here to view the post.

Monday, February 9, 2009

Membuat DNS Server

DNS SERVER

(DOMAIN NAME SYSTEM)

Fungsi:

  1. Merubah Hostname menjadi IP dan IP menjadi Hostname

Langkah Membuat DNS

  1. Setting IP DNS Server

    #vim /etc/network/interfaces
    iface eth0 inet static

address 192.168.2.44

netmask 255.255.255.128

broadcast 192.168.2.63

network 192.168.2.0

gateway 192.168.2.1

esc:wq

#/etc/init.d/networking restart

  1. Install bind9

    #apt-get install bind9

  2. Melakukan Konfigurasi

Membuat Zone
#vim /etc/bind/named.conf
// This is the primary configuration file for the BIND DNS server named.

//

// Please read /usr/share/doc/bind9/README.Debian.gz for information on the

// structure of BIND configuration files in Debian, *BEFORE* you customize

// this configuration file.

//

// If you are just adding zones, please do that in /etc/bind/named.conf.local

include “/etc/bind/named.conf.options”;

// prime the server with knowledge of the root servers

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″;

};

zone “stm.com” {

type master;

file “/etc/bind/db.stm”;

};

zone “2.168.192.in-addr.arpa” {

type master;

file “/etc/bind/rev.stm”;

};

// zone “com” { type delegation-only; };

// zone “net” { type delegation-only; };

// From the release notes:

// Because many of our users are uncomfortable receiving undelegated answers

// from root or top level domains, other than a few for whom that behaviour

// has been trusted and expected for quite some length of time, we have now

// introduced the “root-delegations-only” feature which applies delegation-only

// logic to all top level domains, and to the root domain. An exception list

// should be specified, including “MUSEUM” and “DE”, and any other top level

// domains from whom undelegated responses are expected and trusted.

// root-delegation-only exclude { “DE”; “MUSEUM”; };

include “/etc/bind/named.conf.local”;

Mengisi zone stm.com

#cp /etc/bind/db.local /etc/bind/db.stm

#vim /etc/bind/db.stm;

; BIND data file for local loopback interface

;

$TTL 60480

@ IN SOA stm.com. root.stm.com. (

1 ; Serial

604800 ; Refresh

86400 ; Retry

2419200 ; Expire

604800 ) ; Negative Cache TTL

;

@ IN NS stm.com.

@ IN A 192.168.2.44

esc:wq

Mengisi zone rev.stm

#cp /etc/bind/db.127 /etc/bind/rev.stm

#vim /etc/bind/rev.stm

;

; BIND reverse data file for local loopback interface

;

$TTL 604800

@ IN SOA stm.com. root.stm.com. (

1 ; Serial

604800 ; Refresh

86400 ; Retry

2419200 ; Expire

604800 ) ; Negative Cache TTL

;

@ IN NS stm.com.

44 IN PTR stm.com.

esc:wq

  1. Restart bind9

    #/etc/init.d/bind9 restart

  2. Mengubah DNS Client

#vim /etc/resolv.conf

search stm.com

nameserver localhost

nameserver 192.168.2.44

esc:wq

  1. Menguji DNS

#nslookup
> localhost

Server: 192.168.2.44

Address: 192.168.2.44#53

Name: localhost

Address: 127.0.0.1

> 127.0.0.1

Server: 192.168.2.44

Address: 192.168.2.44#53

1.0.0.127.in-addr.arpa name = localhost.

> stm.com

Server: 192.168.2.44

Address: 192.168.2.44#53

Name: stm.com

Address: 192.168.2.44

> 192.168.2.44

Server: 192.168.2.44

Address: 192.168.2.44#53

44.2.168.192.in-addr.arpa name = stm.com.

(Dikutip dari smkn1-tuban.sch.id)