xref: /illumos-gate/usr/src/cmd/cmd-inet/usr.sbin/ipsecutils/net-tcpkey (revision 8119dad84d6416f13557b0ba8e2aaf9064cbcfd3)
1#!/sbin/sh
2#
3# This file and its contents are supplied under the terms of the
4# Common Development and Distribution License ("CDDL"), version 1.0.
5# You may only use this file in accordance with the terms of version
6# 1.0 of the CDDL.
7#
8# A full copy of the text of the CDDL should have accompanied this
9# source. A copy of the CDDL is also available via the Internet at
10# http://www.illumos.org/license/CDDL.
11
12#
13# Copyright 2024 Oxide Computer Company
14#
15
16. /lib/svc/share/smf_include.sh
17
18if [ -z "$SMF_FMRI" ]; then
19	echo "This script can only be invoked by smf"
20	exit $SMF_EXIT_ERR_NOSMF
21fi
22
23# This service does nothing in a shared IP zone
24smf_configure_ip || exit $SMF_EXIT_NODAEMON
25
26typeset -r CFG="$1"
27if [[ -z "$CFG" ]]; then
28	echo "Configuration file is not set."
29	exit $SMF_EXIT_ERR_FATAL
30fi
31if [[ ! -r "$CFG" ]]; then
32	echo "Configuration file '$CFG' cannot be read."
33	exit $SMF_EXIT_ERR_FATAL
34fi
35
36/usr/sbin/tcpkey -f "$CFG" || exit $SMF_EXIT_ERR_FATAL
37exit $SMF_EXIT_OK
38