Change default SSH port

April 27th, 2008
Bookmark on del.icio.us

By default, SSH runs on port 22. This leads to thousands of automatic scans and scripted attacks being launched.

No reason not to change your port exists to the best of my knowledge. Get it changed!

Add a line in the file /etc/ssh/sshd_config:

Port 6969

Reload sshd

#/etc/rc.d/sshd reload
OR
service sshd restart

A couple of simple things here will ensure you of success:

  •  Check that whichever port you choose is not already in use
  • After restarting ssh, do not close that window. Instead, open a new connection leaving the existing connection open. If anything has gone wrong and you wish to revert your changes back, you can do so in your existing window.

Adding SSH welcome and warning messages

April 27th, 2008
Bookmark on del.icio.us

Using SSH as a login method for *NIX boxes is pretty common. One thing I am regularly asked by our dedicated server users is how to add messages that can be viewed when a user is accessing the system. Keep in mind that it would be well worth restricting root login and running SSH on a non-standard port

There are two methods for doing this, you can use just one or both depending on the desired effect.

Firstly (in time order) there is the banner which appears after a username has been typed. This is normally used to provide a warning against unauthorised access as follows:

login as: user
************************NOTICE***********************
This system is optimised and configured with security and logging as a
priority. All user activity is logged and streamed offsite. Individuals
or groups using this system in excess of their authorisation will have
all access terminated. Illegal access of this system or attempts to
limit or restrict access to authorised users (such as DoS attacks) will
be reported to national and international law enforcement bodies. We
will prosecute to the fullest extent of the law regardless of the funds
required. Anyone using this system consents to these terms and the laws
of the United Kingdom and United States respectively.
************************NOTICE***********************

To add this to your server, you will need to edit your ssh config file (/etc/ssh/sshd_config) and uncomment/add the following line: Banner /etc/banner

You will then want to create/edit the banner you have just referenced: ( pico /etc/banner)

You will need to restart the ssh daemon for this to work: ( service sshd restart)

When you login, you should now see your message displayed after you have entered a username.

The second method is MOTD (Message of the day). The difference here is that this is displayed after login has completed. Some of the most common uses depending of the numbers of users with access:
Rules for accessing files/services
A message for the next sysadmin due to monitor the box
A list of common commands and how to execute them
Anything else of use

To add a MOTD, you will need to edit the motd file : ( pico /etc/motd ), add your message and save the file, it should now be displayed on successful login. If you were to use both it would display something like this:

login as: user

************************NOTICE***********************
This system is optimised and configured with security and logging as a
priority. All user activity is logged and streamed offsite. Individuals
or groups using this system in excess of their authorisation will have
all access terminated. Illegal access of this system or attempts to
limit or restrict access to authorised users (such as DoS attacks) will
be reported to national and international law enforcement bodies. We
will prosecute to the fullest extent of the law regardless of the funds
required. Anyone using this system consents to these terms and the laws
of the United Kingdom and United States respectively.
************************NOTICE***********************

user@domain.com’s password:
Last login: Sun Apr 27 14:37:24 2008 from user-22222222.domain.com

You have somehow managed to login….We are now monitoring your access,
our systems administrators have received a page to alert them of your
presense. If you are not a fully authorised user acting within your
rights then logoff immediately to prevent further action.

IE8 - back to the drawing board

April 20th, 2008
Bookmark on del.icio.us

It’s beta, let me point that out for those who don’t know. Hopefully my comments will be null when the final release version arrives (I’ll not be betting my house on it though, or my car, or a fiver).

There are numerous posts elsewhere regarding the individual supported/unsupported tags and features of IE8 so I won’t go over old ground.

What I want to do is moan, why? To tell you the truth it is purely down to the amount of work that IE costs me on a daily basis. I develop a site, I test it in firefox - everything renders as expected, I test it in opera - everything renders as expected, I test it in safari (guess what) - everything renders as expected…..now - I go to IE:
I have to test in three different versions as they are all different……
IE6 - Moves all my nicely centred divs to the left of the page
IE7 - Except for the extra spacing in linebreaks it’s not too bad - useable
IE8b - WTF! - My two lowest divs (my footer and lower section) are both moved and set infront/behind other divs.

My code all validates, my css validates, my design appears as I want in every other browser I have but IE - OH NO! Then I head to a company which use a very large intranet, I try to login with firefox but I get a blank page…I ring their internal support, only to be told that it’s all developed for IE as are all their internal systems, it doesn’t work with anything else.

IMHO IE is such a cut-and-shut that instead of all of these half-hearted attempts, it should just be scrapped! If my site is standards compliant and every other browser displays it a certain way then what on earth gives MS the right to decide that my site should look different in IE?

Ok, a bit of a deep breath and step back for a sec…I am shouting and pointing the finger at MS, but for all I know, I could have a terrible code syntax which IE doesn’t know how to interpret. Perhaps the other browsers are all being more forgiving and IE is sticking to the rules…. Problem is, I have no way of finding out, every method I have for checking my code says it’s fine. Testing shows it’s fine and I taught myself HTML before MS (and most of the world) knew what standards were……thanks microsoft, rather than reduce the browser footprint to allow developers to develop ONCE….you have just introduced yet another browser with yet more differences. I’ll be adding the firefox download button to my site shortly!

If for any reason you want the heathen software, you can download IE8 Beta

If you are a developer and have found that your site displays poorly in IE8, you can consider adding the following meta tag:

<META http-equiv=”X-UA-Compatible” content=”IE=7″> Which will revert the rendering to that of IE7 (which has it’s own issues), good luck.

Pre-loading images - why when and how?

April 19th, 2008
Bookmark on del.icio.us

Firstly why would you pre-load images on your page?
My primary reason is normally because I want to use rollover images in my navigation. I want it to be a grey icon when there isn’t a mouse hovering over it and I want it to spring to life with colour when there is.
The downside of me wanting to do this is that my original grey image will load with the rest of the page but my mouseover images will only load when they are called (ie when the mouse hovers over them). If my images are not tiny, they may take a fraction of a second to load which could cause the user to think that my images are disappearing when they hover over them.

I want to pre-load my images once the rest of the work has gone on and the user has the ability to view and use my site.

The most simple way of doing this is as follows:

<script language=”JavaScript”>
function preloader()
{
// counter
var i = 0;
// create object
imageObj = new Image();
// set image list
images = new Array();
images[0]=”image1.png”
images[1]=”image2.jpeg”
images[2]=”image3.gif”
images[3]=”image4.jpg”
// start preloading
for(i=0; i<=3; i++)
{
imageObj.src=images[i];
}
}
</script>

Using strings and includes to help development and SEO

April 19th, 2008
Bookmark on del.icio.us

We talked about using php includes to reduce the repetition of code and standardise features here:

One of the things we have looked at recently concerns our headers. Let’s say for example that our header looks like this:

<html>
<head>
<meta name=”keywords” content=”keyword1, keyword2″ />
<meta name=”description” content=”the description of my site” />
<title>This is my page</title>
……..

Great. Now, we want to cut down on how many headers we have (in case we want to change a line later) so that we only update one page instead of all of them. So we create a new page using the code above and we call it include_header.html.

There is just one problem with this scenario, we don’t want all of our pages to have the same title, keywords and description so what do we do? We could seperate it all out into individual headers for each page again but if we wish to add a new line (perhaps for an RSS feed) later, we would have to do so to every one of our pages. So we use strings.

In our include_header.html we change our code to look like this:

<html>
<head>
<meta name=”keywords” content=”<?php echo $keywords; ?>” />
<meta name=”description” content=”<?php echo $description; ?>” />
<title><?php echo $title; ?></title>

……..

Then in each page we declare what each of our strings contain, so for our index, it may look something like this:

<?php $keywords = “keyword1, keyword2″;
$title=”
This is my page”;
$description=”
the description of my site” ?>
<?php include(’/includes/include_header.html’); ?>
<!–anything else you want in the header of only this page can be added here –>
</head>
<body>
<h1>Welcome
<?php echo $title; ?> and here is a description of it <br />
<?php echo $description; ?>
</body>
<html>

So, we now have:
A single header for all pages
Unique variables we can change for each page
A set of strings we can re-use on our pages (and we can change all references on that page by changing one string).

New Site Design

April 17th, 2008
Bookmark on del.icio.us

We have launched the beta of a new site design (version 3).

Please do take a look around and let us know if there is anything you find which isn’t working. It is a beta (which means pre-release), as has become the norm, we have launched it as the final part of our testing.

I hope you enjoy it :D

The design is based on the Jet30 template (released under the creative commons licence) and has been heavily modified to suit our style, thinking and technologies. Some of the main points are:

AJAX
PHP
CSS
Live server status (using the script we posted here)
Mailing list signup
RSS *2
ROR sitemaps
XML sitemaps (standard and g’zipped)
We are also setting our titles using strings now so that we can use includes for the headers successfully. I’ll post more about that shortly. Have a good one :)

Latest project

March 1st, 2008
Bookmark on del.icio.us

Our latest project for Dogue De Bordeaux website Rozeldogue is nearing completion. It is live and you can take a look at it now (although please bear in mind that we have some style changes still to make.

This project is pretty close to my heart as my dog comes from here.

What have we done?

SEO: focused links, keywords, emphasis on text and syntax. Google and DMOZ submission, RSS

Design: Brown and tan with images

Development: XHTML1.1 & CSS

Dynamics: News, RSS feed, customised coppermine gallery, embedded contact form and google maps location

Knwon issues: Widescreen monitors fail to display the menu bar correctly (To be resolved 02/03/08), CSS changes required for gallery display (To be resolved 03/03/08).

Please do take a look, we have 2 more ongoing projects for this customer so feedback is always welcome.

2007 Roundup

January 4th, 2008
Bookmark on del.icio.us

The blog was started in June 2007, personally, I think these numbers are pretty good for a site which emerged from obscurity. Finding the time (and thinking of the content) is actually far more difficult than I imagined and thinking of unique content is much more difficult than leaching it like a lot of others do:

Page views : 8581
Unique visits: 3702
Posts: 44
Comments: 6

Equally, here are the month by month stats since the root domain became live:
Feb-07 300
Mar-07 6532
Apr-07 1075
May-07 1865
Jun-07 6284
Jul-07 22147
Aug-07 9802
Sep-07 6329
Oct-07 11878
Nov-07 13118
Dec-07 6288

Merry Christmas

December 19th, 2007
Bookmark on del.icio.us

We Break up for Christmas tomorrow. I’d like to wish you all a very Merry Christmas and a Happy New Year.

Here’s to 2008

YADD - Yet another damn directory

November 24th, 2007
Bookmark on del.icio.us

It has started as a bit of an experiment really and also as a way of listing some of the links I use for others but to be honest, I am already about 5mins away from deleting it……our new directory.

It’s a third party script (which is Ok, not great - but ok): LINK REMOVED

Don’t bother bookmarking it as it probably won’t be there long:

  • What’s the point in another directory? Well for me it was to be able to personalise it to the things “I” think are interesting or important for the readers of this blog and users of our site.
  • Why not use the blog? Well, I’ll be brutally honest that I was being selfish. I wanted to see what impact it would/could have from an SEO point of view - big mistake! I’ll go into why in a few days…it’s going to take me that long to sort it out.

I genuinely thought it might be a good idea to create a really well set up directory with areas specifically for SEO, web development, accessibility and security but all I can see now are listing problems, spam, management overhead and a whole heap of hassle.

I wasn’t expecting the directory to suddenly sprout 5m links and propel the site to pr10 but I did want to see if I could attribute any positive trend to it once it had become semi-established…..all I have now is a whole heap of respect for somebody who makes a living from running a directory.

In short, if you consider creating a directory………..step slowly away from the keyboard, walk towards a wall and bang your head against it - it’ll be less painful in the long run!

R.I.P directory (for now)