<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sabin Shrestha&#039;s Personal Site &#187; Linux</title>
	<atom:link href="http://www.sabinshrestha.com.np/linux-downloads/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sabinshrestha.com.np</link>
	<description>IT Professional and Consultant</description>
	<lastBuildDate>Mon, 28 Jun 2010 20:27:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>linux admin note</title>
		<link>http://www.sabinshrestha.com.np/linux-downloads/linux-admin-note/</link>
		<comments>http://www.sabinshrestha.com.np/linux-downloads/linux-admin-note/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 05:27:38 +0000</pubDate>
		<dc:creator>sabin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.sabinshrestha.com.np/?p=188</guid>
		<description><![CDATA[Syslog QUOTA NFS Samba SSH TELNET SQUID BIND SENDMAIL POSTFIX PROXY HTTPD FTP DHCP YP LDAP PPPD NTP MRTG TRIPWIRE PAM Password Security Encryption Process security firewall xinetd, tcp_wrappers iptables security tools PortForwarding selinux ======================================================================== Libarary source &#124; compiler &#124; Object code &#124; linkear &#124; staticlibrary,Dynamic library,statically linked executable code, Dynamically linked executablecode &#124; loader [...]]]></description>
			<content:encoded><![CDATA[<p>Syslog<br />
QUOTA<br />
NFS<br />
Samba<br />
SSH<br />
TELNET<br />
SQUID<br />
BIND<br />
SENDMAIL<br />
POSTFIX<br />
PROXY<br />
HTTPD<br />
FTP<br />
DHCP<br />
YP<br />
LDAP<br />
PPPD<br />
NTP<br />
MRTG<br />
TRIPWIRE<br />
PAM<br />
Password Security Encryption<br />
Process security<br />
firewall<br />
xinetd, tcp_wrappers iptables<br />
security tools<br />
PortForwarding<br />
selinux</p>
<p>========================================================================</p>
<p>Libarary</p>
<p>source<br />
|<br />
compiler<br />
|<br />
Object code<br />
|<br />
linkear<br />
|<br />
staticlibrary,Dynamic library,statically linked executable code,<br />
Dynamically linked executablecode<br />
|<br />
loader<br />
|<br />
shared library, executable code</p>
<p>/lib<br />
/usr/lib<br />
/usr/i486-linux-libc5/lib<br />
/usr/X11R6/lib<br />
/usr/i486-linuxout/lib</p>
<p>libname.so / libname.so.major</p>
<p>lld progfile</p>
<p>$lld /bin/rm</p>
<p>LD_LIBRARY_PATH<br />
ldconfig -V<br />
========================================================================<br />
SSH<br />
vi /etc/ssh/sshd_config<br />
ssh 192.168.1.100 &#8220;uname -a&#8221;</p>
<p>scp /etc/hosts <a href="mailto:root@192.168.1.103:/tmp">root@192.168.1.103:/tmp</a><br />
scp <a href="mailto:root@smallfry:/tmp/software.rpm">root@smallfry:/tmp/software.rpm</a> /usr/rpm<br />
(<a href="http://winscp.vse.cz/eng/">http://winscp.vse.cz/eng/</a>)</p>
<p>$sftp 192.168.1.200<br />
SSH without password<br />
Client<br />
ssh-keygen -t dsa<br />
cd ~/.ssh<br />
scp id_dsa.pub <a href="mailto:sabin@192.168.59.7:public-key.tmp">sabin@192.168.59.7:public-key.tmp</a></p>
<p>Server<br />
mkdir /root/.ssh<br />
chmod 700 /root/.ssh<br />
cd .ssh<br />
cat ~/public-key.tmp &gt;&gt;authorized_keys<br />
rm ~/public-key.tmp<br />
========================================================================</p>
<p>SysLog<br />
0 emergencies System unusable<br />
1 alerts Immediate action required<br />
2 critical Critical condition<br />
3 errors Error conditions<br />
4 warnings Warning conditions<br />
5 notifications Normal but significant conditions<br />
6 informational Informational messages<br />
7 debugging Debugging messages</p>
<p>.info;mail.none;authpriv.none;cron.none           /var/log/messages<br />
1) vi /etc/sysconfig/syslog<br />
SYSLOGD_OPTIONS=&#8221;-r -m0&#8243;<br />
service syslog restart</p>
<p>2) vi /etc/syslog.conf<br />
user.*    @stationX<br />
service syslog restart<br />
logger -i -t yourname &#8220;this is test&#8221;</p>
<p>/etc/logrotate.d<br />
ogrotate -f /etc/logrotate.d/syslog<br />
zcat /var/log/messages.1.gz<br />
==========================================================================<br />
Quota<br />
quota.user,quota.group<br />
1)vi /etc/fstab<br />
/home defaults,userquota,groupquota 1 2<br />
2)mount -o remount /home<br />
3)to verify<br />
quotacheck -acug /home<br />
quotacheck -avug /home<br />
edquota -u user<br />
edquota -g group<br />
edquota -t grace<br />
edquota -p kiran sab<br />
quotaon/quotaoff -av<br />
quotaon/quotaoff -avu<br />
quotaon/quotaoff -avg</p>
<p>repquota -a<br />
==========================================================================<br />
NFS<br />
1. You can only export directories beneath the &#8220;/&#8221; directory.<br />
2. You cannot export a subdirectory of a directory that has already<br />
been exported. The exception being when the subdirectory is on a different<br />
physical device. Likewise you cannot export the parent of a subdirectory<br />
unless it is on a separate device too.<br />
3. You can only export local file systems.</p>
<p>Caching= &#8220;read ahead&#8221;</p>
<p>RPM=nfs-utils,portmap-4.0-57</p>
<p>Daemon=Portmap,NFS,NFSlock,NetFS</p>
<p>(async,atime,auto,dev,exec,noatime,noauto,nodev,noexec,<br />
nosuid,nouser,remountro,rw,suid,sync,user)<br />
defaults(rw,suid,dev,exec,auto nouser,async)</p>
<p>x = rsigw = n , number of bytes nfs uses when reading<br />
n = 1024 (default)<br />
x = wsize = n<br />
timeo= n (7)<br />
retry = n number of minutes to nfs mount retry<br />
soft = if the file cannot be mounted and time<br />
out occurs then reutrn an I/O error<br />
hard = if timeout occurs it will display the message<br />
but it will keep on trying unless retry time is over<br />
intr=if nfs file operation has timeout and is<br />
hard mounted then it allow signals to<br />
intrrupt the operations<br />
it uses udp by default<br />
if want tcp then give tcp<br />
optimum=8192<br />
rw,ro(default),sync,async(defualt),no_subtree_check,<br />
subtree_check,root_squash<br />
no_root_squash &#8211; when a client connects to the server run as a root<br />
all_squash</p>
<p>1) vi /etc/exports<br />
/temp          *(rw)<br />
/data/files           *(ro,sync)<br />
/home                 192.168.1.0/24(rw,sync)<br />
/data/test            *.my-site.com(rw,sync)<br />
/data/database        192.168.1.203/32(rw,sync)</p>
<p>2)chkconfig &#8211;level 35 nfs on<br />
chkconfig &#8211;level 35 nfslock on<br />
chkconfig &#8211;level 35 portmap on</p>
<p>3) For Client<br />
chkconfig &#8211;level 35 netfs on<br />
chkconfig &#8211;level 35 nfslock on<br />
chkconfig &#8211;level 35 portmap on</p>
<p>4) rpcinfo -p localhost<br />
nfsstat<br />
df -F nfs<br />
showmount -a<br />
exportfs -a (new share)<br />
exportfs -v (refresh)<br />
exportfs -ua(reload)<br />
exportfs -a (new share)</p>
<p>5)vi /etc/fstab<br />
#Directory                  Mount Point    Type   Options         Dump   FSCK<br />
192.168.1.100:/data/files   /mnt/nfs        nfs    soft,nfsvers=2  0      0</p>
<p>6) mount -t nfs 192.168.1.1:/data/files /mnt/nfs</p>
<p>7)Auto Mount<br />
$vi /etc/auto.master<br />
# File: /etc/auto.master<br />
#<br />
/home   /etc/auto.home &#8211;timeout=300<br />
/-      /etc/auto.direct</p>
<p>8)-Indrect map<br />
$vi /etc/auto.home<br />
peter   bigboy:/home/peter<br />
bob     ochorios:/home/bob<br />
bunny   waitabit:/home/bunny</p>
<p>-Direct Map<br />
$vi /etc/auto.direct<br />
/data/sales          -rw           bigboy:/disk1/data/sales<br />
/sql/database        -ro,soft      waitabit:/var/mysql/database</p>
<p>-Using the Ampersand Wildcard<br />
$vi /etc/auto.home<br />
peter   bigboy:/home/&amp;</p>
<p>9)chkconfig autofs on</p>
<p>Option Description<br />
Bg Retry mounting in the background if mounting initially fails<br />
Fg Mount in the foreground<br />
soft Use soft mounting<br />
hard Use hard mounting<br />
rsize=n The amount of data NFS will attempt to access per read operation.<br />
The default is dependent on the kernel. For NFS version 2 set it<br />
to 8192 to assure maximum throughput.<br />
wsize=n The amount of data NFS will attempt to access per write operation.<br />
The default is dependent on the kernel. For NFS version 2 set it to 8192<br />
to assure maximum throughput.<br />
nfsvers=n The version of NFS the mount command should attempt to use<br />
Tcp Attempt to mount the filesystem using TCP packets, the default is UDP.<br />
intr If the filesystem is hard mounted and the mount times out, allow<br />
for the process to be aborted using the usual methods such as &lt;CTRL-C&gt;<br />
and the &#8220;kill&#8221; command.</p>
<p>===========================================================<br />
SQUID<br />
/var/spool/squid<br />
/var/log/squid/access.log</p>
<p>1) vi /etc/squid/squid.conf<br />
visible_hostname server1.nepal.com</p>
<p>acl home_network src 192.168.1.0/24<br />
acl home_network src &#8220;/root/allow&#8221;<br />
acl business_hours time MTWHF 9:00-17:00<br />
http_access allow homenetwork business_hour<br />
cache_dir<br />
===========================================================<br />
Bind</p>
<p>cp -f /etc/rndc.* /var/named/chroot/etc/<br />
cp /etc/named.conf /var/named/chroot/etc/</p>
<p>1) vi /etc/named.conf<br />
zone &#8220;nepal.com&#8221; IN {<br />
type master;<br />
notify no;<br />
allow-update { none; };<br />
allow-query { any; };<br />
file &#8220;nepal.com.zone&#8221;;<br />
};</p>
<p>2) cp /var/named/localhost.zone /var/named/nepal.com.zone<br />
cp /var/named/localhost.   /var/named/nepal.rev</p>
<p>3) vi /var/named/nepal.com.zone</p>
<p>ns1.nepal.com. IN SOA root.nepal.com.(<br />
1;<br />
1H;<br />
1H;<br />
1H;<br />
1H;<br />
);<br />
ns1.nepal.com.   IN NS 192.168.0.5<br />
ns1.nepal.com.  IN A  192.168.0.5<br />
nepal.com.       IN MX 9 mail.nepal.com.<br />
nepal.com.       IN MX 10 mail1.nepal.com.<br />
nepal.com.        IN A  192.168.0.9<br />
nepal.com.        IN A  192.168.0.10<br />
mail.nepal.com.  IN A  192.168.0.7<br />
mail1.nepal.com. IN A  192.168.0.8<br />
<a href="http://www.nepal.com">www.nepal.com</a>.   IN A  192.168.0.9<br />
<a href="http://www.nepal.com">www.nepal.com</a> IN A  192.168.0.10<br />
nis1.nepal.com   IN A  192.168.0.11<br />
nis2.nepal.com   IN A  192.168.0.12<br />
file.nepal.com   IN A  192.168.0.13<br />
zone &#8220;0.168.196.in-addr.arpa&#8221; {<br />
type master;<br />
allow-update { none; };<br />
notify no;<br />
file &#8220;nepal.rev&#8221;;<br />
};<br />
$TTL 3D<br />
@       IN        SOA        ns1.nepal.com.  hostmaster.nepal.com. (<br />
200303301          ; serial number<br />
8H                 ; refresh, seconds<br />
2H                 ; retry, seconds<br />
4W                 ; expire, seconds<br />
1D )               ; minimum, seconds<br />
NS         ns1.nepal.com.<br />
5                PTR        ns1.nepal.com.<br />
6                PTR        ns2.nepal.com.<br />
7                PTR        mail.nepal.com.<br />
8                PTR        mail1.nepal.com.<br />
4) chkconfig named on</p>
<p>5) service named restart<br />
6) named-checkconfig /etc/named.conf<br />
named-checkzone /var/named.nepal.com.zone</p>
<p>7) nslookup <a href="http://www.nepal.com">www.nepal.com</a><br />
dig @nepal.com <a href="http://www.nepal.com">www.nepal.com</a><br />
dig @nepal.com MX<br />
host nepal.com<br />
========================================================================<br />
Apache(httpd)<br />
RPM= httpd-2.0.48-1.2.rpm</p>
<p>1) adduser nepal<br />
2) passwd nepal<br />
3) chmod 755 /home/nepal</p>
<p>4) vi /etc/httpd/conf/httpd.conf<br />
ServerAdmin <a href="mailto:webmaster@nepal.com">webmaster@nepal.com</a><br />
servername  nepal.com<br />
DocumentRoot &#8220;/home/nepal&#8221;(default)<br />
&lt;Directory &#8220;/home/nepal&#8221;&gt; [/var/www/html]<br />
Options All Indexes Includes FollowSymLinks ExecCGI MultiViews<br />
[MultiViews -Indexes SymLinksIfOwnerMatch IncludesNoExec]<br />
AllowOverride None (.htaccess)</p>
<p>Order allow,deny<br />
Allow from all(Deny from all/[ip])<br />
&lt;/Directory</p>
<p>&lt;Directory /home/*/public_html&gt;<br />
&lt;/Directory&gt;</p>
<p>DirectoryIndex index.html</p>
<p>Alias /sabin &#8220;/home/nepal/sabin&#8221;<br />
&lt;Directory &#8220;/home/nepal/sabin&#8221;&gt;<br />
&lt;/Directory&gt;</p>
<p>ScriptAlias /cgi-bin &#8220;/home/nepal/cgi-bin&#8221;<br />
&lt;Directory &#8220;/home/nepal/cgi-bin&#8221;&gt;<br />
&lt;/Directory&gt;</p>
<p>AddHandler cgi-script .cgi<br />
AddHandler send-as-is asis</p>
<p>ErrorDocument 404 /missing.htm</p>
<p>5) Named Based Hosting<br />
NameVirtualHost 192.168.0.9<br />
NameVirtualHost 192.168.0.10</p>
<p>&lt;VirtualHost *&gt;<br />
Default Directives. (In other words, not site #1 or site #2)<br />
&lt;/VirtualHost&gt;</p>
<p>&lt;VirtualHost 192.168.0.9&gt;<br />
servername <a href="http://www.nepal.com">www.nepal.com</a><br />
DocumentRoot /home/nepal<br />
ServerAdmin <a href="mailto:sabin@nepal.com">sabin@nepal.com</a><br />
ErrorLog logs/error.log<br />
CustomLog logs/access.log<br />
Directives for site #1<br />
&lt;/VirtualHost&gt;</p>
<p>&lt;VirtualHost 192.168.0.9&gt;<br />
DocumentRoot /home/sabin<br />
servername <a href="http://www.sabin.com">www.sabin.com</a><br />
ServerAdmin <a href="mailto:sabin@nepal.com">sabin@nepal.com</a><br />
ErrorLog logs/error.log<br />
CustomLog logs/access.log<br />
Directives for site #2<br />
&lt;/VirtualHost&gt;</p>
<p>&lt;VirtualHost 192.168.0.10&gt;<br />
DocumentRoot /home/www/site2<br />
ServerName <a href="http://www.nepal.com">www.nepal.com</a><br />
ServerAlias nepal.com, <a href="http://www.arati.com">www.arati.com</a> arati.com<br />
&lt;/VirtualHost&gt;</p>
<p>options=<br />
&lt;Directory &#8220;/home/*&#8221;&gt;<br />
Order allow,deny<br />
Allow from all</p>
<p>AllowOverride FileInfo AuthConfig Limit<br />
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec<br />
&lt;Limit GET POST OPTIONS&gt;<br />
Order allow,deny<br />
Allow from all<br />
&lt;/Limit&gt;<br />
&lt;LimitExcept GET POST OPTIONS&gt;<br />
Order deny,allow<br />
Deny from all<br />
&lt;/LimitExcept&gt;<br />
&lt;/Directory&gt;<br />
6) IP based Hosting</p>
<p>&lt;VirtualHost *&gt;<br />
DocumentRoot /home/nepal<br />
&lt;/VirtualHost&gt;</p>
<p>&lt;VirtualHost 192.168.0.9&gt;<br />
DocumentRoot /home/sabin<br />
servername 192.168.0.9<br />
ServerAdmin <a href="mailto:sabin@nepal.com">sabin@nepal.com</a><br />
ErrorLog logs/error.log<br />
CustomLog logs/access.log</p>
<p>&lt;/VirtualHost&gt;</p>
<p>&lt;VirtualHost 192.168.0.10&gt;<br />
DocumentRoot /home/arati<br />
servername 192.168.0.10<br />
ServerAdmin <a href="mailto:arati@nepal.com">arati@nepal.com</a><br />
ErrorLog logs/error.log<br />
CustomLog logs/access.log<br />
&lt;/VirtualHost&gt;</p>
<p>Compression of static pages<br />
(before virtual hosting)<br />
LoadModule deflate_module modules/mod_deflate.so<br />
&lt;Location /&gt;<br />
# Insert filter<br />
SetOutputFilter DEFLATE<br />
# Netscape 4.x has some problems&#8230;<br />
BrowserMatch ^Mozilla/4 gzip-only-text/html<br />
# Netscape 4.06-4.08 have some more problems<br />
BrowserMatch ^Mozilla/4\.0[678] no-gzip<br />
# MSIE masquerades as Netscape, but it is fine<br />
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html<br />
# Don&#8217;t compress images<br />
SetEnvIfNoCase Request_URI \<br />
\.(?:gif|jpe?g|png)$ no-gzip dont-vary<br />
# Make sure proxies don&#8217;t deliver the wrong content<br />
Header append Vary User-Agent env=!dont-vary<br />
&lt;/Location&gt;</p>
<p>7) Proctecting Site<br />
htpasswd -c /home/nepal/.htpasswd sabin<br />
htpasswd  /home/nepal/.htpasswd arati<br />
chmod 644 /home/nepal/.htpasswd</p>
<p>vi .htpasswd (or &lt;Directory&gt;)</p>
<p>AuthUserFile /home/nepal/.htpasswd<br />
AuthGroupFile /dev/null<br />
AuthName EnterPassword<br />
AuthType Basic<br />
require user valid-user</p>
<p> <img src='http://www.sabinshrestha.com.np/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /><br />
openssl genrsa -des3 -out server.key 1024<br />
openssl req -new -key server.key -x509 -out server.crt<br />
cp server.{key,crt} /etc/httpd/conf/<br />
or<br />
/etc/httpd/conf/make testcert<br />
/etc/httpd/conf/make certreq</p>
<p>vi /etc/httpd/conf.d/ssl.conf<br />
&lt;VirtualHost 192.168.0.7:443&gt;<br />
ServerAdmin<br />
DocumentRoot<br />
ServerName<br />
ServerAlias<br />
SSLEngine on<br />
SSLCertificateFile /etc/httpd/conf/server.crt<br />
SSLCertificateKeyFile /etc/httpd/conf/server.key<br />
&lt;/VirtualHost&gt;<br />
========================================================================</p>
<p>Web mail (squriell mail)www.hotscripts.com<br />
$vi /var/www/html/webmail/config/config.php</p>
<p>$org_name      = &#8220;Microtech International&#8221;;<br />
$org_logo      = SM_PATH . &#8216;images/mtechlogo.jpg.new&#8217;;<br />
#$org_logo      = &#8216;/home/chehen/mtechlogo.jpg&#8217;;<br />
$org_logo_width  = &#8217;308&#8242;;<br />
$org_logo_height = &#8217;111&#8242;;<br />
$org_title     = &#8220;Microtech International&#8221;;<br />
$signout_page  = &#8216;http://portal.mtech.com.np&#8217;;<br />
$frame_top     = &#8216;_top&#8217;;</p>
<p>$provider_uri     = &#8216;http://www.microtech.com.np&#8217;;</p>
<p>$provider_name     = &#8216;www.microtech.com.np&#8217;;</p>
<p>$motd = &#8221; &#8220;;</p>
<p>$squirrelmail_default_language = &#8216;en_US&#8217;;</p>
<p>$domain                 = &#8216;microtech.com.np&#8217;;<br />
$imapServerAddress      = &#8217;192.168.59.1&#8242;;<br />
#$imapServerAddress      = &#8217;192.168.59.7&#8242;;<br />
$imapPort               = 143;<br />
$useSendmail            = false;<br />
#$useSendmail            = true;<br />
$smtpServerAddress      = &#8217;192.168.59.1&#8242;;<br />
$smtpPort               = 25;<br />
$sendmail_path          = &#8216;/usr/sbin/sendmail&#8217;;<br />
$pop_before_smtp        = false;<br />
$imap_server_type       = &#8216;other&#8217;;<br />
$invert_time            = false;<br />
$optional_delimiter     = &#8216;detect&#8217;;</p>
<p>vi /etc/httpd/conf.d/squriellmail<br />
========================================================================<br />
Webmin (Web Administration) <a href="http://www.webmin.com">www.webmin.com</a></p>
<p>Installed Directory (/var/libexec/mrtg)<br />
$./setup.sh</p>
<p><a href="http://192.168.59.7:10000">http://192.168.59.7:10000</a><br />
=========================================================================<br />
PostFix<br />
/etc/postfix/main.cf<br />
/etc/postfix/master.cf<br />
Daemon=master,qmgr,smtpd,pikup(others)</p>
<p>1)alternatives  -set mta /usr/sbin/sendmail.posfix<br />
2)vi /etc/postfix/main.cf<br />
myorigin=nepal.com<br />
mydestination= nepal.com mail.nepal.com<br />
mynetworks=192.168.0.0/24,127.0.0.1<br />
inet_interfaces=all</p>
<p>3)service postfix start<br />
4)aliases,virtual,access<br />
5)postmap /etc/postfix/access<br />
=========================================================================<br />
SendMail</p>
<p>1) vi /etc/mail/sendmail.cf or vi /etc/mail/sendmail.mc<br />
copy define(&#8220;Daemon Port Options = Port=smtp; Addr=127.0.0.1,Name MTA&#8221;)<br />
Paste define(&#8220;Daemon Port Options = Port=smtp; Addr=192.168.0.7,Name MTA&#8221;)</p>
<p>define(MAIL_HUB&#8217;, &#8216;nepal.com&#8217;)<br />
define(&#8216;SMART_HOST&#8217;,'nepal.com&#8217;)<br />
define(&#8216;MASQUERADE_AS&#8217;,'nepal.com&#8217;)<br />
EXPOSED_USER(&#8216;root&#8217;)</p>
<p>MASQUERADE_AS(`nepal.com.&#8217;)<br />
MASQUERADE_DOMAIN(`nepal.com.&#8217;)<br />
MASQUERADE_AS(nepal.com)<br />
FEATURE(`accept_unresolvable_domains&#8217;)dnl<br />
FEATURE(delay_checks)dnl<br />
FEATURE(always_add_domain)dnl<br />
FEATURE(`masquerade_entire_domain&#8217;)dnl<br />
FEATURE(`masquerade_envelope&#8217;)dnl<br />
FEATURE(`allmasquerade&#8217;)dnl<br />
MASQUERADE_AS(`my-site.com&#8217;)dnl<br />
MASQUERADE_DOMAIN(`my-site.com.&#8217;)dnl<br />
MASQUERADE_DOMAIN(localhost)dnl<br />
MASQUERADE_DOMAIN(localhost.localdomain)dnl</p>
<p>For LDAP<br />
LDAPROUTE_DOMAIN<br />
LDAP_ROUTIN<br />
2)m4 /etc/mail/sendmail.mc &gt; /etc/mail/sendmail.cf</p>
<p>3)vi /etc/mail/local-host-names(Receive mail of domain, To receive)<br />
nepal.com<br />
mail.nepal.com</p>
<p>4)vi /etc/mail/access (To allow to send mail )<br />
localhost.localdomain RELAY<br />
localhost             RELAY<br />
127.0.0.1             RELAY<br />
nepal.com             RELAY<br />
mail.nepal.com        RELAY<br />
192.168.0             RELAY<br />
mail1.nepal.com       RELAY (for backup email)<br />
spam.com              REJECT</p>
<p>5) vi /etc/mail/virtusertable (to redirect emails)<br />
@nepal.com          sabin<br />
<a href="mailto:info@nepal.com">info@nepal.com</a> sabin</p>
<p>6) make all</p>
<p>7) vi /etc/aliases<br />
hardware: sabin,subash,arati,rakesh,shyam</p>
<p> <img src='http://www.sabinshrestha.com.np/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> newaliases</p>
<p>9) vi /etc/mail/relay-domains<br />
nepal.com  RELAY</p>
<p>10)chkconfig sendmail on<br />
chkconfig ipop3 on<br />
chkconfig imapd on</p>
<p>11) service sendmail restart<br />
service xinetd restart</p>
<p>12) sendmail -d0.1 &lt;/dev/null (to check)</p>
<p>13) mail -s hello <a href="mailto:sabin@nepal.com">sabin@nepal.com</a><br />
hello<br />
.</p>
<p>echo &#8220;helooo&#8221;|mail -v -s hello <a href="mailto:sabin@nepal.com">sabin@nepal.com</a><br />
mail -s hello <a href="mailto:sabin@nepal.com">sabin@nepal.com</a> &lt; /root/a.txt<br />
14)mailq or sendmail -bd -q 30m<br />
sendmail -bd -q<br />
sendmail -q</p>
<p>15) nmap nepal.com (check 25 and 110 port is open)</p>
<p>16) mail, pine , mutt</p>
<p>17) Check SMTP<br />
telnet 192.168.0.7 25<br />
helo nepal.com<br />
mail from: <a href="mailto:sabin@nepal.com">sabin@nepal.com</a><br />
rcpt to: <a href="mailto:arati@nepal.com">arati@nepal.com</a><br />
data<br />
hello<br />
there<br />
.<br />
quit</p>
<p>18) To check POP<br />
telnet 192.168.0.7 110<br />
user sabin<br />
pass shrestha<br />
stat<br />
top 1 99999<br />
dele 1<br />
quit</p>
<p>19 tail -f /var/log/maillog</p>
<p>===============================================================<br />
Spam Controling<br />
spamassassing / mimedefang<br />
1)$vi /etc/mail/spamassassin/local.cf<br />
Required_hits 6<br />
rewrite_subject 1<br />
subject_tag [SPAM]<br />
report_safe 0</p>
<p># How many hits before a message is considered spam.<br />
required_hits           6.0</p>
<p># Whether to change the subject of suspected spam<br />
rewrite_subject         1</p>
<p># Text to prepend to subject if rewrite_subject is used<br />
subject_tag             [SPAM]</p>
<p># Encapsulate spam in an attachment<br />
report_safe             1</p>
<p># Use terse version of the spam report<br />
use_terse_report        0</p>
<p># Enable the Bayes system<br />
use_bayes               1</p>
<p># Enable Bayes auto-learning<br />
auto_learn              0</p>
<p># Enable or disable network checks<br />
skip_rbl_checks         1<br />
use_razor2              0<br />
use_dcc                 0<br />
use_pyzor               0</p>
<p>auto_whitelist_path     /etc/mail/spamassassin/auto-whitelist<br />
bayes_path              /etc/mail/spamassassin/bayes</p>
<p>score SPAM_PHRASE_34_55              3.516<br />
score SPAM_PHRASE_55_XX              1.505<br />
score SPAM_PHRASE_21_34              2.856<br />
score SPAM_PHRASE_13_21              2.337<br />
score SPAM_PHRASE_08_13              2.385<br />
score SPAM_PHRASE_05_08              2.640<br />
score SPAM_PHRASE_03_05              2.084<br />
score SPAM_PHRASE_00_01              0.781<br />
score SPAM_PHRASE_02_03              0.758<br />
score SPAM_PHRASE_01_02              0.500<br />
score LINES_OF_YELLING_2             1.500<br />
score FORGED_RCVD_FOUND              4.000<br />
score MAY_BE_FORGED                  1.000<br />
score UPPERCASE_50_75                2.000<br />
score HTML_FONT_FACE_ODD             1.500<br />
score NIGERIAN_TRANSACTION_1         3.000<br />
score LINES_OF_YELLING               1.500<br />
score WEB_BUGS                       2.500<br />
score FORGED_YAHOO_RCVD              2.500<br />
score SUBJ_HAS_UNIQ_ID               2.000<br />
score JAVASCRIPT_VERY_UNSAFE         3.500<br />
score HTML_FONT_INVISIBLE            2.000<br />
score CTYPE_JUST_HTML                4.000<br />
score FROM_NO_USER                   2.500<br />
score BILLION_DOLLARS                1.000<br />
score CLICK_BELOW                    2.000<br />
score RELAYING_FRAME                 2.000<br />
score MIME_SUSPECT_NAME              2.000<br />
score MIME_HTML_NO_CHARSET           3.000<br />
score MICROSOFT_EXECUTABLE           2.000<br />
score MISSING_MIMEOLE                2.000<br />
score ONLINE_PHARMACY                2.000<br />
score SAVE_UP_TO                     2.000<br />
score SAVE_MONEY                     2.000<br />
score MIME_HTML_ONLY                 2.000<br />
score MONEY_BACK                     2.000<br />
score HTML_FONT_FACE_BAD             3.000<br />
score VIAGRA                         4.000<br />
score VIAGRA_ONLINE                  4.000<br />
score SUBJ_HI                        2.500<br />
score HTML_WEB_BUGS                  2.500<br />
score HTML_IMAGE_ONLY_02             3.000<br />
score HTML_IMAGE_ONLY_04             2.500<br />
score HTML_IMAGE_ONLY_06             2.000<br />
score HTML_IMAGE_ONLY_08             1.500<br />
score HTML_IMAGE_ONLY_10             1.000<br />
score RATWARE_HASH_2                 2.000<br />
score RATWARE_HASH_2_V2              2.000<br />
score MISSING_OUTLOOK_NAME           2.000<br />
score HTML_FONTCOLOR_UNKNOWN         2.000<br />
score NORMAL_HTTP_TO_IP              2.000<br />
score GAPPY_SUBJECT                  3.500<br />
score HTML_FONT_BIG                  2.000<br />
score REMOVE_PAGE                    1.500<br />
score HTML_SHOUTING4                 2.000<br />
score HTML_SHOUTING3                 2.000<br />
score HTML_SHOUTING2                 2.000<br />
score HTML_SHOUTING                  2.000<br />
score NO_REAL_NAME                   2.000<br />
score HGH                            3.000<br />
score MIME_MISSING_BOUNDARY          2.000<br />
score SAVINGS                        3.000<br />
score AMAZING_STUFF                  2.000<br />
score HTML_MESSAGE                   2.500</p>
<p>2)vi /etc/procmailrc</p>
<p># send mail through spamassassin<br />
:0fw<br />
| /usr/bin/spamc</p>
<p>LOGFILE=/var/log/procmail.log<br />
DROPPRIVS=yes</p>
<p># Delete all messages with dangerous attachments, as long as below a certain size<br />
# Note: The whitespace in the [ ] below comprises a space and a tab character<br />
:0<br />
* &lt; 256000<br />
* ! ^Content-Type: text/plain<br />
{<br />
:0B<br />
* ^(Content-(Type|Disposition):.*|[     ]*(file)?)name=(&#8220;[^"]*|[^ ]*)\.(bat|cmd|com|exe|js|pif|scr|zip)<br />
/dev/null<br />
}</p>
<p># SpamAssassin sample procmailrc<br />
#<br />
# Pipe the mail through spamassassin (replace &#8216;spamassassin&#8217; with &#8216;spamc&#8217;<br />
# if you use the spamc/spamd combination)<br />
#<br />
# The condition line ensures that only messages smaller than 250 kB<br />
# (250 * 1024 = 256000 bytes) are processed by SpamAssassin. Most spam<br />
# isn&#8217;t bigger than a few k and working with big messages can bring<br />
# SpamAssassin to its knees.<br />
#<br />
# The lock file ensures that only 1 spamassassin invocation happens<br />
# at 1 time, to keep the load down.<br />
#<br />
:0fw<br />
* &lt; 256000<br />
| /usr/bin/spamc</p>
<p># Delete messages with very high spam level<br />
# Tweak this to your own comfort level!<br />
:0<br />
* ^X-Spam-Level: \*\*\*\*\*\*\*\*<br />
/dev/null</p>
<p># Work around procmail bug: any output on stderr will cause the &#8220;F&#8221; in &#8220;From&#8221;<br />
# to be dropped.  This will re-add it.<br />
:0<br />
* ^^rom[ ]<br />
{<br />
LOG=&#8221;*** Dropped F off From_ header! Fixing up. &#8221;</p>
<p>:0 fhw<br />
| sed -e &#8217;1s/^/F/&#8217;<br />
}<br />
# Klez worm procmail filter<br />
:0 B<br />
* 135AAItEjhyJRI8ci0SOGIlEjxiLRI4UiUSPFItEjhCJRI8Qi0SODIlEjwyLRI4IiUSPCItE<br />
/var/log/klez<br />
3)vi ~/.procmailrc file</p>
<p>INCLUDERC=/etc/mail/spamassassin/spamassassin-default.rc</p>
<p>:0 Hw<br />
* ^X-Spam-Status: Yes<br />
spam</p>
<p>==========================================================================<br />
4) Procmail (~/.procmailrc)<br />
:0<br />
*^From: <a href="mailto:test@try.com">test@try.com</a><br />
<a href="mailto:!sabin@nepal.com">!sabin@nepal.com</a></p>
<p>*^From: *root/root*</p>
<p>*^subjct: .*free.*<br />
/dev/null</p>
<p>:0<br />
*^From: <a href="mailto:test@try.com">test@try.com</a><br />
<a href="mailto:!sabin@abc.com">!sabin@abc.com</a></p>
<p>:0<br />
* ^From: <a href="mailto:spammer@domain.com">spammer@domain.com</a><br />
/dev/null</p>
<p>:0:<br />
* ^(From|CC|To).*tux-lug<br />
tuxlug</p>
<p>==========================================================================<br />
Anti virus<br />
<a href="http://www.clamav.net/">http://www.clamav.net/</a><br />
groupadd clamav<br />
useradd -g clamav -s /bin/false -c &#8220;Clam AntiVirus&#8221; clamav<br />
cd /usr/local/src<br />
wget <a href="http://optusnet.dl.sourceforge.net/sourceforge/clamav/clamav-0.82.tar.gz">http://optusnet.dl.sourceforge.net/sourceforge/clamav/clamav-0.82.tar.gz</a><br />
tar xzf clamav-0.82.tar.gz<br />
chown -R root.root clamav-0.82<br />
cd clamav-0.82<br />
./configure<br />
make<br />
make install<br />
Customise the clamd configuration file</p>
<p>vi /usr/local/etc/clamd.conf<br />
# make sure you comment out the &#8220;example&#8221; line<br />
LogSyslog<br />
FixStaleSocket<br />
User qscand  # need to run as user qscand for clamav<br />
to work with recent versions of the qmail-scanner script<br />
Configure clamd so it is running all the time from bootup onwards</p>
<p>cp contrib/init/RedHat/clamd /etc/rc.d/init.d/<br />
chmod 744 /etc/rc.d/init.d/clamd<br />
chkconfig &#8211;add clamd<br />
Then I like to use the ntsysv program to double-check<br />
that clamd is set to launch at boot time</p>
<p>If you aren&#8217;t ready to reboot the server now, you can<br />
fire up clamd in the mean time with this command :</p>
<p>/etc/rc.d/init.d/clamd start<br />
At this point the clamd software should be running.<br />
A good way to verify this is to use this command :</p>
<p>ps axf<br />
And if all is well, you should be able to see something like this :</p>
<p>18144 ? S 0:00 /usr/local/sbin/clamd<br />
Schedule automatic downloading</p>
<p>touch /var/log/clam-update.log<br />
chmod 600 /var/log/clam-update.log<br />
chown clamav /var/log/clam-update.log<br />
crontab -e<br />
0 * * * *  /usr/local/bin/freshclam &#8211;quiet -l /var/log/clam-update.log<br />
Download latest updates now</p>
<p>/usr/local/bin/freshclam -v<br />
=========================================================================<br />
RAZOR V2</p>
<p><a href="http://razor.sourceforge.net/">http://razor.sourceforge.net/</a></p>
<p>If Razor is installed, SpamAssassin will automatically include it in the<br />
list of tests run. We found that Razor is quite accurate in identifying<br />
spam, and it only added small amount of extra CPU load on the server, so<br />
it is definitely worth installing.</p>
<p>Compile and install :</p>
<p># install the pre-requisite modules for razor<br />
perl -MCPAN -e shell<br />
#(enter your way through all the questions. The only one you will likely<br />
have to answer is regarding your Continent/Country)<br />
# tell the cpan shell to follow the dependency tree and automatically grab<br />
any required modules<br />
o conf prerequisites_policy follow<br />
# make sure you have some of the basic tools needed to get the CPAN<br />
downloads working smoothly<br />
install LWP MD5<br />
# install the razor pre-requisites now<br />
install Net::Ping Net::DNS Time::HiRes Digest::SHA1 Getopt::Long File<br />
::Copy Digest::Nilsimsa URI::Escape<br />
quit<br />
# now install the actual razor software<br />
tar xzf razor-agents-2.67.tar.gz<br />
chown -R root.root razor-agents-2.67<br />
cd razor-agents-2.67<br />
perl Makefile.PL<br />
make<br />
make test<br />
make install<br />
cd ..<br />
The Razor programs will now be installed in /usr/bin. In particular,<br />
SpamAssassin makes use of the program called : &#8220;razor-check&#8221;</p>
<p>Last job is to create the Razor configuration<br />
files (they get put into /etc/razor/) by using these commands :</p>
<p>razor-client<br />
razor-admin -d -create -home=/etc/razor<br />
If your server is going to be busy, then I would recommend<br />
you edit the razor config file and turn down the debugging level a bit :</p>
<p>vi /etc/razor/razor-agent.conf<br />
debuglevel=1</p>
<p>==========================================================================<br />
Fetchmail(offline Mail server)<br />
$vi /root/.fretchmail<br />
#set no bouncemail<br />
poll pop.websurfer.com.np with proto pop3  and options no dns<br />
aka nepal.com<br />
user &#8220;info&#8221; there with password &#8220;catchme&#8221; is * here expunge 10</p>
<p>$vi /root/.mailscript<br />
#!/bin/sh<br />
echo &#8220;**************************&#8221;<br />
/bin/date<br />
/usr/bin/fetchmail -v -a<br />
/usr/sbin/sendmail -bp<br />
/usr/sbin/sendmail -q</p>
<p>crontab<br />
0-59 * * * * /root/.mailscript &gt;&gt; /var/log/fetchmaillog</p>
<p>=================================================================<br />
FTP<br />
$vi /etc/vsftpd/vsftpd.conf<br />
anonymous_enable=NO<br />
ftpd_banner=Welcome to Nepal FTP Server.<br />
chroot_local_user=YES</p>
<p>=================================================================<br />
DHCP<br />
1)vi /etc/dhcpd.conf<br />
(/usr/share/doc/dhcp-&lt;version-number&gt;/dhcpd.conf.sample)<br />
authoritative;<br />
ddns-update-style none; (ad-hoc/interim;)<br />
default-lease-time 604800;<br />
max-lease-time 2592000;<br />
option routers 192.168.0.1;<br />
option domain-name-servers 192.168.0.5;<br />
option domain-name-servers 192.168.0.6;<br />
option subnet-mask 255.255.255.0;<br />
option broadcast-address 192.168.0.255;</p>
<p>subnet 192.168.0.0 netmask 255.255.255.0 {<br />
range 192.168.0.200 192.168.0.250;<br />
}</p>
<p>host mailserver {<br />
hardware ethernet 00:02:44:4A:E8:B1;<br />
fixed-address 192.168.0.8;<br />
}</p>
<p>host sabin {<br />
hardware ethernet 00:0C:29:07:8F:2D;<br />
fixed-address 192.168.0.70;</p>
<p>2)vi /etc/sysconfig/dhcpd<br />
# Command line options here<br />
DHCPDARGS=eth0</p>
<p>touch /var/lib/dhcp/dhcpd.leases</p>
<p>3)vi /etc/sysconfig/dhcrelay<br />
(The DHCP Relay Agent (dhcrelay) allows you to relay DHCP<br />
and BOOTP requests from a subnet with no DHCP server on it<br />
to one or more DHCP servers on other subnets)</p>
<p>service dhcrelay start<br />
====================================================================<br />
PPP Server<br />
vi /etc/inittab<br />
S1:2345:respawn:/sbin/mgetty -D /dev/ttyS1</p>
<p>vi /etc/ppp/options.server<br />
-detach<br />
asyncmap 0<br />
modem<br />
crtscts<br />
lock<br />
require-pap<br />
refuse-chap<br />
login<br />
proxyarp<br />
192.168.59.1:192.168.59.100<br />
ms-dns 192.168.59.7</p>
<p>vi /etc/ppp/options<br />
noauth<br />
defaultroute<br />
lock<br />
ipcp-accept-local<br />
ipcp-accept-remote<br />
usepeerdns<br />
passive</p>
<p>vi /etc/ppp/resolv.conf<br />
nameserver 202.52.255.47<br />
nameserver 202.52.255.3</p>
<p>5)vi /etc/syslog.conf<br />
daemon.* /dev/console</p>
<p>6) cat /etc/ppp/pap-secrets</p>
<p>[root@mail ppp]# cat pap-secrets<br />
# Secrets for authentication using PAP<br />
# client        server  secret                  IP addresses<br />
*               *       &#8220;&#8221;                              *</p>
<p>7) vi /etc/mgetty+sendfax/ login.config<br />
/AutoPPP/ -     -       /usr/sbin/pppd file /etc/ppp/options.server</p>
<p>#Callback conf<br />
back &#8211; - /usr/sbin/callback -S 4352548<br />
=======================================================================<br />
Webmin (Web Administration)<br />
Installed Directory (/var/libexec/mrtg)<br />
$./setup.sh</p>
<p><a href="http://192.168.59.7:10000">http://192.168.59.7:10000</a><br />
========================================================================<br />
YP(NIS server)<br />
Daemon: portmap,ypbind,yptools,ypserv,ypxfrd,nfslock,nfs<br />
1) vi /etc/sysconfig/network<br />
NISDOMAIN=nis1.nepal.com<br />
2) domainname nepal.com<br />
/var/yp/Makefile<br />
all:passwd group hosts<br />
nopush=true,merge_groups=files<br />
/var/yp/make [passwd shadow host]<br />
service portmap start<br />
service ypserv start<br />
/usr/lib/yp/ypinit -m [-s masterservers]<br />
/var/yp/ypservers<br />
service yppasswdd start<br />
service ypserv start</p>
<p>rpcinfo -p localhost<br />
if new user added<br />
/var/yp/make</p>
<p>$ypmatch nisuser passwd<br />
getent passwd nisuser</p>
<p>/var/yp/securenets[network security]<br />
/etc/nsswitch.conf[files dns,nis]</p>
<p># /etc/yp.conf &#8211; ypbind configuration file<br />
ypserver 127.0.0.1<br />
Client<br />
portmap,ypbind,yptools<br />
1) /etc/sysconfig/network<br />
NISDOMAIN=server1.sabin.com<br />
authconfig [/etc/yp.conf]<br />
ypcat passwd[must execute when new useris added]<br />
ypwhich,ypcat,ypchfn,ypchsh,yppasswd,ypush</p>
<p>NFS</p>
<p>/etc/exports<br />
/home *(rw)<br />
service nfs restart<br />
exportfs -r<br />
exportfs -v<br />
exportfs -u<br />
exportfs -a</p>
<p>/etc/auto.master<br />
/home /etc/auto.home &#8211;timeout 60</p>
<p>/etc/auto.home<br />
* -rw,soft,intr 192.168.0.1:/home/&amp;<br />
or<br />
*   -fstype=nfs,soft,intr,rsize=8192,wsize=8192,nosuid,tcp \<br />
192.168.1.100:/home:&amp;</p>
<p>service autofs restart<br />
======================================================================<br />
SAMBA (SWAT Makes Samba Simpler <a href="http://localhost:901">http://localhost:901</a>)<br />
share a linux drive with win machine<br />
share a win datat in linux<br />
share a linux printer with win machine<br />
share a win printer with linux<br />
1.FOR Win 95/98 &#8211; regedit hkey_Local_Machine/system/currentcontrol/services/VxD/vnetsup/<br />
Add a new Dword value: EnablePlanTextPassword 0&#215;01<br />
2.NT HKEY_LOCAL_MACHINE/system/CurrentControl/services/Rdr\parameters\<br />
&#8212;&#8212;<br />
Dword<br />
EnablePlanTextPassword 0&#215;01<br />
2000<br />
&#8212;-<br />
Hkey_local_machine\system\current\services\Rdr\Parameters<br />
EnablePlainTextPassword ox01</p>
<p>Swat<br />
chkconfig swat on<br />
<a href="http://localhost:901">http://localhost:901</a></p>
<p>1)vi /etc/samba/smb.conf</p>
<p>Section Description<br />
[global] General Samba configuration parameters<br />
[printers] Used for configuring printers<br />
[homes] Defines treatment of user logins<br />
[netlogon] A share for storing logon scripts.<br />
(Not created by default.)<br />
[profile] A share for storing domain logon information such as<br />
&#8220;favorites&#8221; and desktop icons.(Not created by default.)</p>
<p>[global]</p>
<p>workgroup = HOMENET<br />
server string = Sabin Server<br />
host allow =192.168.0.<br />
printing = lprng<br />
printcap name =/etc/printcap<br />
security= user share<br />
security=[users,shares,server,domain]<br />
load printers = yes<br />
guest account = sabin<br />
allow hosts = host list<br />
deny hosts = host list<br />
admin users = users list</p>
<p>[global] for domain<br />
workgroup = HOMENET<br />
time server = Yes<br />
domain logons = Yes<br />
os level = 65<br />
preferred master = Yes<br />
domain master = Yes<br />
[homes]<br />
read only = No<br />
browseable = No<br />
create mask = 0644<br />
directory mask = 0755</p>
<p>[netlogon]<br />
path = /home/samba/netlogon<br />
guest ok = Yes</p>
<p>[profiles]<br />
path = /home/samba/profiles<br />
read only = No<br />
create mask = 0600<br />
directory mask = 0700<br />
[printers]<br />
comment = All Printers<br />
path = /var/spool/samba<br />
printable = Yes<br />
browseable = No<br />
public = yes</p>
<p>[tmp]<br />
comments = sabin share<br />
path = /tmp<br />
valid users = sabin<br />
public = no<br />
writable =yes<br />
printable=no<br />
guest ok = yes<br />
only guest = yes<br />
create mask = 0765<br />
read only = yes<br />
write list= @manager</p>
<p>Authentication from NT<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
encrypt password = yes<br />
security = server<br />
password server = &lt;netbios name&gt; of PDC</p>
<p>wins<br />
&#8212;&#8211;<br />
wins supoort = yes<br />
wins server = IP of wins server</p>
<p>Authentication Server:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
encrypt password = yes<br />
domain logons = yes<br />
OS level = 033<br />
[NET LOGON]<br />
path = &lt;someshare in fs&gt;<br />
read only = yes</p>
<p>SAMBA as a PDC ( primary domian controller)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
[ global section]<br />
workgroup =<br />
netbios name =<br />
domain logons = yes<br />
security = user<br />
local master = yes<br />
os level = 65 | 64<br />
preferred master = yes<br />
domain master = yes<br />
logon path = <a href="file://\\%N\profiles\%U">\\%N\profiles\%U</a><br />
logon home = <a href="file://%3chomeserver%3e/%25U">\\&lt;homeserver&gt;\%U</a><br />
[netlogon]<br />
path = /usr/local/samba/netlogon</p>
<p>root is a Admin user for domain<br />
groupadd sysadmin</p>
<p>domain admin group = @sysadmin<br />
admin users = @sysadmin<br />
printer admin = @sysadmin</p>
<p>Dynamic Creation Of Machine Trust Accounts<br />
[global]<br />
# &lt;&#8230;remainder of parameters&#8230;&gt;<br />
add machine script = /usr/sbin/useradd -d /dev/null -g samba-clients -s /bin/false -M %u<br />
groupadd samba-clients<br />
2)smbpasswd -a root password</p>
<p>smbclient //192.168.0.1/abc -U sabin<br />
nmblookup server -R sabin| nmb \*<br />
smbmount //server/share /mnt/sab -o username=sabin<br />
fstab<br />
//server/1/public /mnt/smb smbfs defaults,username=sabin 0 0<br />
password file= /etc/samba/samba<br />
smbadduser root:sabin<br />
smbpasswd -U root</p>
<p>smclient //station5 -U &lt;username%password&gt;</p>
<p>smbclient //server1/myshare  -N -Tx backup.tar<br />
smbclient //server1/myshare  -N -TXx backup.tar /users/doc<br />
mount -t smbfs -o username=admin%passwd IP //server/share /mnt/share<br />
smbmount //server/share mnt_pt -o username=xxxx%pass</p>
<p>======================================================================<br />
LDAP<br />
1. /etc/openldap/slapd.config<br />
suffix &#8220;dc=example,dc=com&#8221;<br />
rootdn &#8220;cn =root , dc=examplex,dc=com&#8221;<br />
rootpw  secret (crypt)<br />
perl -e &#8221; print crypt (&#8216;passwd&#8217;,'a_shell&#8217;);&#8221;<br />
Migrate all users in LDAP server<br />
2. create users student 1 &#8211; student with redhat1 &#8211; redhat9<br />
#!/bin/bash<br />
for 1 in `seq 1 9` ; do<br />
useradd student$1<br />
echo &#8220;redhat$1&#8243; |passwd &#8211;stdin student$1<br />
done<br />
3. /usr/share/openldap/migration<br />
migrate_common.ph<br />
$DEFAULT_MAIL_DOMAIN=&#8221;stationX. example.com<br />
$DEFAULT_BASE=&#8221;dc=example, dc=com&#8221;</p>
<p>/etc/protocols<br />
/etc/services<br />
comment all #+<br />
./migrate_all_offline.sh<br />
./migrate_all_nis_online.sh<br />
&#8220;       &#8220;   &#8220;    &#8221;<br />
file of ldap:<br />
/var/lib/ldap<br />
chown -R ldap.ldap /var/lib/ldap<br />
service ldap restart<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
client side:<br />
graphical LDAP client<br />
preferences select server tab<br />
Name&#8211; stationx.example.com<br />
LDAPHOST:  &#8221;<br />
BASE DN: dc=example,dc=com<br />
=========================================================================<br />
LDAP<br />
Scenario<br />
The I.T. department in a small organization &#8220;nepal.com&#8221; has<br />
many Linux servers they need to administer.</p>
<p>1. They want a simple, secure, centralized login scheme for all of them.<br />
2. They have decided to use the LDAP domain &#8220;example.com&#8221; for their LDAP<br />
database in which one domain component (DC) will be &#8220;example&#8221;, and<br />
the other will be &#8220;com&#8221;.<br />
3. The database will only have one organizational unit simply called<br />
&#8220;People&#8221; which is the LDAP default.<br />
4. Each person will have attributes such as a username (User ID or UID),<br />
password, Linux &#8220;home&#8221; directory and login shell.<br />
5. The Fedora Linux server named &#8220;nepal&#8221; will act as the LDAP server<br />
containing the database and has the IP address 192.168.1.100.<br />
6. The Fedora Linux server named &#8220;sabin&#8221; will be used to test the system<br />
as the LDAP client and has the IP address 192.168.1.102.<br />
7. Server &#8220;nepal&#8221; has a special user account named &#8220;ldapuser&#8221; that will<br />
be used to test the LDAP logins.</p>
<p>Required LDAP Server RPMS<br />
openldap,openldap-clients,openldap-devel,nss_ldap,openldap-servers<br />
Required LDAP Client RPMS<br />
openldap,openldap-clients,openldap-devel,nss_ldap</p>
<p>1)Create a database directory<br />
mkdir /var/lib/ldap/example.com<br />
chown ldap:ldap /var/lib/ldap/example.com</p>
<p>2)Create an LDAP &#8220;root&#8221; password<br />
slappasswd<br />
{SSHA}v4qLq/qy01w9my60LLX9BvfNUrRhOjQZ</p>
<p>3)vi /etc/openldap/slapd.conf<br />
database        ldbm<br />
suffix          &#8221;dc=example,dc=com&#8221;<br />
rootdn          &#8221;cn=Manager,dc=example,dc=com&#8221;<br />
rootpw          {SSHA}v4qLq/qy01w9my60LLX9BvfNUrRhOjQZ<br />
directory       /var/lib/ldap/example.com<br />
4)service ldap start</p>
<p>5)Create the &#8220;ldapuser&#8221; test account<br />
useradd -g users ldapuser<br />
passwd ldapuser<br />
grep ldapuser /etc/passwd &gt; /etc/openldap/passwd.ldapusers<br />
grep root /etc/passwd &gt;   /etc/openldap/passwd.root</p>
<p>6)Find the conversion script<br />
slocate -u<br />
locate migrate<br />
(/usr/share/openldap/migration/migrate_passwd.pl)</p>
<p>7) Convert user&#8217;s to ldap<br />
/usr/share/openldap/migration/migrate_passwd.pl \<br />
/etc/openldap/passwd.ldapusers /etc/openldap/ldapusers.ldif</p>
<p>/usr/share/openldap/migration/migrate_passwd.pl \<br />
/etc/openldap/passwd.root /etc/openldap/root.ldif</p>
<p>8)Edit the user LDIF file<br />
vi /etc/openldap/ldapusers.ldif<br />
:%s/padl/example/g</p>
<p>vi /etc/openldap/root.ldif<br />
:%s/padl/example/g<br />
under the UID line in the file.<br />
cn: Manager</p>
<p>9) vi etc/openldap/example.com.ldif<br />
dn: dc=example,dc=com<br />
dc: example<br />
description: Root LDAP entry for example.com<br />
objectClass: dcObject<br />
objectClass: organizationalUnit<br />
ou: rootobject</p>
<p>dn: ou=People, dc=example,dc=com<br />
ou: People<br />
description: All people in organisation<br />
objectClass: organizationalUnit</p>
<p>10)Import the LDIF files into the database</p>
<p>ldapadd -x -D &#8220;cn=Manager,dc=example,dc=com&#8221; \<br />
-W -f /etc/openldap/example.com.ldif</p>
<p>ldapadd -x -D &#8220;cn=Manager,dc=example,dc=com&#8221; \<br />
-W -f /etc/openldap/root.ldif</p>
<p>ldapadd -x -D &#8220;cn=Manager,dc=example,dc=com&#8221; \<br />
-W -f /etc/openldap/ldapusers.ldif<br />
11) Test the LDAP database<br />
ldapsearch -x -b &#8216;dc=example,dc=com&#8217; &#8216;(objectclass=*)&#8217;</p>
<p>Client<br />
1)vi /etc/openldap/ldap.conf<br />
HOST 192.168.1.100<br />
BASE dc=example,dc=com</p>
<p>2)vi  /etc/nsswitch.conf<br />
$authconfig<br />
[*] Use Shadow Passwords<br />
[*] Use MD5 Passwords<br />
[*] Use LDAP                   [ ] Use TLS<br />
Server: 192.168.1.100<br />
Base DN: dc=example,dc=com<br />
3) Create a home directory for ldap<br />
mkdir /home/ldapuser<br />
chmod 700 /home/ldapuser/<br />
chown ldapuser:users /home/ldapuser/<br />
ll /home<br />
cp /etc/skel/.* /home/ldapuser/<br />
chown ldapuser:users /home/ldapuser/.*</p>
<p>4)vi /usr/local/bin/addldapuser (adduser)<br />
#!/bin/bash<br />
grep $1 /etc/passwd &gt; /tmp/changeldappasswd.tmp<br />
/usr/share/openldap/migration/migrate_passwd.pl \<br />
/tmp/changeldappasswd.tmp /tmp/changeldappasswd.ldif.tmp<br />
cat /tmp/changeldappasswd.ldif.tmp | sed s/padl/example/ \<br />
&gt; /tmp/changeldappasswd.ldif<br />
ldapadd -x -D &#8220;cn=Manager,dc=example,dc=com&#8221; -W -f \<br />
/tmp/changeldappasswd.ldif<br />
rm -f /tmp/changeldappasswd.*</p>
<p>5)addldapuser ldapuser<br />
Create home directories for the user on all the LDAP client Linux boxes</p>
<p>6) vi/usr/local/bin/deleteldapuser<br />
#!/bin/bash<br />
ldapdelete -x -W -D &#8220;cn=Manager,dc=example,dc=com&#8221; \<br />
&#8220;uid=$1,ou=People,dc=example,dc=com&#8221;<br />
7)deleteldapuser ldapuser</p>
<p>8)vi /usr/local/bin/modifyldapuser<br />
#!/bin/bash<br />
grep $1 /etc/passwd &gt; /tmp/modifyldapuser.tmp<br />
/usr/share/openldap/migration/migrate_passwd.pl \<br />
/tmp/modifyldapuser.tmp /tmp/modifyldapuser.ldif.tmp<br />
cat /tmp/modifyldapuser.ldif.tmp | sed s/padl/example/ \<br />
&gt; /tmp/modifyldapuser.ldif<br />
ldapmodify -x -D &#8220;cn=Manager,dc=example,dc=com&#8221; -W -f \<br />
/tmp/modifyldapuser.ldif<br />
rm -f /tmp/modifyldapuser.*</p>
<p>9)passwd ldapuser<br />
modifyldapuser ldapuser</p>
<p>LDAP Web Management Tools<br />
The LDAP Account Manager (LAM) available at <a href="http://lam.sourceforge.net/">http://lam.sourceforge.net/</a><br />
=========================================================================<br />
TOMCAT server(JSP)</p>
<p>=======================================================================<br />
NTP Server<br />
<a href="http://www.eecis.udel.edu/~mills/ntp/servers.html">http://www.eecis.udel.edu/~mills/ntp/servers.html</a><br />
1) vi /etc/ntp.conf<br />
server otherntp.server.org<br />
server ntp.research.gov</p>
<p>restrict otherntp.server.org   mask 255.255.255.255 nomodify notrap noquery<br />
restrict ntp.research.gov      mask 255.255.255.255 nomodify notrap noquery</p>
<p>restrict 192.168.1.0 mask 255.255.255.0 notrust nomodify notrap<br />
restrict 127.0.0.1</p>
<p>2)ntpdate -u 192.168.1.100<br />
ntpq -p<br />
======================================================<br />
CLOCK<br />
<a href="http://www.nixcraft.com/uniqlinuxfeatures/tools/">http://www.nixcraft.com/uniqlinuxfeatures/tools/</a><br />
vivek-tech.com</p>
<p># $ clock &amp;<br />
#<br />
echo<br />
echo &#8220;Digital Clock for Linux&#8221;<br />
echo &#8220;To stop this clock use command kill pid, see above for pid&#8221;<br />
echo &#8220;Press a key to continue. . .&#8221;</p>
<p>while :<br />
do<br />
ti=`date +&#8221;%r&#8221;`<br />
echo -e -n &#8220;\033[7s"    #save current screen postion &amp; attributes<br />
#<br />
# Show the clock<br />
#</p>
<p>tput cup 0 69          # row 0 and column 69 is used to show clock</p>
<p>echo -n $ti            # put clock on screen</p>
<p>echo -e -n "\033[8u"   #restore current screen postion &amp; attributs<br />
#<br />
#Delay fro 1 second<br />
#<br />
sleep 1<br />
done<br />
find / -type f -perm +6000 -ls<br />
find / -perm -2 ! -type l -ls<br />
find / -nouser -o -nogroup<br />
====================================================================<br />
VPN<br />
ipsec-tools,openswan-2.1.4-1.fc2.i386.rpm<br />
chkconfig ipsec on<br />
ipsec verify</p>
<p>1)vi /etc/sysctl.conf<br />
net/ipv4/ip_forward = 1</p>
<p>2)sysctl -p</p>
<p>VPN Configuration Steps (Using RSA Keys)</p>
<p>Left Internet IP address of the left hand side VPN device<br />
Leftsubnet The network protected by the left hand side VPN device<br />
Leftid Fully Qualified Domain Name in DNS of the left hand side VPN<br />
device preceded by an "@" sign. If DNS hasn't been set up for<br />
the IP addresses, then you'll want to remove this entry as names<br />
that don't resolve correctly will cause the VPN initialization to fail.<br />
Leftrsasigkey The entire "left" RSA sig public key for the left hand side<br />
VPN device. This can be obtained by using the "ipsec showhostkey --left" command.<br />
Leftnexthop The next hop router from the left hand side VPN device when t<br />
trying to reach the right hand side VPN device. You may use an<br />
auto-generated variable "%defaultroute" which will be valid in most<br />
cases, or the actual IP address of the next hop router in cases where<br />
the next hop is not the default router.<br />
Right Internet IP address of the right hand side VPN device<br />
Rightsubnet The network protected by the right hand side VPN device<br />
Rightid Fully Qualified Domain Name in DNS of the right hand side VPN device<br />
preceded by an "@" sign. If DNS hasn't been set up for the IP<br />
addresses, then you'll want to remove this entry as names that don't<br />
resolve correctly will cause the VPN initialization to fail.<br />
Rightrsasigkey The entire "right" RSA sig public key for the right hand side<br />
VPN device. This can be obtained by using the "ipsec showhostkey --right" command.<br />
Rightnexthop The next hop router from the right hand side VPN device when<br />
trying to reach the right hand side VPN device. You may use an auto-generated<br />
variable "%defaultroute" which will be valid in most cases, or the actual<br />
IP address of the next hop router in cases where the next hop is not the default router.</p>
<p>Creating Your Own Keys<br />
ipsec rsasigkey --verbose 2048 &gt; keys.tmp</p>
<p>Get The Left Public Key<br />
ipsec showhostkey --left &gt; /tmp/left.pub</p>
<p>Get The Right Public Key<br />
ipsec showhostkey --right &gt; /tmp/right.pub<br />
1)The /etc/ipsec.conf file<br />
( It is important to maintain the indentation,<br />
The "net-to-net" sub sections must be the same in the<br />
/etc/ipsec.conf for both the left and right hand side VPN devices.<br />
There must be no blank lines in the net-to-net section between<br />
parameters. Lines commented with a "#" are acceptable<br />
Restarting IPSec to reload the configuration file doesn't<br />
necessarily restart the tunnels. If you set the "auto=" parameter<br />
to "add", the tunnel will only be started manually with the "ipsec"<br />
command. If the parameter is commented out then the tunnel will<br />
never start. A value of "start" will cause the tunnel to start<br />
automatically.)<br />
#<br />
# File: /etc/ipsec.conf<br />
#<br />
conn net-to-net<br />
left=97.158.253.25             # Public Internet IP address of the<br />
# LEFT VPN device<br />
leftsubnet=172.16.1.0/24       # Subnet protected by the LEFT VPN device<br />
<a href="mailto:leftid=@vpn1.my-site.com">leftid=@vpn1.my-site.com</a> # FQDN of Public Internet IP address of the<br />
# LEFT VPN device with an "@"<br />
leftrsasigkey=0sAQNrV9AYdaW94FXvIxu5p54+MRaW0wy0+HHQrdGofklZYQ4TCBlL+Ym00Ah<br />
fc8mqXlerZY12Os41G8SIV+zzIO04WZ4wmOvEr8DZaldTbfCuvUvMhrTtCpZdm53yF5rCaUbg+Vmx71<br />
fgyVmGu8/kuhzB7nWtOYqDFO8OHDGePOyOVPQi73KfRoDbdb3ND0EtfnRhRPblKJ239OlIq1<br />
leftnexthop=%defaultroute      # correct in many situations<br />
right=6.25.232.1               # Public Internet IP address of<br />
# the RIGHT VPN device<br />
rightsubnet=10.0.0.0/24        # Subnet protected by the RIGHT VPN device<br />
<a href="mailto:rightid=@vpn2.another-site.com">rightid=@vpn2.another-site.com</a> # FQDN of Public Internet IP address of the<br />
# RIGHT VPN device with an "@"<br />
rightrsasigkey=0sAQNNdxFPWCga+E/AnDgIM+uIDq4UXcZzpomwMFUpyQ9+rhUHT9w8nr3rjU<br />
R/qTZOKR2Vqd4XoBd1HkPDBQ8oNjtA3Oz+UQOU3KTMHN5ydFwe6MpTJV/hL6LvhB0OXQad/NhjMIx8v<br />
OnhM8g8SPRnj7pL3abgu7Sg7eFREV1MJSVBhp0DJ0EbVMVV+Xvwlm9++9zbY3mlc+cSXMPAJZ<br />
rightnexthop=97.158.253.25     # correct in many situations<br />
auto=start                     # authorizes and starts this connection<br />
# on booting<br />
2) service ipsec restart</p>
<p>3)Initialize The New Tunnel<br />
ipsec auto --up net-to-net</p>
<p>4)Possible Changes To IP Tables NAT/Masquerade Rules<br />
If you are running iptables with masquerading/NAT the VPN devices<br />
then you will have to exclude packets traversing the tunnel from<br />
the NAT operation. This example assumes that interface eth0 is the<br />
Internet facing interface on your Linux VPN/firewall.</p>
<p>Left Hand Side VPN Device<br />
Old<br />
iptables -t nat -A POSTROUTING -o eth0 -s 172.168.1.0/24 -j MASQUERADE</p>
<p>New<br />
iptables -t nat -A POSTROUTING -o eth0 -s 172.168.1.0/24 -d \! 10.0.0.0/24 -j MASQUERADE</p>
<p>Right Hand Side VPN Device<br />
Old<br />
iptables -t nat -A POSTROUTING -o eth0 -s 10.0.0.0/24 -j MASQUERADE</p>
<p>New<br />
iptables -t nat -A POSTROUTING -o eth0 -s 10.0.0.0/24 -d \! 176.16.1.0/24 -j MASQUERADE</p>
<p>5)How To Ensure Openswan Starts When Rebooting<br />
If your VPN sub- section in the /etc/ipsec.conf file has the line "auto=add"<br />
in it then IPSec will only authorize but won't establish the connection at<br />
startup. You'll have to use the "ipsec auto --up &lt;vpn-name&gt;" command to start it manually.<br />
You'll need to change this to "auto=start" for openswan to automatically<br />
start the VPN when IPSec restarts or when the system reboots.</p>
<p>6)Using Pre-Shared Keys (PSK)<br />
ipsec ranbits --continuous 128</p>
<p>7)Update /etc/ipsec.secrets<br />
vpn1-ip-address vpn2-ip-address : PSK "key in quotations"<br />
97.158.253.25 6.25.232.6 : PSK "nonebutourselvescanfreeourminds"</p>
<p>8)Update /etc/ipsec.conf<br />
authby=secret                # Key exchange method<br />
auto=start                   # authorizes and starts this connection</p>
<p>=============================================================================<br />
Tripwire<br />
config file= /etc/tripwire/twcfg.txt<br />
policy file= /etc/tripwire/tw.opl<br />
database =/var/lib/tripwire/$hostname.twd</p>
<p>1) /etc//tripwire/twinstall.sh<br />
/sbin/tripwire --init<br />
/sbin/tripwire --start</p>
<p>2)integrity check<br />
/sbin/tripwire --check</p>
<p>Report<br />
twprint -m r --twrfile /var/lib/tripwire/report/&lt;name.twr</p>
<p>viewing  tripwire database<br />
twprint -m -d --print -dbfile |less</p>
<p>updating policy<br />
twadmin --print-palfile&gt;/etc/tripwire/twpol.txt</p>
<p>specific files<br />
twprint -m -d --print -dbfile /etc/hosts</p>
<p>tripwire --update --twfile /var/lib/tripwire/report/name.twr<br />
=======================================================================<br />
PAM<br />
=======================================================================<br />
Process Accounting<br />
pcacct*.rpm<br />
$ac=/var/log/wtmp<br />
$action:process account off or on<br />
$accton /var/log/pacct<br />
lastcomm<br />
sa=summarize<br />
sa /var/log/savacct<br />
sa /var/log/usracct</p>
<p>gtop,kpm,xosview,xload,xsysinfo,top</p>
<p>=======================================================================<br />
TCP Wrappers<br />
vi /etc/host.allow<br />
vi /etc/host.deny<br />
&lt;daemonlist&gt;:&lt;clientlist&gt;[:&lt;option&gt;:&lt;options&gt;...]</p>
<p>&lt;daemonlist&gt;=processname(not service) /ALL<br />
&lt;clientlist&gt;=hostname/IP<br />
&lt;option&gt;=allow,deny,alter</p>
<p>vi /etc/host.allow<br />
vsftpd:.example.com<br />
sshd:.example.com\<br />
:spawn /bin/echo `\bin\date` access denied&gt;&gt;/var/log/sshd.log :deny</p>
<p>WILD CARDS<br />
ALL,LOCAL,KNOWN,UNKNOWN,PARANOID(host &amp;ip donot match)</p>
<p>ALL;.example.com<br />
ALL:192.168.<br />
ALL:192.168.0.0/255.255.255.0<br />
in.telnetd:/etc/telnets.hosts<br />
ALL:.example.com EXCEPT sabin.example.com<br />
ALL EXCEPT vsftpd:192.168.0</p>
<p>deny<br />
sshd:.example.com:servrity emerg<br />
sshd:example.com:severity local0.alert</p>
<p>sshd:client1.nepal.com:allow<br />
sshd:client2.nepal.com:deny</p>
<p>Spawn ,twist<br />
in.telnetd:example.com\<br />
:spawn \bin\echo \bin\date from %h&gt;&gt;/var/log/telnet:allow<br />
vsftpd:.example.com\<br />
twist /bin/echo &#8220;bod guy go away&#8221;</p>
<p>=======================================================================<br />
Xinetd<br />
/etc/xinetd.conf<br />
/etc/xinetd.d/<br />
LOG_ON_SUCCESS.LOG_ON_FAILURE,<br />
ATTEMPT,DURATION,EXIT,HOST,PID,RECORD,USERID,</p>
<p>only_from,no_access,access_times(HH:MM-HH:MM)<br />
service telnet<br />
{<br />
disable=no<br />
flags=reuse<br />
socket_type=stream<br />
wait =no<br />
user=root<br />
server=/usr/sbin/in/telnet.d<br />
log_on_failure +=USERID<br />
no_access=192.168.0.0/24<br />
log_on_success +=PID HOST EXIT<br />
access_times=9:00-1600<br />
}<br />
NAT<br />
bind =123.123.123.123<br />
redirect=10.10.10.12 21 23</p>
<p>per_source(no of instances)<br />
cps=max connection per second<br />
max_load=cp usage thereshold for a service</p>
<p>=======================================================================<br />
IPtables<br />
=======================================================================<br />
Selinux<br />
*/selinux filesystem<br />
access<br />
context<br />
create<br />
enforce<br />
load<br />
policyvers<br />
relabel<br />
user</p>
<p>*security.selinux<br />
getfattr -m . -d /etc/passwd<br />
1) Permissive mode<br />
2) Rebuilding policies<br />
3) Labeling files<br />
4) Routine system administration (changing roles,<br />
adding users, and checking file contexts)<br />
5) Monitoring SELinux through log files<br />
6) Miscellaneous troubleshooting</p>
<p>1)System Modes and SELinux Tuning<br />
+ permissive mode that’s useful for policy troubleshooting and system maintenance.<br />
permissive mode is used when configuring, testing, and troubleshooting SELinux<br />
and the SELinux security policy. Under permissive mode, SELinux permits all operations,<br />
even those that violate the SELinux security policy.<br />
+ enforcing mode (sometimes called enforcement mode). Enforcing mode is the<br />
normal mode of SELinux operation. Under enforcing mode, operations that violate<br />
the SELinux security policy are prevented.</p>
<p>a) Switching the SELinux mode<br />
kernel /vmlinuz-2.6.4-1.305 ro root=LABEL=/ enforcing=1<br />
append=&#8221;enforcing=0&#8243;(lilo)</p>
<p>To enter enforcing mode, issue the command:<br />
echo &#8220;1&#8243; &gt; /selinux/enforce</p>
<p>Similarly, to enter permissive mode, issue the command:<br />
echo &#8220;0&#8243; &gt; /selinux/enforce</p>
<p>setenforce 0<br />
getenforce<br />
vi /etc/selinux<br />
To disable (boot parameter<br />
selinux=0<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
2) Loading a security policy<br />
rpm=checkpolicy,selinux*<br />
/etc/selinux/src/policy<br />
Make target Compiles the policy from source? Installs the policy? Loads or reloads the policy?<br />
policy Yes No No<br />
install Yes Yes No<br />
load Yes Yes Yes<br />
reload Yes Yes Yes<br />
relabel No No No</p>
<p>a)su -<br />
b)newrole -r sysadm_r<br />
c)cd /etc/selinux/src/policy<br />
d)make target<br />
e)make reload<br />
checkpolicy=The SELinux policy compiler<br />
load_policy=A utility that loads the SELinux binary policy into the running kernel<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
3) Labeling files<br />
a)su -<br />
newrole -r sysadm_r<br />
cd /etc/selinux/src/policy<br />
make relabel</p>
<p>usr/bin/chcon<br />
Labels one or more files with a specified security context<br />
chcon system_u:object_r:etc_t /etc/hosts /etc/hosts.allow</p>
<p>/sbin/fixfiles<br />
Labels all available filesystems according to the contents of the standard specification<br />
file, src/policy/file_contexts/file_contexts<br />
fixfiles check</p>
<p>/sbin/restorecon<br />
Labels one or more files according to the contents of the standard specification<br />
file, src/policy/file_contexts/file_contexts<br />
restorecon /etc/hosts</p>
<p>/usr/sbin/setfiles<br />
Labels one or more files or filesystems according to the contents of a specification<br />
file<br />
setfiles src/policy/file_contexts/file_contexts /etc/hosts</p>
<p>Tuning Fedora Core 2 SELinux<br />
Fedora Core 2 implementation of<br />
SELinux provides two convenient ways of tailoring SELinux operation:<br />
i) Macros<br />
ii) Policy Booleans</p>
<p>i)Macros<br />
src/policy/tunable.te</p>
<p>Policy macro      Active by default?         Description<br />
allow_user_direct_mouse Yes Allow regular users direct access to the mouse device file<br />
(otherwise allow only the X server to do so).<br />
allow_user_dmesg Yes Allow users to run the dmesg command<br />
allow_user_tcp_server Yes Allow users to run TCP servers (bind to ports and accept<br />
connection from the same domain and outside users).<br />
Disabling this Boolean forces FTP passive mode and may<br />
affect other protocols (including IRC if single_<br />
userdomain is defined).<br />
allow_xserver_home_fonts Yes Allow X server to check for fonts in ~/.gnome or ~/.kde.<br />
allow_ypbind Yes Allow ypbind to run with NIS.<br />
direct_sysadm_daemon Yes Allow sysadm_t to start daemons directly.<br />
ftp_home_dir No Allow FTP to read/write files in user home directories.<br />
ftpd_is_daemon Yes Allow FTP to run from inetd instead of as a stand-alone<br />
daemon.<br />
hide_broken_symptoms No Adds dontaudit rules for broken polices that are not<br />
security risks.<br />
nfs_export_all_ro No Allow reading on any filesystem.<br />
nfs_export_all_rw Yes Allow read/write/create on any filesystem.<br />
nfs_home_dirs Yes Allow NFS home directories.<br />
nscd_all_connect Yes Allow all domains to access NSCD.<br />
read_default_t Yes Allow ordinary users to read any file having type<br />
default_t.<br />
readhome Yes Allow Mozilla to read files in the user home directory.<br />
run_ssh_inetd No Allow SSH to run from inetd instead of as a daemon.<br />
secure_levels No Allow only administrator to log in at the console and forbid<br />
direct access to disk devices.<br />
single_userdomain No Make processes other than newrole and su run by a user<br />
domain stay in the same user domain.<br />
ssh_sysadm_login Yes Allow SSH logins to the sysadm_r:sysadm_t security<br />
context; otherwise, remote SSH users cannot enter this<br />
context.<br />
staff_read_sysadm_file No Allow staff_r users to search the system administrator’s<br />
home directory (generally /root) and read its files.<br />
unlimitedServices Yes Allow processes under initrc and xinetd to run with<br />
all privileges.<br />
unlimitedUsers No Allow users to have full access.<br />
unrestricted_admin Yes Allow sysadm_t to do almost everything.<br />
use_games Yes Allow users to run games.<br />
user_can_mount Yes Allow users to execute mount command.<br />
user_canbe_sysadm Yes Allow normal users to enter sysadm_r role.<br />
user_net_control Yes Allow users to control network interfaces (also needs<br />
USERCTL=true).<br />
user_rw_noexattrfile Yes Allow users to read/write noextattrfile (FAT,<br />
CDROM, FLOPPY).<br />
writehome Yes Allow Mozilla to write files in the user home directory.<br />
xdm_sysadm_login Yes Allow xdm logins as sysadm_r:sysadm_t.</p>
<p>a)vi /etc/selinux/src/policy.<br />
b)edit tunable.te<br />
c)make reload.<br />
ii)Tuning via policy Booleans<br />
change_bool boolean [0|1]<br />
show_bools</p>
<p>change_bool user_ping 0</p>
<p>show_bools<br />
user_ping &#8211;&gt; active: 0 pending: 0</p>
<p>echo 0 &gt; /selinux/booleans/user_ping<br />
echo 1 &gt; /selinux/commit_pending_bools<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
4)Routine SELinux System Use and Administration<br />
a) Entering a role<br />
b) Viewing security contexts<br />
c) Adding users and groups<br />
d) Starting and controlling daemons<br />
e) Tuning SELinux</p>
<p>a) Entering a role<br />
SELinux users have one or more associated<br />
roles and, at any time, are bound to exactly<br />
one of these. Users are initially bound to<br />
a role at login time.<br />
$sestatus<br />
# sestatus -v</p>
<p>The standard SELinux security policy defines four roles:<br />
*staff_r<br />
Used for users permitted to enter the sysadm_r role<br />
*sysadm_r<br />
Used for the system administrator<br />
*system_r<br />
Used for system processes and objects<br />
*user_r<br />
Used for ordinary users</p>
<p>Changing roles<br />
newrole [[-r|--role] ROLE] [[-t|--type] TYPE] [-- [ARGS]&#8230;]<br />
newrole -r role<br />
#newrole -r sysadm_r</p>
<p>b) Viewing security contexts<br />
# id -Z<br />
ls &#8211;context /etc/hosts<br />
ls &#8211;lcontext /etc/hosts<br />
ls &#8211;scontext /etc/hosts<br />
ls -Z /etc/hosts<br />
ps -Z<br />
ps &#8211;context<br />
ps -Z 1</p>
<p>c) Adding users and groups<br />
users’ home directories are labeled with<br />
the special security context user_home_dir_t.<br />
# id -Z<br />
# newrole -r sysadm_r<br />
# id -Z<br />
# useradd -c &#8220;test user&#8221; -m -d /home/testuser \<br />
-g users -s /bin/bash testuser<br />
# finger testuser<br />
# ls -ld -Z /home/testuser/</p>
<p>Associating a user with a nondefault role<br />
By default, users are associated with<br />
the SELinux role user_r<br />
i. Edit the src/policy/users file.<br />
ii. Recompile the security policy.<br />
iii. Load the generated binary policy file into the kernel.<br />
cd /etc/selinux/src/policy<br />
vi users<br />
user username roles { staff_r sysadm_r };<br />
make target<br />
make reload</p>
<p>user:role:type.<br />
the src/policy/appconfig/default_contexts file specifies<br />
default roles for user logins, SSH sessions, and cron jobs.<br />
system_r:sulogin_t sysadm_r:sysadm_t<br />
system_r:local_login_t staff_r:staff_t user_r:user_t sysadm_r:sysadm_t<br />
system_r:remote_login_t user_r:user_t staff_r:staff_t<br />
system_r:sshd_t user_r:user_t staff_r:staff_t sysadm_r:sysadm_t<br />
system_r:crond_t user_r:user_crond_t staff_r:staff_crond_t<br />
sysadm_r:sysadm_crond_t system_r:system_crond_t mailman_r:user_crond_t<br />
system_r:xdm_t staff_r:staff_t user_r:user_t sysadm_r:sysadm_t<br />
staff_r:staff_su_t staff_r:staff_t user_r:user_t sysadm_r:sysadm_t<br />
sysadm_r:sysadm_su_t staff_r:staff_t user_r:user_t sysadm_r:sysadm_t<br />
user_r:user_su_t staff_r:staff_t user_r:user_t sysadm_r:sysadm_t<br />
sysadm_r:sudo_t sysadm_r:sysadm_t<br />
staff_r:sudo_t sysadm_r:sysadm_t staff_r:staff_t<br />
user_r:sudo_t sysadm_r:sysadm_t user_r:user_t</p>
<p>Setting user passwords<br />
vipw, vi,<br />
to repair the file label<br />
restorecon /etc/shadow</p>
<p>d) Starting and controlling daemons<br />
run_init script [[arg]&#8230;]<br />
run_init /etc/init.d/ntpd start</p>
<p>NOTE<br />
By default, Fedora Core 2 allows a role transition<br />
from sysadm_r to system_r, the role used by init.<br />
Therefore, unless you’ve specially configured Fedora<br />
Core 2 to disable this transition, it’s not necessary<br />
to invoke the run_init command explicitly.</p>
<p>runcon -u system_u -r system_r -t crond_t /usr/sbin/crond<br />
runcon system_u:system_r:crond_t /usr/sbin/crond</p>
<p>e) Tuning SELinux<br />
LOG Format<br />
avc: result { operation } for pid=pid exe=exe<br />
path=opath dev=devno:ptno ino=node<br />
scontext=source tcontext=target tclass=class</p>
<p>*result=The value granted or denied, indicating whether<br />
SELinux permitted or prohibitedthe operation.<br />
*operation=The operation that was attempted, such as<br />
read or write. SELinux defines about 150 operations.<br />
*pid=The process ID of the process that attempted the operation.<br />
*exe=The absolute path of the text file (executable) associated<br />
with the process that attempted the operation.<br />
*path=The absolute path of the object on which the operation was attempted.<br />
*devno=The block device number associated with the<br />
object on which the operation was attempted.<br />
*ptno=The partition number associated with the object<br />
on which the operation was attempted.<br />
*node=The inode number of the object on which the operation was attempted.<br />
*source=The security context of the process that<br />
attempted the operation.<br />
*target=The security context of the target object.<br />
*class=The type of the target object, such as file.</p>
<p>SELinux Logging Subtleties(reduce log)<br />
Change to the policy source directory and<br />
reload the security policy:<br />
cd /etc/security/selinux/src/policy<br />
make reload<br />
or<br />
setenforce 1<br />
setenforce 0</p>
<p>Audit2allow=that scans the system log, looking for<br />
entries pertaining to denied operations</p>
<p>(if login,daemon problem problem)<br />
fixfiles restore<br />
cd /etc/security/selinux/src/policy<br />
setfiles file_contexts/file_contexts /home/bill</p>
<p>cd /etc/security/selinux/src/policy<br />
setfiles file_contexts/file_contexts cron_files</p>
<p>cd /etc/security/selinux/src/policy<br />
setfiles file_contexts/file_contexts /etc/init.d/*</p>
<p>Xwindow problem<br />
rm /var/tmp* files</p>
<p>=======================================================================<br />
Instalation Server<br />
1) Make directory<br />
mkdir -p /data/network-install/Fedora/base<br />
mkdir -p /data/network-install/Fedora/RPMS<br />
mkdir -p /data/network-install/ISO</p>
<p>2) Copy the files<br />
cd /mnt/cdrom/Fedora/base<br />
cp -r * /data/network-install/Fedora/base</p>
<p>(copy 4 cd into /data/network-install)</p>
<p>cd /data/network-install/ISO<br />
dd if=/dev/cdrom of=FC2-i386-disc1.iso bs=32k<br />
eject cdrom<br />
dd if=/dev/cdrom of=FC2-i386-disc2.iso bs=32k<br />
eject cdrom<br />
dd if=/dev/cdrom of=FC2-i386-disc3.iso bs=32k<br />
eject cdrom<br />
dd if=/dev/cdrom of=FC2-i386-disc4.iso bs=32k<br />
eject cdrom</p>
<p>another method using mkisofs<br />
mkisofs -J -r -T -o filename.iso /mnt/cdrom</p>
<p>3)Setup Your Webserver ftp &amp; nfs<br />
NameVirtualHost 192.168.1.100<br />
&lt;VirtualHost 192.168.1.100&gt;<br />
DocumentRoot /data/<br />
&lt;Directory /data/network-install&gt;<br />
Options +Indexes<br />
AllowOverride AuthConfig<br />
order allow,deny<br />
allow from all<br />
&lt;/Directory&gt;<br />
&lt;/VirtualHost&gt;</p>
<p>FTP<br />
vi /etc/vsftpd/vsftpd.conf<br />
anon_root=/data/network-install/</p>
<p>NFS<br />
vi /etc/exports<br />
/data/network-install          *(ro,sync)<br />
exportfs -ra</p>
<p>4)Configure DHCP Server</p>
<p>5)Boot form fedora core cd1<br />
boot:linux askmethod<br />
or boot from boot floppy<br />
Kick Start<br />
1)&#8221;ksconfig&#8221; command from a GUI console<br />
2)save it in /data/network-install/ks.cfg<br />
or can use /root/anaconda-ks.cfg<br />
3)to veryfy<br />
install<br />
nfs &#8211;server=192.16.1.100 &#8211;dir=/data/network-install/ISO<br />
install<br />
url &#8211;url <a href="http://192.168.1.100/network-install/">http://192.168.1.100/network-install/</a><br />
4) To install<br />
NFS Method<br />
boot: linux ks=nfs:192.168.1.100:/data/network-install/ks.cfg</p>
<p>HTTP Method<br />
boot: linux ks=http://192.168.1.100/network-install/ks.cfg</p>
<p>DHCP<br />
vi /etc/dhcpd.conf<br />
filename &#8220;/data/network-install/ks.cfg&#8221;;<br />
next-server 192.168.1.100;</p>
<p>boot: linux ks</p>
<p>Floppy<br />
boot:linux ks=floppy</p>
<p>=======================================================================<br />
Encrypting swat or other ports like pop3,smtp<br />
1)useradd stunnel<br />
2)cd /usr/share/ssl/certs<br />
make stunnel.pem<br />
chmod 640 stunnel.pem<br />
chgrp stunnel stunnel.pem</p>
<p>3)vi /etc/stunnel/stunnel.conf<br />
# Configure stunnel to run as user &#8220;stunnel&#8221; placing temporary<br />
# files in the /home/stunnel/ directory<br />
chroot  = /home/stunnel/<br />
pid     = /stunnel.pid<br />
setuid  = stunnel<br />
setgid  = stunnel</p>
<p># Log all stunnel messages to /var/log/messages<br />
debug   = 7<br />
output  = /var/log/messages</p>
<p># Define where the SSL certificates can be found.<br />
client  = no<br />
cert    = /usr/share/ssl/certs/stunnel.pem<br />
key     = /usr/share/ssl/certs/stunnel.pem</p>
<p># Accept SSL connections on port 901 and funnel it to<br />
# port 902 for swat.<br />
[swat]<br />
accept   = 901<br />
connect  = 902</p>
<p>4) cd /etc/xinetd.d<br />
cp swat swat-stunnel</p>
<p>vi swat-stunnel<br />
service swat-stunnel<br />
{<br />
port            = 902<br />
socket_type     = stream<br />
wait            = no<br />
only_from       = 127.0.0.1<br />
user            = root<br />
server          = /usr/sbin/swat<br />
log_on_failure  += USERID<br />
disable         = no<br />
bind            = 127.0.0.1<br />
}<br />
disable 901 port in /etc/services<br />
chkconfig swat off<br />
chkconfig swat-stunnel on</p>
<p>5)start stunnel<br />
$stunnel<br />
(if problem  rpm -e hwcrypto)</p>
<p>6)Test<br />
<a href="https://server-ip-address:901/">https://server-ip-address:901/</a></p>
<p>========<br />
Stunneling pop<br />
1) /var/share/ssl/certs/stunnel.pem<br />
$openssl -req -new -newkey rsa:1024 -nodes \<br />
-x509 -keyout /tmp/key -out /tmp/cert<br />
cat /tmp/cert&gt;&gt;/tmp/key<br />
mv /tmp/key /usr/share/ssl/certs/stunnel.pem<br />
rm /tmp/cert<br />
chmod 600 /usr/share/ssl/certs/stunnel.pem<br />
or<br />
cd /usr/share/ssl/certs<br />
make stunnel.pem</p>
<p>2) vi /etc/xinet.d/pos3s<br />
server=/usr/sbin/stunnel<br />
server_args= -1 /usr/sbin/ipop3d &#8211;ipop3d</p>
<p>telnet<br />
stunnel -d localhost:7023 -r localhost:23</p>
<p>stunnel -c  -d localhost:12345 -r server1.nepal.com:7023<br />
telnet localhost 12345<br />
=======================================================================</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sabinshrestha.com.np/linux-downloads/linux-admin-note/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOS Installing Audio Video</title>
		<link>http://www.sabinshrestha.com.np/linux-downloads/centos-installing-audio-video/</link>
		<comments>http://www.sabinshrestha.com.np/linux-downloads/centos-installing-audio-video/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 11:16:20 +0000</pubDate>
		<dc:creator>sabin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.sabinshrestha.com.np/?p=113</guid>
		<description><![CDATA[http://centos.karan.org/el4/extras/stable/i386/RPMS/repodata/repoview/Applications.Multimedia.group.html # yum info xmms # yum install xmms-mp3 http://rpm.pbone.net/index.php3/stat/4/idpl/1703961/com/bmp-0.9.7-0.lvn.3.3.i386.rpm.html None of RedHat distributions ships with MP3 support because patent issues. In CentOS 4 you have 3 choices: a) Use Rhythmbox: in my opinion, I don&#8217;t recomended this option. This program crash a lot !. For put MP3 support download and install this RPM: http://ftp.freshrpms.net/pub/freshrpms/fedora/linux/3/gstreamer-plugins-extra/gstreamer-plugins-extra-audio-0.8.6-2.1.fc3.fr.i386.rpm [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://centos.karan.org/el4/extras/stable/i386/RPMS/repodata/repoview/Applications.Multimedia.group.html">http://centos.karan.org/el4/extras/stable/i386/RPMS/repodata/repoview/Applications.Multimedia.group.html</a></p>
<p>#  yum info xmms<br />
# yum install xmms-mp3</p>
<p><a href="http://rpm.pbone.net/index.php3/stat/4/idpl/1703961/com/bmp-0.9.7-0.lvn.3.3.i386.rpm.html">http://rpm.pbone.net/index.php3/stat/4/idpl/1703961/com/bmp-0.9.7-0.lvn.3.3.i386.rpm.html</a></p>
<p>None  of RedHat distributions ships with MP3 support because patent issues.</p>
<p>In  CentOS 4 you have 3 choices:</p>
<p>a) Use Rhythmbox: in my opinion, I don&#8217;t  recomended this option. This program crash a lot !. For put MP3 support download  and install this RPM:<br />
<a href="http://ftp.freshrpms.net/pub/freshrpms/fedora/linux/3/gstreamer-plugins-extra/gstreamer-plugins-extra-audio-0.8.6-2.1.fc3.fr.i386.rpm">http://ftp.freshrpms.net/pub/freshrpms/fedora/linux/3/gstreamer-plugins-extra/gstreamer-plugins-extra-audio-0.8.6-2.1.fc3.fr.i386.rpm</a></p>
<p>You  will need other packages like gsm that you found in Dag repository (look b  option).</p>
<p>b) Install XMMS and MP3 support, download APT from Dag website,  it&#8217;s here :<br />
<a href="http://dag.wieers.com/packages/apt/apt-0.5.15cnc6-4.2.el4.rf.i386.rpm">http://dag.wieers.com/packages/apt/apt-0.5.15cnc6-4.2.el4.rf.i386.rpm</a></p>
<p>After  open a terminal and run:<br />
apt-get update<br />
apt-get install xmms  xmms-mp3</p>
<p>c) Install Beep Media Player, it&#8217;s a XMMS fork written in GTK2.  It looks better than XMMS. You find the packages here:<br />
<a href="http://newrpms.sunsite.dk/apt/redhat/en/i386/fc3/RPMS.newrpms/bmp-0.9.7-2.rhfc3.nr.i386.rpm">http://newrpms.sunsite.dk/apt/redhat/en/i386/fc3/RPMS.newrpms/bmp-0.9.7-2.rhfc3.nr.i386.rpm</a><br />
<a href="http://newrpms.sunsite.dk/apt/redhat/en/i386/fc3/RPMS.newrpms/bmp-extra-plugins-0.2.2-3.rhfc3.nr.i386.rpm">http://newrpms.sunsite.dk/apt/redhat/en/i386/fc3/RPMS.newrpms/bmp-extra-plugins-0.2.2-3.rhfc3.nr.i386.rpm</a><br />
<a href="http://newrpms.sunsite.dk/apt/redhat/en/i386/fc3/RPMS.newrpms/bmp-mp3-0.9.7-2.rhfc3.nr.i386.rpm">http://newrpms.sunsite.dk/apt/redhat/en/i386/fc3/RPMS.newrpms/bmp-mp3-0.9.7-2.rhfc3.nr.i386.rpm</a></p>
<p>=====================================<br />
Most  of the libraries that are not in CentOS, are in Dag repository.</p>
<p>For  example liblirc is here<br />
<a href="http://dag.wieers.com/packages/lirc/lirc-0.6.6-4.2.el4.rf.i386.rpm">http://dag.wieers.com/packages/lirc/lirc-0.6.6-4.2.el4.rf.i386.rpm</a></p>
<p>You  can find more packages here:<br />
<a href="http://dag.wieers.com/home-made/apt/packages.php">http://dag.wieers.com/home-made/apt/packages.php</a><br />
===============================================</p>
<p>Install  the Dag repo into Yum using the instruction found at <a href="http://dag.wieers.com/home-made/apt/FAQ.php#B">http://dag.wieers.com/home-made/apt/FAQ.php#B</a><br />
<a href="http://dag.wieers.com/home-made/apt/">http://dag.wieers.com/home-made/apt/</a><br />
<a href="http://dag.wieers.com/home-made/apt/FAQ.php#B">http://dag.wieers.com/home-made/apt/FAQ.php#B</a></p>
<p><a href="http://rpm.greysector.net/yum.html">http://rpm.greysector.net/yum.html</a><br />
<a href="http://rpm.greysector.net/mplayer/yum.html">http://rpm.greysector.net/mplayer/yum.html</a><br />
<a href="http://linux.softpedia.com/get/Multimedia/Video/MPlayer-020.shtml">http://linux.softpedia.com/get/Multimedia/Video/MPlayer-020.shtml</a></p>
<p><a href="http://apt.sw.be/redhat/el4/en/i386/RPMS.dag/">http://apt.sw.be/redhat/el4/en/i386/RPMS.dag/</a><br />
<a href="http://www.live.com/getstarted.aspx"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sabinshrestha.com.np/linux-downloads/centos-installing-audio-video/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Repair Centos 5 lvm filesytem</title>
		<link>http://www.sabinshrestha.com.np/linux-downloads/repair-centos-5-lvm-filesytem/</link>
		<comments>http://www.sabinshrestha.com.np/linux-downloads/repair-centos-5-lvm-filesytem/#comments</comments>
		<pubDate>Wed, 12 Mar 2008 16:39:30 +0000</pubDate>
		<dc:creator>sabin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.sabinshrestha.com.np/?p=111</guid>
		<description><![CDATA[1) linux rescue 2) skip mounting and go to command prompt 3) Run the following command to activate the LVM partition lvm vgchange -a y 5)You should be able to address the activated LVMs. If you have trouble with their naming, run: lvm lvscan 6) check the partition fdisk -l 7) Check and repair each [...]]]></description>
			<content:encoded><![CDATA[<p>1) linux rescue</p>
<p>2) skip mounting and go to command prompt</p>
<p>3) Run the following command to activate the LVM partition</p>
<p>lvm vgchange -a y</p>
<p>5)You should be able to address the activated LVMs. If  you have trouble with their naming, run:</p>
<p>lvm lvscan</p>
<p>6) check the partition</p>
<p>fdisk -l</p>
<p>7) Check and repair each logical volume’s filesystem by running something like  this:</p>
<p>fsck -f /dev/VolGroup00/LogVol00</p>
<p>reboot you system</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sabinshrestha.com.np/linux-downloads/repair-centos-5-lvm-filesytem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Mysql and PHP with BSD/Linux LAMP</title>
		<link>http://www.sabinshrestha.com.np/linux-downloads/apache-13x/</link>
		<comments>http://www.sabinshrestha.com.np/linux-downloads/apache-13x/#comments</comments>
		<pubDate>Sun, 17 Feb 2008 12:08:33 +0000</pubDate>
		<dc:creator>sabin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.sabinshrestha.com.np/?p=26</guid>
		<description><![CDATA[This How-To guides you through the steps to install and configure the most popular and powerful Apache-2.2.8 web server with PHP-5.2.5 and Mysql-5.0.45. This How-To can be used either on Linux with Kernel version 2.4 and higher or on FreeBSD-6.x systems. From wikipedia, the definition of a web server is as follows: A computer program [...]]]></description>
			<content:encoded><![CDATA[<p> This How-To guides you through the steps to install and configure the most popular and powerful Apache-2.2.8 web server with PHP-5.2.5 and Mysql-5.0.45.</p>
<p>This How-To can be used either on Linux with Kernel version 2.4 and higher or on FreeBSD-6.x systems.</p>
<p>From wikipedia,  the definition of a web server is as follows:</p>
<p>A computer program that is responsible for accepting HTTP requests from clients, which are known as web browsers (e.g. Firefox, Internet Explorer), and serving them HTTP responses along with optional data contents, which usually are web pages such as HTML documents and linked objects (images, etc.).</p>
<p>Without Web servers, the Internet would just be as dull as sending and receiving emails.</p>
<p>It is the web server which provides the content and information that we are used to seeing these days. It’s the web server’s job to deliver both static and dynamic contents to end-users via browsers such as Mozilla Firefox and Internet Explorer.</p>
<p>Apache is to web servers what Bind is to DNS servers. Apache is a high performance and scalable web server notable for playing a key role in the initial growth of the World Wide Web. According to the data provided by news.netcraft.com, 50% of all web sites are running on Apache web servers.</p>
<p>In this guide, we will install and configure a simple Apache-2.2.8 web server with PHP-5.2.4 and Mysql-5.0.45.</p>
<p><span id="more-7"></span></p>
<p>MySQL is a robust Relational Database Management System (RDBMS) that relies on Structured Query Language (SQL) for processing the data in the database.</p>
<p>MySQL is most commonly used for Web applications and for embedded applications and has become a popular alternative to <a href="http://www.webopedia.com/TERM/M/MySQL.htm#" id="KonaLink0" target="_top" class="kLink"><font color="blue"><span class="kLink" style="color: blue ! important; font-family: serif; font-weight: 400; font-size: 16px; position: static"></span><span class="kLink" style="color: blue ! important; font-family: serif; font-weight: 400; font-size: 16px; position: static"></span></font></a>proprietary database systems such as Oracle and Sybase because of its speed and reliability.</p>
<p><strong>PHP</strong> is a reflective programming language originally designed for producing dynamic web pages.PHP is used mainly in server-side scripting, but can be used from a command line interface or in standalone graphical applications.</p>
<p>PHP generally runs on a web server, taking PHP code as its input and creating Web pages as output.</p>
<p>The following guide details the installation and configuration of this 3 powerful components.</p>
<p><strong>Installing Mysql-5.0.45</strong></p>
<p><strong>(1.) Create the necessary mysql user and mysql group</strong></p>
<p>groupadd mysql<br />
useradd -g mysql mysql</p>
<p><strong>(2.)  Download Mysql</strong><br />
cd  /usr/local/src</p>
<p>wget   http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.45.tar.gz/from/http://mirror.trouble-free.net/mysql_mirror/</p>
<p><strong>(3.)  Unzip the sources</strong></p>
<p>tar  zxvf  mysql-5.0.45.tar.gz</p>
<p><strong>(4.)  Got to source directory and run configure</strong></p>
<p>cd mysql-5.0.45</p>
<p>./configure   –prefix=/usr/local/mysql</p>
<p><strong>(5.) Make and Install</strong></p>
<p>make</p>
<p>make install</p>
<p><strong>(6.)   Copy the main my.cnf file and change the necessary permissions and run Mysql</strong></p>
<p>cp support-files/my-medium.cnf /etc/my.cnf</p>
<p>cd /usr/local/mysql</p>
<p>chown -R mysql .</p>
<p>chgrp -R mysql .</p>
<p>bin/mysql_install_db –user=mysql</p>
<p>chown -R root .</p>
<p>chown -R mysql var<br />
bin/mysqld_safe –user=mysql &amp;<br />
If all goes well, Mysql is now installed and should be running!!</p>
<p>Note: If you face problems such as getting configuration and compilation errors, check your permissions. 95% of all problems can be solved either by installing dependencies and development libraries. Google is your friend as always.</p>
<p><strong>Installing and configuring Apache-2.2.8</strong></p>
<p><strong>(1.)  Download Apache</strong></p>
<p>cd   /usr/local/src</p>
<p>wget http://veritris.com/mirrors/apache/httpd/httpd-2.2.8.tar.gz</p>
<p><strong>(2.)  unzip the sources</strong></p>
<p>tar   zxvf   httpd-2.2.8.tar.gz</p>
<p><strong>(3.)  Configure Apache</strong></p>
<p>cd    httpd-2.2.8</p>
<p>./configure</p>
<p>–prefix=/usr/local/httpd \<br />
–enable-cache \<br />
–enable-disk-cache \<br />
–enable-mem-cache \<br />
–enable-proxy \<br />
–enable-proxy-http \<br />
–enable-proxy-ftp \<br />
–enable-proxy-connect \<br />
–enable-so \<br />
–enable-cgi \<br />
–enable-info \<br />
–enable-rewrite \<br />
–enable-speling \<br />
–enable-usertrack \<br />
–enable-deflate \<br />
–enable-mime-magic</p>
<p><strong>(4.)   Make and Install</strong></p>
<p>make</p>
<p>make  install</p>
<p>That’s it. Apache should now be installed in /usr/local/httpd ! Note: If you face problems such as getting compilation errors, check your permissions. 95% of all problems can be solved either by installing dependencies and development libraries. Google is your friend as always.</p>
<p><strong>Installing and Configuring PHP</strong></p>
<p><strong>(1.)  Download PHP</strong></p>
<p>cd   /usr/local/src</p>
<p>wget http://www.php.net/get/php-5.2.5.tar.gz/from/au2.php.net/mirror</p>
<p><strong>(2.)   Unzip the sources</strong></p>
<p>tar   zxvf   php-5.2.5.tar.gz</p>
<p><strong>(3.)  Configure PHP for Apache and Mysql support</strong></p>
<p>./configure</p>
<p>–with-apxs2=/usr/local/httpd/bin/apxs \<br />
–with-mysql=/usr/local/mysql \<br />
–prefix=/usr/local/httpd/php \<br />
–with-config-file-path=/usr/local/httpd/php \<br />
–enable-force-cgi-redirect \<br />
–disable-cgi \<br />
–with-zlib \<br />
–with-gettext \<br />
–with-gdbm  <strong> </strong></p>
<p><strong>(4.)  Make and Install</strong></p>
<p>make</p>
<p>make   install</p>
<p><strong>(5.)   Configure PHP configuration</strong></p>
<p>cp     php.ini-dist    /usr/local/lib/php.ini</p>
<p><strong>(6.)  Edit your httpd.conf to load the PHP module</strong></p>
<p>vi    /usr/local/httpd/conf/httpd.conf</p>
<p>#Added the following in the relevant section</p>
<p>LoadModule php5_module modules/libphp5.so<br />
<strong> (7.)   Tell Apache to parse certain extensions as PHP and also to parse .phtml  and phps extensions</strong></p>
<p>vi    /usr/local/httpd/conf/httpd.conf</p>
<p>#Added the following in the relevant sections</p>
<p>AddType application/x-httpd-php .php .phtml</p>
<p>AddType application/x-httpd-php-source .phps</p>
<p><strong>(8.)   Start your Apache-2.2.6 server</strong></p>
<p>/usr/local/httpd/bin/apachectl     start</p>
<p>Note: If you face problems such as getting configuration and compilation errors, check your permissions. 95% of all problems can be solved either by installing dependencies and development libraries. Google is your friend as always.</p>
<p><strong>Testing PHP installation </strong></p>
<p><strong>(1.)  Create the following info.php  file  in the default htdocs directory</strong></p>
<p>vi   /usr/local/httpd/htdocs/info.php</p>
<p>##Copy and paste the following text</p>
<p><code>&lt;?php<br />
phpinfo();<br />
?&gt;</code></p>
<p><strong> (2.) Save the file and start your web browser to point to your local web server. If this server is a remote server, simply enter it’s IP address in place of localhost</strong></p>
<p><code></code>http://localhost/info.php</p>
<p>You should be able to see detailed information about your PHP installation, Apache environment and PHP extensions loaded, etc.</p>
<pre>Apache 1.3.X</pre>
<pre>tar xzvf  openssl-0.9.7d.tar.gz
cd openssl-0.9.7d
./config --prefix=/usr/local --openssldir=/usr/local/openssl
make
make test
make install

tar xzvf mod_ssl-2.8.16-1.3.29.tar.gz
cd mod_ssl-2.8.16-1.3.29
./configure \
              --with-apache=../apache_1.3.29 \
              --with-ssl=../openssl-0.9.7d \
              --prefix=/usr/local/apache \
              --enable-shared=ssl \</pre>
<pre>tar xzvf mod_perl-1.26.tar.gz
cd mod_perl-1.26
perl Makefile.PL \
               APACHE_SRC=../apache_1.3.29/src \
               DO_HTTPD=1 \
               USE_APACI=1 \
               PREP_HTTPD=1 \
               EVERYTHING=1 \

        $ make
        $ make test
        $ make install

 # adduser apache</pre>
<p><span style="color: #ff0000">Note the UID AND GID</span></p>
<pre>tar xzvf apache_1.3.29.tar.gz
cd apache_1.3.29

SSL_BASE=../openssl-0.9.7d \
./configure --prefix=/usr/local/apache \
     --server-uid=apache \
     --server-gid=apache \
     --enable-module=ssl \
     --enable-shared=ssl \
     --enable-module=auth_dbm \
     --enable-module=auth_db \
     --enable-module=auth_anon \
     --enable-module=digest \
     --enable-module=expires \
     --enable-module=so \
     --enable-module=headers \
     --enable-module=usertrack \
     --enable-module=env \
     --enable-module=rewrite \
     --enable-suexec \
     --suexec-caller=apache \
     --suexec-uidmin=500 \
     --suexec-gidmin=500 \
     --activate-module=src/modules/perl/libperl.a \

make</pre>
<pre>make certificate TYPE=custom

make install

##DSO
./configure \
                --with-apxs=/usr/local/apache/bin/apxs \
                --enable-versioning \
                --with-mysql \
                --enable-track-vars

make
make install

#add to httpd.conf

#done auto by make install
#LoadModule php4_module libexec/libphp4.so
#LoadModule php4_module modules/libphp4.so
#AddModule mod_php4.c

AddType application/x-httpd-php .php .php3
AddType application/x-httpd-php-source .phps

cp php.ini-recommended /usr/local/lib/php.ini</pre>
<ul>
<li> <a href="http://www.howtoforge.com/mysql_database_replication">How To Set Up Database Replication In MySQL</a></li>
<li><a href="http://www.howtoforge.com/loadbalanced_mysql_cluster_debian"> How To Set Up A Load-Balanced MySQL Cluster</a></li>
<li><a href="http://www.howtoforge.com/mirroring_with_rsync">Mirror your site with rsync</a></li>
</ul>
<h1><font face="Verdana,Arial,Helvetica">     Load Balancing Your Web Site</font></h1>
<p>http://www.webtechniques.com/archives/1998/05/engelschall/</p>
<p>http://www.ddj.com/architect/184414169?pgno=1</p>
<p>http://www.howtoforge.com/load_balancing_apache_mod_proxy_balancer</p>
<p>Mirror website<br />
<span id="KonaBody"><tt>wget -m -k -K -E http://url/of/web/site</tt></span></p>
<p><strong>find the ip address by location and redirect the mirror site</strong></p>
<p>http://www.hostip.info/use.html</p>
<p>Php code to redirect to mirror server country wise</p>
<p>&lt;?php</p>
<p>/* ipaddresses.txt<br />
- 192.168.1.105 (Single IP)<br />
- 192.168.1.* (IP Range with *)<br />
- 192.168.1.100-110 (IP range with -)<br />
- 192.168.?.* (IP range with ?)<br />
*/<br />
error_reporting(0);</p>
<p>function chkiplist($ip) {<br />
# read in the ip address file<br />
$lines = file(&#8220;ipaddresses.txt&#8221;);<br />
# set a variable as false<br />
$found = false;<br />
# convert ip address into a number<br />
$split_it = split(&#8220;\.&#8221;,$ip);<br />
$ip = &#8220;1&#8243; . sprintf(&#8220;%03d&#8221;,$split_it[0]) .</p>
<p>sprintf(&#8220;%03d&#8221;,$split_it[1]) . sprintf(&#8220;%03d&#8221;,$split_it[2]) .</p>
<p>sprintf(&#8220;%03d&#8221;,$split_it[3]);</p>
<p># loop through the ip address file</p>
<p>foreach ($lines as $line) {</p>
<p># remove line feeds from the line</p>
<p>$line = chop($line);</p>
<p># replace x with a *</p>
<p>$line = str_replace(&#8220;x&#8221;,&#8221;*&#8221;,$line);</p>
<p># remove comments</p>
<p>$line = preg_replace(&#8220;|[A-Za-z#/]|&#8221;,&#8221;",$line);</p>
<p># set a maximum and minimum value</p>
<p>$max = $line;</p>
<p>$min = $line;</p>
<p># replace * with a 3 digit number</p>
<p>if ( strpos($line,&#8221;*&#8221;,0) &lt;&gt; &#8220;&#8221; ) {</p>
<p>$max = str_replace(&#8220;*&#8221;,&#8221;999&#8243;,$line);</p>
<p>$min = str_replace(&#8220;*&#8221;,&#8221;000&#8243;,$line);</p>
<p>}</p>
<p># replace ? with a single digit</p>
<p>if ( strpos($line,&#8221;?&#8221;,0) &lt;&gt; &#8220;&#8221; ) {</p>
<p>$max = str_replace(&#8220;?&#8221;,&#8221;9&#8243;,$line);</p>
<p>$min = str_replace(&#8220;?&#8221;,&#8221;0&#8243;,$line);</p>
<p>}</p>
<p># if the line is invalid go to the next line</p>
<p>if ( $max == &#8220;&#8221; ) { continue; };</p>
<p># check for a range</p>
<p>if ( strpos($max,&#8221; &#8211; &#8220;,0) &lt;&gt; &#8220;&#8221; ) {</p>
<p>$split_it = split(&#8221; &#8211; &#8220;,$max);</p>
<p># if the second part does not match an ip address</p>
<p>if ( !preg_match(&#8220;|\d{1,3}\.|&#8221;,$split_it[1]) ) {</p>
<p>$max = $split_it[0];</p>
<p>}</p>
<p>else {</p>
<p>$max = $split_it[1];</p>
<p>};</p>
<p>}</p>
<p>if ( strpos($min,&#8221; &#8211; &#8220;,0) &lt;&gt; &#8220;&#8221; ) {</p>
<p>$split_it = split(&#8221; &#8211; &#8220;,$min);</p>
<p>$min = $split_it[0];</p>
<p>}</p>
<p># make $max into a number</p>
<p>$split_it = split(&#8220;\.&#8221;,$max);</p>
<p>for ( $i=0;$i&lt;4;$i++ ) {</p>
<p>if ( $i == 0 ) { $max = 1; };</p>
<p>if ( strpos($split_it[$i],&#8221;-&#8221;,0) &lt;&gt; &#8220;&#8221; ) {</p>
<p>$another_split = split(&#8220;-&#8221;,$split_it[$i]);</p>
<p>$split_it[$i] = $another_split[1];</p>
<p>}</p>
<p>$max .= sprintf(&#8220;%03d&#8221;,$split_it[$i]);</p>
<p>}</p>
<p># make $min into a number</p>
<p>$split_it = split(&#8220;\.&#8221;,$min);</p>
<p>for ( $i=0;$i&lt;4;$i++ ) {</p>
<p>if ( $i == 0 ) { $min = 1; };</p>
<p>if ( strpos($split_it[$i],&#8221;-&#8221;,0) &lt;&gt; &#8220;&#8221; ) {</p>
<p>$another_split = split(&#8220;-&#8221;,$split_it[$i]);</p>
<p>$split_it[$i] = $another_split[0];</p>
<p>}</p>
<p>$min .= sprintf(&#8220;%03d&#8221;,$split_it[$i]);</p>
<p>}</p>
<p># check for a match</p>
<p>if ( ($ip &lt;= $max) &amp;&amp; ($ip &gt;= $min) ) {</p>
<p>$found = true;</p>
<p>break;</p>
<p>};</p>
<p>}</p>
<p>return $found;</p>
<p>}; # end function</p>
<p>$country = &#8220;&#8221;;<br />
$country1 = &#8220;&#8221;;<br />
$cxContext-&#8221;";<br />
$site = &#8220;http://mail.niec.edu.np/home/index.php&#8221;;<br />
$port = 80;<br />
$IP = $_SERVER['REMOTE_ADDR'];</p>
<p>if (!empty($IP))<br />
{<br />
if(chkiplist($IP))<br />
{<br />
header(&#8220;Location: http://mail.niec.edu.np&#8221;);<br />
}<br />
else<br />
{<br />
$country = file_get_contents(&#8220;http://api.hostip.info/country.php?ip=&#8221;.$IP);<br />
if(!empty($country)&amp;&amp; $country==&#8221;NP&#8221;)<br />
{<br />
$country1 = file_get_contents(&#8220;http://mail.niec.edu.np/check.php&#8221;);</p>
<p>if(!empty($country1)&amp;&amp; $country1==&#8221;nepal&#8221;)<br />
{<br />
header(&#8220;Location: http://mail.niec.edu.np&#8221;);<br />
}<br />
else<br />
{<br />
header(&#8220;Location: home/&#8221;);<br />
}<br />
}<br />
else<br />
{<br />
header(&#8220;Location: home/&#8221;);<br />
}<br />
}<br />
}<br />
else<br />
{<br />
header(&#8220;Location: home/&#8221;);<br />
}<br />
?&gt;<br />
For more information</p>
<p>http://sourceforge.net/search/?type_of_search=soft&amp;words=ip+to+country+php</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sabinshrestha.com.np/linux-downloads/apache-13x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handy script protects Linux against traffic spikes</title>
		<link>http://www.sabinshrestha.com.np/linux-downloads/handy-script-protects-linux-against-traffic-spikes/</link>
		<comments>http://www.sabinshrestha.com.np/linux-downloads/handy-script-protects-linux-against-traffic-spikes/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 16:13:43 +0000</pubDate>
		<dc:creator>sabin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.sabinshrestha.com.np/?p=109</guid>
		<description><![CDATA[http://enterpriselinuxlog.blogs.techtarget.com/category/scripts/ We received another user-submitted Linux script for our “Share scripts… win Starbucks” series. This one comes from David Witham, who writes: I administer a consumer VoIP switch for a VSP. The switch acts as a SIP registrar and proxy. Many thousands of devices register and re-register with the registrar every few minutes so there’s [...]]]></description>
			<content:encoded><![CDATA[<p>http://enterpriselinuxlog.blogs.techtarget.com/category/scripts/</p>
<p>We received another user-submitted Linux script for our “Share scripts… win Starbucks” series. This one comes from David Witham, who writes:</p>
<p>I administer a consumer VoIP switch for a VSP. The switch acts as a SIP registrar and proxy. Many thousands of devices register and re-register with the registrar every few minutes so there’s a pretty constant stream of traffic hitting it. Some SIP devices have flakey firmware and misbehave in such a way that they flood the registrar with registration requests to the point that performance is compromised, so I needed a way to protect the registrar from those devices.</p>
<p>I wrote a script that takes a sample of network traffic using Ethereal, checks for IP addresses transmitting excessive packets and blocks them by adding them to a list of addresses to drop in the INPUT chain of iptables.</p>
<p>David suggests running the script every 15 minutes to allow new IP addresses to be added to the list, then flushing the addresses and re-adding them so IP addresses that have stopped flooding can re-register.</p>
<p>Give it a try. This script was optimized for RHEL4 but should run on other Linux and Unix systems that have Ethereal or iptables. Feel free to modify it any way you like, or maybe you have one of your own to share? Share a script with us and, if we use it, we’ll treat you to Starbucks.</p>
<p>Keep the scripts coming!</p>
<p>#!/bin/bash<br />
#<br />
# Run from cron on a frequent basis, including on the hour, to block IP addresses flooding with SIP requests<br />
# Use -f to force a flush of the INPUT chain<br />
#<br />
# First 3 octets of destination IP address of the flooding packets</p>
<p>BASE=xxx.xxx.xxx</p>
<p># Whole destination IP address of the flooding packets</p>
<p>HOSTIP=xxx.xxx.xxx.xxx</p>
<p># Interface on which the flooding is occurring</p>
<p>INTERFACE=eth3</p>
<p># Flush iptables INPUT filter chain each hour in case some IPs have stopped flooding and are genuinely trying to use the service<br />
if [ $(date +%M) = “00″ -o “$1″ = “-f” ]; then<br />
/sbin/iptables -F INPUT<br />
# Wait 5 seconds for IPs to start flooding again (most flooding IPs send REGISTER every 4 seconds if not getting a response)<br />
sleep 5<br />
# Add IP address to drop to iptables INPUT filter chain. Repeat a couple of times to catch all IPs<br />
/usr/sbin/tethereal -i $INTERFACE-a duration:10 2&gt;/dev/null | awk ‘{print $2;print $4}’ | grep -v $BASE | sort | uniq -c | sort -rn | awk ‘$1 &gt; 30 {print $2}’ | while read ip; do /sbin/iptables -A INPUT -s $ip -d $HOSTIP -j DROP ; done<br />
sleep 5<br />
/usr/sbin/tethereal -i $INTERFACE-a duration:10 2&gt;/dev/null | awk ‘{print $2;print $4}’ | grep -v $BASE | sort | uniq -c | sort -rn | awk ‘$1 &gt; 30 {print $2}’ | while read ip; do /sbin/iptables -A INPUT -s $ip -d $HOSTIP -j DROP ; done<br />
sleep 5<br />
/usr/sbin/tethereal -i $INTERFACE-a duration:10 2&gt;/dev/null | awk ‘{print $2;print $4}’ | grep -v $BASE | sort | uniq -c | sort -rn | awk ‘$1 &gt; 30 {print $2}’ | while read ip; do /sbin/iptables -A INPUT -s $ip -d $HOSTIP -j DROP ; done<br />
else<br />
# Add more IP addresses to drop to iptables INPUT filter chain<br />
/usr/sbin/tethereal -i $INTERFACE-a duration:10 2&gt;/dev/null | awk ‘{print $2;print $4}’ | grep -v $BASE | sort | uniq -c | sort -rn | awk ‘$1 &gt; 30 {print $2}’ | while read ip; do /sbin/iptables -A INPUT -s $ip -d $HOSTIP -j DROP ; done</p>
<p>fi</p>
<p>===========================================</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sabinshrestha.com.np/linux-downloads/handy-script-protects-linux-against-traffic-spikes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HowTo: Configure Sendmail with Gmail SMTP Server on Linux</title>
		<link>http://www.sabinshrestha.com.np/linux-downloads/howto-configure-sendmail-with-gmail-smtp-server-on-linux/</link>
		<comments>http://www.sabinshrestha.com.np/linux-downloads/howto-configure-sendmail-with-gmail-smtp-server-on-linux/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 13:19:09 +0000</pubDate>
		<dc:creator>sabin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.sabinshrestha.com.np/?p=106</guid>
		<description><![CDATA[Yeah! Finally I’m able to send and receive email with sendmail and dovecot implemented on my Linux server today. I choose gmail smtp server to act as my Outgoing Email Server. Here is how I did, In the /etc/mail/yourhostname.mc file, add the following above the DAEMON_OPTIONS line. define(`confAUTH_OPTIONS’, `A’)dnl define(`confAUTH_MECHANISMS’, `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN [...]]]></description>
			<content:encoded><![CDATA[<p>Yeah! Finally I’m able to send and receive email with sendmail and dovecot implemented on my Linux server today. I choose gmail smtp server to act as my Outgoing Email Server. Here is how I did,</p>
<p>In the <em>/etc/mail/yourhostname.mc</em> file, add the following above the DAEMON_OPTIONS line.</p>
<h6><font color="#339966">define(`confAUTH_OPTIONS’, `A’)dnl</font></h6>
<h6><font color="#339966">define(`confAUTH_MECHANISMS’, `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN’)dnl</font></h6>
<h6><font color="#339966">TRUST_AUTH_MECH(`EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN’)dnl</font></h6>
<h6><font color="#339966">FEATURE(`authinfo’, `Hash -o /etc/mail/authinfo.db’)dnl</font></h6>
<h6><font color="#339966">define(`SMART_HOST’, `smtp.gmail.com’)dnl</font></h6>
<h6><font color="#339966">define(`RELAY_MAILER_ARGS’, `TCP $h 587′)</font></h6>
<h6><font color="#339966">define(`ESMTP_MAILER_ARGS’, `TCP $h 587′)</font></h6>
<p>Create or edit the <em>/etc/mail/authinfo</em> file and with this codes.</p>
<h6><font color="#339966">AuthInfo:smtp.gmail.com “U:root” “I:gmailusername” “P:gmailpassword” “M:PLAIN”<br />
</font></h6>
<h6><font color="#339966"> AuthInfo:smtp.gmail.com:587 “U:root” “I:gmailusername” “P:gmailpassword” “M:PLAIN”</font></h6>
<p>Now, we can run this command in the <em>/etc/mail</em> directory.</p>
<h6><font color="#339966">touch local-host-names</font></h6>
<h6><font color="#339966"> makemap -r hash authinfo.db &lt; authinfo</font></h6>
<h6><font color="#339966">make all<br />
</font></h6>
<p><font color="#339966">service sendmail restart</font></p>
<p>If the <em>“make all install restart</em>” command didn’t work, you can also run <em>“make”</em> alternatively.</p>
<p>References:</p>
<p><a href="http://www.linuxha.com/other/sendmail/gmail.html" target="_blank">http://www.linuxha.com/</a></p>
<p><a href="http://rajasuperman.blogspot.com/search?updated-max=2006-09-08T15%3A47%3A00-07%3A00&amp;max-results=4" target="_blank">http://rajasuperman.blogspot.com/</a></p>
<p><a href="http://www.openaddict.com/node/33" target="_blank">http://www.openaddict.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sabinshrestha.com.np/linux-downloads/howto-configure-sendmail-with-gmail-smtp-server-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>dag wieers update package</title>
		<link>http://www.sabinshrestha.com.np/linux-downloads/dag-wieers-update-package/</link>
		<comments>http://www.sabinshrestha.com.np/linux-downloads/dag-wieers-update-package/#comments</comments>
		<pubDate>Wed, 27 Feb 2008 04:44:05 +0000</pubDate>
		<dc:creator>sabin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.sabinshrestha.com.np/?p=104</guid>
		<description><![CDATA[http://dag.wieers.com/rpm/FAQ.php#B2 yum whatprovides mod_access.so http://dag.wieers.com/rpm/packages/ http://wiki.centos.org/Repositories For your printer see: http://openprinting.org/show_printer.cgi?recnum=Canon-iP4000 (check the FC6 Extras repo for rpm packages) http://mirror.centos.org/centos/ http://mirrorlist.centos.org/ www.silfreed.net/download/repo/redhat/  www.idevelopment.info http://www.dbazone.com/ http://www.idevelopment.info/data/Oracle/DBA_scripts/common.zip]]></description>
			<content:encoded><![CDATA[<p><a href="http://dag.wieers.com/rpm/FAQ.php#B2">http://dag.wieers.com/rpm/FAQ.php#B2</a></p>
<p>yum whatprovides mod_access.so</p>
<p>http://dag.wieers.com/rpm/packages/</p>
<p><a href="http://wiki.centos.org/Repositories" target="_blank">http://wiki.centos.org/Repositories</a></p>
<p>For your printer see: <a href="http://openprinting.org/show_printer.cgi?recnum=Canon-iP4000" target="_blank">http://openprinting.org/show_printer.cgi?recnum=Canon-iP4000</a><br />
(check the FC6 Extras repo for rpm packages)</p>
<p>http://mirror.centos.org/centos/</p>
<p>http://mirrorlist.centos.org/</p>
<p><span class="a">www.silfreed.net/download/<strong>repo</strong>/<strong>redhat</strong>/  </span></p>
<p><a href="http://www.idevelopment.info/" target="_blank" class="bodylink">www.idevelopment.info</a></p>
<p><a href="http://www.dbazone.com/">http://www.dbazone.com/</a></p>
<p><a href="http://www.idevelopment.info/data/Oracle/DBA_scripts/common.zip" class="bodylink">http://www.idevelopment.info/data/Oracle/DBA_scripts/common.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sabinshrestha.com.np/linux-downloads/dag-wieers-update-package/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux RHCE Notes or Tutor</title>
		<link>http://www.sabinshrestha.com.np/linux-downloads/linux-rhce-notes-or-tutor/</link>
		<comments>http://www.sabinshrestha.com.np/linux-downloads/linux-rhce-notes-or-tutor/#comments</comments>
		<pubDate>Sun, 24 Feb 2008 14:57:52 +0000</pubDate>
		<dc:creator>sabin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.sabinshrestha.com.np/?p=100</guid>
		<description><![CDATA[Donload RHCE short notes and tutor help full for RHCE Exam Download linux short how to notes or Tutor Donwload RHCE Notes part 1 Donwload RHCE Notes part 2]]></description>
			<content:encoded><![CDATA[<p>Donload RHCE short notes and tutor help full for RHCE Exam</p>
<p><a href="http://www.sabinshrestha.com.np/wp-content/uploads/2008/02/linux_shortnote.doc" title="linux short how to notes">Download linux short how to notes or Tutor<br />
</a></p>
<p><a href="http://www.sabinshrestha.com.np/wp-content/uploads/2008/02/linux1.doc" title="RHCE Notes part 1">Donwload RHCE Notes part 1</a></p>
<p><a href="http://www.sabinshrestha.com.np/wp-content/uploads/2008/02/linux2.doc" title="Donwload RHCE Notes part 2">Donwload RHCE Notes part 2</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sabinshrestha.com.np/linux-downloads/linux-rhce-notes-or-tutor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ethical Hacking CEH</title>
		<link>http://www.sabinshrestha.com.np/software-downloads/ethical-hacking-ceh/</link>
		<comments>http://www.sabinshrestha.com.np/software-downloads/ethical-hacking-ceh/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 09:20:01 +0000</pubDate>
		<dc:creator>sabin</dc:creator>
				<category><![CDATA[C and Cpp]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.sabinshrestha.com.np/?p=92</guid>
		<description><![CDATA[Ethical Hacking and Countermeasures course mission is to educate, introduce and demonstrate hacking tools for penetration testing purposes only. Prior to attending this course, you will be asked to sign an agreement stating that you will not use the newly acquired skills for illegal or malicious attacks and you will not use such tools in [...]]]></description>
			<content:encoded><![CDATA[<p>Ethical Hacking and Countermeasures course mission is to educate, introduce and demonstrate hacking tools for penetration testing purposes only. Prior to attending this course, you will be asked to sign an agreement stating that you will not use the newly acquired skills for illegal or malicious attacks and you will not use such tools in an attempt to compromise any computer system, and to indemnify EC-Council with respect to the use or misuse of these tools, regardless of intent.</p>
<p>Module 1: Ethics and Legality<br />
What is an Exploit?<br />
The security functionality triangle<br />
The attacker&#8217;s process<br />
Passive reconnaissance<br />
Active reconnaissance<br />
Types of attacks<br />
Categories of exploits<br />
Goals attackers try to achieve<br />
Ethical hackers and crackers &#8211; who are they<br />
Self proclaimed ethical hacking<br />
Hacking for a cause (Hacktivism)<br />
Skills required for ethical hacking<br />
Categories of Ethical Hackers<br />
What do Ethical Hackers do?<br />
Security evaluation plan<br />
Types of Ethical Hacks<br />
Testing Types<br />
Ethical Hacking Report<br />
Cyber Security Enhancement Act of 2002<br />
Computer Crimes<br />
Overview of US Federal Laws<br />
Section 1029<br />
Section 1030<br />
Hacking Punishment</p>
<p>Module 2: Footprinting<br />
What is Footprinting<br />
Steps for gathering information<br />
Whois</p>
<p>http://tucows.com</p>
<p>Hacking Tool: Sam Spade<br />
Analyzing Whois output<br />
NSLookup<br />
Finding the address range of the network<br />
ARIN<br />
Traceroute<br />
Hacking Tool: NeoTrace<br />
Visual Route<br />
Visual Lookout<br />
Hacking Tool: Smart Whois<br />
Hacking Tool: eMailTracking Pro<br />
Hacking Tool: MailTracking.com</p>
<p>Module 3: Scanning<br />
Determining if the system is alive?<br />
Active stack fingerprinting<br />
Passive stack fingerprinting<br />
Hacking Tool: Pinger<br />
Hacking Tool: WS_Ping_Pro<br />
Hacking Tool: Netscan Tools Pro 2000<br />
Hacking Tool: Hping2<br />
Hacking Tool: icmpenum<br />
Detecting Ping sweeps<br />
ICMP Queries<br />
Hacking Tool: netcraft.com<br />
Port Scanning<br />
TCPs 3-way handshake<br />
TCP Scan types<br />
Hacking Tool: IPEye<br />
Hacking Tool: IPSECSCAN<br />
Hacking Tool: nmap<br />
Port Scan countermeasures<br />
Hacking Tool: HTTrack Web Copier<br />
Network Management Tools<br />
SolarWinds Toolset<br />
NeoWatch<br />
War Dialing<br />
Hacking Tool: THC-Scan<br />
Hacking Tool: PhoneSweep War Dialer<br />
Hacking Tool: Queso<br />
Hacking Tool: Cheops<br />
Proxy Servers<br />
Hacking Tool: SocksChain<br />
Surf the web anonymously<br />
TCP/IP through HTTP Tunneling<br />
Hacking Tool: HTTPort</p>
<p>Module 4: Enumeration<br />
What is Enumeration<br />
NetBios Null Sessions<br />
Null Session Countermeasures<br />
NetBIOS Enumeration<br />
Hacking Tool: DumpSec<br />
Hacking Tool: NAT<br />
SNMP Enumertion<br />
SNMPUtil<br />
Hacking Tool: IP Network Browser<br />
SNMP Enumeration Countermeasures<br />
Windows 2000 DNS Zone transfer<br />
Identifying Win2000 Accounts<br />
Hacking Tool: User2SID<br />
Hacking Tool: SID2User<br />
Hacking Tool: Enum<br />
Hacking Tool: UserInfo<br />
Hacking Tool: GetAcct<br />
Active Directory Enumeration</p>
<p>Module 5: System Hacking<br />
Administrator Password Guessing<br />
Performing Automated Password Guessing<br />
Legion<br />
NTInfoScan<br />
Defending Against Password Guessing<br />
Monitoring Event Viewer Logs<br />
VisualLast<br />
Eavesdroppin on Network Password Exchange<br />
Hacking Tool: L0phtCrack<br />
Hacking Tool: KerbCrack<br />
Privilege Escalation<br />
Hacking Tool: GetAdmin<br />
Hacking Tool: hk<br />
Manual Password Cracking Algorithm<br />
Automatic Password Cracking Algorithm<br />
Password Types<br />
Types of Password Attacks<br />
Dictionary Attack<br />
Brute Force Attack<br />
Distributed Brute Force Attack<br />
Password Change Interval<br />
Hybrid Attack<br />
Cracking Windows 2000 Passwords<br />
Retrieving the SAM file<br />
Redirecting SMB Logon to the Attacker<br />
SMB Redirection<br />
Hacking Tool: SMBRelay<br />
Hacking Tool: SMBRelay2<br />
SMBRelay Man-in-the-Middle (MITM)<br />
SMBRelay MITM Countermeasures<br />
Hacking Tool: SMBGrinder<br />
Hacking Tool: SMBDie<br />
Hacking Tool: NBTDeputy<br />
NetBIOS DoS Attack<br />
Hacking Tool: nbname<br />
Hacking Tool: John the Ripper<br />
LanManager Hash<br />
Password Cracking Countermeasures<br />
Keystroke Logger<br />
Hacking Tool: Spector<br />
AntiSpector<br />
Hacking Tool: eBlaster<br />
Hacking Tool: SpyAnywhere<br />
Hacking Tool: IKS Software Logger<br />
Hardware Tool: Hardware Key Logger<br />
Hacking Tool: Rootkit<br />
Planting Rootkit on Windows 2000 Machine<br />
_rootkit_ embedded TCP/IP Stack<br />
Rootkit Countermeasures<br />
MD5 Checksum utility<br />
Tripwire<br />
Covering Tracks<br />
Disabling Auditing<br />
Auditpol<br />
Clearing the Event Log<br />
Hacking Tool: Elslave<br />
Hacking Tool: Winzapper<br />
Hacking Tool: Evidence Eliminator<br />
Hidding Files<br />
NTFS File Streaming<br />
Hacking Tool: makestrm<br />
NTFS Streams Countermeasures<br />
LNS<br />
Steganography<br />
Hacking Tool: ImageHide<br />
Hacking Tool: MP3Stego<br />
Hacking Tool: Snow<br />
Hacking Tool: Camera/Shy<br />
Steganography Detection<br />
StegDetect<br />
Encrypted File System<br />
Hacking Tool: dskprobe<br />
Hacking Tool: EFSView<br />
Buffer Overflows<br />
Creating Buffer Overflow Exploit<br />
Outlook Buffer Overflow<br />
Hacking Tool: Outoutlook</p>
<p>Module 6: Trojans and Backdoors<br />
What is a Trojan Horse?<br />
Overt and Covert<br />
Hacking Tool: QAZ<br />
Hacking Tool: Tini<br />
Hacking Tool: Netcat<br />
Hacking Tool: Donald Dick<br />
Hacking Tool: SubSeven<br />
Hacking Tool: BackOrifice 2000<br />
Back Oriffice Plug-ins<br />
Hacking Tool: NetBus<br />
Wrappers<br />
Hacking Tool: Graffiti<br />
Hacking Tool: Silk Rope 2000<br />
Hacking Tool: EliteWrap<br />
Hacking Tool: IconPlus<br />
Packaging Tool: Microsoft WordPad<br />
Hacking Tool: Whack a Mole<br />
Trojan Construction Kit<br />
BoSniffer<br />
Hacking Tool: FireKiller 2000<br />
Covert Channels<br />
ICMP Tunneling<br />
Hacking Tool: Loki<br />
Reverse WWW Shell<br />
Backdoor Countermeasures<br />
BO Startup and Registry Entries<br />
NetBus Startup and Registry Keys<br />
Port Monitoring Tools<br />
fPort TCPView<br />
Process Viewer<br />
Inzider &#8211; Tracks Processes and Ports<br />
Trojan Maker<br />
Hacking Tool: Hard Disk Killer<br />
Man-in-the-Middle Attack<br />
Hacking Tool: dsniff<br />
System File Verification<br />
TripWire</p>
<p>Module 7: Sniffers<br />
What is a Sniffer?<br />
Hacking Tool: Etheral<br />
Hacking Tool: Snort<br />
Hacking Tool: WinDump<br />
Hacking Tool: EtherPeek<br />
Passive Sniffing<br />
Active Sniffing<br />
Hacking Tool: EtherFlood<br />
How ARP Works?<br />
Hacking Tool: DSniff<br />
Hacking Tool: Macof<br />
Hacking Tool: mailsnarf<br />
Hacking Tool: URLsnarf<br />
Hacking Tool: Webspy<br />
Hacking Tool: Ettercap<br />
Hacking Tool: SMAC<br />
MAC Changer<br />
ARP Spoofing Countermeasures<br />
Hacking Tool: WinDNSSpoof<br />
Hacking Tool: WinSniffer<br />
Network Tool: IRIS<br />
Network Tool: NetInterceptor<br />
SniffDet<br />
Hacking Tool: WinTCPKill</p>
<p>Module 8: Denial of Service<br />
What is Denial of Service Attack?<br />
Types of DoS Attacks<br />
How DoS Work?<br />
What is DDoS?<br />
Hacking Tool: Ping of Death<br />
Hacking Tool: SSPing<br />
Hacking Tool: Land<br />
Hacking Tool: Smurf<br />
Hacking Tool: SYN Flood<br />
Hacking Tool: CPU Hog<br />
Hacking Tool: Win Nuke<br />
Hacking Tool: RPC Locator<br />
Hacking Tool: Jolt2<br />
Hacking Tool: Bubonic<br />
Hacking Tool: Targa<br />
Tools for Running DDoS Attacks<br />
Hacking Tool: Trinoo<br />
Hacking Tool: WinTrinoo<br />
Hacking Tool: TFN<br />
Hacking Tool: TFN2K<br />
Hacking Tool: Stacheldraht<br />
Hacking Tool: Shaft<br />
Hacking Tool: mstream<br />
DDoS Attack Sequence<br />
Preventing DoS Attack<br />
DoS Scanning Tools<br />
Find_ddos<br />
SARA<br />
DDoSPing<br />
RID<br />
Zombie Zapper</p>
<p>Module 9: Social Engineering<br />
What is Social Engineering?<br />
Art of Manipulation<br />
Human Weakness<br />
Common Types of Social Engineering<br />
Human Based Impersonation<br />
Important User<br />
Tech Support<br />
Third Party Authorization<br />
In Person<br />
Dumpster Diving<br />
Shoulder Surfing<br />
Computer Impersonation<br />
Mail Attachments<br />
Popup Window<br />
Website Faking<br />
Reverse Social Engineering<br />
Policies and Procedures<br />
Social Engineering Security Policies<br />
The Importance of Employee Education</p>
<p>Module 10: Session Hijacking<br />
What is Session Hijacking?<br />
Session Hijacking Steps<br />
Spoofing Vs Hijacking<br />
Active Session Hijacking<br />
Passive Session Hijacking<br />
TCP Concepts &#8211; 3 way Handshake<br />
Sequence Numbers<br />
Sequence Number Example<br />
Guessing the Sequence Numbers<br />
Hacking Tool: Juggernaut<br />
Hacking Tool: Hunt<br />
Hacking Tool: TTYWatcher<br />
Hacking Tool: IP Watcher<br />
Hacking Tool: T-Sight<br />
Remote TCP Session Reset Utility<br />
Dangers Posed by Session Hijacking<br />
Protection against Session Hijacking</p>
<p>Module 11: Hacking Web Servers<br />
Apache Vulnerability<br />
Attacks against IIS<br />
IIS Components<br />
ISAPI DLL Buffer Overflows<br />
IPP Printer Overflow<br />
msw3prt.dll<br />
Oversized Print Requests<br />
Hacking Tool: Jill32<br />
Hacking Tool: IIS5-Koei<br />
Hacking Tool: IIS5Hack<br />
IPP Buffer Overflow Countermeasures<br />
ISAPI DLL Source Disclosure<br />
ISAPI.DLL Exploit<br />
Defacing Web Pages<br />
IIS Directory Traversal<br />
Unicode<br />
Directory Listing<br />
Clearing IIS Logs<br />
Network Tool: LogAnalyzer<br />
Attack Signature<br />
Creating Internet Explorer (IE) Trojan<br />
Hacking Tool: IISExploit<br />
Hacking Tool: UnicodeUploader.pl<br />
Hacking Tool: cmdasp.asp<br />
Escalating Privilages on IIS<br />
Hacking Tool: IISCrack.dll<br />
Hacking Tool: ispc.exe<br />
Unspecified Executable Path Vulnerability<br />
Hacking Tool: CleanIISLog<br />
File System Traversal Countermeasures<br />
Microsoft HotFix Problems<br />
UpdateExpert<br />
Cacls utility<br />
Network Tool: Whisker<br />
N-Stealth Scanner<br />
Hacking Tool: WebInspect<br />
Network Tool: Shadow Security Scanner</p>
<p>Module 12: Web Application Vulnerabilities<br />
Documenting the Application Structure<br />
Manually Inspecting Applications<br />
Using Google to Inspect Applications<br />
Directory Structure<br />
Hacking Tool: Instant Source<br />
Java Classes and Applets<br />
Hacking Tool: Jad<br />
HTML Comments and Contents<br />
Hacking Tool: Lynx<br />
Hacking Tool: Wget<br />
Hacking Tool: Black Widow<br />
Hacking Tool: WebSleuth<br />
Cross Side Scripting<br />
Session Hijacking using XSS<br />
Cookie Stealing<br />
Hacking Tool: IEEN</p>
<p>Module 13: Web Based Password Cracking Techniques<br />
Basic Authentication<br />
Message Digest Authentication<br />
NTLM Authentication<br />
Certificate based Authentication<br />
Digital Certificates<br />
Microsoft Passport Authentication<br />
Forms based Authentication<br />
Creating Fake Certificates<br />
Hacking Tool: WinSSLMiM<br />
Password Guessing<br />
Hacking Tool: WebCracker<br />
Hacking Tool: Brutus<br />
Hacking Tool: ObiWan<br />
Hacking Tool: Munga Bunga<br />
Password dictionary Files<br />
Attack Time<br />
Hacking Tool: Varient<br />
Hacking Tool: PassList<br />
Query Strings<br />
Post data<br />
Hacking Tool: cURL<br />
Stealing Cookies<br />
Hacking Tool: CookieSpy<br />
Hacking Tool: ReadCookies<br />
Hacking Tool: SnadBoy</p>
<p>Module 14: SQL Injection<br />
What is SQL Injection Vulnerability?<br />
SQL Insertion Discovery<br />
Blank sa Password<br />
Simple Input Validation<br />
SQL Injection<br />
OLE DB Errors<br />
1=1<br />
blah&#8217; or 1=1<br />
Stealing Credit Card Information<br />
Preventing SQL Injection<br />
Database Specific SQL Injection<br />
Hacking Tool: SQLDict<br />
Hacking Tool: SQLExec<br />
Hacking Tool: SQLbf<br />
Hacking Tool: SQLSmack<br />
Hacking Tool: SQL2.exe<br />
Hacking Tool: Oracle Password Buster</p>
<p>Module 15: Hacking Wireless Networks<br />
802.11 Standards<br />
What is WEP?<br />
Finding WLANs<br />
Cracking WEP keys<br />
Sniffing Trafic<br />
Wireless DoS Attacks<br />
WLAN Scanners<br />
WLAN Sniffers<br />
MAC Sniffing<br />
Access Point Spoofing<br />
Securing Wireless Networks<br />
Hacking Tool: NetTumbler<br />
Hacking Tool: AirSnort<br />
Hacking Tool: AiroPeek<br />
Hacking Tool: WEP Cracker<br />
Hacking Tool: Kismet<br />
WIDZ- Wireless IDS</p>
<p>Module 16: Virus and Worms<br />
Cherobyl<br />
ExploreZip<br />
I Love You<br />
Melissa<br />
Pretty Park<br />
Code Red Worm<br />
W32/Klez<br />
BugBear<br />
W32/Opaserv Worm<br />
Nimda<br />
Code Red<br />
SQL Slammer<br />
How to write your own Virus?<br />
Worm Construction Kit</p>
<p>Module 17: Novell Hacking<br />
Common accounts and passwords<br />
Accessing password files<br />
Password crackers<br />
Netware Hacking Tools<br />
Chknull<br />
NOVELBFH<br />
NWPCRACK<br />
Bindery<br />
BinCrack<br />
SETPWD.NLM<br />
Kock<br />
userdump<br />
Burglar<br />
Getit<br />
Spooflog<br />
Gobbler<br />
Novelffs<br />
Pandora</p>
<p>Module 18: Linux Hacking<br />
Why Linux ?<br />
Linux Basics<br />
Compiling Programs in Linux<br />
Scanning Networks<br />
Mapping Networks<br />
Password Cracking in Linux<br />
Linux Vulnerabilities<br />
SARA<br />
TARA<br />
Sniffing<br />
A Pinger in Disguise<br />
Session Hijacking<br />
Linux Rootkits<br />
Linux Security Countermeasures<br />
IPChains and IPTables</p>
<p>Module 19: IDS, Firewalls and Honeypots<br />
Intrusion Detection System<br />
System Integrity Verifiers<br />
How are Intrusions Detected?<br />
Anomaly Detection<br />
Signature Recognition<br />
How does IDS match Signatures with Incoming Traffic?<br />
Protocol Stack Verification<br />
Application Protocol Verification<br />
What Happens after an IDS Detects an Attack?<br />
IDS Software Vendors<br />
SNORT<br />
Evading IDS (Techniques)<br />
Complex IDS Evasion<br />
Hacking Tool: fragrouter<br />
Hacking Tool: TCPReplay<br />
Hacking Tool: SideStep<br />
Hacking Tool: NIDSbench<br />
Hacking Tool: ADMutate<br />
IDS Detection<br />
Tools to Detect Packet Sniffers<br />
Tools to inject strangely formatted packets onto the wire<br />
Hacking Through Firewalls<br />
Placing Backdoors through Firewalls<br />
Hiding behind Covert Channels<br />
What is a Honeypot?<br />
Honeypots Evasion<br />
Honeypots vendors</p>
<p>Module 20: Buffer Overflows<br />
What is a Buffer Overflow?<br />
Exploitation<br />
Assembly Language Basics<br />
How to Detect Buffer Overflows in a Program?<br />
Skills Required<br />
CPU/OS Dependency<br />
Understanding Stacks<br />
Stack Based Buffer Overflows<br />
Buffer Overflow Technical Implementation<br />
Writing your own Buffer Overflow Exploit in C<br />
Defense against Buffer Overflows<br />
Type Checking Tools for Compiling Programs<br />
StackGuard<br />
Immunix</p>
<p>Module 21: Cryptography<br />
What is PKI?<br />
Digital Certificates<br />
RSA<br />
MD-5<br />
RC-5<br />
SHA<br />
SSL<br />
PGP<br />
SSH<br />
Encryption Cracking Techniques</p>
<p>Download books</p>
<p>http://rapidshare.com/files/34091716/ethicalhack.rar</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sabinshrestha.com.np/software-downloads/ethical-hacking-ceh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Iptables</title>
		<link>http://www.sabinshrestha.com.np/linux-downloads/iptables/</link>
		<comments>http://www.sabinshrestha.com.np/linux-downloads/iptables/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 09:29:53 +0000</pubDate>
		<dc:creator>sabin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.sabinshrestha.com.np/?p=48</guid>
		<description><![CDATA[What Is iptables? Originally, the most popular firewall/NAT package running on Linux was ipchains, but it had a number of shortcomings. To rectify this, the Netfilter organization decided to create a new product called iptables, giving it such improvements as: Better integration with the Linux kernel with the capability of loading iptables-specific kernel modules designed [...]]]></description>
			<content:encoded><![CDATA[<h3 class="docSection1Title">What Is <span class="docEmphasis">iptables</span>?</h3>
<p class="docText">Originally, <a title="idd1e3969" name="idd1e3969"></a><a title="idd1e3970" name="idd1e3970"></a><a title="idd1e3971" name="idd1e3971"></a><a title="idd1e3972" name="idd1e3972"></a>the most popular firewall/NAT package  running on Linux was <tt>ipchains</tt>, but <a title="idd1e3973" name="idd1e3973"></a><a title="idd1e3974" name="idd1e3974"></a><a title="idd1e3975" name="idd1e3975"></a>it had a number of shortcomings. To  rectify this, the <span class="docEmphStrong">Netfilter</span> <a title="idd1e3976" name="idd1e3976"></a>organization decided to create a new <a title="idd1e3977" name="idd1e3977"></a><a title="idd1e3978" name="idd1e3978"></a><a title="idd1e3979" name="idd1e3979"></a>product called <tt>iptables</tt>,  giving it such improvements as:</p>
<ul>
<li>
<p class="docList">Better integration with the Linux kernel with the capability of  loading <tt>iptables</tt>-specific kernel modules designed for improved speed  and reliability.</p>
</li>
<li>
<p class="docList">Stateful packet inspection. This means that the firewall keeps  track of each connection passing through it and in certain cases will view the  contents of data flows in an attempt to anticipate the next action of certain  protocols. This is an important feature in the support of active FTP and DNS, as  well as many other network services.</p>
</li>
<li>
<p class="docList">Filtering packets based on a MAC address and the values of the  flags in the TCP header. This is helpful in preventing attacks using malformed  packets and in restricting access from locally attached servers to other  networks in spite of their IP addresses.</p>
</li>
<li>
<p class="docList">System logging that provides the option of adjusting the level  of detail of the reporting.</p>
</li>
<li>
<p class="docList">Better network address translation.</p>
</li>
<li>
<p class="docList">Support for transparent integration with such Web proxy  programs as Squid.</p>
</li>
<li>
<p class="docList">A rate limiting feature that helps <tt>iptables</tt> block some  types of denial of service (DoS) attacks.</p>
</li>
</ul>
<p class="docText">Considered a faster and more secure alternative to  <tt>ipchains</tt>, <tt>iptables</tt> has become the default firewall package  installed under Red Hat and Fedora Linux.</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td valign="top"><a title="ch14lev1sec2" name="ch14lev1sec2"></a></p>
<h3 class="docSection1Title">Download and Install the <span class="docEmphasis">iptables</span> Package</h3>
<p class="docText">Before <a title="idd1e3980" name="idd1e3980"></a><a title="idd1e3981" name="idd1e3981"></a><a title="idd1e3982" name="idd1e3982"></a><a title="idd1e3983" name="idd1e3983"></a><a title="idd1e3984" name="idd1e3984"></a><a title="idd1e3985" name="idd1e3985"></a><a title="idd1e3986" name="idd1e3986"></a><a title="idd1e3987" name="idd1e3987"></a><a title="idd1e3988" name="idd1e3988"></a><a title="idd1e3989" name="idd1e3989"></a>you begin, you need to make sure that  the <tt>iptables</tt> software RPM is installed. When searching for the RPMs, remember that the filename usually  starts with the software package name by a version number, as in  <tt>iptables-1.2.9-1.0.i386.rpm</tt>.</p>
</td>
</tr>
</table>
<p class="docText">&nbsp;</p>
<h3 class="docSection1Title">How to Start <span class="docEmphasis">iptables</span></h3>
<p class="docText">You <a title="idd1e3990" name="idd1e3990"></a><a title="idd1e3991" name="idd1e3991"></a><a title="idd1e3992" name="idd1e3992"></a><a title="idd1e3993" name="idd1e3993"></a><a title="idd1e3994" name="idd1e3994"></a>can start, stop,  and restart <tt>iptables</tt> after booting by using the commands:</p>
<pre>     [root@bigboy tmp]# service iptables start
     [root@bigboy tmp]# service iptables stop</pre>
<pre>
     [root@bigboy tmp]# service iptables restart</pre>
<p class="docText">To get <tt>iptables</tt> configured to start at boot, use the  <tt>chkconfig</tt> command:</p>
<pre>     [root@bigboy tmp]# chkconfig iptables on</pre>
<p><a href="http://www.sabinshrestha.com.np/wp-admin/23011535.html"><img src="http://www.sabinshrestha.com.np/wp-admin/images/pixel.gif" border="0" height="1" width="1" /></a></p>
<h3 class="docSection1Title" id="439356-988">Determining the Status of <span class="docEmphasis">iptables</span></h3>
<p class="docText">You <a title="idd1e3995" name="idd1e3995"></a><a title="idd1e3996" name="idd1e3996"></a><a title="idd1e3997" name="idd1e3997"></a><a title="idd1e3998" name="idd1e3998"></a><a title="idd1e3999" name="idd1e3999"></a>can determine  whether <tt>iptables</tt> is running or not via the <tt>service iptables  status</tt> command. <a title="idd1e4000" name="idd1e4000"></a><a title="idd1e4001" name="idd1e4001"></a>Fedora Core  will give a simple status message. For example:</p>
<pre>     [root@bigboy tmp]# service iptables status
     Firewall is stopped.
     [root@bigboy tmp]#</pre>
<h3 class="docSection1Title">Packet Processing in <span class="docEmphasis">iptables</span></h3>
<p class="docText">All <a title="idd1e4002" name="idd1e4002"></a><a title="idd1e4003" name="idd1e4003"></a><a title="idd1e4004" name="idd1e4004"></a><a title="idd1e4005" name="idd1e4005"></a><a title="idd1e4006" name="idd1e4006"></a>packets inspected  by <tt>iptables</tt> pass through a sequence of built-in <span class="docEmphStrong">tables</span> <a title="idd1e4007" name="idd1e4007"></a><a title="idd1e4008" name="idd1e4008"></a><a title="idd1e4009" name="idd1e4009"></a>(<span class="docEmphStrong">queues</span>) for processing.  Each of these queues is dedicated to a particular type of packet activity and is  controlled by an associated packet transformation/ filtering chain.</p>
<p class="docText">There are three tables in total. The first is the <a title="idd1e4010" name="idd1e4010"></a><a title="idd1e4011" name="idd1e4011"></a><a title="idd1e4012" name="idd1e4012"></a><tt>mangle</tt>  table, which is responsible for the alteration of quality of service bits in the  TCP header. This is hardly used in a home or SOHO environment.</p>
<p class="docText">The second table <a title="idd1e4013" name="idd1e4013"></a><a title="idd1e4014" name="idd1e4014"></a><a title="idd1e4015" name="idd1e4015"></a><a title="idd1e4016" name="idd1e4016"></a>is the <tt>filter</tt> queue, which is  responsible for packet filtering. It has three built-in chains in which you can  place your firewall policy rules:</p>
<ul>
<li>
<p class="docText"><span class="docEmphStrong">FORWARD chain:</span> Filters packets  to servers protected by the firewall.</p>
</li>
<li>
<p class="docText"><span class="docEmphStrong">INPUT chain:</span> Filters packets  destined for the firewall.</p>
</li>
<li>
<p class="docText"><span class="docEmphStrong">OUTPUT chain:</span> Filters packets  originating from the firewall.</p>
</li>
</ul>
<p class="docText">The third table is <a title="idd1e4017" name="idd1e4017"></a><a title="idd1e4018" name="idd1e4018"></a><a title="idd1e4019" name="idd1e4019"></a><a title="idd1e4020" name="idd1e4020"></a>the <tt>nat</tt>  queue, which is responsible for network address translation. It has two built-in  <a title="idd1e4021" name="idd1e4021"></a>chains:</p>
<ul>
<li>
<p class="docText"><span class="docEmphStrong">PREROUTING chain:</span> NATs packets  when the destination address of the packet needs to be changed.</p>
</li>
<li>
<p class="docText"><span class="docEmphStrong">POSTROUTING chain:</span> NATs  packets when the source address of the packet needs to be changed.</p>
</li>
</ul>
<p class="docText"> provides  more details on each queue.<a title="idd1e4022" name="idd1e4022"></a><a title="idd1e4023" name="idd1e4023"></a><a title="idd1e4024" name="idd1e4024"></a><a title="idd1e4025" name="idd1e4025"></a><a title="idd1e4026" name="idd1e4026"></a></p>
<p><a title="ch14table01" name="ch14table01"></a></p>
<table class="allBorders" border="1" cellpadding="4" cellspacing="0" rules="all">
<thead>
<th class="thead" scope="col" align="left" valign="top">
<p class="docText"><span class="docEmphStrong">Queue Type</span></p>
</th>
<th class="thead" scope="col" align="left" valign="top">
<p class="docText"><span class="docEmphStrong">Queue Function</span></p>
</th>
<th class="thead" scope="col" align="left" valign="top">
<p class="docText"><span class="docEmphStrong">Packet Transformation Chain in  Queue</span></p>
</th>
<th class="thead" scope="col" align="left" valign="top">
<p class="docText"><span class="docEmphStrong">Chain  Function</span></p>
</th>
<td class="docTableCell" rowspan="3" align="left" valign="top">
<p class="docText"><tt>filter</tt></p>
</td>
<td class="docTableCell" rowspan="3" align="left" valign="top">
<p class="docText">Packet filtering</p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">FORWARD</p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">Filters packets to servers accessible by another NIC on the  firewall.</p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">INPUT</p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">Filters packets destined to the firewall.</p>
</td>
<tr>
<td class="docTableCell" align="left" valign="top">
<p class="docText">OUTPUT</p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">Filters packets originating from the firewall.</p>
</td>
</tr>
<tr>
<td class="docTableCell" rowspan="2" align="left" valign="top">
<p class="docText">NAT</p>
</td>
<td class="docTableCell" rowspan="2" align="left" valign="top">
<p class="docText">Network Address Translation</p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">PREROUTING</p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">Address translation occurs before routing. Facilitates the  transformation of the destination IP address to be compatible with the  firewall&#8217;s routing table. Used with NAT of the destination IP address, also  known as destination NAT or DNAT.</p>
</td>
</tr>
<tr>
<td class="docTableCell" align="left" valign="top">
<p class="docText">POSTROUTING</p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">Address translation occurs after routing. This implies that  there was no need to modify the destination IP address of the packet as in  prerouting. Used with NAT of the source IP address using either one to one or  many to one NAT. This is known as source NAT or SNAT.</p>
</td>
</tr>
<tr>
<td class="docTableCell" align="left" valign="top">&nbsp;</td>
<td class="docTableCell" align="left" valign="top">&nbsp;</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">OUTPUT</p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">Network address translation for packets generated by the  firewall. (Rarely used in SOHO environments.)</p>
</td>
</tr>
<tr>
<td class="docTableCell" align="left" valign="top">
<p class="docText"><tt>mangle</tt></p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">TCP header modification</p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">PREROUTING, POSTROUTING, OUTPUT, INPUT, FORWARD</p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">Modification of the TCP packet quality of service bits before  routing occurs. (Rarely used in SOHO  environments.)</p>
</td>
</tr>
</thead>
</table>
<p class="docText">You need to specify the table and the chain for each firewall  rule you create. There is an exception: Most rules are related to filtering, so  <tt>iptables</tt> assumes that any chain that&#8217;s defined without an associated  table will be a part of the <tt>filter</tt> table. The <tt>filter</tt> table is  therefore the default.<a title="idd1e4027" name="idd1e4027"></a><a title="idd1e4028" name="idd1e4028"></a><a title="idd1e4029" name="idd1e4029"></a><a title="idd1e4030" name="idd1e4030"></a><a title="idd1e4031" name="idd1e4031"></a></p>
<p class="docText">To help make this clearer, take a look at the way packets are  handled by <tt>iptables</tt>. In  TCP packet from the Internet arrives at the firewall&#8217;s interface on  Network A to create a data connection.</p>
<p><a title="ch14fig01" name="ch14fig01"></a></p>
<p><center><br />
</center></p>
<p class="docText"><a title="idd1e4032" name="idd1e4032"></a><a title="idd1e4033" name="idd1e4033"></a><a title="idd1e4034" name="idd1e4034"></a><a title="idd1e4035" name="idd1e4035"></a><a title="idd1e4036" name="idd1e4036"></a>The packet is  first examined by your rules in the <tt>mangle</tt> table&#8217;s PREROUTING chain, if  any. It is then inspected by the rules in the <tt>nat</tt> table&#8217;s PREROUTING  chain to see whether the packet requires DNAT. It is then routed.</p>
<p class="docText">If the packet is destined for a protected network, then it is  filtered by the rules in the FORWARD chain of the <tt>filter</tt> table and, if  necessary, the packet undergoes SNAT before arriving at Network B. When the  destination server decides to reply, the packet undergoes the same sequence of  steps.</p>
<p class="docText">If the packet is destined for the firewall itself, then it is  filtered by the rules in the INPUT chain of the <tt>filter</tt> table before  being processed by the intended application on the firewall. At some point, the  firewall needs to reply. This reply is inspected by your rules in the OUTPUT  chain of the mangle table, if any. The rules in the OUTPUT chain of the  <tt>nat</tt> table determine whether address translation is required and the  rules in the OUTPUT chain of the <tt>filter</tt> table are then inspected before  the packet is routed back to the Internet.<a title="idd1e4037" name="idd1e4037"></a><a title="idd1e4038" name="idd1e4038"></a><a title="idd1e4039" name="idd1e4039"></a><a title="idd1e4040" name="idd1e4040"></a><a title="idd1e4041" name="idd1e4041"></a></p>
<p class="docText">It is now time to discuss the ways in which you add rules to  these chains.</p>
<h3 class="docSection1Title">Targets and Jumps</h3>
<p class="docText">Each <a title="idd1e4047" name="idd1e4047"></a><a title="idd1e4048" name="idd1e4048"></a><a title="idd1e4049" name="idd1e4049"></a><a title="idd1e4050" name="idd1e4050"></a><a title="idd1e4051" name="idd1e4051"></a><a title="idd1e4052" name="idd1e4052"></a><a title="idd1e4053" name="idd1e4053"></a><a title="idd1e4054" name="idd1e4054"></a><a title="idd1e4055" name="idd1e4055"></a><a title="idd1e4056" name="idd1e4056"></a>firewall rule inspects each IP packet  and then tries to identify it as the <span class="docEmphStrong">target</span> of  some sort of operation. Once a target is identified, the packet needs to <span class="docEmphStrong">jump</span> over to it for further processing. <a href="#ch14table02" class="docLink">Table 14.2</a> lists the built-in targets that  <tt>iptables</tt> uses.</p>
<p><a title="ch14table02" name="ch14table02"></a></p>
<table class="allBorders" border="1" cellpadding="4" cellspacing="0" rules="all">
<thead>
<th class="thead" scope="col" align="left" valign="top">
<p class="docText"><span class="docEmphStrong">Target</span></p>
</th>
<th class="thead" scope="col" align="left" valign="top">
<p class="docText"><span class="docEmphStrong">Description</span></p>
</th>
<th class="thead" scope="col" align="left" valign="top">
<p class="docText"><span class="docEmphStrong">Most Common  Options</span></p>
</th>
<td class="docTableCell" align="left" valign="top">
<p class="docText">ACCEPT<a title="idd1e4057" name="idd1e4057"></a></p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText"><tt>iptables</tt> stops further processing. The packet is  handed over to the end application or the operating system for  processing.</p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">N/A</p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">DROP<a title="idd1e4058" name="idd1e4058"></a></p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText"><tt>iptables</tt> stops further processing. The packet is  blocked.</p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">N/A</p>
</td>
<tr>
<td class="docTableCell" align="left" valign="top">
<p class="docText">LOG<a title="idd1e4059" name="idd1e4059"></a></p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">The packet information is sent to the syslog daemon for  logging. <tt>iptables</tt> continues processing with the next rule in the table.  As you can&#8217;t log and drop at the same time, it is common to have two similar  rules in sequence. The first logs the packet, the second drops it.</p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText"><tt>--log-prefix "string"</tt> Tells <tt>iptables</tt> to  prefix all log messages with a user defined string. Frequently used to tell why  the logged packet was dropped.</p>
</td>
</tr>
<tr>
<td class="docTableCell" align="left" valign="top">
<p class="docText">REJECT<a title="idd1e4060" name="idd1e4060"></a></p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">Works like the DROP target, but also returns an error message  to the host sending the packet that the packet was blocked.</p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText"><tt>--reject-with</tt> <span class="docEmphasis"><tt>qualifier</tt></span> The qualifier tells what type of  reject message is returned. Qualifiers include</p>
<p class="docText"><tt>icmp-port-unreachable</tt> (default)</p>
<p class="docText"><tt>icmp-net-unreachable</tt></p>
<p class="docText"><tt>icmp-host-unreachable</tt></p>
<p class="docText"><tt>icmp-proto-unreachable</tt></p>
<p class="docText"><tt>icmp-net-prohibited</tt></p>
<p class="docText"><tt>icmp-host-prohibited</tt></p>
<p class="docText"><tt>tcp-reset</tt></p>
<p class="docText"><tt>echo-reply</tt></p>
</td>
</tr>
<tr>
<td class="docTableCell" align="left" valign="top">
<p class="docText">DNAT<a title="idd1e4061" name="idd1e4061"></a></p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">Used to do <span class="docEmphStrong">destination network  address translation</span>, rewriting the destination IP address of the  packet.</p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText"><tt>--to-destination</tt> <span class="docEmphasis"><tt>ipaddress</tt></span> Tells <tt>iptables</tt> what the  destination IP address should be.</p>
</td>
</tr>
<tr>
<td class="docTableCell" align="left" valign="top">
<p class="docText">SNAT<a title="idd1e4062" name="idd1e4062"></a></p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">Used to do source network address translation, rewriting the  source IP address of the packet.</p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText"><tt>--to-source</tt> <span class="docEmphasis"><tt>&lt;address&gt;  [-&lt;address&gt;][:&lt;port&gt;-&lt;port&gt;]</tt></span> The source IP address  is user defined.</p>
<p class="docText">Specifies the source IP address and ports to be used by  SNAT.</p>
</td>
</tr>
<tr>
<td class="docTableCell" align="left" valign="top">
<p class="docText">MASQUERADE<a title="idd1e4063" name="idd1e4063"></a></p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText">Used to do source network address translation.</p>
<p class="docText">By default the source IP address is the same as that used by  the firewall&#8217;s interface.</p>
</td>
<td class="docTableCell" align="left" valign="top">
<p class="docText"><span class="docEmphasis"><tt>[--to-ports  &lt;port&gt;[-&lt;port&gt;]]</tt></span> Specifies the range of source ports to  which the original source port can be  mapped.</p>
</td>
</tr>
</thead>
</table>
<p class="docText">&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sabinshrestha.com.np/linux-downloads/iptables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
