iOS Otomatik VPN Bağlantısı | alicangonullu.biz

iOS Otomatik VPN Bağlantısı

Merhabalar

Bu yazımda sizlere Objective-C ve Swift gibi dilleri öğrenmeye gerek kalmadan İOS Web uygulaması yazmayı öğreticem

I.Adım XML'e Hoşgeldiniz

Evet uygulamamız .mobileconfig uzantılı ve XML dilinde yazılıyor.

II.Adım Başlıyoruz

Öncelikle uygulamamıza ad veriyoruz

<?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">
<dict>
  <key>PayloadContent</key>
  <array>        <dict>
      <key>UserDefinedName</key>
      <string>Uygulama Adi</string>
      <key>PayloadDisplayName</key>
      <string>Uygulama Adi</string>
      <key>PayloadIdentifier</key>
      <string>com.uygulamaadi.vpn1</string>
      <key>PayloadUUID</key>
      <string>80745B76-EA66-33FB-8CC9-B85FDFF04594</string>
      <key>VPNType</key>
      <string>L2TP (IKEv2 ve IPSEC'de destekler)</string>
      <key>IPSec</key>
      <dict>
        <key>AuthenticationMethod</key>
        <string>SharedSecret</string>
        <key>LocalIdentifierType</key>
        <string>KeyID</string>
        <key>SharedSecret</key>
        <string>gizli-pass</string>
      </dict>

Devamında ise kullanıcı adı, şifre ve hostname giricez

      <key>PPP</key>
      <dict>
        <key>AuthName</key>
        <string>kadi</string>
        <key>AuthPassword</key>
        <string>passwd</string>
        <key>CommRemoteAddress</key>
        <string>hostname</string>
      </dict>

Sonra diğer ayarlar...

   <key>OnDemandRules</key>
          <array>
        <dict>
          <key>InterfaceTypeMatch</key>
          <string>WiFi</string>
          <key>SSIDMatch</key>
          <array>
 <string>SSID-Adi</string>
           </array>
          <key>Action</key>
          <string>Disconnect</string>
        </dict>
 <key>Action</key>
          <string>Disconnect</string>
        </dict>
        <dict>
          <!-- VPN Default state -->
          <key>Action</key>
          <string>Connect</string>
        </dict>
          </array>
  <key>OverridePrimary</key>
      <true/>
      <key>IPv4</key>
      <dict>
        <key>OverridePrimary</key>
        <integer>1</integer>
      </dict>
      <key>PayloadType</key>
      <string>com.apple.vpn.managed</string>
      <key>PayloadVersion</key>
      <integer>1</integer>
    </dict>
</array>
  <key>PayloadDisplayName</key>
  <string>VPN Configurations</string>
  <key>PayloadIdentifier</key>
  <string>AFC8105A-6213-4D5B-3A17-64C4D5818E77</string>
  <key>PayloadRemovalDisallowed</key>
  <false/>
  <key>PayloadType</key>
  <string>Configuration</string>
  <key>PayloadUUID</key>
  <string>0690FC77-130B-55B4-430B-B880C7F15253</string>
  <key>PayloadVersion</key>
  <integer>1</integer>
</dict>
</plist>

Vee bitti. Sonrasında tamamı :

<?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">
<dict>
  <key>PayloadContent</key>
  <array>        <dict>
      <key>UserDefinedName</key>
      <string>Uygulama Adi</string>
      <key>PayloadDisplayName</key>
      <string>Uygulama Adi</string>
      <key>PayloadIdentifier</key>
      <string>com.uygulamaadi.vpn1</string>
      <key>PayloadUUID</key>
      <string>80745B76-EA66-33FB-8CC9-B85FDFF04594</string>
      <key>VPNType</key>
      <string>L2TP</string>
      <key>IPSec</key>
      <dict>
        <key>AuthenticationMethod</key>
        <string>SharedSecret</string>
        <key>LocalIdentifierType</key>
        <string>KeyID</string>
        <key>SharedSecret</key>
        <string>gizli-pass</string>
      </dict>
      <key>PPP</key>
      <dict>
        <key>AuthName</key>
        <string>kadi</string>
        <key>AuthPassword</key>
        <string>passwd</string>
        <key>CommRemoteAddress</key>
        <string>hostname</string>
      </dict>
      <key>OnDemandEnabled</key>
   <integer>1</integer>
   <key>OnDemandRules</key>
          <array>
        <dict>
          <key>InterfaceTypeMatch</key>
          <string>WiFi</string>
          <key>SSIDMatch</key>
          <array>
 <string>SSID-Adi</string>
           </array>
          <key>Action</key>
          <string>Disconnect</string>
        </dict>
        <dict>
          <!-- VPN Default state -->
          <key>Action</key>
          <string>Connect</string>
        </dict>
          </array>
      <key>OverridePrimary</key>
      <true/>
      <key>IPv4</key>
      <dict>
        <key>OverridePrimary</key>
        <integer>1</integer>
      </dict>
      <key>PayloadType</key>
      <string>com.apple.vpn.managed</string>
      <key>PayloadVersion</key>
      <integer>1</integer>
    </dict>
</array>
  <key>PayloadDisplayName</key>
  <string>VPN Configurations</string>
  <key>PayloadIdentifier</key>
  <string>AFC8105A-6213-4D5B-3A17-64C4D5818E77</string>
  <key>PayloadRemovalDisallowed</key>
  <false/>
  <key>PayloadType</key>
  <string>Configuration</string>
  <key>PayloadUUID</key>
  <string>0690FC77-130B-55B4-430B-B880C7F15253</string>
  <key>PayloadVersion</key>
  <integer>1</integer>
</dict>
</plist>

 

Örnek olarak vpn_ornek.mobileconfig dan yararlanabilirsiniz.


Belge / Video Eki


Ali Can Gönüllü | Blog