env/utils/scripts/create-iked-ecdsa.sh

24 lines
788 B
Bash
Raw Normal View History

#!/bin/sh
# env
# Written in 2021 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
if [ X"$(id -nu)" != Xroot ]; then
printf "%s: needs root\n" "${0##*/}" >&2
exit 1
fi
iked_key=/etc/iked/private/local.key
iked_pub=/etc/iked/local.pub
openssl genpkey -algorithm ec -pkeyopt ec_paramgen_curve:secp384r1 |
(umask 077 && tee "$iked_key") |
openssl pkey -pubout -out "$iked_pub"