Posts Tagged ‘ubuntu’

Zimbra Server Firewall

Posted: August 2, 2015 in Uncategorized
Tags: , , , , , , , , , , ,

Zimbra Firewall using Iptables

Use on your own risk.

#——————————————————— # Cut Here#——————————————————— #

#!/bin/sh
# firewall
# msyamsuri.cm@gmail.com
# description: Starts, stops iptables firewall

case “$1” in
start)

# Clear rules
iptables -t filter -F
iptables -t filter -X
echo – Clear rules : [OK]

# SSH In
iptables -t filter -A INPUT -p tcp –dport 22 -j ACCEPT
echo – SSH : [OK]

# Don’t break established connections
iptables -A INPUT -m state –state RELATED,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -m state –state RELATED,ESTABLISHED -j ACCEPT
echo – established connections : [OK]

# Block all connections by default
iptables -t filter -P INPUT DROP
iptables -t filter -P FORWARD DROP
iptables -t filter -P OUTPUT DROP
echo – Block all connections : [OK]

# SYN-Flood Protection
iptables -N syn-flood
iptables -A syn-flood -m limit –limit 10/second –limit-burst 50 -j RETURN
iptables -A syn-flood -j LOG –log-prefix “SYN FLOOD: ”
iptables -A syn-flood -j DROP
echo – SYN-Flood Protection : [OK]

# Loopback
iptables -t filter -A INPUT -i lo -j ACCEPT
iptables -t filter -A OUTPUT -o lo -j ACCEPT
echo – Loopback : [OK]

# ICMP (Ping)
iptables -t filter -A INPUT -p icmp -j ACCEPT
iptables -t filter -A OUTPUT -p icmp -j ACCEPT
echo – PING : [OK]

# DNS In/Out
iptables -t filter -A OUTPUT -p tcp –dport 53 -j ACCEPT
iptables -t filter -A OUTPUT -p udp –dport 53 -j ACCEPT
iptables -t filter -A INPUT -p tcp –dport 53 -j ACCEPT
iptables -t filter -A INPUT -p udp –dport 53 -j ACCEPT
echo – DNS : [OK]

# NTP Out
iptables -t filter -A OUTPUT -p udp –dport 123 -j ACCEPT
echo – NTP : [OK]

# HTTP + HTTPS Out
iptables -t filter -A OUTPUT -p tcp –dport 80 -j ACCEPT
iptables -t filter -A OUTPUT -p tcp –dport 443 -j ACCEPT
# HTTP + HTTPS In
iptables -t filter -A INPUT -p tcp –dport 80 -j ACCEPT
iptables -t filter -A INPUT -p tcp –dport 443 -j ACCEPT
echo – HTTP/HTTPS : [OK]

# Mail SMTP:25
iptables -t filter -A INPUT -p tcp –dport 25 -j ACCEPT
iptables -t filter -A OUTPUT -p tcp –dport 25 -j ACCEPT
echo – SMTP : [OK]

# Mail POP3:110
iptables -t filter -A INPUT -p tcp –dport 110 -j ACCEPT
iptables -t filter -A OUTPUT -p tcp –dport 110 -j ACCEPT
echo – POP : [OK]

# Mail IMAP:143
iptables -t filter -A INPUT -p tcp –dport 143 -j ACCEPT
iptables -t filter -A OUTPUT -p tcp –dport 143 -j ACCEPT
echo – IMAP : [OK]

# Mail IMAP:443
iptables -t filter -A INPUT -p tcp –dport 443 -j ACCEPT
iptables -t filter -A OUTPUT -p tcp –dport 443 -j ACCEPT
echo – IMAP : [OK]

# Mail IMAPS:993
iptables -t filter -A INPUT -p tcp –dport 993 -j ACCEPT
iptables -t filter -A OUTPUT -p tcp –dport 993 -j ACCEPT
echo – IMAP : [OK]

# Mail POP3S:995
iptables -t filter -A INPUT -p tcp –dport 995 -j ACCEPT
iptables -t filter -A OUTPUT -p tcp –dport 995 -j ACCEPT
echo – IMAP : [OK]

# Mail ZIMBRA ADMIN:7071
iptables -t filter -A INPUT -p tcp –dport 7071 -j ACCEPT
iptables -t filter -A OUTPUT -p tcp –dport 7071 -j ACCEPT
echo – IMAP : [OK]
echo – Firewall [OK]
exit 0
;;

stop)
echo “Stopping Firewall… ”
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t filter -F
echo “Firewall Stopped!”
exit 0
;;

restart)
/etc/init.d/firewall stop
/etc/init.d/firewall start
;;

*)
echo “Usage: /etc/init.d/firewall {start|stop|restart}”
exit 1
;;
esac

#——————————————————— # Cut Here#——————————————————— #

Assalamualaikum,

Aida saya dah jumpa cara senang nak recover root password utk freebsd @ Linux :
Step 1 = Stop mysql
 
Freebsd = /usr/local/rc.d/mysql-server stop
Ubuntu / Debian = /etc/init.d/mysql stop
 
Step 2 = start mysql data 
 
Freebsd : /usr/local/rc.d/mysql-server –skip-grant-tables &
Ubuntu / Debian = /usr/sbin/mysqld –skip-grant-tables –skip-networking &
 
Step 3 = Login Mysql
 
Freebsd = mysql -u root mysql
Ubuntu / Debian = mysql -u root
 
Step 4 : Change Password
 
** Utk root yg bleh access database online i.e.:  Muamalat
 
mysql> FLUSH PRIVILEGES;
mysql> UPDATE mysql.user SET Password=PASSWORD(‘newpwd’) WHERE User=‘root’;
 
** Utk Mysql biasa i.e: Arrahn
 
mysql> FLUSH PRIVILEGES;
mysql> SET PASSWORD FOR root@‘localhost’ = PASSWORD(‘password’);
 
Step 5 : kill mysql
 
killall mysqld 
 
issue command ni “ps aux | grep mysql”
dapatkan PID kemudian kill PID “killall PID”
 
CTH : 

msyamsuris-iMac:~ msyamsuri$ ps aux | grep mysql

msyamsuri        2866   0.0  0.0  2432772    664 s000  S+    8:08PM   0:00.00 grep mysql

2866 <– PID No

Step 6 : hidupkan semula mysql

Freebsd = /usr/local/rc.d/mysql-server strt
Ubuntu / Debian = /etc/init.d/mysql start

OK sekian utk Tutorial . 

** Email to mysq X-staff fine simple solutions for mysql root recovery.

Always forget:

How to configure Network Bridge on Ubuntu Server

 

1. Configure DHCP on brO

######################

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#auto eth0
#iface eth0 inet dhcp

auto br0
iface br0 inet dhcp
bridge_ports eth0
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

######################

 

2. Configure Static IP on brO

######################

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#auto eth0
#iface eth0 inet dhcp

auto br0
iface br0 inet static
address 192.168.1.200
broadcast 192.168.1.255
netmask 255.255.255.0
gateway 192.168.1.254
bridge_ports eth0
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

######################

Date in ubuntu

Posted: October 28, 2011 in Debian
Tags: , , , , , , , , ,

Selalu lupa….

1. Install ntp

root@webmail:~# aptitude install ntp

2. Get date from mst.sirim.my

ntpdate mst.sirim.my

3. Set script

root@webmail:~# pico /skrip/takwin

################ cut here ##################

#!/bin/bash
ntpdate mst.sirim.my

################ cut here ##################

4. Set Cron

root@webmail:~# crontab -u root -e

*/50 * * * * /skrip/takwin >/dev/null 2>&1

5. Run takwin

root@webmail:~# /skrip/takwin

28 Oct 19:52:27 ntpdate[1162]: step time server 202.190.26.30 offset 4.735816 sec