Commit 66c79953 authored by Parménides GV's avatar Parménides GV

Merge branch 'develop'

parents 1f41fec6 e533cf69

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
......@@ -58,7 +58,6 @@ openvpn/libtool
openvpn/stamp-h1
openvpn/version.sh
t_client.sh
ics-openvpn.zip
zh-CN.zip
zh-TW.zip
google-breakpad/
......@@ -76,8 +75,6 @@ build
.gradle
jniLibs
*.dot
/ics-openvpn/
/TAGS
/ics-openvpn
/ics-openvpn-stripped
app/ovpnlibs
[submodule "ics-openvpn"]
path = ics-openvpn
branch = bitmask
url = git@github.com:parmegv/ics-openvpn.git
0.9.4 June 16th, 2015 - the "fabbutton" release
Bugs:
- Show the log window only when a real error happened, since some
users weren't able to know why Bitmask had failed and they didn't
think of opening the log by themselves.
- Aborting the establishment of a new VPN connection didn't work
properly, and some users were confused because they wanted to cancel
the start and Bitmask didn't do it, although the UI stated the
opposite. That has been improved, detecting the real status of the
VPN connection much better.
- If the user doesn't "trust this application", bitmask doesn't try to
connect to the VPN anymore.
Features:
- Removed the progress bars that caused confusion in some states (such
as "Waiting for connectivity")
- Removed the switch button that was not clear enough (some users
experimented problems with it during connections, staying "on" while
the VPN was "off", and put an icon with a progress indicator around
it.
- Code tests to avoid this bugs are revived, since some problems the
users were experiencing had already been fixed in the early days of
the project.
- Optimized the layout to various devices, so that UI remains
consistent across sizes, screen resolutions...
- Localized the app to Spanish, and simplified the login/logout
feedback so that localization can be polished.
- Improved wording, both in Spanish and in English.
- Updated gradle libraries
- Updated ics-openvpn (thanks Arne), from GitHub!
0.9.3
Bugs:
- If VPN connection fails, blocking VPN is turned off
......
{
"main_url" : "https://demo.bitmask.net/"
"main_url" : "https://demo.bitmask.net/",
"ca_cert_fingerprint" : "c3f9f39af6d42d1f201195dec918ac7603597049"
}
{
"main_url" : "https://calyx.net/"
"main_url" : "https://calyx.net/",
"ca_cert_fingerprint" : "98086aee17b5800acd0bdefe852e7c1ae72bd248"
}
{
"main_url" : "https://riseup.net/"
"main_url" : "https://riseup.net/",
"ca_cert_fingerprint" : "aef7a642d7f8e046770521b354961a95cd4a76a8"
}
apply plugin: 'android'
//import org.ajoberstar.grgit.*
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
buildToolsVersion "22.0.1"
signingConfigs {
release {
......@@ -14,6 +13,15 @@ android {
}
}
productFlavors {
production {
}
insecure {
}
}
buildTypes {
release {
//runProguard true
......@@ -22,9 +30,9 @@ android {
}
}
lintOptions {
abortOnError false
}
lintOptions {
abortOnError false
}
sourceSets {
main {
......@@ -39,12 +47,14 @@ android {
}
dependencies {
androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.3.1'
compile 'com.jakewharton:butterknife:6.0.0+'
provided 'com.squareup.dagger:dagger-compiler:1.2.2+'
compile 'com.github.pedrovgs:renderers:1.3+'
androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.4.1'
compile 'com.jakewharton:butterknife:6.1.0'
provided 'com.squareup.dagger:dagger-compiler:1.2.2'
compile 'com.github.pedrovgs:renderers:1.5'
compile 'com.intellij:annotations:12.0'
compile 'com.google.code.gson:gson:2+'
compile 'com.google.code.gson:gson:2.3.1'
compile 'org.thoughtcrime.ssl.pinning:AndroidPinning:1.0.0'
compile 'mbanje.kurt:fabbutton:1.1.4'
}
def processFileInplace(file, Closure processText) {
......@@ -52,20 +62,25 @@ def processFileInplace(file, Closure processText) {
file.write(processText(text))
}
task checkoutStrippedIcsOpenVPN ( type: Copy ) {
println "checkoutStrippedIcsOpenVPN"
//FIXME Checkout ics-openvpn-stripped from branch "ics-openvpn-upstream"
//grgit = Grgit.open(project.file('../'))
from '../../bitmask_android_tmp/ics-openvpn-stripped'
into '../ics-openvpn-stripped'
}
task copyIcsOpenVPNClasses( type: Copy ) {
println "copyIcsOpenVPNClasses"
from ('../ics-openvpn-stripped/main/') {
include '**/*.java'
from ('../ics-openvpn/main/') {
include '**/LaunchVPN.java'
include '**/OpenVPNSservice.java'
include '**/VpnProfile.java'
include '**/DisconnectVPN.java'
include '**/VpnProfile.java'
include '**/LogWindow.java'
include '**/LogFragment.java'
include '**/SeekBarTicks.java'
include '**/log_window.xml'
include '**/log_fragment.xml'
include '**/log_silders.xml'
include '**/vpnstatus.xml'
include '**/styles.xml'
include '**/dimens.xml'
include '**/logmenu.xml'
include '**/core/**.java'
includeEmptyDirs = false
......@@ -83,7 +98,7 @@ task copyIcsOpenVPNClasses( type: Copy ) {
task copyIcsOpenVPNXml( type: Copy ) {
println "copyIcsOpenVPNXml"
from ('../ics-openvpn-stripped/main/') {
from ('../ics-openvpn/main/') {
include '**/strings.xml'
include '**/log_*.xml'
include '**/vpnstatus.xml'
......@@ -104,7 +119,7 @@ task copyIcsOpenVPNXml( type: Copy ) {
task copyIcsOpenVPNImages( type: Copy ) {
println "copyIcsOpenVPNImages"
from ('../ics-openvpn-stripped/main/') {
from ('../ics-openvpn/main/') {
include '**/ic_filter*.png'
include '**/ic_delete*.png'
include '**/ic_share*.png'
......@@ -116,15 +131,8 @@ task copyIcsOpenVPNImages( type: Copy ) {
} into '.'
}
task copyIcsOpenVPNFiles( type: Copy, dependsOn: 'checkoutStrippedIcsOpenVPN' ) {
println "copyIcsOpenVPNFiles"
copyIcsOpenVPNClasses.execute()
copyIcsOpenVPNXml.execute()
copyIcsOpenVPNImages.execute()
}
// thanks to http://pleac.sourceforge.net/pleac_groovy/fileaccess.html
task removeDuplicatedStrings( dependsOn: 'copyIcsOpenVPNFiles' ) {
task removeDuplicatedStrings() {
println "removeDuplicatedStrings"
new File('.').eachFileRecurse {
if(it.name.equals('strings.xml')) {
......@@ -143,9 +151,9 @@ task removeDuplicatedStrings( dependsOn: 'copyIcsOpenVPNFiles' ) {
}
}
task mergeUntranslatable( type: Copy, dependsOn: 'removeDuplicatedStrings') {
task mergeUntranslatable( type: Copy ) {
println "mergeUntranslatable"
from ('../ics-openvpn-stripped/main/') {
from ('../ics-openvpn/main/') {
include '**/untranslatable.xml'
rename 'untranslatable.xml', 'untranslatable-icsopenvpn.xml'
} into '.'
......@@ -176,17 +184,18 @@ task mergeUntranslatable( type: Copy, dependsOn: 'removeDuplicatedStrings') {
delete ics_openvpn_untranslatable
}
task updateIcsOpenVpn( type: Copy, dependsOn: 'mergeUntranslatable') {
from('../ics-openvpn-stripped/') {
include 'openvpn/**/*'
include 'openssl/**/*'
include 'lzo/**/**'
include 'jni/**/*'
include 'misc/**/*'
include 'ovpn3/**/*'
include 'snappy/**/*'
} into './'
task copyIcsOpenVPNFiles( type: Copy ) {
println "copyIcsOpenVPNFiles"
copyIcsOpenVPNClasses.execute()
copyIcsOpenVPNXml.execute()
copyIcsOpenVPNImages.execute()
//mergeUntranslatable.execute()
removeDuplicatedStrings.execute()
}
task updateIcsOpenVpn( type: Exec ) {
commandLine 'git', 'submodule', 'update', '--init', '--recursive'
copyIcsOpenVPNFiles.execute()
}
task buildNative ( type: Exec ) {
......
../ics-openvpn/main/jni
\ No newline at end of file
# Path of the sources
JNI_DIR := $(call my-dir)
#optional arguments
#WITH_POLAR=1
#WITH_OPENVPN3=1
# Build openvpn with polar (OpenVPN3 core is always build with polar)
#WITH_BREAKPAD=0
include lzo/Android.mk
include snappy/Android.mk
include openssl/Android.mk
ifeq ($(TARGET_ARCH),mips)
USE_BREAKPAD=0
endif
ifeq ($(TARGET_ARCH),mips64)
USE_BREAKPAD=0
endif
ifneq ($(USE_BREAKPAD),0)
WITH_BREAKPAD=1
include google-breakpad/android/google_breakpad/Android.mk
else
WITH_BREAKPAD=0
endif
ifeq ($(WITH_POLAR),1)
USE_POLAR=1
endif
ifeq ($(WITH_OPENVPN3),1)
USE_POLAR=1
endif
ifeq ($(USE_POLAR),1)
include polarssl/Android.mk
endif
include openvpn/Android.mk
ifeq ($(WITH_OPENVPN3),1)
include ovpn3/Android.mk
endif
LOCAL_PATH := $(JNI_DIR)
# The only real JNI library
include $(CLEAR_VARS)
LOCAL_LDLIBS := -llog -lz
LOCAL_CFLAGS = --std=c99
LOCAL_C_INCLUDES := openssl/include openssl/crypto openssl
LOCAL_SRC_FILES:= jniglue.c jbcrypto.cpp scan_ifs.c
LOCAL_MODULE = opvpnutil
LOCAL_SHARED_LIBRARIES := libcrypto
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_LDLIBS := -lz -lc
LOCAL_SHARED_LIBRARIES := libssl libcrypto openvpn
LOCAL_SRC_FILES:= minivpn.c dummy.cpp
LOCAL_MODULE = nopievpn
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_LDLIBS := -lz -lc
LOCAL_CFLAGS= -fPIE -pie
LOCAL_CFLAGS = -fPIE
LOCAL_LDFLAGS = -fPIE -pie
LOCAL_SHARED_LIBRARIES := libssl libcrypto openvpn
LOCAL_SRC_FILES:= minivpn.c dummy.cpp
LOCAL_MODULE = pievpn
include $(BUILD_EXECUTABLE)
APP_ABI := arm64-v8a armeabi armeabi-v7a mips x86 x86_64
APP_PLATFORM := android-14
APP_STL:=stlport_shared
#APP_STL:=gnustl_shared
#APP_OPTIM := release
#LOCAL_ARM_MODE := arm
#NDK_TOOLCHAIN_VERSION=clang
\ No newline at end of file
/*#include <string>
#include <iostream>
void dummy()
{
std::cout << "I am a dummy function to help compile on Android NDK r9" << std::endl;
}
*/
//
// JBCyrpto.cpp
// xcopenvpn
//
// Created by Arne Schwabe on 12.07.12.
// Copyright (c) 2012 Universität Paderborn. All rights reserved.
//
#include <jni.h>
#include <openssl/ssl.h>
#include <openssl/rsa.h>
#include <openssl/objects.h>
#include <openssl/md5.h>
#include <android/log.h>
#include <openssl/err.h>
extern "C" {
jbyteArray Java_de_blinkt_openvpn_core_NativeUtils_rsasign(JNIEnv* env, jclass, jbyteArray from, jint pkeyRef);
}
int jniThrowException(JNIEnv* env, const char* className, const char* msg) {
jclass exceptionClass = env->FindClass(className);
if (exceptionClass == NULL) {
__android_log_print(ANDROID_LOG_DEBUG,"openvpn","Unable to find exception class %s", className);
/* ClassNotFoundException now pending */
return -1;
}
if (env->ThrowNew( exceptionClass, msg) != JNI_OK) {
__android_log_print(ANDROID_LOG_DEBUG,"openvpn","Failed throwing '%s' '%s'", className, msg);
/* an exception, most likely OOM, will now be pending */
return -1;
}
env->DeleteLocalRef(exceptionClass);
return 0;
}
static char opensslerr[1024];
jbyteArray Java_de_blinkt_openvpn_core_NativeUtils_rsasign (JNIEnv* env, jclass, jbyteArray from, jint pkeyRef) {
// EVP_MD_CTX* ctx = reinterpret_cast<EVP_MD_CTX*>(ctxRef);
EVP_PKEY* pkey = reinterpret_cast<EVP_PKEY*>(pkeyRef);
if (pkey == NULL || from == NULL) {
jniThrowException(env, "java/lang/NullPointerException", "EVP_KEY is null");
return NULL;
}
jbyte* data = env-> GetByteArrayElements (from, NULL);
int datalen = env-> GetArrayLength(from);
if(data==NULL )
jniThrowException(env, "java/lang/NullPointerException", "data is null");
int siglen;
unsigned char* sigret = (unsigned char*)malloc(RSA_size(pkey->pkey.rsa));
//int RSA_sign(int type, const unsigned char *m, unsigned int m_len,
// unsigned char *sigret, unsigned int *siglen, RSA *rsa);
// adapted from s3_clnt.c
/* if (RSA_sign(NID_md5_sha1, (unsigned char*) data, datalen,
sigret, &siglen, pkey->pkey.rsa) <= 0 ) */
siglen = RSA_private_encrypt(datalen,(unsigned char*) data,sigret,pkey->pkey.rsa,RSA_PKCS1_PADDING);
if (siglen < 0)
{
ERR_error_string_n(ERR_get_error(), opensslerr ,1024);
jniThrowException(env, "java/security/InvalidKeyException", opensslerr);
ERR_print_errors_fp(stderr);
return NULL;
}
jbyteArray jb;
jb =env->NewByteArray(siglen);
env->SetByteArrayRegion(jb, 0, siglen, (jbyte *) sigret);
free(sigret);
return jb;
}
#include <jni.h>
#include <android/log.h>
#include <stdlib.h>
#include <unistd.h>
#include "jniglue.h"
jint JNI_OnLoad(JavaVM *vm, void *reserved) {
#ifndef NDEBUG
__android_log_write(ANDROID_LOG_DEBUG,"openvpn", "Loading openvpn native library $id$ compiled on " __DATE__ " " __TIME__ );
#endif
return JNI_VERSION_1_2;
}
void android_openvpn_log(int level,const char* prefix,const char* prefix_sep,const char* m1)
{
__android_log_print(ANDROID_LOG_DEBUG,"openvpn","%s%s%s",prefix,prefix_sep,m1);
}
void Java_de_blinkt_openvpn_core_NativeUtils_jniclose(JNIEnv *env,jclass jo, jint fd) {
int ret = close(fd);
}
//
// jniglue.h
// xcopenvpn
//
// Created by Arne Schwabe on 29.03.12.
// Copyright (c) 2012 Universität Paderborn. All rights reserved.
//
#ifndef xcopenvpn_jniglue_h
#define xcopenvpn_jniglue_h
void android_openvpn_log(int level,const char* prefix,const char* prefix_sep,const char* m1);
#endif
#ifdef __cplusplus
extern "C" {
#endif
int jniThrowException(JNIEnv* env, const char* className, const char* msg);
#ifdef __cplusplus
}
#endif
#include <jni.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
#include <linux/if.h>
#include <android/log.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include "jniglue.h"
jobjectArray Java_de_blinkt_openvpn_core_NativeUtils_getIfconfig(JNIEnv* env)
{
int sd;
if ((sd = socket (AF_INET, SOCK_DGRAM, 0)) < 0) {
__android_log_print(ANDROID_LOG_DEBUG, "openvpn", "Opening socket for intface get failed");
//jniThrowException(env, "java/lang/IllegalArgumentException", "Opening socket for intface get failed");
return NULL;
}
struct ifreq ifs[23];
struct ifconf ifc;
ifc.ifc_req = ifs;
ifc.ifc_len = sizeof (ifs);
if (ioctl (sd, SIOCGIFCONF, &ifc) < 0) {
__android_log_print(ANDROID_LOG_DEBUG, "openvpn", "IOCTL for intface get failed");
//jniThrowException(env, "java/lang/IllegalArgumentException", "IOTCL socket for intface get failed");
return NULL;
}
char buf[NI_MAXHOST];
int ji=0;
/*
jtmp = (*env)->NewStringUTF(env, "HALLO WELT");
(*env)->SetObjectArrayElement(env, ret, ji++, jtmp);
*/
size_t num_intf=ifc.ifc_len / sizeof(struct ifreq);
jobjectArray ret= (jobjectArray) (*env)->NewObjectArray(env, num_intf*3,(*env)->FindClass(env, "java/lang/String"), NULL);
for (struct ifreq* ifr = ifc.ifc_req; ifr < ifs + num_intf; ifr++) {
if (ifr->ifr_addr.sa_family != AF_INET) {
__android_log_print(ANDROID_LOG_DEBUG, "openvpn", "NOT AF_INET: %s", ifr->ifr_name);
continue;
}
/* get interface addr, prefilled by SIOGIFCONF */
int err;
if (err=getnameinfo(&ifr->ifr_addr, sizeof(struct sockaddr_in), buf, NI_MAXHOST, NULL, 0,
NI_NUMERICHOST) !=0) {
__android_log_print(ANDROID_LOG_DEBUG, "openvpn", "getnameinfo failed for %s: %s", ifr->ifr_name, gai_strerror(err));
continue;
}
jstring jaddr = (*env)->NewStringUTF(env, buf);
jstring jname = (*env)->NewStringUTF(env, ifr->ifr_name);
struct ifreq ifreq;
strncpy (ifreq.ifr_name, ifr->ifr_name, sizeof (ifreq.ifr_name));
/* interface is up */
if (ioctl (sd, SIOCGIFFLAGS, &ifreq) < 0) {
__android_log_print(ANDROID_LOG_DEBUG, "openvpn", "SIOCGIFFLAGS failed for %s: %s", ifr->ifr_name, strerror(errno));
continue;
}
if (!(ifreq.ifr_flags & IFF_UP)) {
__android_log_print(ANDROID_LOG_DEBUG, "openvpn", "IFF_UP failed for %s", ifr->ifr_name);
continue;
}
/* interface netmask */
if (ioctl (sd, SIOCGIFNETMASK, &ifreq) < 0) {
__android_log_print(ANDROID_LOG_DEBUG, "openvpn", "SIOCIFNETMASK failed for %s: %s", ifr->ifr_name, strerror(errno));
continue;
}
if (err=getnameinfo(&ifreq.ifr_netmask, sizeof(struct sockaddr_in), buf, NI_MAXHOST, NULL, 0,
NI_NUMERICHOST) !=0) {
__android_log_print(ANDROID_LOG_DEBUG, "openvpn", "getnameinfo failed for %s: %s", ifr->ifr_name, gai_strerror(err));
continue;
}
jstring jnetmask = (*env)->NewStringUTF(env, buf);
(*env)->SetObjectArrayElement(env, ret, ji++, jname);
(*env)->SetObjectArrayElement(env, ret, ji++, jaddr);
(*env)->SetObjectArrayElement(env, ret, ji++, jnetmask);
}
if (sd >= 0)
close (sd);
return ret;
}
../ics-openvpn/main/lzo
\ No newline at end of file