forked from jontowles/MacScripts
-
Notifications
You must be signed in to change notification settings - Fork 1
/
anyconnect.sh
26 lines (25 loc) · 934 Bytes
/
anyconnect.sh
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
#!/bin/sh
# Variables
myHost=$(hostname | /usr/bin/awk -F's-' '{print $1}')
cert=`security find-certificate -c $myHost -Z | grep SHA | awk '{print $3}'`
loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`
#Create .anyconnect config file
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<AnyConnectPreferences>
<DefaultUser>$loggedInUser</DefaultUser>
<DefaultSecondUser></DefaultSecondUser>
<ClientCertificateThumbprint>$cert</ClientCertificateThumbprint>
<ServerCertificateThumbprint></ServerCertificateThumbprint>
<DefaultHostName>vpn.test.com</DefaultHostName>
<DefaultHostAddress>vpn.test.com</DefaultHostAddress>
<DefaultGroup>VPNGROUP</DefaultGroup>
<ProxyHost></ProxyHost>
<ProxyPort></ProxyPort>
<SDITokenType>none</SDITokenType>
<ControllablePreferences></ControllablePreferences>
</AnyConnectPreferences>" > /Users/$loggedInUser/.anyconnect
# PopulateCert.sh
#
#
# Created by Jon Towles on 5/7/18.
#