forked from hummypkg/webif
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1848 2a923420-c742-0410-a762-8d5b09965624
42 lines
620 B
Bash
Executable File
42 lines
620 B
Bash
Executable File
#!/bin/sh
|
|
|
|
config=/tmp/openssl.cnf.$$
|
|
|
|
if [ "$1" = "-delete" ]; then
|
|
cd /mod/etc
|
|
[ -f webif.pem ] && rm -f webif.pem
|
|
[ -f mongoose.cert ] && rm -f mongoose.cert
|
|
exit 0
|
|
fi
|
|
|
|
cat << EOM > $config
|
|
[req]
|
|
distinguished_name = req_dn
|
|
|
|
[req_dn]
|
|
|
|
EOM
|
|
|
|
/mod/bin/openssl req \
|
|
-x509 -nodes -days 365 \
|
|
-newkey rsa:2048 \
|
|
-subj "/C=GB/ST=Humax/CN=`hostname`" \
|
|
-sha1 \
|
|
-nodes \
|
|
-batch \
|
|
-keyout /mod/etc/webif.pem -out /mod/etc/webif.pem \
|
|
-config $config
|
|
|
|
rm -f $config
|
|
|
|
# Support legacy mongoose server...
|
|
|
|
(
|
|
cd /mod/etc
|
|
[ -f mongoose.cert ] && rm -f mongoose.cert
|
|
ln -sf webif.pem mongoose.cert
|
|
)
|
|
|
|
exit 0
|
|
|