This file is indexed.

/usr/share/tcos/hooks-addons/18openvpn is in initramfs-tools-tcos 0.89.86.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# hook to include openvpn
# need openvpn

if [ -n "$TCOS_OPENVPN" ] && [ ! -d /var/lib/tcos/openvpn/keys ] ; then
  _echo "    TCOS_OPENVPN enabled but no keys"
  _echo ""
  _echo "        Please run 'tcos-init-openvpn' as root user"
  _echo ""

elif [ -n "$TCOS_OPENVPN" ] && [ -d /var/lib/tcos/openvpn/keys ]; then

stat_before

tcos_manual_add_modules tun

cpifexists /usr/sbin/openvpn /usr/bin/
mkdir -p $DESTDIR/usr/share/openvpn
cpifexists /var/lib/tcos/openvpn/keys/ca.crt     /usr/share/openvpn/
cpifexists /var/lib/tcos/openvpn/keys/client.key /usr/share/openvpn/
cpifexists /var/lib/tcos/openvpn/keys/client.crt /usr/share/openvpn/

TCOS_VPN_SERVER=$(awk '/^server/ {print $2}' /var/lib/tcos/openvpn/tcosserver.conf | cut -d . -f -3)".1"

# startup script
cat << EOF > $DESTDIR/scripts/tcos-bottom/18vpn
#!/bin/sh

if [ "\$1" = "prereqs" ]; then
  exit 0
fi

quiet=n
. /scripts/functions
maybe_break openvpn1

modprobe tun
ln -s /bin/busybox /sbin/ifconfig
ln -s /bin/busybox /sbin/route
openvpn /usr/share/openvpn/client.conf > /tmp/openvpn.log 2>&1 &

grep -v -e xdmcp-server -e font-server /etc/hosts > /etc/hosts.new
mv /etc/hosts.new /etc/hosts
echo "$TCOS_VPN_SERVER xdmcp-server" >> /etc/hosts
echo "$TCOS_VPN_SERVER font-server" >> /etc/hosts
echo "$TCOS_VPN_SERVER vpn-server" >> /etc/hosts

maybe_break openvpn2

# wait for carrier/ping in tap0
log_begin_msg "Waiting for OpenVPN connection"
log_end_msg 0
while [ 1 ]; do
  #if [ "\$(cat /sys/class/net/tap0/carrier)" = "1" ]; then
  #  break
  #fi
  ping -q -W 1 -c 2 vpn-server >/dev/null 2>&1 && break
  sleep 1
done


EOF
chmod +x $DESTDIR/scripts/tcos-bottom/18vpn


cat << EOF > $DESTDIR/usr/share/openvpn/client.conf
client
dev tap
proto udp
remote tcos-server 2194
float
resolv-retry infinite
nobind
persist-key
persist-tun
ca "/usr/share/openvpn/ca.crt"
cert "/usr/share/openvpn/client.crt"
key "/usr/share/openvpn/client.key"
comp-lzo
verb 1
ns-cert-type server
EOF

stat_after "OpenVPN"
fi # end of TCOS_OPENVPN