From 421141e64541a0c6f30b11304209f90545926a4b Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Mon, 18 Jun 2012 00:27:03 +0200 Subject: Add a status message which shows the status of the connecting/connected VPN --- proguard.cfg | 40 ------------- res/values/strings.xml | 13 +++-- res/xml/general_settings.xml | 10 ++++ src/de/blinkt/openvpn/LaunchVPN.java | 60 ++++++++++--------- src/de/blinkt/openvpn/LogWindow.java | 4 +- src/de/blinkt/openvpn/NetworkSateReceiver.java | 1 - src/de/blinkt/openvpn/OpenVPN.java | 16 ++++- src/de/blinkt/openvpn/OpenVPNThread.java | 2 +- src/de/blinkt/openvpn/OpenVpnManagementThread.java | 40 +++++++------ src/de/blinkt/openvpn/OpenVpnService.java | 68 ++++++++++++++++++---- todo.txt | 10 ---- 11 files changed, 147 insertions(+), 117 deletions(-) delete mode 100644 proguard.cfg diff --git a/proguard.cfg b/proguard.cfg deleted file mode 100644 index b1cdf17b..00000000 --- a/proguard.cfg +++ /dev/null @@ -1,40 +0,0 @@ --optimizationpasses 5 --dontusemixedcaseclassnames --dontskipnonpubliclibraryclasses --dontpreverify --verbose --optimizations !code/simplification/arithmetic,!field/*,!class/merging/* - --keep public class * extends android.app.Activity --keep public class * extends android.app.Application --keep public class * extends android.app.Service --keep public class * extends android.content.BroadcastReceiver --keep public class * extends android.content.ContentProvider --keep public class * extends android.app.backup.BackupAgentHelper --keep public class * extends android.preference.Preference --keep public class com.android.vending.licensing.ILicensingService - --keepclasseswithmembernames class * { - native ; -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet); -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet, int); -} - --keepclassmembers class * extends android.app.Activity { - public void *(android.view.View); -} - --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - --keep class * implements android.os.Parcelable { - public static final android.os.Parcelable$Creator *; -} diff --git a/res/values/strings.xml b/res/values/strings.xml index f7c9817f..423ad066 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -24,6 +24,7 @@ 1194 Location folder can\'t be read! + Select Cancel No Data LZO Compression @@ -32,6 +33,7 @@ Client Certificate Key PKCS12 File CA Certificate + Select Nothing selected Copyright © 2002–2010 OpenVPN Technologies, Inc. <sales@openvpn.net>\n @@ -55,7 +57,6 @@ All your precious VPNs Type PKCS12 Password - Select… Select… Nothing Selected Use TLS Authentication @@ -212,6 +213,10 @@ Network Status: %s The CA cert is usually returned from the Android Keystore. Specify a seperate certificate if you get certificate verification errors. Select - No CA Certificate returned while reading from Android keystore. Auhtentication will probably fail. - - + No CA Certificate returned while reading from Android keystore. Auhtentication will probably fail. + Shows the log window on connect. The log window can always be accessed from the notification status. + Show log window + Keep the notification displayed after the connection is established to show traffic statistics. + Show Traffic Statistics + + \ No newline at end of file diff --git a/res/xml/general_settings.xml b/res/xml/general_settings.xml index 74c8965f..2da80cc6 100644 --- a/res/xml/general_settings.xml +++ b/res/xml/general_settings.xml @@ -11,5 +11,15 @@ android:key="useCM9Fix" android:summary="@string/owner_fix_summary" android:title="@string/owner_fix" /> + + \ No newline at end of file diff --git a/src/de/blinkt/openvpn/LaunchVPN.java b/src/de/blinkt/openvpn/LaunchVPN.java index e76057d7..1c873f22 100644 --- a/src/de/blinkt/openvpn/LaunchVPN.java +++ b/src/de/blinkt/openvpn/LaunchVPN.java @@ -44,7 +44,6 @@ import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.ListView; import android.widget.TextView; -import android.widget.Toast; /** * This Activity actually handles two stages of a launcher shortcut's life cycle. @@ -80,11 +79,11 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { private ProfileManager mPM; private VpnProfile mSelectedProfile; - - + + private boolean mCmfixed=false; static boolean minivpnwritten=false; - + @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); @@ -92,7 +91,7 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { mPM =ProfileManager.getInstance(this); } - + @Override protected void onStart() { super.onStart(); @@ -100,6 +99,7 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { final Intent intent = getIntent(); final String action = intent.getAction(); + // If the intent is a request to create a shortcut, we'll do that and exit if(Intent.ACTION_MAIN.equals(action)) { @@ -110,10 +110,11 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { VpnProfile profileToConnect = ProfileManager.get(shortcutUUID); if(shortcutName != null && profileToConnect ==null) profileToConnect = ProfileManager.getInstance(this).getProfileByName(shortcutName); - + if(profileToConnect ==null) { - Toast notfound = Toast.makeText(this, R.string.shortcut_profile_notfound, Toast.LENGTH_SHORT); - notfound.show(); + OpenVPN.logError(R.string.shortcut_profile_notfound); + // show Log window to display error + showLogWindow(); finish(); return; } @@ -221,31 +222,31 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { // } } - + private boolean writeMiniVPN() { File mvpnout = new File(getCacheDir(),"minivpn"); if (mvpnout.exists() && mvpnout.canExecute()) return true; - + if(minivpnwritten) return true; try { InputStream mvpn = getAssets().open("minivpn"); - + FileOutputStream fout = new FileOutputStream(mvpnout); - + byte buf[]= new byte[4096]; - + int lenread = mvpn.read(buf); while(lenread> 0) { fout.write(buf, 0, lenread); lenread = mvpn.read(buf); } fout.close(); - + if(!mvpnout.setExecutable(true)) return false; - + minivpnwritten=true; return true; } catch (IOException e) { @@ -303,26 +304,36 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { if(needpw !=0) { askForPW(needpw); } else { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); + boolean showlogwindow = prefs.getBoolean("showlogwindow", false); + if(showlogwindow) + showLogWindow(); new startOpenVpnThread().start(); } - } else if (resultCode == Activity.RESULT_CANCELED) { // User does not want us to start, so we just vanish finish(); } } } + void showLogWindow() { + + Intent startLW = new Intent(getBaseContext(),LogWindow.class); + startLW.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); + startActivity(startLW); + + } void showConfigErrorDialog(int vpnok) { AlertDialog.Builder d = new AlertDialog.Builder(this); d.setTitle(R.string.config_error_found); d.setMessage(vpnok); d.setPositiveButton(android.R.string.ok, new OnClickListener() { - + @Override public void onClick(DialogInterface dialog, int which) { finish(); - + } }); d.show(); @@ -339,7 +350,7 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { // Check if we want to fix /dev/tun SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); boolean usecm9fix = prefs.getBoolean("useCM9Fix", false); - + if(usecm9fix && !mCmfixed ) { ProcessBuilder pb = new ProcessBuilder(new String[] {"su","-c","chown system /dev/tun"}); try { @@ -353,8 +364,8 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { e.printStackTrace(); } } - - + + if (intent != null) { // Start the query @@ -363,7 +374,8 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { } catch (ActivityNotFoundException ane) { // Shame on you Sony! At least one user reported that // an official Sony Xperia Arc S image triggers this exception - Toast.makeText(this, R.string.no_vpn_support_image, Toast.LENGTH_LONG).show(); + OpenVPN.logError(R.string.no_vpn_support_image); + showLogWindow(); } } else { onActivityResult(START_VPN_PROFILE, Activity.RESULT_OK, null); @@ -379,10 +391,6 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { } void startOpenVpn() { - Intent startLW = new Intent(getBaseContext(),LogWindow.class); - startLW.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); - startActivity(startLW); - if(!writeMiniVPN()) { OpenVPN.logMessage(0, "", "Error writing minivpn binary"); return; diff --git a/src/de/blinkt/openvpn/LogWindow.java b/src/de/blinkt/openvpn/LogWindow.java index 6060e7ad..8fadf3ad 100644 --- a/src/de/blinkt/openvpn/LogWindow.java +++ b/src/de/blinkt/openvpn/LogWindow.java @@ -271,12 +271,12 @@ public class LogWindow extends ListActivity implements StateListener { } @Override - public void updateState(final String logmessage) { + public void updateState(final String status,final String logmessage) { runOnUiThread(new Runnable() { @Override public void run() { - mSpeedView.setText(logmessage); + mSpeedView.setText(status + " " + logmessage); } }); diff --git a/src/de/blinkt/openvpn/NetworkSateReceiver.java b/src/de/blinkt/openvpn/NetworkSateReceiver.java index a8d69896..0758cf3a 100644 --- a/src/de/blinkt/openvpn/NetworkSateReceiver.java +++ b/src/de/blinkt/openvpn/NetworkSateReceiver.java @@ -26,7 +26,6 @@ public class NetworkSateReceiver extends BroadcastReceiver { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); boolean sendusr1 = prefs.getBoolean("netchangereconnect", true); - String netstatestring; if(networkInfo==null) netstatestring = "not connected"; diff --git a/src/de/blinkt/openvpn/OpenVPN.java b/src/de/blinkt/openvpn/OpenVPN.java index b09eb60e..c23ee56d 100644 --- a/src/de/blinkt/openvpn/OpenVPN.java +++ b/src/de/blinkt/openvpn/OpenVPN.java @@ -41,6 +41,12 @@ public class OpenVPN { } + public LogItem(int loglevel, int ressourceId) { + mRessourceId =ressourceId; + mLevel = loglevel; + } + + String getString(Context c) { if(mMessage !=null) { return mMessage; @@ -73,7 +79,7 @@ public class OpenVPN { } public interface StateListener { - void updateState(String logmessage); + void updateState(String state, String logmessage); } synchronized static void logMessage(int level,String prefix, String message) @@ -126,9 +132,9 @@ public class OpenVPN { } - public static void updateStateString(String msg) { + public static void updateStateString(String state, String msg) { for (StateListener sl : stateListener) { - sl.updateState(msg); + sl.updateState(state,msg); } } @@ -155,6 +161,10 @@ public class OpenVPN { } + public static void logError(int ressourceId) { + newlogItem(new LogItem(LogItem.ERROR, ressourceId)); + } + } diff --git a/src/de/blinkt/openvpn/OpenVPNThread.java b/src/de/blinkt/openvpn/OpenVPNThread.java index fdb0ac02..22a08763 100644 --- a/src/de/blinkt/openvpn/OpenVPNThread.java +++ b/src/de/blinkt/openvpn/OpenVPNThread.java @@ -41,7 +41,7 @@ public class OpenVPNThread implements Runnable { //mInterface = null; - OpenVPN.updateStateString("No process running"); + OpenVPN.updateStateString("NOPROCESS","No process running"); // Not a good place to do it, but will do OpenVPN.logBuilderConfig(null); Log.i(TAG, "Exiting"); diff --git a/src/de/blinkt/openvpn/OpenVpnManagementThread.java b/src/de/blinkt/openvpn/OpenVpnManagementThread.java index 012e0923..f23d9d9b 100644 --- a/src/de/blinkt/openvpn/OpenVpnManagementThread.java +++ b/src/de/blinkt/openvpn/OpenVpnManagementThread.java @@ -21,7 +21,8 @@ public class OpenVpnManagementThread implements Runnable { private LinkedList mFDList=new LinkedList(); private int mBytecountinterval=2; private long mLastIn=0; - private long mLastOut=0; + private long mLastOut=0; + private String mCurrentstate; private static Vector active=new Vector(); @@ -185,8 +186,9 @@ public class OpenVpnManagementThread implements Runnable { } private void processState(String argument) { - String[] args = argument.split(",",2); - OpenVPN.updateStateString(args[1]); + String[] args = argument.split(",",3); + mCurrentstate = args[1]; + OpenVPN.updateStateString(mCurrentstate,args[2]); } @@ -195,32 +197,32 @@ public class OpenVpnManagementThread implements Runnable { int comma = argument.indexOf(','); long in = Long.parseLong(argument.substring(0, comma)); long out = Long.parseLong(argument.substring(comma+1)); - + long diffin = in - mLastIn; long diffout = out - mLastOut; - + mLastIn=in; mLastOut=out; - - String netstat = String.format("In: %8s, %8s/s Out %8s, %8s/s ", + + String netstat = String.format("In: %8s, %8s/s Out %8s, %8s/s", humanReadableByteCount(in, false), humanReadableByteCount(diffin, false), humanReadableByteCount(out, false), humanReadableByteCount(diffout, false)); - OpenVPN.updateStateString(netstat); - - + OpenVPN.updateStateString("BYTECOUNT",netstat); + + } // From: http://stackoverflow.com/questions/3758606/how-to-convert-byte-size-into-human-readable-format-in-java public static String humanReadableByteCount(long bytes, boolean si) { - int unit = si ? 1000 : 1024; - if (bytes < unit) return bytes + " B"; - int exp = (int) (Math.log(bytes) / Math.log(unit)); - String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp-1) + (si ? "" : "i"); - return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre); + int unit = si ? 1000 : 1024; + if (bytes < unit) return bytes + " B"; + int exp = (int) (Math.log(bytes) / Math.log(unit)); + String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp-1) + (si ? "" : "i"); + return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre); } - + private void processNeedCommand(String argument) { int p1 =argument.indexOf('\''); int p2 = argument.indexOf('\'',p1+1); @@ -328,10 +330,10 @@ public class OpenVpnManagementThread implements Runnable { private void processPWCommand(String argument) { //argument has the form Need 'Private Key' password - + String needed; try{ - + int p1 = argument.indexOf('\''); int p2 = argument.indexOf('\'',p1+1); needed = argument.substring(p1+1, p2); @@ -384,7 +386,7 @@ public class OpenVpnManagementThread implements Runnable { public void reconnect() { managmentCommand("signal SIGUSR1\n"); - + } } diff --git a/src/de/blinkt/openvpn/OpenVpnService.java b/src/de/blinkt/openvpn/OpenVpnService.java index 8c172115..a0d7503d 100644 --- a/src/de/blinkt/openvpn/OpenVpnService.java +++ b/src/de/blinkt/openvpn/OpenVpnService.java @@ -19,19 +19,24 @@ package de.blinkt.openvpn; import java.io.IOException; import java.util.Vector; +import de.blinkt.openvpn.OpenVPN.StateListener; + import android.app.Notification; +import android.app.Notification.Builder; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.content.SharedPreferences; import android.net.ConnectivityManager; import android.net.LocalSocket; import android.net.LocalSocketAddress; import android.net.VpnService; import android.os.ParcelFileDescriptor; +import android.preference.PreferenceManager; -public class OpenVpnService extends VpnService { +public class OpenVpnService extends VpnService implements StateListener { private Thread mServiceThread; private Vector mDnslist=new Vector(); @@ -54,7 +59,9 @@ public class OpenVpnService extends VpnService { private NetworkSateReceiver mNetworkStateReceiver; - private static final int HELLO_ID = 1; + private boolean mDisplayBytecount=false; + + private static final int OPENVPN_STATUS = 1; @Override public void onRevoke() { @@ -63,24 +70,36 @@ public class OpenVpnService extends VpnService { stopSelf(); }; - private void showNotification() { + private void hideNotification() { + String ns = Context.NOTIFICATION_SERVICE; + NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns); + mNotificationManager.cancel(OPENVPN_STATUS); + + } + private void showNotification(String msg) { String ns = Context.NOTIFICATION_SERVICE; NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns); int icon = R.drawable.icon; - CharSequence tickerText = "Hello"; long when = System.currentTimeMillis(); + + android.app.Notification.Builder nbuilder = new Notification.Builder(this); - mNotification = new Notification(icon, tickerText, when); + nbuilder.setContentTitle("OpenVPN - " + mProfile.mName); + nbuilder.setContentText(msg); + nbuilder.setOnlyAlertOnce(true); + nbuilder.setOngoing(true); + nbuilder.setContentIntent(getLogPendingIntent()); + nbuilder.setSmallIcon(icon); + nbuilder.setWhen(when); - Context context = getApplicationContext(); - CharSequence contentTitle = "My notification"; - CharSequence contentText = "Hello World!"; + mNotification = nbuilder.getNotification(); - mNotification.setLatestEventInfo(context, contentTitle, contentText, getLogPendingIntent()); - mNotificationManager.notify(HELLO_ID, mNotification); + + + mNotificationManager.notify(OPENVPN_STATUS, mNotification); } @@ -135,7 +154,7 @@ public class OpenVpnService extends VpnService { String profileUUID = intent.getStringExtra(prefix + ".profileUUID"); mProfile = ProfileManager.get(profileUUID); - //showNotification(); + OpenVPN.addSpeedListener(this); // Stop the previous session by interrupting the thread. if(OpenVpnManagementThread.stopOpenVPN()){ @@ -357,4 +376,31 @@ public class OpenVpnService extends VpnService { mLocalIPv6 = ipv6addr; } + @Override + public void updateState(String state,String logmessage) { + if("NOPROCESS".equals(state)) { + hideNotification(); + mDisplayBytecount=false; + return; + } + + if("CONNECTED".equals(state)) { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); + mDisplayBytecount = prefs.getBoolean("statusafterconnect", false); + if(!mDisplayBytecount) { + hideNotification(); + return; + } + } + + if("BYTECOUNT".equals(state)) { + if(mDisplayBytecount) { + showNotification(logmessage); + } + } else { + // Other notifications are shown + showNotification(state +" " + logmessage); + } + } + } diff --git a/todo.txt b/todo.txt index bb5135f8..06948a72 100644 --- a/todo.txt +++ b/todo.txt @@ -9,16 +9,10 @@ Ideas: - implement general settings dialog - encryption of profiles - Speed/Transfered in notification bar (byte counter of management) - - Kick openvpn on network state change (Wifi <-> GPRS/EDGE/UMTS) - - rework logging system (first step: rename OpenVPN class to samething sensible) - - map SIGUSR1 to SIGINT - add a put this certificate into file obscure option -- adding a profile should bring up editing the profile instantly - - Bugfixes: - startpath file explorer @@ -38,7 +32,3 @@ Tap support: - implement arp, possible the most difficult task ... - need to chose right mac of receiver -Requested by users: -auth -mtu-link - -- cgit v1.2.3 From b5d6a0975af0bb6c7607846b72b5c1a574e373ee Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Mon, 18 Jun 2012 23:37:33 +0200 Subject: A requrested feature. How to start a VPN from an external app. --- README.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.txt b/README.txt index c21409b7..54eab980 100644 --- a/README.txt +++ b/README.txt @@ -12,3 +12,23 @@ Do ndk-build in the root directory of the project. Use eclipse with android plugins to build the project. Optional: Copy minivpn from lib/ to assets (if you want your own compiled version) + + + + +Starting a VPN by name from an external app: + +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); + } +} \ No newline at end of file -- cgit v1.2.3 From e8ea1db33db4fb9b4ef360125d2ec95071cd6424 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Tue, 19 Jun 2012 09:52:31 +0200 Subject: Spelling fixes by Lodewijk Voege Thank you very much! Closes issue #39 --- res/values/strings.xml | 58 +++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index f7c9817f..32e2a2ae 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -50,7 +50,7 @@ LZO OpenSSL About - About Openvpn for Android + About OpenVPN for Android List of all configured VPNs All your precious VPNs Type @@ -64,7 +64,7 @@ Enter IPv4 Address/Netmask in CIDR Format (e.g. 1.2.3.4/24) IPv4 Address IPv6 Address - Enter custom OpenVPN options. Use with great care. Also note that many of the tun related Openvpn settings cannot be supported by design of the VPNSettings. If you think an important option is missing contact the author + Enter custom OpenVPN options. Use with great care. Also note that many of the tun related OpenVPN settings cannot be supported by design of the VPNSettings. If you think an important option is missing contact the author Username Password For the static configuration the TLS Auth Keys will be used as static keys. @@ -83,7 +83,7 @@ Connect to VPN Profile specified in shortcut not found Random Host Prefix - adds 6 random chars in front of hostname + Adds 6 random chars in front of hostname Enable Custom Options Specify custom options. Use with care! Route rejected by Android @@ -94,9 +94,9 @@ Remove VPN Checks whether the server uses a TLS Server Certificate Except TLS Server - Checks the Remote Server Certificate CN against a String + Checks the Remote Server Certificate CN against a string Certificate Hostname Check - Enter the string against which the remote Server is checked. Openvpn will use prefix matching. "Server" matches "Server-1" and "Server-2"\nLeave empty to check the CN against the server hostname. + Enter the string against which the remote Server is checked. OpenVPN will use prefix matching. "Server" matches "Server-1" and "Server-2"\nLeave empty to check the CN against the server hostname. Remote Hostname(CN) Enables the TLS Key Authentication TLS Auth File @@ -123,56 +123,56 @@ Custom Options Edit VPN Settings Remove the VPN Profile %s? - On some custom ICS images the permission on /dev/tun might be wrong, or the tun module might be missing completly. For CM9 images try the fix ownership option under general settings" + On some custom ICS images the permission on /dev/tun might be wrong, or the tun module might be missing completely. For CM9 images try the fix ownership option under general settings" Opening tun interface failed badly. "Error: " Clear info Show connection details - Last interface configuration from Openvpn: + Last interface configuration from OpenVPN: Local IPv4: %1$s/%2$d IPv6: %3$s MTU: %4$d DNS Server: %s DNS Domain: %s Routes: %s - Routes Ipv6: %s - Got interface information %1$s and %2$s, assuming second address is peer address of remote. Using /32 netmask for local IP. Mode given by openvpn is \"%3$s\". + Routes IPv6: %s + Got interface information %1$s and %2$s, assuming second address is peer address of remote. Using /32 netmask for local IP. Mode given by OpenVPN is \"%3$s\". Cannot make sense of %1$s and %2$s as IP route with CIDR netmask, using /32 as netmask. Corrected route %1$s/%2$s to %3$s/%2$s - Cannot accces the Android Keychain Certificates. If you restored a backup of the app/app settings reselect the certificate to recreate the permission to access the certificate. + Cannot access the Android Keychain Certificates. If you restored a backup of the app/app settings re-select the certificate to recreate the permission to access the certificate. %1$s %2$s - Send Logfile + Send log file Send - ICS Openvpn log file + ICS OpenVPN log file Copied log entry to clip board Tap Mode Tap Mode is not possible with the non root VPN API. Therefore this application cannot provide tap support - Again? Are you kidding? No tap mode is really not supported and sending more mail aksing if it will be supported will not help. + Again? Are you kidding? No tap mode is really not supported and sending more mail asking if it will be supported will not help. A third time? Actually one could write a a tap emulator based on tun that would add layer2 information on send and strip layer2 information on receive. But this tap emulator would have to implement also ARP and possible a DHCP client. I am not aware of anybody doing any work in this direction. Contact me if you want to start coding on this. FAQ - frequently asked questions and some adivce + Frequently asked questions and some advice Copying log entries - To copy a single log entry press and and hold on the log entry. To copy/send the whole log use the Send Log option. Use the hardware menu button if not visible in the gui. + To copy a single log entry press and and hold on the log entry. To copy/send the whole log use the Send Log option. Use the hardware menu button if not visible in the GUI. Shortcut to start You can place a shortcut to start OpenVPN on your desktop. Depending on your homescreen program you have to add a shortcut or a widget. Your image does not support the VPNService API,sorry :( Encryption - Enter Encryption method - Enter the cipher key for openvpn. Leave empty to use default cipher + Enter encryption method + Enter the cipher key for OpenVPN. Leave empty to use default cipher Authentication/Encryption File Explorer Inline File Import Error importing File - Could not import File from Filesystem + Could not import File from filesystem [[Inline file data]] Refusing to open tun device without IP information Import Profile from ovpn file Import Could not read Profile to import - Error reading Config file + Error reading config file add Profile Trying to read file: %1$s - Could not find file %1$s mentioned in the imported Config file + Could not find file %1$s mentioned in the imported config file Importing config file from source %1$s Your config file specified a pkcs12 file. Please import the file by selecting select in the Basic Settings configuration of the converted VPN Your configuration had a few configuration options that could be parsed. These options were added as custom configuration options. The custom configuration is displayed below: @@ -182,17 +182,17 @@ Please not that the config importer is an experimental feature. If it does not work for you or you think that things could be done better please drop me a email. Import configuration file Security considerations - "As openvpn is security sensitive a few notes about security are sensible. All data on the sdcard is inherently unsecure. Every app can read it (for example this program requires no special sd card rights). The data of this application can only be read by the application itself. By using the import option for cacert/cert/key in the file dialog the data is stored in the vpn profile. The vpn profiles are only accessable by this application. (Do not forget to delete the copies on the sd card afterwards). Even though accessible only by this application the data is stil unecrypted. By rooting the telephone or other exploits it may be possible to retrieve the data. Saved passwords are stored in plain text as well. For pkcs12 files it is highly recommended that you import them into the android keystore." + "As OpenVPN is security sensitive a few notes about security are sensible. All data on the sdcard is inherently insecure. Every app can read it (for example this program requires no special sd card rights). The data of this application can only be read by the application itself. By using the import option for cacert/cert/key in the file dialog the data is stored in the VPN profile. The VPN profiles are only accessible by this application. (Do not forget to delete the copies on the sd card afterwards). Even though accessible only by this application the data is still unencrypted. By rooting the telephone or other exploits it may be possible to retrieve the data. Saved passwords are stored in plain text as well. For pkcs12 files it is highly recommended that you import them into the android keystore." Import Error showing certificate selection - Got an excption trying to show the Android 4.0+ certificate selction dialog. This should never happens as this a standard feature of Android 4.0+. Maybe your Android ROM support for certificate storage is broken + Got an exception trying to show the Android 4.0+ certificate selection dialog. This should never happen as this a standard feature of Android 4.0+. Maybe your Android ROM support for certificate storage is broken IPv4 IPv6 Waiting for state message… imported profile imported profile %d Broken Images - <p>Offical HTC images are known to have a strange routing problem causing traffic not to flow through the tunnel (See also <a href=\"http://code.google.com/p/ics-openvpn/issues/detail?id=18\">Issue 18</a> in the bug tracker.)</p><p>The offical SONY images from Xperia arc S and Xperia Ray have been reported to be missing the VPNService completly from the image. Other Sony images may be affected as well. (See also <a href=\"http://code.google.com/p/ics-openvpn/issues/detail?id=29\">Issue 29</a> in the bug tracker.)</p><p>On custom build images the tun module might be missing or the rights of /dev/tun might be wrong. Some CM9 images need the fix ownership option under general settings.</p><p>Most important: If you have a broken image, report it to your vendor. The more people report the issue to the vendor the more likely you will get a fix.</p> + <p>Official HTC images are known to have a strange routing problem causing traffic not to flow through the tunnel (See also <a href=\"http://code.google.com/p/ics-openvpn/issues/detail?id=18\">Issue 18</a> in the bug tracker.)</p><p>The official SONY images from Xperia arc S and Xperia Ray have been reported to be missing the VPNService completely from the image. Other Sony images may be affected as well. (See also <a href=\"http://code.google.com/p/ics-openvpn/issues/detail?id=29\">Issue 29</a> in the bug tracker.)</p><p>On custom build images the tun module might be missing or the rights of /dev/tun might be wrong. Some CM9 images need the fix ownership option under general settings.</p><p>Most important: If you have a broken image, report it to your vendor. The more people report the issue to the vendor the more likely you will get a fix.</p> The username must not be empty. PKCS12 File Encryption Key Private Key Password @@ -203,15 +203,15 @@ General Settings Tries to set the owner of /dev/tun to system. Some CM9 images need this to make the VPNService API work. Requires root. Fix ownership of /dev/tun - Shows the generated openvpn Configuration File + Shows the generated OpenVPN Configuration File Editing \"%s\" - Building configration… - Turning this option on will force a reconnet if the network state is change (WIFI to/from mobile) - Reconnect on Network change + Building configuration… + Turning this option on will force a reconnect if the network state is change (WIFI to/from mobile) + Reconnect on network change Got certificate \'%s\' from Keystore Network Status: %s - The CA cert is usually returned from the Android Keystore. Specify a seperate certificate if you get certificate verification errors. + The CA cert is usually returned from the Android Keystore. Specify a separate certificate if you get certificate verification errors. Select - No CA Certificate returned while reading from Android keystore. Auhtentication will probably fail. + No CA Certificate returned while reading from Android keystore. Authentication will probably fail. -- cgit v1.2.3 From e9b93deeff850a113870e1b27bde251d266b9d7c Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Wed, 20 Jun 2012 22:27:31 +0200 Subject: Make important message have a ticker message, fix status line in log window --- src/de/blinkt/openvpn/LogWindow.java | 5 ++++- src/de/blinkt/openvpn/OpenVpnService.java | 10 +++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/de/blinkt/openvpn/LogWindow.java b/src/de/blinkt/openvpn/LogWindow.java index 8fadf3ad..ae5277cd 100644 --- a/src/de/blinkt/openvpn/LogWindow.java +++ b/src/de/blinkt/openvpn/LogWindow.java @@ -276,7 +276,10 @@ public class LogWindow extends ListActivity implements StateListener { @Override public void run() { - mSpeedView.setText(status + " " + logmessage); + String prefix=status+ ":"; + if (status.equals("BYTECOUNT") || status.equals("NOPROCESS") ) + prefix=""; + mSpeedView.setText(prefix + logmessage); } }); diff --git a/src/de/blinkt/openvpn/OpenVpnService.java b/src/de/blinkt/openvpn/OpenVpnService.java index a0d7503d..fd0b4f2a 100644 --- a/src/de/blinkt/openvpn/OpenVpnService.java +++ b/src/de/blinkt/openvpn/OpenVpnService.java @@ -76,7 +76,7 @@ public class OpenVpnService extends VpnService implements StateListener { mNotificationManager.cancel(OPENVPN_STATUS); } - private void showNotification(String msg) { + private void showNotification(String msg, String tickerText) { String ns = Context.NOTIFICATION_SERVICE; NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns); @@ -93,6 +93,9 @@ public class OpenVpnService extends VpnService implements StateListener { nbuilder.setContentIntent(getLogPendingIntent()); nbuilder.setSmallIcon(icon); nbuilder.setWhen(when); + + if(tickerText!=null) + nbuilder.setTicker(tickerText); mNotification = nbuilder.getNotification(); @@ -395,11 +398,12 @@ public class OpenVpnService extends VpnService implements StateListener { if("BYTECOUNT".equals(state)) { if(mDisplayBytecount) { - showNotification(logmessage); + showNotification(logmessage,null); } } else { // Other notifications are shown - showNotification(state +" " + logmessage); + String ticker = state.toLowerCase(); + showNotification(state +" " + logmessage,ticker); } } -- cgit v1.2.3