cancel
Showing results for 
Search instead for 
Did you mean: 

Cisco AnyConnect Command install with install options and profile creation.

Fulgubbe
Novitiate III

Hi! 

Thought i should share how we install Cisco AnyConnect with install Options and profile creation. We just want to install the VPN client and not all the other features the pkg contains but you can choose what you want with <integer>1</integer> or <integer>0</integer>. The script also creates a Profile on target machine with chosen attributes.

You can use this script as a daily command (if installed it will exit) or in a post install script in an empty pkg if you want to utilize the software management funktion.

 

#!/bin/sh

downloadLink="YOUR AnyConnect.pkg DOWNLOAD LINK"
pkgName="AnyConnect.pkg"
companyName="YOUR COMPANY NAME"
vpnHostname="YOUR VPN HOSTNAME URL"

#Check if installed
if [ -d /Applications/Cisco/ ];
then
  echo "Already Installed"
  exit 0
else

#Add install chooices
cat > /tmp/vpn_install_choice.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
     <dict>
         <key>attributeSetting</key>
         <integer>1</integer>
         <key>choiceAttribute</key>
         <string>selected</string>
         <key>choiceIdentifier</key>
         <string>choice_vpn</string>
     </dict>
     <dict>
         <key>attributeSetting</key>
         <integer>0</integer>
         <key>choiceAttribute</key>
         <string>selected</string>
         <key>choiceIdentifier</key>
         <string>choice_websecurity</string>
     </dict>
     <dict>
         <key>attributeSetting</key>
         <integer>0</integer>
         <key>choiceAttribute</key>
         <string>selected</string>
         <key>choiceIdentifier</key>
         <string>choice_fireamp</string>
     </dict>
     <dict>
         <key>attributeSetting</key>
         <integer>0</integer>
         <key>choiceAttribute</key>
         <string>selected</string>
         <key>choiceIdentifier</key>
         <string>choice_dart</string>
     </dict>
     <dict>
         <key>attributeSetting</key>
         <integer>0</integer>
         <key>choiceAttribute</key>
         <string>selected</string>
         <key>choiceIdentifier</key>
         <string>choice_posture</string>
     </dict>
     <dict>
         <key>attributeSetting</key>
         <integer>0</integer>
         <key>choiceAttribute</key>
         <string>selected</string>
         <key>choiceIdentifier</key>
         <string>choice_iseposture</string>
     </dict>
     <dict>
         <key>attributeSetting</key>
         <integer>0</integer>
         <key>choiceAttribute</key>
         <string>selected</string>
         <key>choiceIdentifier</key>
         <string>choice_nvm</string>
     </dict>
     <dict>
         <key>attributeSetting</key>
         <integer>0</integer>
         <key>choiceAttribute</key>
         <string>selected</string>
         <key>choiceIdentifier</key>
         <string>choice_umbrella</string>
     </dict>
</array>
</plist>
EOF

#Download installer
curl -L -o /tmp/$pkgName $downloadLink

#Install AnyConnect with choices
/usr/sbin/installer -pkg /tmp/$pkgName -applyChoiceChangesXML /tmp/vpn_install_choice.xml -target /

#Add VPN Profile
cat > /opt/cisco/anyconnect/profile/$companyName.xml <<EOF
<AnyConnectProfile xmlns="http://schemas.xmlsoap.org/encoding/">
  <ClientInitialization>
    <WindowsLogonEnforcement>SingleLocalLogon</WindowsLogonEnforcement>
    <WindowsVPNEstablishment>AllowRemoteUsers</WindowsVPNEstablishment>
  </ClientInitialization>
  <ServerList>
    <HostEntry>
      <HostName>$companyName</HostName>
      <HostAddress>$vpnHostname</HostAddress>
    </HostEntry>
  </ServerList>
</AnyConnectProfile>
EOF
fi

 

0 REPLIES 0