Archive for the 'Servers' Category

It's not all about "unstable" Mongrel :)

Friday, January 19th, 2007

Well, after 2 days of weird server behavious, after which I have installed the Monit services monitor, it turned out that Mongrel was not actually the biggest source of the problem.

Yesterday, server started behaving very weirdly - restarting itself every 10-20 minutes. No trace of errors in logs, no notifications about restart to be performed even. I though that may be, just may be it is a software problem, although everything looked like a hardware problem from at the first glance. So I have checked cron (oh well, who know may be there's some process restarting the server?), even tried to turn off Monit as it was the only software I have installed recently. All this just to find the server restarting in next 10 minutes :)

At this point, I finally decided to attach a monitor to the server - yeah it was headless before that heh :) And once it was done, I could witness the exact way the server restarts itself - by just.. turning itself off and on, like somebody just pressed the Reset button. So.. since then it definitely started to look like hardware problems so I took the server offline completely and booted up from memtest CD. Just to find out that server restarts itself before the test progress even reaches 2%.

Long story short - got a new memory module, installed, started server - and all is fine since then. But anyway, all these manipulations with setting up Monit were not without use. Mongrel instances still crash several times a day. But are quickly relaunched by Monit.

So, hopefully now more midnight server fixes :)

Securing your sleep when running Mongrel

Wednesday, January 17th, 2007

Mongrel, which, along with Apache 2.2 & load balancer & mongrel cluster, I run for hosting my Rails site - is a very nice piece of software. But there is a problem. It crashes.

I found about it the hard way - by a phone call at 0:30 in the morning, saying "the server seems to be down". "Doh", I though - and got out of my comfy bad.. Got to my computer, logged in to the server, restarted Mongrel cluster and got back to sleep (you can always check the logs later in the morning, right? :) (more…)

Japanese mobile operators are rfc-ignorant.org blacklisted

Tuesday, January 9th, 2007

I had a plenty of "good" time today as I have found out that all of the subscribe-by-sending an-empy-mail systems I maintain just stopped working a few days ago. Here I will describe sympthoms and solutions for this problem.
The forementioned systems work so that a user sends an empty email message to a designated email address, and gets added to a corresponding mailing list. Simple and easy to use system.

Most users (like say, 90%) are Japanese users who add themselves into mailing lists using their mobile phones. Therefore using Japanese mobile operator's email servers, such as DoCoMo's, Vodafone/Softbank and others.

The problem was that although the system was working without any problems for over a year now, a couple of days ago it just stopped working. I turned out that email messages which were sent from DoCoMo and Vodafone/Softbank mobile phones were not reaching the processing scripts on my server.

After a little digging, it turned out that these emails were classified as spam by SpamAssassin which I have of course running of the server. Now.. everything worked just a few days ago, and suddenly stopped to. Why?

After a little more digging, I found the following information added to spam messages by the SpamAssassin:

Content analysis details: (5.3 points, 3.0 required)

pts rule name description
—- ———————- ————————————————–
0.6 NO_REAL_NAME From: does not include a real name
0.5 DNS_FROM_RFC_ABUSE RBL: Envelope sender in abuse.rfc-ignorant.org
1.4 DNS_FROM_RFC_POST RBL: Envelope sender in
postmaster.rfc-ignorant.org
1.3 MISSING_SUBJECT Missing Subject: header
1.5 EMPTY_MESSAGE Message appears to be empty with no Subject: text

As the subscription emails by their nature were always sent without any subject and content, and without real name in most cases (and my SpamAssassin was set to filter out all messages with spam level of 3.0 or higher), it looks like the reason for the mail to suddenly became spam were the lines:

0.5 DNS_FROM_RFC_ABUSE RBL: Envelope sender in abuse.rfc-ignorant.org
1.4 DNS_FROM_RFC_POST RBL: Envelope sender in postmaster.rfc-ignorant.org

A quick look at rfc-ignorant.org's blacklist turned out the following:

docomo.jpg vodafone.jpg

So, both operators are black-listed because they don't conform to requirements of having postmaster@… and abuse@… email addresses. I'm not really sure that such non-conformance can be classified as a possible source of spam, but oh well.. whatever. How to fix the bloody thing?

Actually, pretty easy. You just need to edit a single config file for SpamAssassin and set the spam level of both DNS_FROM_RFC_ABUSE and DNS_FROM_RFC_POST messages to lower level (or to zero if you wish). The file is located at : /etc/mail/spamassassin/local.cf

And you just need to add the following two lines to the file and save it. Changes will be activated immediately:

score DNS_FROM_RFC_POST 0.0
score DNS_FROM_RFC_ABUSE 0.0

That's it! We just ignore the stupid false-spam messages and everything works fine again, as it was doing for a long-long time before. Just one question remains - WHY, though both operators' mail servers were black-listed more than 2 years ago, my local SpamAssassin started to pay attention to it just a few days ago?.. I don't remember updating any of server software lately, so.. a mistery? :)

Easy Inline SWF plugin updated to version 1.0.2

Sunday, October 1st, 2006

The new version fixes problems with resolving local path to .swf in situations when WordPress is not installed at site's root (ie: http://mydomain.com/wordpress, etc)

Get the info and download the new version at this link.

Transmit SFTP without entering login and password

Wednesday, September 27th, 2006

In my previous entry regarding "SSH Login without entering password" I have wrote about how to make it easier to login into SSH servers.

It's all nice, works, and makes life easier. But if you are a Mac user who uses Transmit to log into SFTP servers, there is one very nice side-effect of the technique described in the forementioned entry. You can actually log into your SFTP servers by just typing a server's address, and with not need to enter password, or even login name!

Here's how I connect to my SFTP server:

nouserid.jpg

And after clicking the Connect button…

loggedin.jpg

Voila! No login name, and no password, but I was logged into a server which actually does require a login name, and the password is actually more than 10 characters!

How does it work? Well actually, SFTP connection is a connection using the same mechanism which is used to do an SSH connection (you use the same login and password for both). And Transmit uses the standard OS built-in functions to do this connection. Therefore, once you have set up your computer to be able to login into remote SSH server without entering password, you automatically gain ability to use Transmit to log into the same server using SFTP protocol!

There's one catch though. I have told you that you don't need to enter login name, but actually it is not true :) A name is required in order to login, but if you don't specify it, your current login name is used (which is "mike" in my case), and if login name on remote server is the same as your local one (and it happens that remote server's login name is "mike" too), you are just fine with the default values.

But what you are to do if, say, your local name is "mike", and you have setup an SSH key for, say, server "example.com" as "hosting@example.com" (ie, the user name on the remote hosting is "hosting", and not "mike)? Well, you can override the defaults, and specify which default name you want to use when connecting to which server. In order to do that, you have to edit contents of ~/.ssh/config file (you have to create it if it doesn't exist). For the case above, the contents of the ~/.ssh/config file should read

Host example.com
User hosting

This way, when you connect to the host "example.com" without specifying user name, the default user name "hosting" will be used (thanks to Dave Teare for this hint).

And of course, you can always just specify user name in the Transmit connection window :)

example.jpg

That's it :) Happy name-less and password-less SFTPing ;)

Easy Inline SWF 1.0 Plugin for WordPress

Wednesday, September 13th, 2006

There are several plugins to display Flash content for WordPress, but they don't make it easy for a user to insert Flash. They ask you to put some weird tags into your post, set Flash dimensions.. Well… NO MORE OF THIS PAIN! :) (cool CM huh ;) (more…)

WordPress: how to hide other users' posts in admin panel

Monday, September 11th, 2006

I am working on another WordPress-based system currently, and have faced a problem when I have many users who can log into WordPress admin panel to post their blog entries. But doing so, they all can see each others posts, even though not being able to edit any post but their own's.

From users  point of view, it is not the best thing in the world to look for your own posts in the list, especially if there are lots of users in the system.

So, here's a simple solution for the problem - after logging into the system, non-admin users will be able to only see their own posts in the Admin -> Manage panel. The only thing is that I seems no plugin solultion is possible so you have to add 3 lines to one file.

The file you have to add these lines is located in /wp-admin/edit.php file in your WordPress installation. You have to go to line 150 (or near it, where it says:

if ($posts) {
$bgcolor = '';
foreach ($posts as $post)…..

..etc

Now, just add the following code ABOVE the one mentioned above:

if ($userdata->user_level<10) {
    $posts = query_posts("author=".$userdata->ID);
}

So, in the end you will get something like that:

<?php

if ($userdata->user_level<10) {
    $posts = query_posts("author=".$userdata->ID);
}

if ($posts) {
$bgcolor = '';
foreach ($posts as $post) { start_wp();
$class = ('alternate' == $class) ? '' : 'alternate';

You're done! Now all non-admin users will see only their own posts :) Simple and easy. Have fun. 

Inline Google Maps for WordPress

Friday, September 8th, 2006

There are several WordPress plugins for showing Google maps on blog pages exist, but unfortunately, they are all kind of do "too much" :) Like displaying your posts on a Google map, or something like that. What I needed is just a simple plugin which would allow me to embed a Google map into my WordPress blog pages, anywhere I want, preferrably with a single line of simple code. There was nothing like that so I have wrote my own plugin. It's easy to use and install, and works fine so.. here we go :)

(more…)

Integration of Spry and PHP/MySQL

Wednesday, July 5th, 2006

Adobe have recently released its Spry Ajax framework for public beta-test by developers and I've been playing with this baby for a while. And here's some kind of report of what I have learned.

(more…)

Power in Simplicity (discover the 'scp' command)

Wednesday, June 28th, 2006

Just recently I have discovered the power which ssh-installkey utility gives for the ssh login (i.e. you don't need to enter your password to log into a remote computer after you have installed your public SSH key onto it). And you can read about it here

Now, I have discovered the power which a simple 'scp' (SSH Copy?) gives you when added to the mix. (more…)