詳見:
正所謂害人之心不可有,防人之心不可無,這是篇好文章,你還在使用WEP或是WPA-PSK嗎?趕緊更換policy吧!
帽客計畫用Aircrack-ng來破解WEP method看看,當然一定是破解我自己的AP囉。
rootu1u2lawmysqlTOTAL=5
# yum install openswan*
修改Kernel相關參數,使得之後跑ipsec verify時不會出錯。# vi /etc/sysctl.conf*********************************************************************# example entries for /etc/sysctl.conf# forwarding is needed for subnet or l2tp connectionsnet.ipv4.ip_forward = 1# rp_filter is stupid and cannot deal decrypted packets "appearing out of# nowhere"net.ipv4.conf.default.rp_filter = 0# when using 1 interface for two networks, and in some other cases with# NETKEY, the kernel thinks it can be clever but breaks things.net.ipv4.conf.all.send_redirects = 0net.ipv4.conf.default.send_redirects = 0net.ipv4.icmp_ignore_bogus_error_responses = 1net.ipv4.conf.all.log_martians = 0net.ipv4.conf.default.log_martians = 0# these are non-ipsec specific security policies you should usenet.ipv4.conf.default.accept_source_route = 0net.ipv4.conf.all.accept_redirects = 0net.ipv4.conf.default.accept_redirects = 0*********************************************************************#sysctl -p
# cp/usr/share/doc/openswan-doc*/examples /etc/ipsec.d/hosttohost.conf# vi /etc/hosttohost.conf*********************************************************************# sample connections# This file is RCSID $Id: examples,v 1.5 1999/12/13 02:38:16 henry Exp $# sample tunnel (manually or automatically keyed)# Here we just use ESP for both encryption and authentication, which is# the simplest and often the best method.conn sample# left security gateway (public-network address)left=10.12.95.3# next hop to reach right#leftnexthop=10.44.55.66# subnet behind left (omit if left end of the tunnel is just the s.g.)leftsubnet=172.17.1.0/24# right s.g., subnet behind it, and next hop to reach leftright=10.12.95.2#rightnexthop=10.88.77.66rightsubnet=172.17.2.0/24# (manual) SPI number#spi=0x200# (manual) encryption/authentication algorithm and parameters to itesp=3des-md5-96#espenckey=[192 bits]#espauthkey=[128 bits]authby=secretauto=add*********************************************************************
# vi /etc/ipsec.secrets*********************************************************************include /etc/ipsec.d/*.secrets10.12.95.3 10.12.95.2 : PSK "1234567890"10.12.95.2 10.12.95.3 : PSK "1234567890"
# vi /etc/ipsec.conf*********************************************************************# /etc/ipsec.conf - Openswan IPsec configuration file## Manual: ipsec.conf.5## Please place your own config files in /etc/ipsec.d/ ending in .confversion 2.0 # conforms to second version of ipsec.conf specification# basic configurationconfig setup# Debug-logging controls: "none" for (almost) none, "all" for lots.# klipsdebug=none# plutodebug="control parsing"# For Red Hat Enterprise Linux and Fedora, leave protostack=netkeyprotostack=netkeynat_traversal=yesvirtual_private=oe=off# Enable this if you see "failed to find any available worker"nhelpers=0#You may put your configuration (.conf) file in the "/etc/ipsec.d/" and uncomment this.include /etc/ipsec.d/*.conf
# /etc/init.d/ipsec start/usr/libexec/ipsec/addconn Non-fips mode set in /proc/sys/crypto/fips_enabledipsec_setup: Starting Openswan IPsec U2.6.21/K2.6.18-164.6.1.el5...ipsec_setup: multiple ip addresses, using 10.12.95.3 on eth0ipsec_setup: /usr/libexec/ipsec/addconn Non-fips mode set in /proc/sys/crypto/fips_enabled
# ipsec verifyChecking your system to see if IPsec got installed and started correctly:Version check and ipsec on-path [OK]Linux Openswan U2.6.21/K2.6.18-164.6.1.el5 (netkey)Checking for IPsec support in kernel [OK]NETKEY detected, testing for disabled ICMP send_redirects [OK]NETKEY detected, testing for disabled ICMP accept_redirects [OK]Checking for RSA private key (/etc/ipsec.secrets) [OK]Checking that pluto is running [OK]Two or more interfaces found, checking IP forwarding [OK]Checking NAT and MASQUERADEing [N/A]Checking for 'ip' command [OK]Checking for 'iptables' command [OK]Opportunistic Encryption DNS checks:Looking for TXT in forward dns zone: centos.example.com [MISSING]Does the machine have at least one non-private address? [FAILED]
# ipsec auto --up sample104 "sample" #1: STATE_MAIN_I1: initiate003 "sample" #1: received Vendor ID payload [Openswan (this version) 2.6.21 ]003 "sample" #1: received Vendor ID payload [Dead Peer Detection]003 "sample" #1: received Vendor ID payload [RFC 3947] method set to=109106 "sample" #1: STATE_MAIN_I2: sent MI2, expecting MR2003 "sample" #1: NAT-Traversal: Result using RFC 3947 (NAT-Traversal): no NAT detected108 "sample" #1: STATE_MAIN_I3: sent MI3, expecting MR3003 "sample" #1: received Vendor ID payload [CAN-IKEv2]004 "sample" #1: STATE_MAIN_I4: ISAKMP SA established {auth=OAKLEY_PRESHARED_KEY cipher=aes_128 prf=oakley_sha group=modp2048}117 "sample" #2: STATE_QUICK_I1: initiate004 "sample" #2: STATE_QUICK_I2: sent QI2, IPsec SA established tunnel mode {ESP=>0xca7bd686 <0x193e1d71 xfrm="3DES_0-HMAC_MD5" natoa="none" natd="none" dpd="">
# ping 172.17.2.100 -I 172.17.1.100 -c 10PING 172.17.2.100 (172.17.2.100) from 172.17.1.100 : 56(84) bytes of data.64 bytes from 172.17.2.100: icmp_seq=1 ttl=64 time=1.65 ms64 bytes from 172.17.2.100: icmp_seq=2 ttl=64 time=0.716 ms64 bytes from 172.17.2.100: icmp_seq=3 ttl=64 time=1.16 ms64 bytes from 172.17.2.100: icmp_seq=4 ttl=64 time=1.41 ms64 bytes from 172.17.2.100: icmp_seq=5 ttl=64 time=1.24 ms64 bytes from 172.17.2.100: icmp_seq=6 ttl=64 time=1.17 ms64 bytes from 172.17.2.100: icmp_seq=7 ttl=64 time=1.52 ms64 bytes from 172.17.2.100: icmp_seq=8 ttl=64 time=0.544 ms64 bytes from 172.17.2.100: icmp_seq=9 ttl=64 time=0.796 ms64 bytes from 172.17.2.100: icmp_seq=10 ttl=64 time=1.58 m
openswan-doc-2.6.21-5.el5_4.1openswan-2.6.21-5.el5_4.1
wget http://softlayer.dl.sourceforge.net/project/ss5/ss5/3.7.9-1/ss5-3.7.9-1.tar.gz
tar zxvf ss5-3.7.9-1.tar.gz
[root@server2 src]# tar zxvf ss5-3.7.9-1.tar.gz[root@server2 ss5-3.7.9]# ./configure[root@server2 ss5-3.7.9]# make[root@server2 ss5-3.7.9]# make install
找到auth與permit並將註解取消,注意我並沒有enable使用者需做認證的機制。[root@server2 ~]# vi /etc/opt/ss5/ss5.conf
# SHost SPort Authenticationauth 0.0.0.0/0 - -# Auth SHost SPort DHost DPort Fixup Group Band ExpDatepermit - 0.0.0.0/0 - 0.0.0.0/0 - - - - -
[root@server2 ~]# chkconfig --add ss5[root@server2 ~]# chkconfig ss5 on[root@server2 ~]# /etc/init.d/ss5 startdoneting ss5... [ OK ][root@server2 ~]#
最後可透過FireFox來測試Socks4/5.
工具->選項->進階->設定->手動設定Proxy:SOCKS主機: x.x.x.x Port: 1080並選擇SOCKS v4或是SOCKS v5
Server: exportfs *:/tmpClient: mount 192.168.0.254:/tmp /mnt/nfs
Server: exportfs *:/tmpClient: mount -o nfsvers=2 192.168.0.254:/tmp /mnt/nfs
Server: exportfs -o fsid=o *:/tmpClient: mount -t nfs4 192.168.0.254:/tmp /mnt/nfs
cat /proc/sys/net/ipv4/ip_no_pmtu_disc0 代表pmtud enable (default)1 代表pmtud disable
opensuse:~ # ping 10.12.64.220 -s 1450PING 10.12.64.220 (10.12.64.220) 1450(1478) bytes of data.From 10.12.95.3: icmp_seq=1 Frag needed and DF set (mtu = 1400)From 10.12.95.3 icmp_seq=1 Frag needed and DF set (mtu = 1400)1458 bytes from 10.12.64.220: icmp_seq=2 ttl=63 time=2.85 ms1458 bytes from 10.12.64.220: icmp_seq=3 ttl=63 time=4.97 ms1458 bytes from 10.12.64.220: icmp_seq=4 ttl=63 time=3.48 ms
1 #!/bin/bash23 vsftp_conf="/etc/vsftpd/vsftpd.conf"45 if [ -f $vsftp_conf ]; then6 if [ $# -ne 1 ]; then7 echo "Parameters is not allow"8 echo "usage: $0 on or $0 off"9 exit 110 fi1112 case "$1" in13 on) CMD='YES';;14 off) CMD='NO';;15 *)16 echo "format error!"17 exit 118 ;;19 esac2021 if [ $CMD = 'YES' ]; then22 sed 's/^.*anonymous_enable=.*/anonymous_enable=YES/' $vsftp_conf > /tmp/$$.vsftpd.conf23 mv -f /tmp/$$.vsftpd.conf $vsftp_conf24 /etc/init.d/vsftpd restart25 else26 sed 's/^.*anonymous_enable=.*/anonymous_enable=NO/' $vsftp_conf > /tmp/$$.vsftpd.conf27 mv -f /tmp/$$.vsftpd.conf $vsftp_conf28 /etc/init.d/vsftpd restart29 fi30 else echo "$vsftp_conf is not exist"31 fi
列5 先判斷/etc/vsftpd/vsftpd.conf是否存在,若不存在則回報檔案不存在。(列30)列6 判斷所傳入的引數是否為1個,若不是則回報錯誤並結束。 (列7~10)列12-19 使用case,判斷是on, off或是格式有誤。列21-24 若為on則設定anonymous_enable=YES,並重新啟動vsftpd。列25-28 若為off則設定anonymous_enable=NO,並重新啟動vsftpd。
[root@centos bin]# ./vsftpd.sh onShutting down vsftpd: [ OK ]Starting vsftpd for vsftpd: [ OK ][root@centos bin]# ftp localhostConnected to localhost.localdomain.220 (vsFTPd 2.0.5)530 Please login with USER and PASS.530 Please login with USER and PASS.KERBEROS_V4 rejected as an authentication typeName (localhost:root): ftp331 Please specify the password.Password:230 Login successful.Remote system type is UNIX.Using binary mode to transfer files.ftp>
[root@centos bin]# ./vsftpd.sh offShutting down vsftpd: [ OK ]Starting vsftpd for vsftpd: [ OK ][root@centos bin]# ftp localhostConnected to localhost.localdomain.220 (vsFTPd 2.0.5)530 Please login with USER and PASS.530 Please login with USER and PASS.KERBEROS_V4 rejected as an authentication typeName (localhost:root): ftp331 Please specify the password.Password:530 Login incorrect.Login failed.ftp>
1. 沒有提供Trial version2. 目前似乎沒有for Linux的版本
1. 預設的中文字型不好看。2. 即使我已經裝了Adobe flash player,還是不能播放Youtube的影片。
# monitor session 1 source interface Gi 0/11如此一來port 10就會成為port 11的mirror port。
# monitor session 1 destination interface Gi 0/10
1. OpenSSH:由上可知OpenSSH可由TCP wrappers託管,但是NFS與Apache則不行。(有自己的安全機制)
[root@centos ~]# ldd /usr/sbin/sshd | grep libwrap
libwrap.so.0 => /lib/libwrap.so.0 (0x003f9000)
2. NFS:
[root@centos ~]# ldd /usr/sbin/rpc.nfsd | grep libwrap
3. Apache:
[root@centos ~]# ldd /usr/sbin/httpd | grep libwrap
Netifera is a new modular open source platform for creating network security tools. This project provides many advantages for both security developers and researchers who want to implement new tools as well as the community of users of these tools.Netifera website
# mkdir -p /mnt/iso/1Step2. 掛載ISO檔:
# mount -o loop /mnt/nfs/CentOS-5.4*.iso /mnt/iso/1Step3. 安裝createrepo套件:
# yum install createrepo
Step4. 產生來源repository:
# cd /mnt/isoStep5. 建立新repository設定檔:
# createrepo .
Step6. 準備升級:# vi /etc/yum.repos.d/centos54.repo
[CentOS5.4 Repository]
baseurl=file:///mnt/iso
enabled=1
先將原本的repos全部rename成xxx.repo.bak成功的話就可看到下圖顯示準備更新成CentOS5.4的套件:
# yum clean all
# yum update
LinuxCommandAlso please let me know your favorite websites for learning Linux command line in the comments.
O'Reilly's Linux Command Directory
The Linux CookBook
Ols3 shell script
Apple MAC OSX 10.6.2 [未使用,好想用呀~哭]
CentOS 5.4 [使用中]
Ubuntu 9.10 [未使用]
OpenSUSE 11.2 [使用中]
Fedora 12 [快要出了]
Windows 7 [恩...]
Step1. Yast->Software->Software Repositories->Add->Local ISO Image添加OpenSUSE11.2镜像。遺憾的是.....我竟然在X Window幹下此等蠢事,zypper dup會將有衝突的軟件強制刪除,沒想到在Firefox開啟的狀態下,造成系統crash導致更新尚未完成!重開機後整個系統爛掉,唉!我可不能panic呀,冷靜下來進入failsafe mode重新再執行一次zypper dup,沒想到卻回報無法找到來源,原來還需要讓Kernel把loop的模組掛起來,於是便執行modprobe loop,如此一來就可以繼續升級的動作了。
Step2. 手動移除OpenSUSE 11.1的repositories
Step3. # zypper dup
# zypper ar http://ftp.gwdg.de/pub/linux/misc/packman/suse/11.2/ packmanUpdate2_安裝S10e(Broadcom Corporation BCM4312 802.11b/g)的wireless module:
# zypper ar http://download.opensuse.org/distribution/11.2/repo/oss/ opensuse11.2_oss
# zypper ar http://download.opensuse.org/distribution/11.2/repo/non-oss/opensuse_11.2_non-oss
# zypper ar http://download.opensuse.org/update/11.2/ opensuse11.2_update
# zypper in broadcom-wl*
# yum list updates
# yum update
copy / paste original vdi檔。
Windows->cmd->vboxmanage clonehd "original vdi" "new vdi"
OpenSUSE: ln -s /usr/share/fonts/truetype/uming.ttf
Ubuntu: ln -s /usr/share/fonts/truetype/arphic/uming.ttf
#!/bin/bash
select VAR in a1 a2 a3 a4 a5 exit
do
case $VAR in
a1) read -p "Delete a1? (y/Y/n/N)" FLAG
if [ $FLAG = y -o $FLAG = Y ]; then
rm -f ./a1
fi;;
a2) read -p "Delete a2? (y/Y/n/N)" FLAG
if [ $FLAG = y -o $FLAG = Y ]; then
rm -f ./a2
fi;;
a3) read -p "Delete a3? (y/Y/n/N)" FLAG
if [ $FLAG = y -o $FLAG = Y ]; then
rm -f ./a3
fi;;
a4) read -p "Delete a4? (y/Y/n/N)" FLAG
if [ $FLAG = y -o $FLAG = Y ]; then
rm -f ./a4
fi;;
a5) read -p "Delete a5? (y/Y/n/N)" FLAG
if [ $FLAG = y -o $FLAG = Y ]; then
rm -f ./a5
fi;;
exit) exit;;
esac
done
#!/bin/bash太久沒寫了腦袋打結了一下。
function re () {
local tmp
tmp=$1
if [ $tmp -eq 1 ]; then
total=1
else
re $(($tmp-1))
total=$(($tmp*$total))
fi
}
read -p "Data=" VAR
re $VAR
echo "$VAR!=$total"
d1.txt====================abc:12bob:25cdc:36OK:121Tomy:99Jack:108d2.txt====================Jack:9cdc:8OK:11Tomy:22bob:5abc:88試寫一 script 來處理 d1.txt d2.txt 使其變成abc:12:88bob:25:5cdc:36:8Jack:108:9OK:121:11Tomy:99:22
iptables rules:
#iptables -A INPUT -p tcp --dport 22 -i ethx -m state --state NEW -m recent --set
#iptables -A INPUT -p tcp --dport 22 -i ethx -m state --state NEW -m recent --update --seconds 60 --hitcount 5 -j DROP
如此一來,本機於1分鐘內收到超過5個以上的SSH連線需求時,第5個SSH connection就會被drop掉.
緊接著用hping測試連續送出n個TCP port 22 SYN,看看第5個SSH connection是否會被drop:
Reference:
http://www.cyberciti.biz/tips/linux-unix-bsd-openssh-server-best-practices.html
http://tuxtraining.com/2009/06/23/stop-ssh-brute-force-attack-using-susefirewall
這麼下達就可以得到結果了 :
# last|awk -F" " '{print $1}'|grep -v "^$"|grep -v reboot|grep -v wtmp|sort|uniq -c
Packman is the most popular third-party repository available for openSUSE. It contains many packages that aren't in the openSUSE version; either because they cannot be included for legal reasons, because the distribution contains an older version, or simply because it was never packaged for the distribution release.
This is the repository where you can acquire the relevant mp3 and other codecs, as well as many multimedia applications (such as mplayer), torrent clients, games, etc...
之後透過yast的Software/Software Management來安裝所需要的套件就方便了許多.