openssl: added jue's mksslcert wrapper

This commit is contained in:
Simone Rota 2006-02-24 16:32:23 +00:00
parent 0cdb5418b4
commit bdadaaa18b
4 changed files with 52 additions and 1 deletions

View File

@ -13,6 +13,7 @@ drwxr-xr-x root/root etc/ssl/private/
drwxr-xr-x root/root usr/
drwxr-xr-x root/root usr/bin/
-rwxr-xr-x root/root usr/bin/c_rehash
-rwxr-xr-x root/root usr/bin/mksslcert
-rwxr-xr-x root/root usr/bin/openssl
drwxr-xr-x root/root usr/include/
drwxr-xr-x root/root usr/include/openssl/

View File

@ -1 +1,2 @@
9d0df57845af8acd1027a7df5c18d017 mksslcert.sh
1d16c727c10185e4d694f87f5e424ee1 openssl-0.9.8a.tar.gz

View File

@ -5,7 +5,8 @@
name=openssl
version=0.9.8a
release=1
source=(http://www.openssl.org/source/$name-$version.tar.gz)
source=(http://www.openssl.org/source/$name-$version.tar.gz \
mksslcert.sh)
build() {
cd $name-$version
@ -14,4 +15,5 @@ build() {
make INSTALL_PREFIX=$PKG MANDIR=/usr/man MANSUFFIX=ssl install
find $PKG -name "*fips*" -exec rm -f {} \;
chmod -R +w $PKG
install -D -m 755 ../mksslcert.sh $PKG/usr/bin/mksslcert
}

47
openssl/mksslcert.sh Executable file
View File

@ -0,0 +1,47 @@
#!/bin/sh
#
# mksslcert
#
# creates self-signed openssl certificates based on
# the local hostname or the given one
# Fallback to localhost if not set.
#
# Jürgen Daubert, jue at jue dot li
print_help() {
echo "usage: ${0##*/} <key> <cert> [hostname]"
echo " key full path to openssl private key"
echo " cert full path to openssl certificate"
echo " hostname host name of certificate"
}
main() {
if [ ! "$1" -o ! "$2" ]; then
print_help
exit 1
fi
KEY=$1
CRT=$2
FQDN=$(hostname -f) || FQDN=localhost
if [ ! -z "$3" ]; then
FQDN="$3"
fi
INFO=".\n.\n.\n.\n.\n$FQDN\nroot@$FQDN"
OPTS="req -new -nodes -x509 -days 365 -newkey rsa:1024"
echo -e $INFO | openssl $OPTS -out $CRT -keyout $KEY 2> /dev/null
if [ $? -ne 0 ]; then
echo "Error: creating of certificate failed"
exit 1
else
echo "SSL certificate $CRT with key $KEY for host $FQDN created"
chmod 0600 $CRT $KEY
fi
}
main "$@"
# End of file