Apache Compression (gzip, deflate) kontrol etmek

Temmuz 30, 2013 § Yorum yok § Kalıcı bağlantı


[fatih@localhost ~]$ cat 1.sh 
function check_compression {
  curl -I -H 'Accept-Encoding: gzip,deflate' $1 |grep "Content-Encoding"
}
check_compression http://www.linuxwiki.net

[fatih@localhost ~]$ bash 1.sh

Scientific Linux ve Centos 6.x için Multimedya Desteği

Temmuz 30, 2013 § Yorum yok § Kalıcı bağlantı

Atrpms Repoyu ekleyelim

32-bit --> rpm -Uhv http://dl.atrpms.net/all/atrpms-repo-6-6.el6.i686.rpm
64-bit --> rpm -Uhv http://dl.atrpms.net/all/atrpms-repo-6-6.el6.x86_64.rpm

Macromedia Repoyu ekleyelim

32-bit --> rpm -Uhv http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
64-bit --> rpm -Uhv http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm

Multimedya dosyalarını yükleyelim

yum install ffmpeg libdvdcss libdvdread libdvdnav libdvdplay lsdvd libquicktime mplayer mplayerplug-in gstreamer-plugins-ugly gstreamer-ffmpeg gstreamer-plugins-bad-free vlc

Flash desteğini ekleyelim

yum install flash-plugin

Videodan resim oluşturmak

Temmuz 15, 2013 § Yorum yok § Kalıcı bağlantı

mplayer -vo jpeg tomb.raider.sample.mpg

Bazı Linux Admin Komutları

Temmuz 8, 2013 § Yorum yok § Kalıcı bağlantı

Processlerin güç kullanımı

sudo powertop -d

Ekran görüntüsünü yakalamak:

ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -s $(xwininfo -root | grep 'geometry' | awk '{print $2;}') -r 25 -i :0.0 -vcodec mpeg2video -ar 44100 -s wvga -y -sameq desktop.mpg

Açık internet bağlantılarını tesbit etmek

fatih@fatih:~$ lsof -P -i -n
COMMAND  PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
firefox 2544 fatih   39u  IPv4 233241      0t0  TCP 10.1.21.9:51613->173.254.28.135:80 (ESTABLISHED)
firefox 2544 fatih   44u  IPv4 229228      0t0  TCP 10.1.21.9:59468->184.72.204.221:80 (ESTABLISHED)
firefox 2544 fatih   56u  IPv4 228053      0t0  TCP 10.1.21.9:41984->74.125.224.239:443 (ESTABLISHED)
firefox 2544 fatih   63u  IPv4 229229      0t0  TCP 10.1.21.9:40146->54.224.52.183:80 (ESTABLISHED)
firefox 2544 fatih   87u  IPv4 228125      0t0  TCP 10.1.21.9:52492->173.194.39.137:443 (ESTABLISHED)
firefox 2544 fatih   90u  IPv4 219045      0t0  TCP 10.1.21.9:52872->108.168.151.6:80 (ESTABLISHED)

İşletim sisteminin 32-64 bit olmasının tesbiti

$ getconf LONG_BIT 64
64

Traceroute ve ping peraber kullanan bir tool

mtr google.com

Dosya içeriğini silmek için

> 1.txt

Vi’da izinsiz dosyaları değiştirmek için

:w !sudo tee %

History’de görünmeden komut çalıştırmak için

<space> command

Dışa çıkan ip’yi öğrenmek için

curl ifconfig.me/all
veya 
curl ifconfig.me

Buffer Cache Silmek

Temmuz 5, 2013 § Yorum yok § Kalıcı bağlantı

Linux arada bir kendi buffer cacheni temizlemekte.
Yinede ihtiyaç olursa bu işi elle yapmak için

Öncesi:
1

sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"

Sonrası:
1

Centos Cluster Testi

Temmuz 1, 2013 § Yorum yok § Kalıcı bağlantı

Cluster testi:

Zaman verisini cluster ip ye basıyorum ve clientlerda gelen bilgiyi dosyaya yazıyorum.

client dosyası

fatih@fatih:~$ cat client.sh 
while :
do
	nc -l 1234
done
fatih@fatih:~$  bash client.sh > deneme1.txt

Servisi taşıyacağımız clientda da

fatih@fatih:~$  bash client.sh > deneme2.txt

Server dosyası

fatih@fatih:~$ cat server.sh 
while :
do
	date +'%Y-%m-%d %H:%M:%S.%N' | sed 's/[0-9][0-9][0-9][0-9][0-9][0-9]$//g' | nc cluterip 1234
done

fatih@fatih:~$ bash server.sh

Şimdi cluster ip’yi bir sunucudan diğerine taşıyorum

clusvcadm -r "IP" -m deneme1

Oluşan sonuç dosyaları

fatih@fatih:~$ cat deneme2.txt 

2013-07-01 14:46:59.573
2013-07-01 14:46:59.630
2013-07-01 14:46:59.667
2013-07-01 14:46:59.725
2013-07-01 14:46:59.765
2013-07-01 14:46:59.812
2013-07-01 14:46:59.860
2013-07-01 14:46:59.928
2013-07-01 14:46:59.972
2013-07-01 14:47:00.040
2013-07-01 14:47:00.087
2013-07-01 14:47:00.153
2013-07-01 14:47:00.258
2013-07-01 14:47:00.321
2013-07-01 14:47:00.369
2013-07-01 14:47:00.410
2013-07-01 14:47:00.476
2013-07-01 14:47:00.525
2013-07-01 14:47:00.593
2013-07-01 14:47:00.644
2013-07-01 14:47:00.686
2013-07-01 14:47:00.743
2013-07-01 14:47:00.793

fatih@fatih:~$ cat deneme1.txt 

2013-07-01 14:47:21.862
2013-07-01 14:47:21.889
2013-07-01 14:47:21.904
2013-07-01 14:47:21.929
2013-07-01 14:47:21.954
2013-07-01 14:47:21.978
2013-07-01 14:47:21.994
2013-07-01 14:47:22.025
2013-07-01 14:47:22.043
2013-07-01 14:47:22.063
2013-07-01 14:47:22.085
2013-07-01 14:47:22.115
2013-07-01 14:47:22.126

Sonuç: Cluster servisinin başlaması 21-22 saniye sürmekte.

Not:Virtualbox’da Centos 6.4 üzerinde 512mb ram, 2.4 Ghz tek core işlemcili sanal makinada test edildi.

Ağda Stream Edilen Videoyu Yakalamak!

Haziran 28, 2013 § Yorum yok § Kalıcı bağlantı

Mplayer ile

mplayer -dumpstream udp://10.1.21.9:1234 -dumpfile sonuc.dump

ffmpeg ile

ffmpeg -i udp://10.1.21.9:1234 -acodec copy -vcodec copy sonuc.dump

vlc ile

cvlc -vvv udp://@172.16.101.131:5000 --start-time=00 --run-time=10 --sout file/ts:test3.ts

hacker tools

Haziran 27, 2013 § Yorum yok § Kalıcı bağlantı

Pinaapple

http://www.troyhunt.com/2013/04/the-beginners-guide-to-breaking-website.html
http://hakinthebox.blogspot.com.au/2012/06/you-just-cant-trust-wireless-covertly.html

ve yönetilir usb
http://hakshop.myshopify.com/collections/gadgets/products/usb-rubber-ducky

ve Abel&cain ile Firesheep

Dünyayı Kurtaran Hacker!

Haziran 27, 2013 § Yorum yok § Kalıcı bağlantı

Aşağıdaki linkte çok ilginç bir yarışmadan sorular ve fikirler var.
Tavsiye ederim:
http://www.security.pandoraninkutusu.net/dunyayi-kurtaran-hacker-yarismasi-2012/

Centos Cluster Yapımı, Arsadan Anahtar Teslim!

Haziran 26, 2013 § Yorum yok § Kalıcı bağlantı

Yeni bir Centos kurduk
ETH0 açılışta ayağa kalksın

vi /etc/sysconfig/network-scripts/ifcfg-eth0
ONBOOT=yes

eth0’ın routing ayarlarını yapalım

vi /etc/sysconfig/network-scripts/route-eth0
GATEWAY0=10.1.21.1
NETMASK0=255.255.255.0

Diğer network ayarları

vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=deneme4
GATEWAY=10.1.21.1

NetworkManager müdehalesini önleyelim

chkconfig NetworkManager off | service NetworkManager stop

iptables’ı kapatalım. Daha sonra açıp ayarlanabilir.

chkconfig iptables off
service iptables stop

ntp servisi çalışsın ki sunucular saati bilsin

chkconfig ntpd on
service ntpd start

selinux’ü iptal edelim

vi /etc/selinux/config
SELINUX=disabled

ayrıca konsoldan
setenforce 0

epel paketi ile depo ekleyelim. High Availability paketlerini kuralım

rpm -Uvh /root/epel-release-6-8.noarch.rpm
yum groupinstall "High Availability" -y

ricci şifresini verelim

passwd ricci

Cluster servisleri başlangıçta çalışsın

chkconfig cman on
chkconfig rgmanager on
chkconfig modclusterd on
chkconfig ricci on

Şimdi paket kurmakla işimiz bitti.
hosts dosyasına cluster üyelerini ve cluster ip’lerini ekleyelim

vi /etc/hosts 
10.1.21.101 node1
10.1.21.102 node2
10.1.21.103 node3
10.1.21.99 cluster1
10.1.21.98 cluster2

statik ip verelim

vi /etc/sysconfig/network-scripts/ifcfg-eth0 
BOOTPROTO=static
IPADDR=10.1.21.101
NETMASK=255.255.255.0
GATEWAY=10.1.21.254

Bütün nodlarda aynı cluster.conf olmalı. cluster.conf her değiştirildiğinde config_version=”n” arttırılmalıdır.

vi /etc/cluster/cluster.conf

<?xml version="1.0"?>
<cluster config_version="16" name="hacluster">
	<clusternodes>
		<clusternode name="deneme1" nodeid="1" votes="1">
			<fence>
				<method name="single"/>
			</fence>
		</clusternode>
		<clusternode name="deneme2" nodeid="2" votes="1">
			<fence>
				<method name="single"/>
			</fence>
		</clusternode>
		<clusternode name="deneme3" nodeid="3" votes="1">
			<fence>
				<method name="single"/>
			</fence>
		</clusternode>
		<clusternode name="deneme4" nodeid="4" votes="1">
			<fence>
				<method name="single"/>
			</fence>
		</clusternode>
	</clusternodes>
	<fencedevices/>
	<rm>
		<failoverdomains>
			<failoverdomain name="first" ordered="1" restricted="0">
				<failoverdomainnode name="deneme1" priority="4"/>
				<failoverdomainnode name="deneme2" priority="3"/>
				<failoverdomainnode name="deneme3" priority="2"/>
				<failoverdomainnode name="deneme4" priority="1"/>
			</failoverdomain>
		</failoverdomains>
		<resources>
			<ip address="10.1.21.200" monitor_link="1"/>
			<ip address="10.1.21.201" monitor_link="1"/>
			<ip address="10.1.21.202" monitor_link="1"/>
		</resources>
		<service autostart="1" exclusive="1" name="IP" recovery="relocate">
			<ip ref="10.1.21.200"/>
		</service>
		<service autostart="1" exclusive="1" name="IP2" recovery="relocate">
			<ip ref="10.1.21.201"/>
		</service>
		<service autostart="1" exclusive="1" name="IP3" recovery="relocate">
			<ip ref="10.1.21.202"/>
		</service>
	</rm>
</cluster>

Bütün nodlarda konfigürasyon validasyonu için

ccs_config_validate

Tebrikler. Clusterımız hazır ve nazır…
Hadi biraz eğlenelim

Cluster üyelerini görmek için

cman_tool nodes
Node  Sts   Inc   Joined               Name
   1   M    632   2011-09-16 06:26:53  hn1.redhat.com
   2   M    636   2011-09-16 06:26:53  hn2.redhat.com

Sanal ipleri görmek için

#ip addr list -- Get the virtual Ip Address
------------------------------------------------------
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 08:00:27:06:76:c7 brd ff:ff:ff:ff:ff:ff
    inet 151.8.18.53/16 brd 151.8.255.255 scope global eth0
    inet 151.8.18.55/16 scope global secondary eth0
    inet6 fe80::a00:27ff:fe06:76c7/64 scope link 

veya

ip addr list| grep "global second"| cut -d" " -f6| cut -d/ -f1

Cluster durumunu görmek için

# clustat -l
Cluster Status for Test_cluster @ Fri Sep 16 06:44:36 2011
Member Status: Quorate
 Member Name                             ID   Status
 ------ ----                             ---- ------
 hn1.redhat.com                                 1 Online, Local, rgmanager
 hn2.redhat.com                                 2 Online, rgmanager
Service Information
------- -----------
Service Name      : service:File system Mounting
  Current State   : started (112)
  Flags           : none (0)
  Owner           : hn2.redhat.com
  Last Owner      : hn1.redhat.com
  Last Transition : Fri Sep 16 06:19:27 2011

Service Name      : service:IP Address
  Current State   : started (112)
  Flags           : none (0)
  Owner           : hn1.redhat.com
  Last Owner      : hn2.redhat.com
  Last Transition : Fri Sep 16 06:27:18 2011

Servisi bir üyeden diğerine taşımak için

#clusvcadm -r service-name -m host-name
clusvcadm -r "IP" -m deneme1

HA Troubleshooting

At least that’s the theory. You may experience some issues, and when you do, you’ll find that troubleshooting HA clusters is a complex task because of the way they work – various daemons and kernel modules are responsible for different HA tasks, and each of these essential parts of the cluster can cause problems.

Checking logs can provide some clues when things go wrong. By default, all cluster-related messages go to /var/log/messages. These simple messages give basic information about major changes in the cluster, such as starting, stopping, or moving a service. This log also collects errors about problems with cluster communication.

You can find additional logs in the directory /var/log/cluster/. Each of the cluster’s components has a log file; the most important ones are:

corosync.log, which provides information about intercluster communication and synchronization. You can also use the command corosync-objctl without any arguments to show the cluster’s configuration in full detail.

rgmanager.log, which lists information related to the cluster’s services.

fenced.log, which provides information about fencing nodes. This log is not very detailed by default. It’s better to use the command fence_tool dump when debugging fenced daemon problems.