1 #!/usr/bin/pfsh
2
3 #
4 # This file and its contents are supplied under the terms of the
5 # Common Development and Distribution License ("CDDL"), version 1.0.
6 # You may only use this file in accordance with the terms of version
7 # 1.0 of the CDDL.
8 #
9 # A full copy of the text of the CDDL should have accompanied this
10 # source. A copy of the CDDL is also available via the Internet at
11 # http://www.illumos.org/license/CDDL.
12 #
13
14 #
15 # Copyright 2016 OmniTI Computer Consulting, Inc. All rights reserved.
16 #
17
18 #
19 # in.iked used to be a hard link to "isaexec", but thanks to its closed-source
20 # and recent discoveries about amplification attacks, we need to instead
21 # put a wrapper around the actual executables and LD_PRELOAD an interposer to
22 # __xnet_sendmsg to rate-limit messages.
23 #
24
25 # First determine the right in.iked binary.
26 EXECDIR=`/usr/bin/dirname $0`
27 ISA=`/usr/bin/isainfo -k`
28
29 if [ $ISA = "i386" ]; then
30 ISADIR="i86"
31 else
32 # Should work for "amd64", "sparc", and "sparcv9".
33 ISADIR=$ISA
34 fi
35
36 # Then set up LD_PRELOAD to interpose on __xnet_sendmsg().
37 if [ -e $LD_PRELOAD ]; then
38 LD_PRELOAD=libRLike.so
39 else
40 LD_PRELOAD="libRLike.so $LD_PRELOAD"
41 fi
42
43 export LD_PRELOAD
44
45 # echo "LD_PRELOAD is " $LD_PRELOAD
46 # echo "Would execute $EXECDIR/$ISADIR/in.iked"
47 exec $EXECDIR/$ISADIR/in.iked