<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>ramblings of a system administrator.</title>
    <link rel="alternate" type="text/html" href="http://www.ramblingsofasysadmin.com/" />
    <link rel="self" type="application/atom+xml" href="http://www.ramblingsofasysadmin.com/atom.xml" />
   <id>tag:www.ramblingsofasysadmin.com,2006://1</id>
    <link rel="service.post" type="application/atom+xml" href="http://www.ramblingsofasysadmin.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1" title="ramblings of a system administrator." />
    <updated>2006-12-11T18:36:44Z</updated>
    <subtitle>stuff i learned on the job.</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 3.2</generator>
 
<entry>
    <title>enabling mod_rewrite on apache.</title>
    <link rel="alternate" type="text/html" href="http://www.ramblingsofasysadmin.com/2006/12/enabling_mod_rewrite_on_apache_1.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.ramblingsofasysadmin.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=30" title="enabling mod_rewrite on apache." />
    <id>tag:www.ramblingsofasysadmin.com,2006://1.30</id>
    
    <published>2006-12-11T18:27:03Z</published>
    <updated>2006-12-11T18:36:44Z</updated>
    
    <summary>on a basic default apache installation, mod_rewrite doesn&apos;t work by default. i&apos;ve determined that in all the cases i&apos;ve experienced, it&apos;s because AllowOverride All is not specified (by default, it&apos;s AllowOverride None). here are other troubleshooting steps to consider (credit...</summary>
    <author>
        <name>tamar</name>
        
    </author>
            <category term="troubleshooting." />
    
    <content type="html" xml:lang="en" xml:base="http://www.ramblingsofasysadmin.com/">
        <![CDATA[<p>on a basic default apache installation, mod_rewrite doesn't work by default. </p>

<p>i've determined that in all the cases i've experienced, it's because <font face="courier">AllowOverride All</font> is not specified (by default, it's <font face="courier">AllowOverride None</font>).</p>

<p>here are other troubleshooting steps to consider (credit to <a href="http://www.webmasterworld.com/forum92/2195.htm">jdMorgan from webmasterworld.com</a>):</p>

<p><li> LoadModule rewrite_module modules/mod_rewrite.so<br />
<li> AddModule mod_rewrite.c</p>

<p><li> allowoverride FileInfo Options -or-<br />
<li> allowoverride All</p>

<p><li> Options +FollowSymLinks -or-<br />
<li> Options +SymLinksIfOwnerMatch -or-<br />
<li> Options All</p>]]>
        
    </content>
</entry>
<entry>
    <title>paranoid iptables: block that IP range for good.</title>
    <link rel="alternate" type="text/html" href="http://www.ramblingsofasysadmin.com/2006/10/paranoid_iptables_block_that_i.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.ramblingsofasysadmin.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=28" title="paranoid iptables: block that IP range for good." />
    <id>tag:www.ramblingsofasysadmin.com,2006://1.28</id>
    
    <published>2006-10-17T15:24:55Z</published>
    <updated>2006-10-17T15:30:09Z</updated>
    
    <summary>as long as your iptables is saved regularly, this command is pretty useful for those IPs that just seem to linger and never go away. i have this problem with IPs in korea. as such, i&apos;ve implemented the following &quot;paranoid&quot;...</summary>
    <author>
        <name>tamar</name>
        
    </author>
            <category term="security." />
    
    <content type="html" xml:lang="en" xml:base="http://www.ramblingsofasysadmin.com/">
        <![CDATA[<p>as long as your iptables is saved regularly, this command is pretty useful for those IPs that just seem to linger and never go away.  i have this problem with IPs in korea.</p>

<p>as such, i've implemented the following "paranoid" iptables rule which i consider pretty helpful to keep them out for good:</p>

<p><font face="courier"># iptables -t nat -I PREROUTING 1 -s 222.122.0.0/16 -j DROP</font></p>

<p>simply put, this bans the entire 222.122.x.x subnet on the NAT table and prevents any packets from coming in. </p>]]>
        
    </content>
</entry>
<entry>
    <title>port utilization checkup.</title>
    <link rel="alternate" type="text/html" href="http://www.ramblingsofasysadmin.com/2006/10/port_utilization_checkup.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.ramblingsofasysadmin.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=27" title="port utilization checkup." />
    <id>tag:www.ramblingsofasysadmin.com,2006://1.27</id>
    
    <published>2006-10-17T15:12:11Z</published>
    <updated>2006-10-17T15:18:49Z</updated>
    
    <summary>i run nmap on localhost on a nightly basis and compare the results (which are emailed to me) against the previous night&apos;s. this way, i can tell if something happened at a certain time if a new port mysteriously opens...</summary>
    <author>
        <name>tamar</name>
        
    </author>
            <category term="security." />
    
    <content type="html" xml:lang="en" xml:base="http://www.ramblingsofasysadmin.com/">
        <![CDATA[<p>i run nmap on localhost on a nightly basis and compare the results (which are emailed to me) against the previous night's.  this way, i can tell if something happened at a certain time if a new port mysteriously opens itself.</p>

<p>today, i encountered an open port on 6010.  i investigated who was using them by running the following useful commands, which i am posting here for reference:</p>

<p><font face="courier"># /usr/sbin/lsof -i TCP:6010<br />
COMMAND   PID USER   FD   TYPE   DEVICE SIZE NODE NAME<br />
sshd    21176  user    9u  IPv4 13084094       TCP localhost:x11-ssh-offset (LISTEN)</font></p>

<p>guess he was using X11, which opens an additional port.</p>

<p>i further broke this down by looking into the following:</p>

<p><font face="courier"># /sbin/fuser -name tcp 6010<br />
here: 6010<br />
6010/tcp:            24345</font></p>

<p>this indicated that process ID (pid) 24345 was doing something funny.</p>

<p>so i looked into the pid:</p>

<p><font face="courier"># /usr/sbin/lsof -p 24345<br />
COMMAND   PID USER   FD   TYPE     DEVICE    SIZE     NODE NAME<br />
sshd    24345 user  cwd    DIR        8,5    4096        2 /<br />
sshd    24345 user rtd    DIR        8,5    4096        2 /<br />
sshd    24345 user  txt    REG        8,5  309200 20922628 /usr/sbin/sshd<br />
sshd    24345 user  mem    REG        8,5  941024 23234362 /lib/libcrypto.so.0.9.7a<br />
sshd    24345 user  mem    REG        8,5   14542 23234382 /lib/libutil-2.3.4.so<br />
sshd    24345 user  mem    REG        8,5   63624  3069543 /usr/lib/libz.so.1.2.1.2<br />
sshd    24345 user  mem    REG        8,5   56328 23232671 /lib/libselinux.so.1<br />
[snip]</font></p>

<p>point being: i now knew the source of the open port, and it was harmless.</p>

<p>on the other hand, if it was something to wonder about, i'd have killed the process using <font face="courier">kill -9 24345</font> and have figured out the entry point to the server in order to better secure it.</p>]]>
        
    </content>
</entry>
<entry>
    <title>qmail error resolution: sorry, although i&apos;m listed as a best-preference mx for that host, it isn&apos;t in my control/locals file.</title>
    <link rel="alternate" type="text/html" href="http://www.ramblingsofasysadmin.com/2006/09/qmail_error_resolution_sorry_a.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.ramblingsofasysadmin.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=26" title="qmail error resolution: sorry, although i'm listed as a best-preference mx for that host, it isn't in my control/locals file." />
    <id>tag:www.ramblingsofasysadmin.com,2006://1.26</id>
    
    <published>2006-09-28T19:00:49Z</published>
    <updated>2006-09-28T19:08:25Z</updated>
    
    <summary>today, i had to reenable a domain through plesk. once the guy&apos;s site was up and running, he said that he couldn&apos;t receive email. i sent him a test email and had the following message: Sorry. Although I&apos;m listed as...</summary>
    <author>
        <name>tamar</name>
        
    </author>
            <category term="troubleshooting." />
    
    <content type="html" xml:lang="en" xml:base="http://www.ramblingsofasysadmin.com/">
        <![CDATA[<p>today, i had to reenable a domain through plesk.  once the guy's site was up and running, he said that he couldn't receive email.  i sent him a test email and had the following message:</p>

<p><font face="courier">Sorry. Although I'm listed as a best-preference MX or A for that host, it isn't in my control/locals file, so I don't treat it as local. (#5.4.6)</font></p>

<p>how come?  i honestly never saw this problem before.</p>

<p>well, qmail/plesk stores the hostname in a file located in <font face="courier">/var/qmail/control/rcpthosts</font>.  i checked and it was there.  so what gives?</p>

<p>my guess is that plesk did things too quickly, or not well enough.  i ended up having to restart qmail.  after that was done, he began receiving his messages again.</p>]]>
        
    </content>
</entry>
<entry>
    <title>qmail: 7 day mail queues?  too long.</title>
    <link rel="alternate" type="text/html" href="http://www.ramblingsofasysadmin.com/2006/09/qmail_7_day_mail_queues_too_lo.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.ramblingsofasysadmin.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=25" title="qmail: 7 day mail queues?  too long." />
    <id>tag:www.ramblingsofasysadmin.com,2006://1.25</id>
    
    <published>2006-09-20T18:45:13Z</published>
    <updated>2006-09-20T19:00:27Z</updated>
    
    <summary>i&apos;ve been taking a proactive stance in checking the mail queue in my office, since if it gets cluttered with newsletters or unnecessary stuff (including the occasional password phishing from code vulnerabilities in contact forms), it ends up slowing down...</summary>
    <author>
        <name>tamar</name>
        
    </author>
            <category term="tutorials." />
    
    <content type="html" xml:lang="en" xml:base="http://www.ramblingsofasysadmin.com/">
        <![CDATA[<p>i've been taking a proactive stance in checking the mail queue in my office, since if it gets cluttered with newsletters or unnecessary stuff (including the occasional password phishing from code vulnerabilities in contact forms), it ends up slowing down other emails significantly.</p>

<p>by default, the qmail queue is 7 days long (604800 seconds).  to check that, you can run the following:</p>

<p><font face="courier"># qmail-showctl | grep queue<br />
queuelifetime: (Default.) Message lifetime in the queue is 604800 seconds.</font></p>

<p>(side point: there's a lot of cool stuff you can see there related to the qmail setup if you don't only grep for the queue.)</p>

<p>in my opinion, 7 days is just way too long.  sometimes i'm checking the queue and an email is mailed to a wrong address... and the email just sits there while the mailserver repeatedly attempts to send the message to this nonexistent address.  (for example, if you're looking to email someguy@aol.com and you accidentally addressed it with the domain aol.org, you'll be waiting a long time for a bounceback, which might cause frustration and anger because you thought you sent it to the right guy to begin with.)</p>

<p>everything on linux can be tweaked, and it's relatively easy to do at times.  in this particular case, what is needed is a newly created file, <font face="courier">/var/qmail/control/queuelifetime</font>, which contains a single line: the number of seconds that you want the queue to last.  in my case, i made it 172800 seconds (2 full days; a single day is 86400), so these emails get returned to sender informing them that they should get the right address or try later.</p>

<p>once you run this file, you can verify that the new queue length is in effect by running the following:</p>

<p><font face="courier"># /var/qmail/bin/qmail-showctl | grep queue<br />
queuelifetime: Message lifetime in the queue is 172800 seconds.</font></p>

<p>note how it doesn't say "Default" anymore like the previous execution of the same command did.</p>

<p>to force those old emails to be sent?  just run <font face="courier">qmHandle -a</font> and you'll notice that the queue (<font face="courier">qmHandle -l</font>) has gotten a lot shorter.</p>

<p>if you don't have <font face="courier">qmHandle</font>, <a href="http://sourceforge.net/projects/qmhandle" target="_new">you can get it on sourceforge; just click here</a>.  it's not part of the regular qmail distribution.  more information on qmHandle can be found in <a href="http://www.ramblingsofasysadmin.com/2006/06/viewing_mail_queues.html" target="_new">this blog entry</a>.</p>]]>
        
    </content>
</entry>
<entry>
    <title>robots.txt and spidering.</title>
    <link rel="alternate" type="text/html" href="http://www.ramblingsofasysadmin.com/2006/09/robotstxt_and_spidering.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.ramblingsofasysadmin.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=24" title="robots.txt and spidering." />
    <id>tag:www.ramblingsofasysadmin.com,2006://1.24</id>
    
    <published>2006-09-19T16:24:20Z</published>
    <updated>2006-09-19T16:59:48Z</updated>
    
    <summary>when you have content that is not for public consumption, you should always be safe than sorry by preventing the search engines from crawling (or spidering) the page and learning your link structure. for example, in a development environment, it...</summary>
    <author>
        <name>tamar</name>
        
    </author>
            <category term="tutorials." />
    
    <content type="html" xml:lang="en" xml:base="http://www.ramblingsofasysadmin.com/">
        <![CDATA[<p>when you have content that is not for public consumption, you should always be safe than sorry by preventing the search engines from crawling (or spidering) the page and learning your link structure.  for example, in a development environment, it would hardly be useful for the page to be viewed as if it's a public site when it's not ready yet.</p>

<p>enter <font face="courier">robots.txt</font>.  this file is extremely important; search engines look for that file and determine whether the site can be entered into its search cache or if you want to keep it private.</p>

<p>the basic <font face="courier">robots.txt</font> file works like this: you stick the file in the root of your website (e.g. the <font face="courier">public_html</font> or <font face="courier">httpdocs</font> folder.  it won't work if it's located anywhere else or in a subdirectory of the site.</p>

<p>the crux of the <font face="courier">robots.txt</font> is the <font face="courier">User-Agent</font> and <font face="courier">disallow</font> directives.  if you don't want <b>any</b> search engine bots to spider your any files on your site, the basic file looks like this:</p>

<p><font face="courier">User-agent: *<br />
Disallow: /</font></p>

<p>however, if you don't want the search engines to crawl a specific folder, e.g. www.yoursite.com/private, you would create the file as so:</p>

<p><font face="courier">User-agent: *<br />
Disallow: /private/</font></p>

<p>if you don't want <b>google</b> to spider a specific folder called /newsletters/, then you would use the following:</p>

<p><font face="courier">User-agent: googlebot<br />
Disallow: /newsletters/</font></p>

<p>there are hundreds of bots that you'd need to consider, but the main ones are probably google (googlebot), yahoo (yahoo-slurp), and msn (msnbot).</p>

<p>you can also target multiple user-agents in a robots.txt file that looks like this:</p>

<p><font face="courier">User-agent: *<br />
Disallow: /<br />
User-agent: googlebot<br />
Disallow: /cgi-bin/<br />
Disallow: /private/</font></p>

<p>there's a great reference on user agents <a href="http://en.wikipedia.org/wiki/User_agent" target="_new">on wikipedia</a>.  another great resource is <a href="http://www.mcanerin.com/EN/search-engine/robots-txt.asp">this robots.txt file generator</a>.</p>

<p>where security is concerned, a <font face="courier">robots.txt</font> file makes a huge difference.</p>]]>
        
    </content>
</entry>
<entry>
    <title>showing and understanding mysql processes in detail.</title>
    <link rel="alternate" type="text/html" href="http://www.ramblingsofasysadmin.com/2006/09/showing_and_understanding_mysq.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.ramblingsofasysadmin.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=23" title="showing and understanding mysql processes in detail." />
    <id>tag:www.ramblingsofasysadmin.com,2006://1.23</id>
    
    <published>2006-09-18T19:15:13Z</published>
    <updated>2006-10-17T14:26:17Z</updated>
    
    <summary>i&apos;ve learned a little trick on how to determine how your mysql server is running and where to pinpoint problems in the event of a heavy load. this is useful in determining how you might want to proceed in terms...</summary>
    <author>
        <name>tamar</name>
        
    </author>
            <category term="tutorials." />
    
    <content type="html" xml:lang="en" xml:base="http://www.ramblingsofasysadmin.com/">
        <![CDATA[<p>i've learned a little trick on how to determine how your mysql server is running and where to pinpoint problems in the event of a heavy load.  this is useful in determining how you might want to proceed in terms of mysql optimization.</p>

<p><font face="courier"># mysql -u [adminuser] -p<br />
mysql> show processlist;</font></p>

<p>granted, on a server with heavy volume, you might see hundreds of rows and it will scroll off the screen.  here are the key elements to the processlist table: Id, User, Host, db, Command, Time, State, Info, where:<br />
<b>Id</b> is the connection identifier<br />
<b>User</b> is the mysql user who issued the statement<br />
<b>Host</b> is the hostname of the client issuing the statement.  this will be localhost in almost all cases unless you are executing commands on a remote server.<br />
<b>db</b> is the database being used for the particular mysql statement or query.<br />
<b>Command</b> can be one of many different commands issued in the particular query.  the most common occurrence on a webserver is "Sleep," which means that the particular database connection is waiting for new directions or a new statement.  <br />
<b>Time</b> is the delay between the original time of execution of the statement and the time the processlist is viewed<br />
<b>State</b> is an action, event, or state of the specific mysql command and can be one of hundreds of different values.  <br />
<b>Info</b> will show the actual statement being run in that instance</p>

<p>another useful command is:<br />
<font face="courier">mysql> show full processlist;</font> <br />
which is equivalent to:<br />
<font face="courier">mysqladmin -u [adminuser] -p processlist;</font></p>

<p>this shows my specific query as:<br />
<font face="courier">| 4342233 | adminusername   | localhost | NULL               | Query   |    0 | NULL  | show full processlist |</font><br />
</font></p>

<p>or you can display each field in a row format (vertical format), like so, simply by appending <font face="courier">\G</font> to the end of the query:<br />
<font face="courier">mysql> show full processlist\G</font></p>

<p>this list is very likely preferable in the event that your data scrolls off the screen and you want to find out the specific field name of a value in your database.<br />
<font face="courier">******** 55. row ********<br />
     Id: 4342233<br />
   User: adminusername<br />
   Host: localhost<br />
     db: NULL<br />
Command: Query<br />
   Time: 0<br />
  State: NULL<br />
   Info: show full processlist<br />
</font></p>

<p>you can also check how many mysql queries a user has open by running the following command:<br />
<font face="courier">mysqladmin -u [adminuser] -p pr | awk -F\| {'print $3'} | sort -nk1 | awk -F_ {'print $1'} |uniq -c |sort</font></p>

<p>to see which database has the most active queries, run the following:<br />
<font face="courier">mysqladmin -u [adminuser] -p pr | awk -F\| {'print $3'} | sort -nk1 |uniq -c |sort</font></p>

<p><br />
oh, and since it's useful... here's a recommend <font face="courier">/etc/my.cnf</font>:</p>

<p><font face="courier"><br />
[mysqld]<br />
datadir=/var/lib/mysql<br />
skip-locking<br />
skip-innodb<br />
safe-show-database<br />
query_cache_limit=1M<br />
query_cache_size=64M <br />
query_cache_type=1<br />
max_user_connections=100<br />
max_connections=350<br />
interactive_timeout=10<br />
wait_timeout=20<br />
connect_timeout=20<br />
thread_cache_size=128<br />
key_buffer=64M <br />
join_buffer=1M<br />
max_connect_errors=20<br />
max_allowed_packet=16M<br />
table_cache=1024<br />
record_buffer=1M<br />
sort_buffer_size=2M <br />
read_buffer_size=2M <br />
read_rnd_buffer_size=2M  <br />
thread_concurrency=4 <br />
myisam_sort_buffer_size=64M<br />
server-id=1<br />
long_query_time=2<br />
slave_net_timeout = 50<br />
delayed_insert_timeout = 50</p>

<p>[mysql.server]<br />
user=mysql<br />
basedir=/var/lib</p>

<p>[safe_mysqld]<br />
err-log=/var/log/mysqld.log<br />
pid-file=/var/lib/mysql/mysql.pid<br />
open_files_limit=8192</p>

<p>[mysqldump]<br />
quick<br />
max_allowed_packet=16M</p>

<p>[mysql]<br />
no-auto-rehash</p>

<p>[isamchk]<br />
key_buffer=64M<br />
sort_buffer=64M<br />
read_buffer=16M<br />
write_buffer=16M</p>

<p>[myisamchk]<br />
key_buffer=64M<br />
sort_buffer=64M<br />
read_buffer=16M<br />
write_buffer=16M</p>

<p>[mysqlhotcopy]<br />
interactive-timeout<br />
</font></p>

<p>another fine tuning would include the following and is good for machines with plesk:</p>

<p><font face="courier"><br />
skip-locking<br />
key_buffer = 128M<br />
max_allowed_packet = 1M<br />
table_cache = 512<br />
sort_buffer_size = 2M<br />
read_buffer_size = 2M<br />
read_rnd_buffer_size = 8M<br />
myisam_sort_buffer_size = 64M<br />
thread_cache_size = 8<br />
query_cache_size = 64M<br />
thread_concurrency = 8<br />
</font></p>

<p><br />
the above will help you optimize your mysql database as well, but the configuration isn't for everyone.</p>]]>
        
    </content>
</entry>
<entry>
    <title>preventing against ddos attacks.</title>
    <link rel="alternate" type="text/html" href="http://www.ramblingsofasysadmin.com/2006/08/preventing_against_ddos_attack.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.ramblingsofasysadmin.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=22" title="preventing against ddos attacks." />
    <id>tag:www.ramblingsofasysadmin.com,2006://1.22</id>
    
    <published>2006-08-24T19:16:27Z</published>
    <updated>2006-08-24T19:38:06Z</updated>
    
    <summary>what is a ddos attack, you ask? a distributed denial of service (ddos) attack is when multiple computers try to flood your server with thousands of connections with the goal in mind to bring your server down for a good...</summary>
    <author>
        <name>tamar</name>
        
    </author>
            <category term="system tools." />
    
    <content type="html" xml:lang="en" xml:base="http://www.ramblingsofasysadmin.com/">
        <![CDATA[<p>what is a ddos attack, you ask?  a distributed denial of service (ddos) attack is when multiple computers try to flood your server with thousands of connections with the goal in mind to bring your server down for a good chunk of time.</p>

<p>a lot of people fall victim to these attacks daily. </p>

<p>they don't have to.</p>

<p>(d)dos-deflate is an open-source tool that will prevent against any denial of service attacks.  you can download it <a href="http://deflate.medialayer.com/" target="_new">here</a>.</p>

<p>all of the configuration files by default get stored in <font face="courier">/usr/local/ddos/ddos.conf</font>.  </p>

<p>i've personally tweaked the system to ban the IP for a little longer than the default 600 seconds, and of course, don't forget to change the email address so that the warnings go to you.  (you wouldn't want your IP being blocked accidentally and have your email warnings go to a possibly unchecked email address!)</p>

<p>you can also whitelist IP addresses by adding them, line by line, to <font face="courier">/usr/local/ddos/ignore.ip.list</font>.</p>]]>
        
    </content>
</entry>
<entry>
    <title>resolving canonical issues with plesk.</title>
    <link rel="alternate" type="text/html" href="http://www.ramblingsofasysadmin.com/2006/08/canonical_issues_with_plesk.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.ramblingsofasysadmin.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=21" title="resolving canonical issues with plesk." />
    <id>tag:www.ramblingsofasysadmin.com,2006://1.21</id>
    
    <published>2006-08-22T16:08:08Z</published>
    <updated>2006-08-22T16:24:34Z</updated>
    
    <summary>in the world of SEO (search engine optimization), there is an unwritten rule (well, it will be written sooner or later) that you can&apos;t have duplicate content on google search engines from the same site. this means that http://www.domain.com and...</summary>
    <author>
        <name>tamar</name>
        
    </author>
            <category term="tutorials." />
    
    <content type="html" xml:lang="en" xml:base="http://www.ramblingsofasysadmin.com/">
        <![CDATA[<p>in the world of SEO (search engine optimization), there is an unwritten rule (well, it will be written sooner or later) that you can't have duplicate content on google search engines from the same site.  this means that http://www.domain.com and http://domain.com cannot both be found by search engines.  you must choose one or the other or you may face a penalty.</p>

<p>there's an easy solution for this using vhosts in plesk.  the only not-so-user-friendly part about this that you have to do it for every domain you are worried about, and with 100+ domains, you'll be making 100+ (or 200+ files if you have SSL  support as well) vhost files for each domain.</p>

<p>in any event, this is how it's done.</p>

<p>navigate on your plesk server to your domain's conf directory.  on some machines, it's </p>

<p><font face="courier"># cd /var/www/vhosts/domain.com/conf</font></p>

<p>i prefer going through this shortcut:</p>

<p><font face="courier"># cd /home/httpd/vhosts/domain.com/conf</font></p>

<p>regardless, both are symbolically linked -- or they should be in certain setups.</p>

<p>create the file <font face="courier">vhost.conf</font></p>

<p><font face="courier"># vi vhost.conf</font></p>

<p>add the following to the vhost.conf file</p>

<p><font face="courier">RewriteEngine On<br />
RewriteCond %{HTTP_HOST} !^www\. [NC]<br />
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}$1 [QSA,R=301,L]</font></p>

<p>for domains with SSL support, you will need to create a file called <font face="courier">vhost_ssl.conf</font> as well.</p>

<p><font face="courier"># vi vhost_ssl.conf<br />
RewriteEngine On<br />
RewriteCond %{HTTP_HOST} !^www\. [NC]<br />
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}$1 [QSA,R=301,L]</font></p>

<p>that's it!  now, run this plesk command to process your update. </p>

<p><font face="courier"># /usr/local/psa/admin/bin/websrvmng -av</font></p>

<p>load your page in your preferred web browser as http://domain.com.  it will automatically redirect to http://www.domain.com and will be reflected in search engines with the www prefix only.</p>]]>
        
    </content>
</entry>
<entry>
    <title>rkhunter ... doesn&apos;t support redhat ES 4 (nahant update 3)?</title>
    <link rel="alternate" type="text/html" href="http://www.ramblingsofasysadmin.com/2006/07/rkhunter_doesnt_support_redhat.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.ramblingsofasysadmin.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=20" title="rkhunter ... doesn't support redhat ES 4 (nahant update 3)?" />
    <id>tag:www.ramblingsofasysadmin.com,2006://1.20</id>
    
    <published>2006-07-28T18:47:39Z</published>
    <updated>2006-07-28T19:54:39Z</updated>
    
    <summary>actually, it does. but version 1.28 (the latest version as of this writing) doesn&apos;t recognize it. if you&apos;re running rkhunter and get the following message: Determining OS... Unknown Warning: This operating system is not fully supported! Warning: Cannot find md5_not_known...</summary>
    <author>
        <name>tamar</name>
        
    </author>
            <category term="miscellaneous." />
    
    <content type="html" xml:lang="en" xml:base="http://www.ramblingsofasysadmin.com/">
        <![CDATA[<p>actually, it does.  but version 1.28 (the latest version as of this writing) doesn't recognize it.</p>

<p>if you're running rkhunter and get the following message:</p>

<p><font face="courier">Determining OS... Unknown<br />
Warning: This operating system is not fully supported!<br />
Warning: Cannot find md5_not_known<br />
All MD5 checks will be skipped!</font></p>

<p>you can get rkhunter to acknowledge your OS by doing the following:</p>

<p><font face="courier"># cd usr/local/rkhunter/lib/rkhunter/db<br />
# pico os.dat</font></p>

<p>(i'm still a fan of vi, but i'm trying to be tolerant) :)</p>

<p>in this file, look for like 189.  add this line immediately below as such:</p>

<p><font face="courier">190:Red Hat Enterprise Linux ES release 4 (Nahant Update 3):/usr/bin/md5sum:/bin</font></p>

<p>save the file and then run <font face="courier">rkhunter -c</font> once again.</p>

<p>no errors!<br />
</p>]]>
        
    </content>
</entry>
<entry>
    <title>finding files with specific permissions.</title>
    <link rel="alternate" type="text/html" href="http://www.ramblingsofasysadmin.com/2006/07/finding_files_with_specific_pe_1.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.ramblingsofasysadmin.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=19" title="finding files with specific permissions." />
    <id>tag:www.ramblingsofasysadmin.com,2006://1.19</id>
    
    <published>2006-07-28T17:15:06Z</published>
    <updated>2006-08-24T20:58:41Z</updated>
    
    <summary>in may, we did a plesk migration from an older server to a newer one. it was relatively smooth, but for some reason, a lot of image permissions were not kept intact (instead being read+write only by the owner, but...</summary>
    <author>
        <name>tamar</name>
        
    </author>
            <category term="tutorials." />
    
    <content type="html" xml:lang="en" xml:base="http://www.ramblingsofasysadmin.com/">
        <![CDATA[<p>in may, we did a plesk migration from an older server to a newer one.  it was relatively smooth, but for some reason, a lot of image permissions were not kept intact (instead being read+write only by the owner, but not the user or group).</p>

<p>i am beginning to learn how useful the <font face="courier">find</font> command is.  this code snippet below enabled me to find all of the jpg images on my server that were chmodded 600 ... and made them appropriately readable.</p>

<p><font face="courier"># find /home/httpd/vhosts -name '*.jpg' -perm 600</font></p>

<p>but wait, you can execute commands on these results too!</p>

<p><font face="courier"># find /hme/httpd/vhosts/ -name '*.jpg' -perm 600 -exec chmod 644 {} \;</font></p>

<p>good stuff!</p>]]>
        
    </content>
</entry>
<entry>
    <title>iptables port redirection (smtp servers).</title>
    <link rel="alternate" type="text/html" href="http://www.ramblingsofasysadmin.com/2006/07/iptables_port_redirection.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.ramblingsofasysadmin.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=18" title="iptables port redirection (smtp servers)." />
    <id>tag:www.ramblingsofasysadmin.com,2006://1.18</id>
    
    <published>2006-07-11T14:48:29Z</published>
    <updated>2006-08-24T16:36:26Z</updated>
    
    <summary>this is a quick tutorial on tables port redirection. we have a few clients whose outgoing port 25 is blocked by their ISP due to vulnerabilities and exploits that cause this port to send out considerable amounts of spam. this...</summary>
    <author>
        <name>tamar</name>
        
    </author>
            <category term="tutorials." />
    
    <content type="html" xml:lang="en" xml:base="http://www.ramblingsofasysadmin.com/">
        <![CDATA[<p>this is a quick tutorial on tables port redirection.</p>

<p>we have a few clients whose outgoing port 25 is blocked by their ISP due to vulnerabilities and exploits that cause this port to send out considerable amounts of spam.</p>

<p>this is never an obstacle for someone who hosts on a linux server with iptables, because you simply can forward traffic from port 25 to another port (e.g. 26, as in the example below):</p>

<p><font face="courier"># iptables -t nat -I PREROUTING -p tcp --dport 26 -j REDIRECT --to-ports 25</font></p>

<p>easy, isn't it?</p>

<p>of course, if 26 is blocked, you can substitute another open port -- but 25 must remain the same, as 25 is the standard smtp (outgoing email) port.</p>

<p>for someone who needs to utilize these settings, s/he would be required to go to outlook or whatever email application is being used and change the smtp port from standard 25 to 26 (in outlook, this can be done by going to tools > email accounts > view or change existing email accounts > select the questionable email account > change > more settings > advanced tab > change 25 to 26).</p>

<p>then, try to send out the email.  it should no longer be sitting in the user's outbox.</p>

<p>to verify that the change was made on the linux side, simply run:</p>

<p><font face="courier"># iptables -t nat --list</font></p>

<p>the output should show something like this:</p>

<p><font face="courier">Chain PREROUTING (policy ACCEPT)<br />
target     prot opt source               destination<br />
REDIRECT   tcp  --  anywhere             anywhere            tcp dpt:26 redir ports 25<br />
</font></p>

<p>confirmed -- it is working!</p>

<p>make sure to save your changes so that the rules are maintained between reboots:</p>

<p><font face="courier"># /sbin/iptables-save</font></p>]]>
        
    </content>
</entry>
<entry>
    <title>nobodycheck.sh</title>
    <link rel="alternate" type="text/html" href="http://www.ramblingsofasysadmin.com/2006/07/nobodychecksh.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.ramblingsofasysadmin.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=17" title="nobodycheck.sh" />
    <id>tag:www.ramblingsofasysadmin.com,2006://1.17</id>
    
    <published>2006-07-10T17:43:09Z</published>
    <updated>2006-07-11T15:48:14Z</updated>
    
    <summary>i found another free useful tool today: nobodycheck.sh. the file can be accessed right over here. this tool will search for malicious files on your server and email you in the event that such files are found. right now, it&apos;s...</summary>
    <author>
        <name>tamar</name>
        
    </author>
            <category term="system tools." />
    
    <content type="html" xml:lang="en" xml:base="http://www.ramblingsofasysadmin.com/">
        <![CDATA[<p>i found another free useful tool today: nobodycheck.sh.</p>

<p>the file can be accessed right over <a href="http://www.webhostgear.com/353.html" target="_new">here</a>.</p>

<p>this tool will search for malicious files on your server and email you in the event that such files are found.  right now, it's intended to be used by cpanel users, although the application for plesk and other web administrator consoles are in development from what i have heard.</p>

<p>there are never too many security tools that you can install on your linux server, as each can do something different and may catch something that another does not.</p>]]>
        
    </content>
</entry>
<entry>
    <title>a bash script to delete files older than 7 days.</title>
    <link rel="alternate" type="text/html" href="http://www.ramblingsofasysadmin.com/2006/07/a_bash_script_to_delete_files.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.ramblingsofasysadmin.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=16" title="a bash script to delete files older than 7 days." />
    <id>tag:www.ramblingsofasysadmin.com,2006://1.16</id>
    
    <published>2006-07-10T16:08:41Z</published>
    <updated>2006-07-10T17:12:39Z</updated>
    
    <summary>i would like to share this nifty little script, courtesy of a forum post on linuxquestions.org, one of the most authoritative websites on linux genius and learning. #!/bin/bash find /directoryname -type f -mtime +7 -exec rm {} \; this script...</summary>
    <author>
        <name>tamar</name>
        
    </author>
            <category term="miscellaneous." />
    
    <content type="html" xml:lang="en" xml:base="http://www.ramblingsofasysadmin.com/">
        <![CDATA[<p>i would like to share this nifty little script, courtesy of a forum post on <a href="http://www.linuxquestions.org/questions/showthread.php?t=462290" target="_new">linuxquestions.org</a>, one of the most authoritative websites on linux genius and learning.</p>

<p><font face="courier"><br />
#!/bin/bash<br />
find /directoryname -type f -mtime +7 -exec rm {} \; <br />
</font></p>

<p>this script will find all the files that are older than 7 days (as indicated by <font face="courier">mtime +7</font> in the <font face="courier">/directoryname</font> folder (note: it is advisable to use an absolute path here) and execute the <font face="courier">rm</font> command, which will delete (or "remove") the files.</p>]]>
        
    </content>
</entry>
<entry>
    <title>disabling spamassassin in plesk for individual mailboxes.</title>
    <link rel="alternate" type="text/html" href="http://www.ramblingsofasysadmin.com/2006/07/disabling_spamassassin_in_ples.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.ramblingsofasysadmin.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=15" title="disabling spamassassin in plesk for individual mailboxes." />
    <id>tag:www.ramblingsofasysadmin.com,2006://1.15</id>
    
    <published>2006-07-10T13:52:02Z</published>
    <updated>2006-07-10T14:54:31Z</updated>
    
    <summary>today, i got a complaint from a user who didn&apos;t like spam headers in his email. since spamassassin is the only spam-filtering addon installed on our servers, i knew that the best solution would be to disable spamassassin altogether for...</summary>
    <author>
        <name>tamar</name>
        
    </author>
            <category term="system tools." />
    
    <content type="html" xml:lang="en" xml:base="http://www.ramblingsofasysadmin.com/">
        <![CDATA[<p>today, i got a complaint from a user who didn't like spam headers in his email.  since spamassassin is the only spam-filtering addon installed on our servers, i knew that the best solution would be to disable spamassassin altogether for this particular email address.</p>

<p>the Plesk GUI, unfortunately, doesn't make that easy.  fortunately, with versions of plesk 7.5.3 and up, you can do it on the command-line as such:</p>

<p><font face="courier"># /usr/local/psa/bin/spamassassin.sh --update email@domain.com -status false</font></p>

<p>this completely disables the spamassassin addon for this email address and eliminates all spam headers.  while that is not what people nowadays want, it's exactly what this guy wanted, and it works.</p>]]>
        
    </content>
</entry>

</feed> 


