Search This Blog

Wednesday, May 16, 2012

Trac Hacks - Plugins Macros etc. - Trac

Trac Hacks - Plugins Macros etc. - Trac:


Welcome to Trac Hacks

The purpose of TracHacks is to provide free Subversion hosting for community created Trac hacks.
TracHacks uses the excellent TagsPlugin, which adds basic categorisation to Trac. All hacks are tagged with one or more of the available tags.

Nagios unable to send email

Nagios unable to send email

ERROR MESSAGE

May 16 13:02:00 d4 nagios: Warning: Attempting to execute the command "/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: PROBLEM\n\nService: Uptime\nHost: xyz.com\nAddress: 50.116.53.49\nState: CRITICAL\n\nDate/Time: Wed May 16 13:02:00 IST 2012\n\nAdditional Info:\n\n(Return code of 127 is out of bounds - plugin may be missing)\n" | /bin/mail -s "** PROBLEM Service Alert: xyz.com/Uptime is CRITICAL **" support@xyz.com" resulted in a return code of 127.  Make sure the script or binary you are trying to execute actually exists...

SOLUTION
user@d4:user$ whereis mail
mail: /usr/bin/mail.mailutils /usr/bin/mail /usr/share/man/man1/mail.1.gz

user@d4:user$ sudo ln -s /usr/bin/mail /bin/mail

Monday, May 14, 2012

Relaying through Google Apps using Sendmail to bypass EC2 spam blockage | Looking for the paradigm

Relaying through Google Apps using Sendmail to bypass EC2 spam blockage | Looking for the paradigm:


Update 3 May 2011: I’ve subsequently modified our EC2 systems to relay SMTP mail through Amazon’s SES which doesn’t have the 500 messages per day limit that Google Apps does.
A few months ago I moved a site into EC2. I didn’t want to move the existing IMAP server (ugh) so I moved the email to Google Apps. There are only about 10 mailboxes so we went with “Standard” edition (free). Once we completed the move to EC2 we discovered that emails from our webserver were bouncing due to our EC2 IP address being listed in a spam RBL. This sucked, so I looked into relaying the mail from the EC2 webserver through our Google Apps account. Fortunately this turned out to be pretty easy.
This wiki page on scalix.com has a procedure for setting up SMTP relaying in Ubuntu with TLS & auth. I’m not running Ubuntu so the paths were different but it was basically the same procedure:
  • Create the file /etc/mail/client-info with these contents:AuthInfo:smtp.gmail.com "U:bounces@example.com" "I:bounces@example.com" "P:superpassword", where “example.com” is your Google Apps domain, “bounces” is a valid account, and the password is the account’s password. Mail relayed with these credentials will show “bounces@example.com” in the From: field of the message.
  • In /etc/mail, run makemap hash client-info < client-info
  • Edit /etc/mail/sendmail.mc, adding or uncommenting these lines:
    define(`SMART_HOST', `smtp.gmail.com')dnl
    define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
    FEATURE(`authinfo', `hash /etc/mail/client-info')dnl
    
  • Recompile sendmail.cf: m4 sendmail.mc > sendmail.cf . I got this error: "/etc/mail/sendmail.mc:10: m4: Cannot open /usr/share/sendmail-cf/m4/cf.m4" when running the command, but I resolved it by doing yum install sendmail-cf
  • Restart sendmail.
Once this was done I sent myself a test message from the command line and received it; I checked the SMTP headers and sure enough it went through Google's mail server. One nice side effect is that all the mail sent by the webserver appears in the "Sent" folder for the Google Apps username provided in the client-info file. Hopefully this will resolve the spam issues, since the mail is now coming from Google's IP block.

Integrating Amazon SES with Sendmail - Amazon Simple Email Service

Integrating Amazon SES with Sendmail - Amazon Simple Email Service:


Sendmail was released in the early 1980s, and has been continuously improved ever since. It is a very flexible and configurable MTA, and it has a large installed base.
For information about Sendmail, go to http://www.sendmail.com/sm/open_source/.
To configure integration using STARTTLS
  1. Edit the /etc/mail/authinfo file. If the file does not exist, create it. Add the following lines to the file, replacing USERNAME and PASSWORD with your SMTP user name and password.
    AuthInfo:email-smtp.us-east-1.amazonaws.com "U:root" "I:USERNAME" "P:PASSWORD" "M:LOGIN"
    AuthInfo:ses-smtp-prod-335357831.us-east-1.elb.amazonaws.com "U:root" "I:USERNAME" "P:PASSWORD" "M:LOGIN"
                        
  2. Save the authinfo file.
  3. At a command prompt, issue the following command to generate the Sendmail configuration file:
    makemap hash authinfo < authinfo
  4. Edit the /etc/mail/sendmail.mc file. If the file does not exist, you can obtain it by installing the sendmail.cf package on your system. In the sendmail.mc file, add the following lines:
    define(`SMART_HOST', `email-smtp.us-east-1.amazonaws.com')dnl
    define(`RELAY_MAILER_ARGS', `TCP $h 25')dnl
    define(`confAUTH_MECHANISMS', `LOGIN PLAIN')dnl
    FEATURE(`authinfo', `hash -o /etc/mail/authinfo.db')dnl
                        
    [Note]Note
    Be sure that relaying is allowed for email-smtp.us-east-1.amazonaws.com in the /etc/mail/access file.
  5. Save the sendmail.mc file.
  6. Issue the following command:
    m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

    if you get following error
    m4:/etc/mail/sendmail.mc:10: cannot open `/usr/share/sendmail-cf/m4/cf.m4': No such file or directory
    then
    yum install sendmail-cf

AWS Developer Forums: How do I resolve these duplicates ...

AWS Developer Forums: How do I resolve these duplicates ...:

If sudo yum update --skip-broken does not work. Then do the below.

package-cleanup --dupes
package-cleanup --cleandupes

amazon ec2 - Broken yum package tree - Server Fault

amazon ec2 - Broken yum package tree - Server Fault:


update your system
yum clean all
yum update
Then if you need python 2.6 try installing it via yum

AWS Developer Forums: Sendmail not playing nice with SES ...

AWS Developer Forums: Sendmail not playing nice with SES ...:




I understand some of the permissions warnings, as I did open up some of the permissions for testing, but that shouldn't cause a problem, should it?

Does anyone have any suggestions? Email is the last hurdle before I move my entire site to AWS, and I'd like to stick with AWS solutions (namely SES) if possible, but it's starting to look like I need to look around some more for other email relays.
PermlinkReplies: Pages: Last Post: Sep 12, 2011 6:12 AM by: Igor@AWS
Replies

Re: Sendmail not playing nice with SES
Posted by:  Igor@AWS
Posted on: Sep 12, 2011 6:12 AM
in response to: Nathan G Barhorst in response to: Nathan G Barhorst
 Click to reply to this threadReply
Hi Nathan,

From your logs, it seems that you’ve configured the mailer correctly (although you need to address the permissions warnings). However, you get errors when sendmail tries to call ses-send-email.pl. Here are some debug steps:
  • Stop current sendmail instance
  • Start sendmail in debug mode:
sendmail -bD -O LogLevel=20 -X /tmp/sendmail.log
  • Send a test email
  • Open /tmp/sendmail.log file
  • You should see entries similar to:
EXEC ses-send-email.pl -r -k ... -e https://email.us-east-1.amazonaws.com -f ...-
  • Check out the errors

Hope this helps,
Igor

Sunday, May 13, 2012

TechCauldron: Mobile share of web traffic in Asia has tripled since 2010

TechCauldron: Mobile share of web traffic in Asia has tripled since 2010:


Nearly 50% of web traffic in India is from the mobile ! Not surprising at all given the mobile phone penetartion vs PC, data capability of phones entry level upwards and aggressive push by whole ecosystem (handset manufacturers, operators, content providers) towards increasing data adoption. The mobile is enabling the first internet experience for many !


In just over two years, the share of web traffic in Asia that comes from mobile devices has almost tripled. In fact, in some countries, close to half of all web traffic comes from mobile devices. India is very close to mobile traffic breaking 50% of all web traffic, as are several other countries in Asia as well as Africa.

The world is changing, and it’s changing fast

If you look at the top countries in the world ranked by number of mobile phones, there’s little surprise that China is the number one, followed by India, United States, Brazil, and Indonesia.
But if we look at the percentage of users that go online with a mobile device compared to with a computer, the list changes.
In late 2010, we investigated what part of all web usage across the world was mobile, and we’ve done so again with the latest figures available. This is what it looks like right now:
Mobile versus desktop web traffic
Comparing the figures from 2010 to the current ones reveals a dramatic increase in just over two years:
Mobile share of web traffic
20102012Increase 2010-2012
Africa5.81%14.85%155.59%
Asia6.1%17.84%192.46%
Europe1.81%5.13%183.43%
North America4.71%7.96%69.00%
Oceania2.88%7.55%162.15%
South America1.46%2.86%95.89%
Worldwide3.81%10.01%162.73%
We should point out that these numbers are percentages out of the total of web traffic and do not reflect any change in the absolute number of people or devices.
But by all accounts, mobile web traffic counted in absolute numbers is virtually exploding in the next few years.

Countries with largest mobile share of web traffic

When we dig a little deeper into this information, we find that, in several countries, mobile web traffic is close to overtaking web traffic from computers.  Over at The Next Web, Jon Russell recently predicted that mobile web traffic in India will overtake PC web traffic this year, which seems pretty likely to happen.
Right now, the countries with the highest share of mobile traffic as part of total web traffic are:
  • 48.87% – India
  • 47.09% – Zambia
  • 44.95% – Sudan
  • 42.36% – Uzbekistan
  • 40.65% – Nigeria
  • 37.95% – Zimbabwe
  • 35.46% – Laos
  • 34.66% – Brunei
  • 31.79% – Ethiopia
  • 29.2% – Kenya
As you can see, Africa and Asia split the list between them. Africa amassed six countries, which left Asia with four.
The first European country is the United Kingdom with 10.71%, and the U.S. showed 8.61% mobile web traffic as share of all web traffic.
It’s worth noting that Europe scored a 183.43% increase in mobile browsing share over this period, not that far behind Asia. But with the mobile share only increasing from 1.81% to 5.13%, Europe is still far behind both Africa and Asia when it comes to the percentage of users accessing the web using mobiles.

The trend is set to continue

Worldwide, mobiles only account for about 10% of web access, but it’s a figure that is growing fast. With some countries already closing in on 50% of web traffic coming from mobiles – with India in the lead – it’s safe to assume this development will only continue.
Clearly, people are taking to their mobile devices all over the world to get on the Internet, but more so in Africa and Asia than elsewhere.
This is a very interesting development to follow, and we’re sure to report on it in future articles.
Note about the data: We used data from StatCounter as the basis for our analysis. The data for 2012 covers the first seven days of May, 2012.

Thursday, May 10, 2012

HOWTO: install APC on Debian or Ubuntu

HOWTO: install APC on Debian or Ubuntu:

Step 1
sudo apt-get install make

Step 2
sudo apt-get install libpcre3-dev


Step 3
sudo pecl install apc


Step 4
echo "extension=apc.so" > /etc/php5/apache2/conf.d/apc.ini


Step 5
sudo service apache2 restart

pcre.h: No such file or directory when installing APC (PHP extension) | Christer's blog o' fun

pcre.h: No such file or directory when installing APC (PHP extension) | Christer's blog o' fun:


After a complete reinstall of Ubuntu 10.04 on my laptop I had to recreate my development environment. Part of that included installing some extensions from PECL. When trying to install apc-3.1.2 I got the following error:
/usr/include/php5/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory
I decided to search the package archives for the pcre.h file. To do this I used a command called apt-file (apt-get install apt-file and apt-file update if you don’t have it installed).
apt-file search -x "/pcre.h$"
The -x informs the command that I want to use a regular expression as the pattern. apt-file provided me with three hits:
  • kannel-dev: /usr/include/kannel/gwlib/pcre.h
  • libajax6-dev: /usr/include/ajax/pcre.h
  • libpcre3-dev: /usr/include/pcre.h
The last one is the one I want:
apt-get install libpcre3-dev
Now that I finally have this package I can run pear install pecl/apc-3.1.2 to install APC.