IPTABLES BLOCK PORT part 1

Block Port : In/Out

Incoming :
iptables -A INPUT -p tcp --destination-port 80 -j DROP
In Specific interface :
iptables -A INPUT -i eth1 -p tcp --dport 80 -j DROP

Exception IP :
iptables -A INPUT -p tcp -i eth1 -s ! 122.222.80.xx --dport 80 -j DROP

Outgoing :
/sbin/iptables -A OUTPUT -p tcp --dport 25 -j DROP



CLAMAV CENTOS 6

     
[root@assp assp]# yum install clamav-db.x86_64 clamav-devel.x86_64 perl-ClamAV-Client.noarch clamav.x86_64 clamav-milter.x86_64 clamd.x86_64 perl-Mail-ClamAV.x86_64

[root@assp assp]# /etc/init.d/clamd start
Starting Clam AntiVirus Daemon: LibClamAV Error: cl_cvdhead: Can't read CVD header in /var/clamav/daily.cld
LibClamAV Error: cli_loaddbdir(): error parsing header of /var/clamav/daily.cld
ERROR: Malformed database
                                                           [FAILED]
[root@assp assp]# freshclam
ClamAV update process started at Fri Sep 14 19:54:14 2012
WARNING: DNS record is older than 3 hours.
WARNING: Invalid DNS reply. Falling back to HTTP mode.
Reading CVD header (main.cvd): OK

INSTALL PERL FROM SOURCE

[root@spam ~]# wget http://www.cpan.org/src/5.0/perl-5.12.3.tar.gz
--2012-09-12 05:40:13--  http://www.cpan.org/src/5.0/perl-5.12.3.tar.gz
Resolving www.cpan.org... 199.15.176.140, 212.117.177.118, 2620:101:d000:8::140:1, ...
Connecting to www.cpan.org|199.15.176.140|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14933787 (14M) [application/x-gzip]
Saving to: `perl-5.12.3.tar.gz'



[root@spam ~]# tar -xvf perl-5.12.3.tar.gz
[root@spam ~ perl-5-12xxxx]# Sh Configure -de -Dusethreads
 

CALCULATOR COMMAND LINE


hafiz ~ $ bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.


2x3
(standard_in) 3: syntax error
2*3
6
10*3:5
(standard_in) 5: illegal character: :
(standard_in) 5: syntax error
10*3/5
6


CHECK PERL MODULE LINUX CENTOS


[root@spam ~]# perldoc -m Mail::Send

specify a minimum module version

( categories:  )
Sometimes you must use a specific module version in your programs. To avod using earlier version of that module, append the minimum version number you want in the use 'module' statement:
Example:
#-- Use version 5.8 of later of module LWP
use LWP 5.8
Your program will exit with an appropriate error message if the installed module version is lower than the version you specified

execute commands on remote machines using ssh

( categories:  |  )
You can execute commands on remote machines from a Perl script using the Net::SSH::Perl module.
This module allows you to execute a command remotely and receive the STDOUT, STDERR, and exit status of that remote command.
One big advantage of Net::SSH::Perl over other methods is that you can automate the login process, that way you can write fully automated perl scripts, no console interaction is required in order to authenticate in the remote machine.
Example:

list the installed modules

( categories:  |  )
There are several ways to obtain the list of perl modules installed in a system:

Linux and Windows FireFox issues : Error code: sec_error_reused_issuer_and_serial


It took me a while to figure it out from googling, but the solution is simply to delete the cert8.db from your FireFox profile, usually found in  /home/hafiz/.mozilla/firefox/t5q6cggf(some-name).default and Easier still just search for cert8.db in your computer and delete that file. Close and Start again your firefox


Windows:

It took me a while to figure it out from googling, but the solution is simply to delete the cert8.db from your FireFox profile, usually found in C:\Documents and Settings\<yourname>\Application Data\Mozilla\Firefox\Profiles\<yourprofile>. Easier still just search for cert8.db in your computer and delete that file.
Oh….. you need close FireFox first

Got this information somewhere in net and worked fine for me.

LDAPSEARCH Per-User

[root@xdc2 ~]# ldapsearch -x -H ldap://10.10.1.119:389 "(cn=Muhammad Hafiz)"

Renaming Mail Server Zimbra

1. set your /etc/hosts
the /etc/hosts for lookup your new hostname mail system zimbra

2. set in your DNS
for new hostname mail system, the DNS must can be resolve a new fqdn / hostname zimbra with mx record

3. Step for changing a new hostname server zimbra

su - zimbra
/opt/zimbra/libexec/zmsetservername -n <servername>


for example:
[zimbra@hafiz ~]$ /opt/zimbra/libexec/zmsetservername -n newhostname.hafiz.com

set webmail zimbra http to https

set webmail zimbra http to https:
as a user zimbra follow the steps

changing the webmail over https
$ zmtlsctl https

restart the mail server zimbra for perform a new configuration
$ zmcontrol restart 

now if you want to go  the webmail point your browser to
https://your.webmail.com

How to install Apache-Tomcat

first-step
download JDK disini
# chmod +x jdk-1_5_0_22-linux-amd64-rpm.bin
# sh jdk-1_5_0_22-linux-amd64-rpm.bin
# ln -s /usr/java/jdk1.5.0_22/ /usr/lib/jdk
# export JAVA_HOME=/usr/lib/jdk/

download apache-tomcat
http://archive.apache.org/dist/tomcat
download tomcat-administration 
download apache-tomcat disini
karena menggunakan JDK download juga
apache-tomcat-compact 

kemudian ekstrak
# tar xvf apache-tomcat-7.0.12.tar.gz
# mv apache-tomcat-7.0.12/* /usr/tomcat/
mkdir /usr/tomcat
export CATALINA_PID=/var/run/tomcat.pid
vim /etc/init.d/tomcat
chmod a+x /etc/init.d/tomcat
chkconfig --add tomcat
chkconfig tomcat on

bridging network IP

Redhat base

paket yang diinstall

# rpm -qa|grep bridge
bridge-utils-1.1-2
# cd /etc/sysconfig/network-scripts
# vi ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
BRIDGE=br0
ONBOOT=yes

# vi ifcfg-br0
DEVICE=br0
TYPE=bridge
BOOTPROTO=static
IPADDR=192.168.1.99
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
ONBOOT=yes

setelah configure selesai
restart network
# /etc/init.d/network restart

ubuntu base
paket yang diinstall
$ sudo dpkg -l |grep bridge
ii  bridge-utils      1.4-5ubuntu2    Utilities for configuring the Linux Ethernet bridge

$ sudo vim /etc/network/interfaces
auto eth0
iface eth0 inet static
        address 192.168.1.99
        netmask 255.255.255.0
        gateway 192.168.1.1

auto br0
iface br0 inet static
        address 192.168.1.99
        netmask 255.255.255.0
        gateway 192.168.1.1
        bridge_ports eth0

restart network
$ sudo /etc/init.d/networking restart
atau
$ sudo /etc/init.d/networking force-reload

VirtualBox: install extension Pack Vbox

download VirtualBox Extension-Pack

http://download.virtualbox.org/virtualbox/4.0.8/Oracle_VM_VirtualBox_Extension_Pack-4.0.8-71778.vbox-extpack

install VirtualBox Extension-Pack
hafiz:~$ vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.0.8-71778.vbox-extpack


hafiz:~$ vboxmanage list extpacks
Extension Packs: 1
Pack no. 0:   Oracle VM VirtualBox Extension Pack
Version:      4.0.8
Revision:     71778
Description:  USB 2.0 Host Controller, VirtualBox RDP, PXE ROM with E1000 support.
VRDE Module:  VBoxVRDP
Usable:       true
Why unusable:



untuk delete
hafiz:~$ vboxmanage extpack uninstall 'Oracle VM VirtualBox Extension Pack'

create virtual bridging IP (virbr) virtual machine

# cd /etc/libvirt/qemu/networks
# cp virbr0.xml virbr1.xml
# uuidgen
a9ff1c7e-e16f-438b-8384-b58a9beec408

copy uuid tersebut dan paste pada parameter uuid di xml file
# vi virbr1.xml
<network>
  <name>virbr1</name>
  <uuid>a9ff1c7e-e16f-438b-8384-b58a9beec408</uuid>
  <forward mode='nat'/>
  <bridge name='virbr1' stp='on' forwardDelay='0' />
  <ip address='192.168.123.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.123.2' end='192.168.123.254' />
    </dhcp>
  </ip>
</network>

save

yang perlu diperhatikan jika kita mengcopy sebuah file dari virtual network yang berbeda adalah parameter
<name>virbr1</name>
<bridge name='virbr1' stp='on' forwardDelay='0' />
<ip address='192.168.123.1' netmask='255.255.255.0'>
dan range dari dhcp virtual ip tersebut
<range start='192.168.123.2' end='192.168.123.254' />

setelah kita definisikan dengan benar
jalankan
# virsh net-define virbr1.xml
# virsh net-start virbr1
# virsh net-autostart virbr1
# virsh net-list

Name                 State      Autostart
-----------------------------------------
virbr0               active     yes
virbr1               active     yes

untuk delete

# net-destroy virbr4
gunakan virsh net-list untuk melihat kembali virbr yang aktif

simple dhcp server

distro: CentOS 5.5 x86_64
# yum install dhcp
konfigurasi dhcp server range 192.168.1.110 - 192.168.1.115
yang berarti hanya untuk 5 client, 1 IP pada tiap client

# vi /etc/dhcpd.conf

ddns-update-style ad-hoc;
ddns-update-style interim;
subnet 192.168.1.0 netmask 255.255.255.0 {
        option routers                  192.168.1.1;
        option subnet-mask              255.255.255.0;

        option domain-name              "jabetto.lan";
        option domain-name-servers       192.168.1.160;

        option time-offset              -18000;     # Eastern Standard Time

    range 192.168.1.110 192.168.1.115;
}

# service dhcpd start
# chkconfig dhcpd on

untuk testing
pada client jalankan
# dhclient eth0

create iscsi target

persiapkan storage yang akan digunakan
misal dalam case ini menggunakan backing-store /dev/sda3
yang akan digunakan sebagai target iscsi Storage Area Network (SAN)

in RedHat Base or CentOS

# yum install scsi-target-utils

# /etc/init.d/tgtd start

configuration filenya ada di file /etc/tgt/targets.conf edit beberapa parameter berikut

# vi /etc/tgt/targets.conf


<target iqn.2011-05.lan.jabetto:server.jabetto1>
    backing-store /dev/sda3
</target>



# /etc/init.d/tgtd restart

untuk melihat bahwa configurasi sudah berjalan dengan benar

# tgtadm --lld iscsi --op show --mode target

jika berhasil maka akan menampilkan hasil LUN yang telah dibuat tadi sesuai dengan kapasitas storage yang di attach tadi


untuk yang debian base or Ubuntu

$ sudo apt-get install iscsitarget

$ sudo /etc/init.d/iscsitarget start
file konfigurasinya di /etc/iet/ietd.conf
ubah beberapa parameter pada file konfigurasi

$ sudo nano /etc/iet/ietd.conf

Target iqn.2011-05.lan.jabetto:storage.disk2.sys1.hafiz
Lun 0 Path=/dev/sda3,Type=fileio,ScsiId=hafiz,ScsiSN=hafiz

$ sudo /etc/init.d/iscsitarget restart

untuk melihat storage yang sudah berhasil di attach

$ ietadm --op show --tid=1