環境:
Server IP:192.168.0.1
設定:
#規則初始化
iptables --flush
#隱形掃瞄攻擊防範
iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
iptables -A FORWARD -p tcp --tcp-flags ALL NONE -j DROP
iptables -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
iptables -A FORWARD -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
iptables -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
iptables -A INPUT -p tcp --tcp-flags FIN,RST FIN,RST -j DROP
iptables -A FORWARD -p tcp --tcp-flags FIN,RST FIN,RST -j DROP
iptables -A INPUT -p tcp --tcp-flags ACK,FIN FIN -j DROP
iptables -A FORWARD -p tcp --tcp-flags ACK,FIN FIN -j DROP
iptables -A INPUT -p tcp --tcp-flags ACK,URG URG -j DROP
iptables -A FORWARD -p tcp --tcp-flags ACK,URG URG -j DROP
#非法位址篩選
iptables -A INPUT -i eth0 -s 0.0.0.0/8 -j DROP
iptables -A FORWARD -i eth0 -s 0.0.0.0/8 -j DROP
iptables -A INPUT -i eth0 -s 10.0.0.0/8 -j DROP
iptables -A FORWARD -i eth0 -s 10.0.0.0/8 -j DROP
iptables -A INPUT -i lo -s 127.0.0.0/8 -j DROP
iptables -A FORWARD -i lo -s 127.0.0.0/8 -j DROP
iptables -A INPUT -i eth0 -s 169.254.0.0/16 -j DROP
iptables -A FORWARD -i eth0 -s 169.254.0.0/16 -j DROP
iptables -A INPUT -i eth0 -s 172.16.0.0/12 -j DROP
iptables -A FORWARD -i eth0 -s 172.16.0.0/12 -j DROP
iptables -A INPUT -i eth0 -s 192.168.0.0/16 -j DROP
iptables -A FORWARD -i eth0 -s 192.168.0.0/16 -j DROP
iptables -A INPUT -i eth0 -s 192.168.2.0/24 -j DROP
iptables -A FORWARD -i eth0 -s 192.168.2.0/24 -j DROP
iptables -A INPUT -i eth0 -s 224.0.0.0/4 -j DROP
iptables -A FORWARD -i eth0 -s 224.0.0.0/4 -j DROP
iptables -A INPUT -i eth0 -s 240.0.0.0/5 -j DROP
iptables -A FORWARD -i eth0 -s 240.0.0.0/5 -j DROP
iptables -A INPUT -i eth0 -s 255.255.255.255 -j DROP
iptables -A FORWARD -i eth0 -s 255.255.255.255 -j DROP
iptables-save
2008年7月20日 星期日
2008年7月19日 星期六
架設Webmin
環境:
Server IP:192.168.0.1
設定:
vi /etc/apt/sources.list
Add
deb http://download.webmin.com/download/repository sarge contrib
apt-get update
apt-get install webmin
接下來就可以透過瀏覽器進入https://192.168.0.1:10000來管理伺服器囉
Server IP:192.168.0.1
設定:
vi /etc/apt/sources.list
Add
deb http://download.webmin.com/download/repository sarge contrib
apt-get update
apt-get install webmin
接下來就可以透過瀏覽器進入https://192.168.0.1:10000來管理伺服器囉
架設Samba
環境:
Server IP:192.168.0.1
Networks:192.168.0.0/255.255.255.0
設定:
vi /etc/samba/smb.conf
全數清空,改為以下
#======================= Global Settings =======================
[global]
log file = /var/log/samba/log.%m #記錄檔存放點
display charset = utf8 #顯示之字碼為utf-8
passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n .
socket options = TCP_NODELAY SO_SNDBUF=8192 SO_RCVBUF=8192 #Socket
obey pam restrictions = Yes
encrypt passwords = True
domain master = Yes #設為DMB
local master = Yes #設為LMB
preferred master = Yes #設為PDC
interfaces = eth0 #負責的網卡
hosts allow = 192.168.0.0/255.255.255.0 #允許的主機
passdb backend = tdbsam
passwd program = /usr/bin/passwd %u
template shell = /bin/false
wins support = true #將主機設為Wins
dns proxy = no
netbios name = teed7334.idv.tw #主機名稱
netbios aliases = teed7334.idv.tw #主機別名
server string = %h server
invalid users = root #禁止進入的使用者
dos charset = cp950
workgroup = WORKGROUP #使用的工作群組
os level = 255 #0~255,數值越大,越優先成為LMB、DMB
syslog = 0
security = user
unix charset = utf8
panic action = /usr/share/samba/panic-action %d
max log size = 1000
#======================= Share Definitions =======================
[homes] #使用者家目錄
comment = Home Directories #分享的資料夾別名
create mode = 700 #新增檔案預設權限
directory mode = 600 #新增資料夾預設權限
valid users = %S
writeable = yes #預設可寫入
public = yes #公開
[Temp] #資料暫存區
comment = Temp #分享的資料夾別名
create mode = 777 #新增檔案預設權限
directory mode = 777 #新增資料夾預設權限
writeable = yes #預設可寫入
public = yes #公開
path = /tmp #分享資料夾系統路徑
[Game] #分享資料夾
comment = Game Directories #分享的資料夾別名
create mode = 777 #新增檔案預設權限
directory mode = 777 #新增資料夾預設權限
path = /mnt/hdb/game #分享資料夾系統路徑
write list = a1,a2,a3 #分享資料夾系統路徑
/etc/init.d/samba restart
Server IP:192.168.0.1
Networks:192.168.0.0/255.255.255.0
設定:
vi /etc/samba/smb.conf
全數清空,改為以下
#======================= Global Settings =======================
[global]
log file = /var/log/samba/log.%m #記錄檔存放點
display charset = utf8 #顯示之字碼為utf-8
passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n .
socket options = TCP_NODELAY SO_SNDBUF=8192 SO_RCVBUF=8192 #Socket
obey pam restrictions = Yes
encrypt passwords = True
domain master = Yes #設為DMB
local master = Yes #設為LMB
preferred master = Yes #設為PDC
interfaces = eth0 #負責的網卡
hosts allow = 192.168.0.0/255.255.255.0 #允許的主機
passdb backend = tdbsam
passwd program = /usr/bin/passwd %u
template shell = /bin/false
wins support = true #將主機設為Wins
dns proxy = no
netbios name = teed7334.idv.tw #主機名稱
netbios aliases = teed7334.idv.tw #主機別名
server string = %h server
invalid users = root #禁止進入的使用者
dos charset = cp950
workgroup = WORKGROUP #使用的工作群組
os level = 255 #0~255,數值越大,越優先成為LMB、DMB
syslog = 0
security = user
unix charset = utf8
panic action = /usr/share/samba/panic-action %d
max log size = 1000
#======================= Share Definitions =======================
[homes] #使用者家目錄
comment = Home Directories #分享的資料夾別名
create mode = 700 #新增檔案預設權限
directory mode = 600 #新增資料夾預設權限
valid users = %S
writeable = yes #預設可寫入
public = yes #公開
[Temp] #資料暫存區
comment = Temp #分享的資料夾別名
create mode = 777 #新增檔案預設權限
directory mode = 777 #新增資料夾預設權限
writeable = yes #預設可寫入
public = yes #公開
path = /tmp #分享資料夾系統路徑
[Game] #分享資料夾
comment = Game Directories #分享的資料夾別名
create mode = 777 #新增檔案預設權限
directory mode = 777 #新增資料夾預設權限
path = /mnt/hdb/game #分享資料夾系統路徑
write list = a1,a2,a3 #分享資料夾系統路徑
/etc/init.d/samba restart
架設Bind
環境:
僅設定為forward only的DNS,轉向HiNet DNS–168.95.1.1
設定:
apt-get install bind
vi /etc/bind/named.conf.options
add
forward only;
forwarders {
168.95.1.1;
};
/etc/init.d/bind restart
僅設定為forward only的DNS,轉向HiNet DNS–168.95.1.1
設定:
apt-get install bind
vi /etc/bind/named.conf.options
add
forward only;
forwarders {
168.95.1.1;
};
/etc/init.d/bind restart
架設Apache2+PHP5+MySQL5
設定:
apt-get install apache2.2-common apache2-utils apache2-mpm-prefork libapache2-mod-php5 php5-mysql
apt-get install mysql-server-5.0 mysql-client-5.0
apt-get install apache2.2-common apache2-utils apache2-mpm-prefork libapache2-mod-php5 php5-mysql
apt-get install mysql-server-5.0 mysql-client-5.0
2008年7月17日 星期四
針對特定MAC指定固定IP
環境:
追加MAC為(00:0E:A6:2D:98:CD)成固定IP(192.168.0.2)
設定:
vi /etc/dhcpd.conf
Add
host 主機名稱 {
hardware ethernet 00:0E:A6:2D:98:CD;
fixed-address 192.168.0.2;
}
/etc/init.d/dhcp3-server restart
追加MAC為(00:0E:A6:2D:98:CD)成固定IP(192.168.0.2)
設定:
vi /etc/dhcpd.conf
Add
host 主機名稱 {
hardware ethernet 00:0E:A6:2D:98:CD;
fixed-address 192.168.0.2;
}
/etc/init.d/dhcp3-server restart
2008年7月12日 星期六
架設pptpd
環境:
Server Domain:teed7334.idv.tw
Server IP:192.168.0.1
DNS Server IP:192.168.0.1
Wins Server IP:192.168.0.1
Networks:192.168.0.1/255.255.255.0
設定:
apt-get install pptpd
vi /etc/pptpd.conf
#localip 192.168.0.234-238,192.168.0.245
#remoteip 192.168.1.234-238,192.168.1.245
To
localip 192.168.0.1 #VPN Server 本地IP
remoteip 192.168.0.0-192.168.0.255 #VPN Client IP分配範圍
vi /etc/ppp/pptpd-options
#ms-dns 10.0.0.1
.
.
.
#ms-wins 10.0.0.3
.
.
.
#debug
To
ms-dns 192.168.0.1 #指定分配給VPN Client的DNS
.
.
.
ms-wins 192.168.0.1 #指定分配給VPN Client的WINS
.
.
.
debug #指定建立日誌檔
Add
name teed7334.idv.tw #指定VPN Server的Domain
vi /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
Add
#使用者名稱 伺服器Domain 密碼 允許連入IP
teed7334 teed7334.idv.tw teed7334 *
/etc/init.d/pptpd restart
Server Domain:teed7334.idv.tw
Server IP:192.168.0.1
DNS Server IP:192.168.0.1
Wins Server IP:192.168.0.1
Networks:192.168.0.1/255.255.255.0
設定:
apt-get install pptpd
vi /etc/pptpd.conf
#localip 192.168.0.234-238,192.168.0.245
#remoteip 192.168.1.234-238,192.168.1.245
To
localip 192.168.0.1 #VPN Server 本地IP
remoteip 192.168.0.0-192.168.0.255 #VPN Client IP分配範圍
vi /etc/ppp/pptpd-options
#ms-dns 10.0.0.1
.
.
.
#ms-wins 10.0.0.3
.
.
.
#debug
To
ms-dns 192.168.0.1 #指定分配給VPN Client的DNS
.
.
.
ms-wins 192.168.0.1 #指定分配給VPN Client的WINS
.
.
.
debug #指定建立日誌檔
Add
name teed7334.idv.tw #指定VPN Server的Domain
vi /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
Add
#使用者名稱 伺服器Domain 密碼 允許連入IP
teed7334 teed7334.idv.tw teed7334 *
/etc/init.d/pptpd restart
訂閱:
文章 (Atom)

