Tuesday, December 8, 2009

SUN SGD on Debian Lenny

Surprizingly enough SSGD installs fine on a debian lenny system.

Probably you have to
sudo aptitude install libmotif3
Then convert the rpm package to a debian one:
alien --scripts tta-4.50-907.i386.rpm
Make same necessary symbolic links:
ln -s /usr/lib/libXm.so.3.0.2 /usr/lib/libXm.so
ln -s /usr/lib/libexpat.so.1.5.2 /usr/lib/libexpat.so.0
Install the package:
dpkg -i tta_4.50-908_i386.deb
There is a minor error message that AFAICT does not cause any problems:
pythagoras:~# dpkg -i tta_4.50-908_i386.deb
Selecting previously deselected package tta.
(Reading database ... 24510 files and directories currently installed.)
Unpacking tta (from tta_4.50-908_i386.deb) ...
Setting up tta (4.50-908) ...
chown: cannot dereference `/opt/tarantella/lib/i3so/libXm.so': No such file or directory
chmod: cannot operate on dangling symlink `/opt/tarantella/lib/i3so/libXm.so'
/var/lib/dpkg/info/tta.postinst: line 17218: [: 0configure: integer expression expected
To complete the installation, please run /opt/tarantella/bin/tarantella start

Monday, December 7, 2009

Batch resize and convert images using ImageMagick

Enter the following command to resize all JPEG images in a directory to 750×500 pixels. Obviously, you can change the 750×500 to whatever dimensions you prefer:
convert -resize 750×500 *.jpg
Enter the following command to convert a JPEG into a GIF. You can convert any format image, it doesn’t have to just be JPEG to GIF:
convert image.jpg newImage.gif
Enter the following command to reduce the quality of every JPEG in a directory down to 80%. You can change the 80% to whatever percentage you prefer:
convert -quality 80% *.jpg
Please visit the ImageMagick homepage to learn about the thousands of other commands available.
Note: You can also combine commands. For example:
convert -resize 750×500 -quality 80% *.jpg

Friday, December 4, 2009

Google Docs multiple Headers And Footers

For multiple headers (i.e. different header on each page) use the following tags.:
<div class="google_header">your_content_goes here</div>
For multiple footers:
<div class="google_footer">your_content_goes here</div>
Note that when using multiple footer, do not insert a footer using the UI. It will add the following tag to the page:
<div id="google_footer">your_content_goes here</div>
Setting the id to google_footer makes this header move to the first page, which is not what you intend most of the time with multiple footers.
For page number:
<span class="google_pagenumber">1</span>
For page count:
<span class="google_pagecount">1</span>
Please note that if you are using the page number tags, it would be best not to choose page number option in the user interface as that might conflict with the page numbers you have already entered.

Thursday, December 3, 2009

how to setup OpenLDAP log file

how to setup OpenLDAP log file

[root@esker /etc]# man slapd.conf
...
loglevel
Specify the level at which debugging statements and
operation statistics should be syslogged (currently
logged to the syslogd(8) LOG_LOCAL4 facility). Log
levels are additive, and available levels are:
1 trace function calls
2 debug packet handling
4 heavy trace debugging
8 connection management
16 print out packets sent and received
32 search filter processing
64 configuration file processing
128 access control list processing
256 stats log
connections/operations/results
512 stats log entries sent
1024 print communication with shell
backends
2048 entry parsing

...


[root@esker /etc]# cat /etc/openldap/slapd.conf
...
loglevel 4095
...

[root@esker /etc]# cat /etc/syslog.conf
...
# save OpenLDAP log
local4.* /var/log/ldap.log

restart ldap server

Tuesday, December 1, 2009

Changing the hostname on CentOS

The file /etc/sysconfig/network contains the hostname and will look something like this:

NETWORKING="yes"
GATEWAY="10.1.1.1"
HOSTNAME="www.example.com"

Simply open up the file in your favourite text editor, either as root or using sudo, and change the HOSTNAME value to what you want it to. For example, if we wanted to change www.example.com from the above example to ftp.example.com then you'd end up with the following:

NETWORKING="yes"
GATEWAY="10.1.1.1"
HOSTNAME="ftp.example.com"

This change won't take affect until the next reboot, but you can make the change happen immediately using the hostname command like so:

$ hostname ftp.example.com

Simply issuing the command on its own will return the current hostname, eg

$ hostname
ftp.example.com

You may also need to add/change the hostname in the /etc/hosts file. By default this would look something like this, using our www.example.com example again:

127.0.0.1 www.example.com localhost localhost.localdomain

You would then change it to be like so:

127.0.0.1 ftp.example.com localhost localhost.localdomain

Wednesday, October 7, 2009

OpenSSL Usage tips

OpenSSL can be a complicated application to be sure. This page intends to shed some light on how to accomplish some typical operations, such as viewing a certificates details or creating a SSL (client) connection to an email server that supports STARTTLS.

View a certificates' details
openssl x509 -in filename.crt -noout -text

Where filename corresponds to the X.509 certificate file, which typically would end in .crt, .cert or .pem. See also: man x509

Viewing the details of a certificate revocation list (CRL)
openssl crl -in filename -noout -text

Where filename corresponds to the CRL file, which typically would end in .crl or .pem. See also: man crl

DER to PEM conversion
Converts a DER format certificate to PEM - which is more widely used in applications such as apache.
openssl x509 -out exported-pem.crt -outform pem -text -in derfile.crt -inform der

See also: man x509

Generate the hash value from a certificate
Sometimes useful when you want to store multiple CA certificates as separate files in a directory configured into your application.
openssl x509 -hash -noout -in certfile.pem

See also: man x509

Testing STARTTLS
Connects to a mail server and starts TLS session, shows all the server certs (certificate chain) with -showcerts.
openssl s_client -connect test.smtp.org:25 -starttls smtp -showcerts

Note: only support in newer versions of openssl (check man page for -starttls option) See also: man s_client

Tuesday, October 6, 2009

What is UMASK?

UMASK is a Unix environment variable which automatically sets file permissions on newly created files.

The UMASK variable can be confusing to use, because it does work as a mask. In other words, you set the permissions that you do not want in the UMASK.

To calculate permissions which will result from specific UMASK values, subtract the UMASK from 666 for files and from 777 for directories.

If you want all files created with permissions of 666, set your UMASK to 000. Alternatively, if you want all files created with permissions of 000, set your UMASK to 666.

A reasonable value for UMASK is 022, which will cause files to be created with permissions of 644 (rw-r--r--) and directories to be created with permissions of 755 (rwxr-xr-x).

A more secure value for UMASK is 066, which will cause files to be created with permissions of 600 (rw-------) and directories to be created with permissions of 700 (rwx------).

UMASK is nomally defined in the .profile or .login user startup files.