Steps to Renew StartSSL Certificate

Renew StartSSL SSL/TLS web certificate with the following steps:

Validate your email

Control panel > Authenticate > Validations Wizard > Email Validation

Renew S/MIME authentication certificate

Control panel > Authenticate > Certificate Wizards > Renew S/MIME authentication certificate

Renew web server SSL certficiate

Control panel > Authenticate > Certificate Wizard > Web Server SSL/TLS Certificate


Redirect http to https with Apache mod_rewrite

Assuming you’re already loading the mod_rewrite module in Apache, you can add the following configuration to redirect traffic from http to https.

In your VirtualHost definition in httpd.conf:

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

The same can also be accomplished in an .htaccess file, allowing for control at a directory level, provided the Directory definition has AllowOverride All. For example:

<Directory /var/www/>
AllowOverride All

Then add the Rewrite statements above in the file /var/www/

Either accomplish the same, but allow control at a different level of granularity.

Related link: Creating an SSL certificate for Apache

Creating an SSL certificate for Apache

Want https to work for your website? Here are the steps to create an SSL certificate to use with Apache.

Generate private key
$ openssl genrsa -out ca.key 2048

Generate CSR
$ openssl req -new -key ca.key -out ca.csr

With your CSR, you can send to a third-party to sign or self-sign. Self-signed certificates will produce warnings in browsers, so you may want to consider having a Certificate Authority sign your certificate.

Generate Self-Signed Key
$ openssl x509 -req -days 1095 -in ca.csr -signkey ca.key -out ca.crt

Move keys to where Apache will use them. This is the CentOS structure:
$ mv ca.crt /etc/pki/tls/certs/ca.crt
$ mv ca.key /etc/pki/tls/private/ca.key
$ mv ca.csr /etc/pki/tls/private/ca.csr

Secure these files with chown root and chmod 600. Permissions can be restrictive since Apache will read these in as root when starting.

Assuming you already have Apache set up for Virtual Hosts, you might have a config like this in your /etc/httpd/conf/httpd.conf:

NameVirtualHost *:443

<VirtualHost *:443>
ServerAlias *
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/ca.crt
SSLCertificateKeyFile /etc/pki/tls/private/ca.key
<Directory /var/www/>
AllowOverride All
DocumentRoot /var/www/
ErrorLog logs/
CustomLog logs/ common

Or better yet, for ease of maintenance, extract each Virtual host into its own config file (for example, /etc/httpd/conf/vhosts/ Next, add an include in your httpd.conf:

Include conf/vhosts/*.conf

Now restart Apache
$ apachectl restart

Good luck!

Related link: Redirect http to https with Apache mod_rewrite

Mac OS X ‘open’ command

If you work with the command line often, you may find the open command useful.

open will launch the program associated with a file, as determined by LaunchServices. For example, to open all .c files in the current directory:

open *.c

It can also be used to open Finder to a particular directory. For example, to open Finder to the current directory:

open .

Using Mac OS X with Linux CUPS server

If you have a printer connected to a Linux box that is being shared via CUPS, the following command at the command line in Mac OS X will tell CUPS on your Mac to look for printers on other CUPS servers.

cupsctl BrowseProtocols='"cups dnssd"'

Now when you go to Printers in System Preferences, your shared Linux printer should show up automagically.

Using ‘find’ to quickly change file permissions

To quickly change UNIX/Linux file permissions (this applies to Mac OS X also), one can use the find command, combined with the -exec flag.

For example, suppose you want all directories nested beneath (and including) the current directory to have 755 permissions:

find . -type d -exec chmod 755 ‘{}’ ;

Explanation: ‘.’ refers to the current directory, ‘-type d’ indicates file type of directory, the command executed is chmod 755, where ‘{}’ is a cookie — the directory name will be inserted here. The exec command ends with a semicolon ‘;’, which must be escaped with a backslash so that your shell doesn’t interpret it.

To change file permissions to 644 (leaving the directories as is):

find . -type r -exec chmod 644 ‘{}’ ;

Note the type of ‘r’ to indicate a regular file.

Using these two find commands together, one can quickly change permissions on directories and files to 755 and 644 respectively to make them globally accessible, or 700 and 600 respectively to secure the files.

OpenOffice: Set Default Margins

Tired of Open Office giving you .8″ margins, when you expect the usual 1″? Here’s how to set up a template so that new documents will have your preferred margins set by default.

Create a New Document
Go to Format -> Page to set up your margins as you’d like them
Go to File -> Templates -> Save
Save as My Templates -> Default (or whatever name you’d prefer)
Now go to File -> Templates -> Organize
Select your template file (ie, My Templates -> Default)
Commands -> Set as Default Template.

Now when you create a new document, your margins should be set to your preferences already.