Thursday, 14 April 2011

Systemtap

Install Systemtap.  You will need to kernel-debuginfo, kernel-devel and kernel-headers first
#yum install kernel-debuginfo-$(uname -r) kernel-devel-$(uname -r) kernel-headers-$(uname -r)

If the machine is a production server then only install the runtime
#yum install systemtap-runtime
ELSE
#yum install systemtap

Check the following examples
#ll /usr/share/doc/systemtap-1.1/examples
drwxr-xr-x 2 root root  4096 Jan 30 15:52 general
drwxr-xr-x 2 root root  4096 Jan 30 15:52 html
-rw-r--r-- 1 root root 31140 Nov 17 14:41 index.html
-rw-r--r-- 1 root root 21938 Nov 17 14:41 index.txt
drwxr-xr-x 2 root root  4096 Jan 30 15:52 interrupt
drwxr-xr-x 2 root root  4096 Jan 30 15:52 io
-rw-r--r-- 1 root root 63347 Nov 17 14:41 keyword-index.html
-rw-r--r-- 1 root root 41966 Nov 17 14:41 keyword-index.txt
drwxr-xr-x 2 root root  4096 Jan 30 15:52 locks
drwxr-xr-x 2 root root  4096 Jan 30 15:52 memory
drwxr-xr-x 2 root root  4096 Jan 30 15:52 network
drwxr-xr-x 2 root root  4096 Jan 30 15:52 process
drwxr-xr-x 2 root root  4096 Jan 30 15:52 profiling
-rw-r--r-- 1 root root  5065 Nov 17 14:41 README
It is possible to create modules which can be run using staprun
#stap iotop.stp -m iotop

will create  iotop.ko. This can be run with the following command

#staprun iotop.ko

Disk Performance

Use iostat to get the performance data
# iostat -x

Device:       rrqm/s   wrqm/s   r/s   w/s       rsec/s   wsec/s   avgrq-sz avgqu-sz   await  svctm  %util
sda               0.48          2.76     1.90  0.92        56.44     29.40    30.53         0.01        4.48       2.46      0.69

Work out the queue length
requests * average wait time / 1000 = queue length
((1.90+0.92) * 4.48) / 1000 = 0.01

Calculate the throughput
reads and writes * sector size
(56.44+29.40) * 512 / 1024 = 43Ki

Calculate utilization
requests * service time / 1000 * 100 = utilization
(1.90+0.92) * 2.46 / 1000 * 100 = 0.69 

Determine peak arrival rate
1/service time * 1000
(1/2.46 )*1000 = 406.5

Network Performance

This command will show if packets are being dropped and the q needs to be lenghtened
#tc -s qdisc show dev eth0

Network statistics
#netstat -a

Check reassembly failures, this will indicate a buffer change is required
#cat /proc/net/snmp | grep "^Ip:" | cut -f17 -d" "

BDP
Use Ping to determine round trip time
#ping remotehost
PING remotehost (192.168.48.190) 56(84) bytes of data.
64 bytes from ex442-2 (192.168.48.190): icmp_seq=1 ttl=64 time=1.65 ms

Check the bandwidth using ethtool
#ethtool eth0

BDP = Bandwidth * Delay

BDP = (100Mbps * 1024 *1024 / 8 ) * 1.65 =  21626880

Copy the old settings to sysctl.conf and comment out
#sysctl -a | grep rmem >> /etc/sysctl.conf

edit with
net.ipv4.tcp_rmem = 21626880     21626880     21626880
net.core.rmem_default = 21626880    
then
#sysctl -p

EX442 Requirements

  • use utilities such as vmstat,iostat,mpstat,sar, gnome-system-monitor, top and others to analyze and report system behavior
  • configure systems to provide performance metrics over a network via SNMP
  • query system performance metrics using SNMP
  • configure graphical SNMP client utilities such as MRTG,RRDtool, etc.
  • use the Pluggable Authentication Modules (PAM) mechanism to implement restrictions on critical system resources
  • use /proc/sys, sysctl and /sys to examine and modify and set kernel run-time parameters
  • use utilities such as dmesg, dmidecode, x86info, sysreport etc. to profile system hardware configurations
  • analyze system and application behavior using tools such as ps, strace, top, OProfile and Valgrind
  • configure systems to run SystemTap scripts
  • alter process priorities of both new and existing processes
  • configure systems to support alternate page sizes for applications that use large amounts of memory
  • given multiple versions of applications that perform the same or similar tasks, choose which version of the application to run on a system based on its observed performance characteristics
  • configure disk subsystems for optimal performance using mechanisms such as software RAID, swap partition placement, I/O scheduling algorithm selection, file system layout and others
  • configure kernel behavior by altering module parameters
  • calculate network buffer sizes based on known quantities such as bandwidth and round-trip time and set system buffer sizes based on those calculations

Thursday, 10 March 2011

Clone channels and use a cloned channel

RHN Satellite Server Channel Administrators also have the ability to clone software channels for
easy package association. Cloning offers you a complete replica of another channel, enabling you to
immediately associate appropriate packages and errata with a custom software channel. To access
this functionality, click the Channels tab on the top navigation bar, then the Manage Software
Channels on the left navigation bar. This takes you to the Software Channel Management page. To
begin cloning, click clone channel at the top-right corner.
You are immediately presented with three cloning options: current state of the channel, original state
of the channel, or select errata. These options are described fully on the webpage itself but are
summarized as:
• Current state of the channel — All of the errata and all of the latest packages now in the target
channel.

Upload custom RPMS to an RHN Satellite server

Packages must be uploaded to your private channel as root and must be digitally signed by
the uploader.

run
[root@dhcp ~]# mkdir ~/.gnupg
then
[root@dhcp ~]# gpg --gen-key

Select a type 1 DSA and ElGamal key (the default)
Select does not expire
For Real Name enter Satellite Root
For email root@satellite-fqdn
Comment to leave it blank.Enter a passphrase for your private key

gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 56E7F807 marked as ultimately trusted
public and secret key created and signed.
gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
key ID
pub   1024D/56E7F807 2011-03-14
Fingerprint   
Key fingerprint = 3C68 34CB FFC5 B1F0 227E  B99D 0C7E 0353 56E7 F807
uid                  Satellite Root <root@satellite-fqdn >
sub   2048g/D214DE21 2011-03-14
Write down your key ID and fingerprint for later use.

Export the GPG public key
[root@dhcp ~]# gpg --export --armor key-ID > /tmp/MY-GPG-KEY

Copy that key to the Satellite Server's Apache DocumentRoot's pub directory
[root@dhcp ~]# cp /tmp/MY-GPG-KEY /var/www/html/pub/MY-GPG-KEY

Log into your satellite server and create a new user named channeladmin. Modify the user account to be a channel administrator. Log out of the web site and log in again as channeladmin. Go to the Channels tab and create new channel. Make your new channel a child channel of the OS version of your client. For your GPG key URL use http://satellite-fqdn/pub/MY-GPG-KEY. Enter the GPG key ID and GPG key Fingerprint

To get fingerprint info
[root@wint-server-73 ~]# gpg --fingerprint
/root/.gnupg/pubring.gpg
------------------------
pub   1024D/56E7F807 2011-03-14
      Key fingerprint = 3C68 34CB FFC5 B1F0 227E  B99D 0C7E 0353 56E7 F807
uid                  Satellite Root <root@wint-server-73.wcm-london.com>
sub   2048g/D214DE21 2011-03-14

Add the following to ~/.rpmmacros
%_signature gpg
%_gpg_name KEYID

 To sign the package
[root@dhcp ~]# rpm --resign package-name-1.0-1.noarch.rpm

To make sure the package is signed, use the following command
[root@dhcp ~]# rpm --checksig -v package-name-1.0-1.noarch.rpm

Upload your RPM
[root@dhcp ~]# rhnpush -c 'Channel Name' --server localhost

Subscribe your client to the private channel:

Using the URL listed by the RHN child channel , download the public key to your client system and then import it
[root@dhcp ~]# rpm --import MY-GPG-KEY

Wednesday, 9 March 2011

EX333 Requirements

Centralized Authentication Security

Network Services Security