Screen with bytes of info

RSS Feed
Technology Bytes
Articles About Technological Tangles and Triumphs Learned


Rejecting Spam in Postfix


No Spam Sign

     I administer an e-mail server (Postfix with Dovecot) and found that some of the e-mail addresses were getting spam more and more often.  I really don't like spam and was trying to figure out how to reduce/eliminate it.  I have SpamAssassin installed but it doesn't block known spamming clients.

     After doing some research, I found that clients can be rejected after connecting to my mail server by checking the client ip address, helo domain name, and the from e-mail domain name against a spam database.  An international organization, called "Spamhaus", runs a DNS Blackhole List (DNSBL) for IP addresses (zen.spamhaus.org) and domain names (dbl.spamhaus.org) which is basically a list of IP addresses and domain names that have been identified as used to send spam.  I found that Spamhaus provides one of several blacklists that are available.  I was excited to see that Postfix has the configuration to utilize a DNSBL.

     After looking up the configuration, I found how to add it to my configuration files.  First, to reject the client, the configuration must be specified in the smtpd_client_restrictions config key.

To reject the client if found based on:
  the connecting IP address, use reject_rbl_client zen.spamhaus.org
  the connecting declared domain name, use reject_rhsbl_client dbl.spamhaus.org
  the connecting IP address reverse domain name, use reject_rhsbl_reverse_client dbl.spamhaus.org

     For checking the domain from the FROM address, use reject_rhsbl_sender dbl.spamhaus.org and this belongs in smtpd_sender_restrictions config key.

     Remember, if a config key is listed in the Postfix master.cf using the -o override, then then changes made in the main.cf will not take effect for the processes that override it.  What I did is create a variable at the top of my main.cf called client_spam_config and set the values inside it and used the variable anywhere that smtpd_client_restrictions was used:

main.cf
-----
client_spam_config = reject_rbl_client zen.spamhaus.org, \
     reject_rhsbl_client dbl.spamhaus.org, \
     reject_rhsbl_reverse_client dbl.spamhaus.org
...
smtpd_client_restrictions = $client_spam_config


master.cf
-----
    -o smtpd_client_restrictions=$client_spam_config,...

Date and Time Stamp in Your Area


Clock

     One of the most recent modification I've made to this blog has been to include the date and time stamp with each article of when it was published.  I, at first, had the date displayed to a format that I liked and in Universal Time.  But then I wondered if there was a way to let people see it in their own time zone.

     With the new HTML5 spec being developed, I would have thought that there would be a way to display the time zone with the TIME element in each person's own time zone/area.  However, when I did some research, I found no such thing in any of the HTML documentation.  The suggested way of doing it was with JavaScript.  So, I decided to combine both the TIME element and JavaScript to do this very thing.

     For each article, I made sure that the TIME element included the DATETIME attribute with Universal Time and left the inner HTML portion of the TIME element empty (which is valid).  Then, when the page loads, I have some JavaScript that retrieves the time value from the DATETIME attribute, creates a new JavaScript Date object from it, and then outputs the local date and time stamp (based on the browser) into the inner HTML portion of the TIME element.

     Example, I start with the TIME element empty with the DATETIME attribute:
<time datetime="2013-03-01T13:21:37+00:00"></time>

     Then I write the following JavaScript function and call it when the page loads:
function articleWriteTimestamps()
{
    var timeTags = document.getElementsByTagName('time');

    for (var i = 0; i < timeTags.length; i++)
       timeTags[i].innerHTML = (new Date(timeTags[i].getAttribute('datetime'))).toString();
}


     Which then outputs the following for my time zone (CST) using my browser (Chrome):
Fri Mar 1 2013 07:21:37 GMT-0600 (Central Standard Time)

Only One Page Prints from Website?


Printer

     Let's see... click the print button and... WHAT?  Only one page?  I've recently had an issue with a page on a website that would only print one page when there was obviously more than one page of content available.  It had been an ongoing problem for almost a year and I had tried to solve it several time with no success... until recently.

     With Google being my favorite place to go to search for possible solution to problems that I run into, I have been searching with different keywords to try to find another solution (I've tried several) that would solve my issue of IE (Internet Explorer) only printing the first page from a particular page on a website.  This particular page has a CSS file associated with it and many of the "solutions" I've found were CSS changes.  The way it's set up is that it has a media selector for the screen and for print.  Inside the print media selector, I've changed the CSS overflow property from none to visible, added a min-height of 100%, and changed the position from absolute to static.  I even made sure the character set was being sent properly as part of the header.  However, none of these changes fixed my problem.

     While searching, I saw a link to a page that dealt with a Firefox bug that would only print one page.  But I ignored it because I wasn't dealing with Firefox.  However, later I saw it again and decided that perhaps there might be something I could take away from any solution presented that might fix my problem.  In the article, it talked about some ways to get around the problem by setting the CSS properties to certain values and on of those was to remove the height property of the body if it is set to 100%.

     I looked at the CSS that I had and both the html and body selectors were set to a height of 100%.  So I moved those settings into the screen media selector and then tested the page with IE and it printed all of the pages!  After testing it a couple more times, I was convinced that it resolved my issue.

     So if you have an issue with a browser printing only one page, try making sure you don't have the html and/or body selectors set at a height of 100%.  Also, the link to the article that helped solve my problem is as follows:
http://jafferhaider.wordpress.com/2007/12/29/fix-for-the-firefoxcss-one-page-printing-bug/

UPDATE: Sync Multiple Google Calendars


Google Calendar

     I have just heard of Google no longer allowing new users into the Google Sync service (Google's ActiveSync).  They have announced that they now support CardDAV along with their already existing IMAP and CalDAV services and expect users to use those protocols for Google Contacts, GMail, and Google Calendar.  CardDAV is a protocol that allows one to synchronize contacts, IMAP is an e-mail protocol to access e-mail, and CalDAV is a protocol for synchronizing calendar entries.

     I was recently trying to help someone be able to sync multiple calendars to their iPhone and referenced the article I wrote earlier about synchronizing multiple Google calendars but found that the link at the bottom of the article no longer pointed to the right Google page to do so.

     These two events have brought me to write this article to provide the links to choose which calendars are synchronized to an iOS device.  I did some research and found that there are two different pages based on how you have your device set up to load the calendar.  Below, I have provided the two links.

     To update your calendar selection using Google Sync, open up your phone browser to the link provided below.  Sign in with your Google account and it will provide a list of devices that have accessed your calendar.  Since I've had several iPhones, it shows multiple items with the name "iPhone".  Select the device for which you want to sync calendars and then it will provide a list of calendars associated with your account.
Google Sync link:  https://m.google.com/sync/settings/

     To update your calendar selection using Google's CalDAV protocol, open up your browser to the link provided below.  Sign in to your account and immediately it will list the calendars to sync or unsync (check or uncheck) with any device using CalDAV.
Google's CalDAV link:  https://www.google.com/calendar/syncselect

     Check mark all of the ones you want to see.  When done, select "save" at the bottom to save your settings.  Congratulations!  You have successfully updated your Google calendar settings for your device.  You can now open up your calendar app and see the change in calendars.

Windows 8 Doesn't Like My Game (Spiral Knights)?


Windows 8 Logo

     I like to play games on my computer every so often and in particular I like to play one called, Spiral Knights.  Well, since Microsoft was doing a promotional upgrade of $39.99 to Windows 8 Pro, I decided to go ahead and install it on my laptop and desktop.  I then tried to install and run Spiral Knights and found that it gave me an error and wouldn't run.

     Figuring that it was a Windows 8 issue, I decided to do some looking online to see what other people had found out.  It turned out that I found the source of the problem right on Spiral Knight's website and it said that it was due to the Windows 8 drivers for certain graphic cards not being compatible with the game:
Most current computers should be able to upgrade to Windows 8 and still play Spiral Knights properly. However, up to date graphics drivers are required since the Windows default driver cannot run Spiral Knights in most cases.


     So I checked to see which company created my graphics cards and found that Intel created both for my desktop and laptop.  So I figured I would install the latest drivers for my computers and did so.  However, to my disappointment, the game still would not run and still showed the same error.  So I gave up for a time.

     Well, just a few days ago, I decided to see if there were any updates to the Windows 8 graphic issues or if there were any new workarounds.  I did some searching and found that the website still said the same thing.  So I did some more searching to see if anyone was able to get it working anyway and someone wrote that they installed the Windows 7 drivers for their graphics card.  The display looked fine in Windows 8 with the Windows 7 drivers and the game worked.  So I figured I would give it a try.  Since my desktop is a 64-bit machine, I made sure I downloaded the 64-bit graphic drivers for Windows 7.  I wanted to try it on my desktop first before causing problems unnecessarily on my laptop.  I installed the drivers and let it restart my computer.

     When the computer came back on with the Windows 7 drivers, I couldn't tell a difference.  It looked the same to me.  So I tried running the game.  Initially, it looked like it wasn't doing anything (no window opened up) but I could tell that it was running in the background and no error popped up yet so I was hopeful.  Sure enough, the game opened right up!  I was excited to see that I could play my game again!  So I decided to try installing the Windows 7 driver on my laptop and after doing so and installing the game, it worked too.

     So, if you have a game or program that won't run on Windows 8 due to a graphics issue (probably OpenGL), try installing the Windows 7 drivers and see if that fixes your problem like it did mine.