Archive for 2005

Encrypting files with OpenSSL

Tuesday, August 16th, 2005

The OpenSSL Project is an Open Source implementation of the Secure Sockets Layer and Transport Layer Security protocols as well as a cryptography library. In this tip I will show you how to encrypt an individual file using the openssl tool.

Probably GPG is a better choice for simple file encryption, but in some ocassions (i.e. encrypt without building keys or certificates) OpenSSL could be very useful. It’s very simple:

openssl enc -aes-256-cbc -salt -in SuperSecretFile.txt -out SuperSecretFile.txt.enc

And your are done! Now to decrypt the file:

openssl enc -d -aes-256-cbc -in SuperSecretFile.txt.enc -out SuperSecretFile.txt

A note from the man pages.

use a salt in the key derivation routines. This option should *ALWAYS* be used unless compatibility with previous versions of OpenSSL or SSLeay is required. This option is only present on OpenSSL versions 0.9.5 or above.

Redirect HTTP to HTTPS

Saturday, August 6th, 2005

This little trick will show you how to configure Apache to automatically redirect HTTP requests to HTTPS, i.e. http://www.karkomaonline.com to https://www.karkomaonline.com.

Add this directives to you configuration file:

RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]

Display system configuration

Saturday, August 6th, 2005

If you are new to Solaris world, don’t forget to add prtconf to your arsenal. This command provides you with information of your sistem configuration.

Simply type the following…

prtconf -v

Ethernet card settings in Linux

Thursday, August 4th, 2005

If you have a Linux system, there is a tool that lets you examine and change ethernet based network interfaces.

The ethtool utility is used for querying settings of an ethernet device and changing them. The basic usage is as follows:

ethtool eth0

…and you’ll get something like this:

Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised auto-negotiation: Yes
Speed: Unknown! (65535)
Duplex: Unknown! (255)
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: umbg
Wake-on: g
Current message level: 0×00000007 (7)
Link detected: no

For more information take a look at man pages.

System Administrator Appreciation Day

Friday, July 29th, 2005

System Administrator Appreciation Day – A special day, once a year, to acknowledge the worthiness and appreciation of the person occupying the role, especially as it is often this person who really keeps the wheels of your company turning… source.

How to create unique temporary files

Sunday, July 10th, 2005

Unix provides a couple of useful commands to create temporary file names or directories that can be used in your applications or shell scripts.

In Linux we have mktemp and tempfile. The simplest usage is as follows:

mktemp
/tmp/tmp.avSbCw

or…

tempfile
/tmp/file8W2jIZ

For more information take a look at man pages for both commands.

The birth of Unix

Sunday, July 10th, 2005

In the 1960s AT&T Bell Labs, the Massachusetts Institute of Technology, and General Electric joined efforts to develop an experimental operating system called Multics. It took several years to develop Multics (1965 – 1968) but the result was not succesful and AT&T Bell Labs pulled out of the project in 1969.

Ken Thomson (from Bell Labs) could get an unused DEC PDP-7 machine where he ported his favorite Multics game (Space Travel). He developed the tools he had been using on Multics for the PDP-7, then he built a kernel, a file system, an editor and a shell using the B programming language.

According to Thompson:

It was the summer of '69. In fact, my wife went on vacation to my family's place in California.... I allocated a week each to the operating system, the shell, the editor, and the assembler, to reproduce itself, and during the month she was gone, it was totally rewritten in a form that looked like an operating system, with tools that were sort of known, you know, assembler, editor, and shell.... Yeh, essentially one person for a month.

After developing this basic environment, Dennis Ritchie and others joined and they started to enhance the basics: kernel, device drivers, file system. They included a command interpreter and other utilities. The project was called UNICS (Uniplexed Information and Computing System), a hack on Multics. The name was later changed to UNIX.

European Parliament said NO to software patents

Wednesday, July 6th, 2005

From The Register

The European Parliament has voted by a massive majority to reject the software patents directive, formally known as the Directive on the Patentability of Computer Implemented Inventions. The vote to scrap the bill was passed by a margin of 648 votes to 14, with 18 abstentions.

You can read the entire article in The Register‘s website. More information from  BBC News.

Say NO to software patents

Wednesday, July 6th, 2005

As noepatents.eu.org says…

The Software Patents Directive, as approved by the European Council of Ministers, would codify US-style Software Patents in the European Union.

If that happens, software developers will no longer own what they write and can be sued for selling or distributing their own software.

If you don't inform your parliament, mega-corporations are doing the job for you: "The European Parliament is filled with lobbyists of Microsoft, Eicta, CompTIA and so on. There are 30 to 40 lobbyists permanently roaming the halls." (in Eweek, 21 June).

What can you do?

udevfs or devfs

Friday, April 1st, 2005

If you want to use pure udevfs then don’t set boot devfs on boot time in kernel config.

CONFIG_DEVFS_FS is not set

(in .config)

To use udevfs linux device naming convention install udevfs and do this step:

# emerge udev

Then

kernel /bzImage root=/dev/hda3 boot=nodevfs

(in grub.conf)

now when system boots it’ll use udevfs.