[APP][4.0+][v1.11 - 20150221] OpenConnect - SSL VPN client for Cisco AnyConnect

Search This thread

petelking

Member
Apr 11, 2012
29
4
Code:
busybox ifconfig tun0 mtu 1200

Many thanks for getting back to me, Anyconnect MTU is 1405 while openconnect MTU is 1406
Changing the MTU to 1200 solved this but also chaining it to 1405 solved so I'd like to thank you for your efforts :good:
Any way to make this change permenent?

Code:
busybox ifconfig tun0 mtu 1405

Cheers!
 
Last edited:

cernekee

Senior Member
Jun 2, 2013
186
427
Many thanks for getting back to me, Anyconnect MTU is 1405 while openconnect MTU is 1406

Hmm, that's odd. I wonder how it is being calculated. Normally we just get a number from the server and use it as-is. When I connect to a local ASA with either client, I get 1406.

Can you send the MTU info for the other interfaces under both clients?
 
  • Like
Reactions: petelking

petelking

Member
Apr 11, 2012
29
4
Sent Via Email

After further testing, setting MTU to 1200 as you suggested works a lot better than 1405 with a lot less time-outs and retransmits.

Thanks.
 

GT3XX

New member
Jul 8, 2014
4
0
(Tasker) intent to start vpn connection

Hi all,

I just switched from Apple to Android and like it already! ;)
Tho, I can't figure out what's the intent to add to tasker to start the vpn connection. I read the github page which said smth about the intent, but i can't translate it to tasker format. Can someone put me into the right direction?

A: public class StartOpenVPNActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

final String EXTRA_NAME = "de.blinkt.openvpn.shortcutProfileName";

Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
shortcutIntent.setClassName("de.blinkt.openvpn", "de.blinkt.openvpn.LaunchVPN");
shortcutIntent.putExtra(EXTRA_NAME,"upb ssl");
startActivity(shortcutIntent);

or from the shell:

am start -a android.intent.action.MAIN -n de.blinkt.openvpn/.LaunchVPN -e de.blinkt.openvpn.shortcutProfileName Home
 

cernekee

Senior Member
Jun 2, 2013
186
427
Tho, I can't figure out what's the intent to add to tasker to start the vpn connection. I read the github page which said smth about the intent, but i can't translate it to tasker format.

This feature was in the original ics-openvpn sources, but it isn't currently working in OpenConnect.

I can look into getting it fixed up if you're interested in using it. Are you starting/stopping the VPN connection based on e.g. location, hours, etc.?
 

GT3XX

New member
Jul 8, 2014
4
0
This feature was in the original ics-openvpn sources, but it isn't currently working in OpenConnect.

I can look into getting it fixed up if you're interested in using it. Are you starting/stopping the VPN connection based on e.g. location, hours, etc.?

Aff, sorry. I'ts getting kinda late here. It would be great if I can start the VPN connection when the phone is connected to specific WIFI APs.
 

GT3XX

New member
Jul 8, 2014
4
0
Don't want to hesitate you, but I'm still interested. Do you have any updates? Thanks!
 

cernekee

Senior Member
Jun 2, 2013
186
427
Don't want to hesitate you, but I'm still interested. Do you have any updates? Thanks!

I haven't coded anything up yet but I gave it some thought.

First - I think SmoothConnect does some sort of blacklist/whitelist based on wifi SSIDs, so that might be something to check out.

Disconnecting in response to another app's intent is easy. Connecting is often interactive, so I think it might work best if the following conditions are satisfied:

  • VpnService confirmation dialog is bypassed. Arne Schwab made an Xposed module for this. I was thinking I might integrate a cut-down version of this feature into OpenConnect directly, so that if you install OpenConnect you'll automatically get an option in the Xposed Installer to always allow VPN connections from OpenConnect. Hopefully this doesn't have any ill effects if Xposed is not installed.
  • You would probably want to use batch mode (or a passwordless cert) so that OpenConnect doesn't bug you for group/login/password on every connection. Does this currently work for you?
 

GT3XX

New member
Jul 8, 2014
4
0
1157

I haven't coded anything up yet but I gave it some thought.

First - I think SmoothConnect does some sort of blacklist/whitelist based on wifi SSIDs, so that might be something to check out.

Disconnecting in response to another app's intent is easy. Connecting is often interactive, so I think it might work best if the following conditions are satisfied:

  • VpnService confirmation dialog is bypassed. Arne Schwab made an Xposed module for this. I was thinking I might integrate a cut-down version of this feature into OpenConnect directly, so that if you install OpenConnect you'll automatically get an option in the Xposed Installer to always allow VPN connections from OpenConnect. Hopefully this doesn't have any ill effects if Xposed is not installed.
  • You would probably want to use batch mode (or a passwordless cert) so that OpenConnect doesn't bug you for group/login/password on every connection. Does this currently work for you?

Thanks for your quick reply. I own an ASA for home use so I'm able to set it up as needed.
At this moment, I have to Anyconnect profiles:

  • Cert based - To use an encrypted tunnel when I'm connected to public AP's so it would be hard to intercept traffic.
  • AAA + 2 factor authentication - To access my LAN.
I'd like to connect to my cert based profile when I'm not locally connected to my LAN nor 4G. I tried to setup SmoothConnect but it keeps bugging me certficate warnings (your OpenConnect and the official AnyConnect apps work perfectly though).
If it ain't much work the most ideal situation would be to manage the connection by Tasker and be able to see the status of the connection by Tasker variables.
 

Ray-Out

Member
Apr 20, 2012
8
2
I found a problem with the current version:

Since commit 4d4c10 certificate files in the cache folder that get used by the lib are no more updated with the ones for the connection.

Seems path never gets changed as only srcPath is assigned.
 
  • Like
Reactions: cernekee

cernekee

Senior Member
Jun 2, 2013
186
427
I found a problem with the current version:

Since commit 4d4c10 certificate files in the cache folder that get used by the lib are no more updated with the ones for the connection.

Seems path never gets changed as only srcPath is assigned.

Oops, looks like I forgot to return srcPath for the !isExecutable case (no temp file). Thanks for catching that.

I'll make a v1.02 with the fix.
 
  • Like
Reactions: Ray-Out

wilhexm

Member
Aug 23, 2012
26
21
Hello
I connected to a Cisco ASA server with a P12 file certification. But I can't select user group, while I can chose it by AnyConnect app.
Need for help, Thank you.
 

hatoxda

Member
Oct 10, 2015
15
2
When the mtu is less than 1280, the ipv6 should be disabled

Hi, thanks for this great app. But I got a problem regarding MTU setting:
Because the lame HUAWEI phone has an MTU of 1400 for both wireless and mobile data interface, the resulted MTU is 1269. And the app fallback to 1280, I think it's for the IPV6? In this case, I think the IPV6 should be disabled instead of fallback? I believe the recent version of ocserv is doing this. I also filed an issue on GitHub. Could you please have a look on this?

Thanks.
 

batvan

Senior Member
Jan 16, 2007
117
4
Toronto
Split Tunelling

Hello

Can someone help me set up split tunelling? I want to be able to access my local home printer while on my work VPN .

I tried using both options and inputted my home subnet;

192.168.0.0/24

Doesn't seem to be working .
 

lyrelai

Member
Jun 28, 2009
41
3
The split tunnel is specified to include the ip address range you want Openconnect to route to on your Work VPN side. Any other ip address that is not in this range will be routed through your normal local network route. So, put your work VPN internal ip address range in that split tunnel range, then everything else will not be routed through VPN.

Lyre
 
  • Like
Reactions: batvan

Quirken

Member
Feb 16, 2012
11
1
seems like the TOTP token isn't working for me.

I set software token to TOTP and entered my token string and when i connect, it still asks me for my 2 step passcode. It isn't prefilled with anything

The log tab mentions

CALLBACK: onProcessAuthForm
AUTH: message 'somestringblahblah'
AUTH form result is 1

Running Android 6 if relevant, AOSP stock. Typing in the code manually succeeds with connection.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 15
    Highlights

    • 100% open source (GPLv2+)
    • No ads
    • One-click connection (batch mode)
    • Supports RSA SecurID and TOTP software tokens
    • Keepalive feature to prevent unnecessary disconnections
    • Compatible with ARMv7, x86, and MIPS devices
    • No root required
    • Based on the popular OpenConnect Linux package

    Requirements

    • Android 4.0 (ICS) or higher (with working VpnService + tun infrastructure)
    • An account on a suitable VPN server

    Downloads

    (note that the F-Droid binaries are signed by a different key than the official releases)

    Changelog

    Code:
    v1.11 - 2015/02/21
    
     - Fix "Unknown compression type 0" errors when CSTP and DTLS use
       different compression settings

    Older changelogs:


    Code:
    v1.10 - 2015/02/08
    
     - Fix CSD script problem on Lollipop (bug #1)
    
     - Fix IPv6 address display on status window (bug #2)
    
     - Enable LZ4 compression support
    
     - Identify as a mobile client when Android or iOS is selected
    
     - Update to OpenConnect v7.04+, GnuTLS 3.2.21
    
    v1.02 - 2014/09/02
    
     - Fix regression on certificate handling
    
    v1.01 - 2014/08/29
    
     - Add Spanish translations (thanks to teosoft)
    
     - Fix regression on CSD scripts starting with "#!/bin/sh"
    
     - Improve error messages on broken ROMs that throw exceptions when
       starting a VpnService
    
     - Fix intermittent fragment-related crashes on ICS
    
    v1.00 - 2014/08/10
    
     - Fix problems storing >8kB certificates on some ROMs
    
     - Clean up seldom-used menu items and move some options into General Settings
       or About
    
     - Integrate Xposed module for bypassing the VPN confirmation dialog
    
     - Switch to ACRA for problem reporting
    
    v0.96 - 2014/07/06
    
     - Force a minimum MTU of 1280 on KK due to bugs in 4.4.3 and 4.4.4 ROMs:
       https://code.google.com/p/android/issues/detail?id=70916
    
     - Fix navigation anomalies (weird Back button behavior) seen after
       re-entering OpenConnect from one of the Notifications
    
    v0.95 - 2014/06/14
    
     - Show the auth dialog <message> text in case it contains useful information
    
     - Add German translations (thanks to Ingo Zansinger <ingo@zansinger.de>)
    
     - Add Chinese translations
    
     - Add Advanced options for changing Dead Peer Detection timeout and enabling Perfect Forward Secrecy
    
     - Clean up a bunch of lint warnings and unused strings/files
    
     - Try to generate a human-readable profile name when adding a new VPN
    
    v0.91 - 2014/06/01
    
     - Fix bugs involving saved authgroups
    
     - Fix batch mode error handling
    
     - Update to GnuTLS 3.2.15 to fix GNUTLS-SA-2014-3 / CVE-2014-3466
    
    v0.9 - 2014/04/26
    
     - Add new "Send feedback" screen
    
     - Add new "SecurID info" screen for RSA soft token users
    
     - Allow changing settings and using other menu options (about, SecurID,
       send feedback, etc.) while connected
    
     - Update FAQ and provide some links to relevant XDA posts
    
    v0.81 - 2014/04/06
    
     - Fix potential issue recognizing certificates stored in VPN profiles
       created with <= v0.7
    
    v0.8 - 2014/04/02
    
     - Fix hangs after reconnect if DTLS is disabled
    
     - Fix incorrect storage of PKCS#12 certificates
    
     - Remove unnecessary passphrase prompts on unencrypted certificates
    
     - Add a workaround for ASA certificate request quirks
    
     - Fix FC when attempting to import an OpenVPN profile
    
    v0.7 - 2014/03/08
    
     - Update GnuTLS to address CVE-2014-0092
    
     - Fix FC and other misbehavior on IPv6 connections
    
     - Update to libopenconnect 5.99+
    
     - Fix/delete several broken translations
    
     - Minor improvements to the auth form UI
    
     - Switch curl from OpenSSL to GnuTLS and remove advertising clauses
    
    v0.6 - 2014/02/09
    
     - First release in Google Play Store
    
     - Change to new "big O" launcher icon
    
     - Avoid displaying error alerts if the user terminated the connection
    
     - Try to make the libopenconnect build process more robust, and strip *.so
       files to conserve space
    
    v0.5 - 2014/02/01
    
     - Fix "living dead" connections (can't pass data after reconnection due to
       DTLS parameter mismatches)
    
     - Add FAQ tab in response to user feedback
    
     - Move log window into a tab
    
     - Reorganize action bar so that the most important items (Status/Log/FAQ)
       are tabs, and less important items (Settings/About) are in the menu
    
     - Fix KeepAlive socket errors on KitKat devices
    
     - Other UI and documentation fixes
    
     - Add split tunnel configuration options
    
     - Improve icons
    
    v0.2 - 2014/01/18
    
     - Allow SecurID token import via URI or text file
    
     - Newly reworked "status" tab with uptime, error alerts, IP addresses,
       etc.
    
     - Fix a couple of bugs involving screen rotation / activity redraw on
       the log window
    
     - Prompt for hostname instead of profile name when adding a new VPN, to
       help avoid "empty hostname" mistakes
    
     - Numerous other UI improvements and fixes
    
     - Remove "reconnect on boot" until it works properly
    
     - Try to accommodate Linux CSD wrapper scripts starting with "#!/bin/bash"

    FAQ

    Q: What is this app used for?

    A: OpenConnect is used to access virtual private networks (VPNs) which utilize the Cisco AnyConnect SSL VPN protocol. A typical use case might involve logging into your workplace remotely to check email after hours.

    If in doubt, check with your I.T. administrator to see if a suitable service is available.


    Q: How do I get started?

    A: In most cases, you'll just need to create a profile and enter the hostname of the VPN gateway. The other fields in the profile are all optional and should be left alone unless there is a specific need to change them.

    Once you've set up the profile, select the VPN entry and OpenConnect will attempt to establish a new session. If this fails, the "Log" tab may provide helpful diagnostic information.


    Q: How do I authenticate using an SSL client certificate?

    A: Copy your certificate files to Android's external storage directory (nominally /sdcard or the Downloads folder), then edit the VPN profile and make the following changes:

    P12 or PFX file: select "User certificate", pick the file from the list, then touch "select". Leave "Private key" blank.

    Single PEM/CRT/CER file: same as above.

    Separate PEM/CRT/CER and KEY files: populate "User certificate" with the certificate file, and "Private key" with the key file.

    When finished, delete the certificate files from external storage so they cannot be stolen by other apps.

    If you are generating your own keys (e.g. for use with your ocserv gateway), some basic CA setup instructions are posted here.


    Q: Will OpenConnect work with non-AnyConnect VPNs?

    A: Unfortunately the software design is tied very closely to the AnyConnect requirements and the libopenconnect interfaces. Therefore it only works with Cisco AnyConnect and ocserv gateways.


    Q: Will OpenConnect work with Cisco IPsec VPNs running on an ASA?

    A: OpenConnect supports SSL VPN (CSTP + DTLS) only.


    Q: How do I import a SecurID software token?

    A: If you have an URL that starts with "com.rsa.securid.iphone://" or "http://127.0.0.1/securid/" in your email, click on it and tell OpenConnect to add it to the desired VPN profile. If you just have a raw token string then write it to a text file, copy it under /sdcard, click "Token string" in the VPN profile editor, then select the filename.

    If you have an "sdtid" XML file, copy it to /sdcard and then import it.


    Q: Is it possible to skip all login prompts when connecting?

    A: If you have saved your username, password, or other credentials, or if you are using SecurID or certificate authentication, you can try enabling "Batch Mode" in the VPN profile to skip the login dialogs. If you need to change your saved password later or have trouble connecting, just disable batch mode.

    The VPN warning dialog is a security feature built into the Android OS. It cannot be bypassed by OpenConnect, but if your device is rooted, you can try installing the Xposed Framework and then activating the Auto VPN Dialog Confirm module. Some notes on this are posted here.

    Due to the user interaction required by these dialogs, it is not always possible to reliably start up the VPN in the background. So a "start-on-boot" feature is not currently provided.


    Q: How do I improve battery life while the VPN is up?

    A: One option is to select "Pause when asleep" under Settings. The downside is that VPN access will be temporarily stopped when the screen is off. Also, ASA gateways sometimes get annoyed with constant reconnections and may prematurely terminate your session after a few days.

    Another option is to contact your server administrator and request that they disable dead peer detection (DPD), increase the idle timeout to >1hr, and increase the keepalive interval to ~5min or so.


    Q: How do I use OpenConnect with AFWall+?

    A: There are a few caveats to keep in mind when using an Android firewall with VPN:

    * If you run KitKat, use Android 4.4.2 or higher and AFWall 1.2.8 or higher. Android 4.4 and 4.4.1 have a serious TCP MSS bug which causes stalled connections and/or poor performance. AFWall <=1.2.7 does not have the extra logic needed to handle the routing changes in KitKat.
    * Always allow traffic from the VPN app on all interfaces. In particular, you should whitelist VPN traffic from OpenConnect, as OpenConnect sends DNS requests over the VPN interface every few minutes to help keep the connection from timing out.


    Q: Are any apps incompatible with VPN?

    A: Apps which perform their own DNS resolution, such as Firefox, may have issues picking up the latest system DNS settings when connecting to the VPN. This can be a problem if your system DNS servers are not accessible over the VPN's routes, or if you are trying to look up hostnames that do not have public (internet) DNS entries.


    Q: Under what circumstances will OpenConnect request root?

    A: There are two root-only features shown under Settings; both are disabled by default. One setting works around a ROM bug in CM9 which sets incorrect permissions on /dev/tun, preventing VpnService from passing traffic to the tunnel interface; the other setting loads tun.ko on ROMs that neglect to load it by default.

    Based on user feedback and testing, future releases may autodetect these conditions.


    Q: How do I send a problem report?

    A: Navigate to Log -> (menu) -> Send log file. Please be sure to furnish a complete, accurate description of the issue you are seeing, as the logs do not always show a smoking gun.


    TODO

    • Translations - I will set up the necessary infrastructure if there are volunteers
    • Compatibility testing
    • Add x509 certificate parsing/validation in the profile editor
    • Enable Android keystore support
    • Proxy support
    • Split tunnel DNS?

    MISC

    Using OpenConnect + ocserv (on a VPS) to bypass China's Great Firewall (GFW): link

    XDA:DevDB Information
    OpenConnect, App for the Android General

    Contributors
    cernekee
    Source Code: https://github.com/cernekee/ics-openconnect


    Version Information
    Status: Testing

    Created 2014-01-18
    Last Updated 2015-02-21
    6
    Hi all,
    I've extended OpenConnect for Android to support the Juniper and PAN GlobalProtect protocols, which are both supported in openconnect 8.0+. (Full disclosure: I am the primary author of the upstream GlobalProtect support.)

    The changes needed to support multiple protocols are actually quite minor (https://github.com/cernekee/ics-openconnect/pull/34) now that openconnect has an API for figuring out the supported protocols.


    _7H-5U5IbQfQ4Y-2ElUr23JUVgaOANT8yZ9wbpfGNvwbG0vQX5ljXdUxuJarrvD8sMqQm0lWysTxmbHQLJuEUpFVo_BRIL2DPMrd53hHPWX-AmIKwvEotUpIGa1qvc1XTL48K2rIeIi7nQD_LtlT_2BOJuaUCF_UgtxojH-LXzasjwza4RxfucrRfRR4npklHLYbDuosm2eZPrR4R-R-L5DG1YkrRYu6SV-SiskflfzBgnhaCsqasZskFXok8aynNiTNXfsr1lU5KemGOTBwMy-titdc7v-MfOblFt6e5JgxOzWYVQQJCD4VG1Oa_CS5uXHoVlLAHkvb5Ab2_TMFDjNJgiQtpm3A5JMjPHeiICCgwf4z9OenfbdpG4k5VAXpUGz7iT1Iu3oYKUdb5knWo7PVsH_Bj6XUK7h5apRElTBf4SzfGLEpdVZ_1UI26h79q6UKa0FNDb9s7RUKN_x4t-FHkVUBGJ7nzAoz_IsEaDDOeOFtUUHcLq1CGdceJC5iYiEMiMgLZ41GrX7Bd2NNiLyWzX0g8Lp4mqkbF_t0dx35zFg6vrexqBRBKWvPeIPapCkihSCj9nczQfXFhS-8WswWm8HVcQHRnOZmDBiS=w720-h1280-no
    3
    is there any update for android 10 ?
    Well, someone made their own copy of Openconnect with Android 10 changes and published it in Play Store:
    https://play.google.com/store/apps/details?id=com.github.digitalsoftwaresolutions.openconnect
    2
    here is the output after some bad sites access

    Hmm, on my KitKat device I have an st_mangle_POSTROUTING chain which does the TCPMSS clamping:

    Code:
    Chain st_mangle_POSTROUTING (1 references)
        pkts      bytes target     prot opt in     out     source               destination         
           0        0 TCPMSS     tcp  --  *      tun0    0.0.0.0/0            0.0.0.0/0            tcpflags: 0x06/0x02 TCPMSS clamp to PMTU

    I did not see this in your output. Maybe Samsung is using an outdated version of netd.

    Try running this command as root after bringing up the VPN and see if you are able to pass traffic with the bad sites:

    Code:
    iptables -t mangle -A POSTROUTING -p tcp -o tun0 --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

    If not, post the new "iptables -t mangle -nxvL" output so we can look at the traffic counters.

    Also can you attach your /system/bin/netd binary?

    Thanks.
    1
    I got it. first I rooted my note3 then I followed the instruction in the video and here it is, I hope it's what you asked me for. waiting for your diagnosis, fingers crossed