Dave's Brain

Browse - computer tips - self signed certificate with no password

Date: 2007dec11
OS: Linux

Q.  How do I make a self-signed certificate with no password?

A.  This script does the trick:
	
	#!/bin/sh

	usage()
	{
		echo 'Usage: makecert <hostname>' >&2
		exit 1
	}

	if [ $# -ne 1 ]; then
		usage
	fi

	HOST=$1
	openssl genrsa 1024 > $HOST.key
	chmod 400 $HOST.key
	openssl req -new -x509 -nodes -sha1 -days 3650 -key $HOST.key > $HOST.cert
	cat $HOST.cert $HOST.key > $HOST.pem
	chmod 400 $HOST.pem

You might want to save the certificate in /etc/pki/tls/certs
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2012, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.
Advertisements: