]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
android: Make sending certificate requests configurable in the GUI
authorTobias Brunner <tobias@strongswan.org>
Thu, 29 Jun 2017 12:52:28 +0000 (14:52 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 3 Jul 2017 08:37:09 +0000 (10:37 +0200)
src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnProfileDetailActivity.java
src/frontends/android/app/src/main/res/layout/profile_detail_view.xml
src/frontends/android/app/src/main/res/values-de/strings.xml
src/frontends/android/app/src/main/res/values-pl/strings.xml
src/frontends/android/app/src/main/res/values-ru/strings.xml
src/frontends/android/app/src/main/res/values-ua/strings.xml
src/frontends/android/app/src/main/res/values-zh-rCN/strings.xml
src/frontends/android/app/src/main/res/values-zh-rTW/strings.xml
src/frontends/android/app/src/main/res/values/strings.xml

index 1b1494be8f0cf856fd426dd93dd4fb84a6a12d56..8bf5fd2b211804d23d054178f2bbd24029775da7 100644 (file)
@@ -53,6 +53,7 @@ import android.widget.EditText;
 import android.widget.MultiAutoCompleteTextView;
 import android.widget.RelativeLayout;
 import android.widget.Spinner;
+import android.widget.Switch;
 import android.widget.TextView;
 
 import org.strongswan.android.R;
@@ -113,6 +114,7 @@ public class VpnProfileDetailActivity extends AppCompatActivity
        private TextInputLayoutHelper mMTUWrap;
        private EditText mPort;
        private TextInputLayoutHelper mPortWrap;
+       private Switch mCertReq;
        private EditText mNATKeepalive;
        private TextInputLayoutHelper mNATKeepaliveWrap;
        private EditText mIncludedSubnets;
@@ -167,6 +169,7 @@ public class VpnProfileDetailActivity extends AppCompatActivity
                mPortWrap = (TextInputLayoutHelper) findViewById(R.id.port_wrap);
                mNATKeepalive = (EditText)findViewById(R.id.nat_keepalive);
                mNATKeepaliveWrap = (TextInputLayoutHelper) findViewById(R.id.nat_keepalive_wrap);
+               mCertReq = (Switch)findViewById(R.id.cert_req);
                mIncludedSubnets = (EditText)findViewById(R.id.included_subnets);
                mIncludedSubnetsWrap = (TextInputLayoutHelper)findViewById(R.id.included_subnets_wrap);
                mExcludedSubnets = (EditText)findViewById(R.id.excluded_subnets);
@@ -530,9 +533,10 @@ public class VpnProfileDetailActivity extends AppCompatActivity
                boolean show = mShowAdvanced.isChecked();
                if (!show && mProfile != null)
                {
-                       Integer st = mProfile.getSplitTunneling();
+                       Integer st = mProfile.getSplitTunneling(), flags = mProfile.getFlags();
                        show = mProfile.getRemoteId() != null || mProfile.getMTU() != null ||
-                                  mProfile.getPort() != null || mProfile.getNATKeepAlive() != null || (st != null && st != 0) ||
+                                  mProfile.getPort() != null || mProfile.getNATKeepAlive() != null ||
+                                  (flags != null && flags != 0) || (st != null && st != 0) ||
                                   mProfile.getIncludedSubnets() != null || mProfile.getExcludedSubnets() != null ||
                                   mProfile.getSelectedAppsHandling() != SelectedAppsHandling.SELECTED_APPS_DISABLE;
                }
@@ -661,6 +665,9 @@ public class VpnProfileDetailActivity extends AppCompatActivity
                mProfile.setMTU(getInteger(mMTU));
                mProfile.setPort(getInteger(mPort));
                mProfile.setNATKeepAlive(getInteger(mNATKeepalive));
+               int flags = 0;
+               flags |= !mCertReq.isChecked() ? VpnProfile.FLAGS_SUPPRESS_CERT_REQS : 0;
+               mProfile.setFlags(flags);
                String included = mIncludedSubnets.getText().toString().trim();
                mProfile.setIncludedSubnets(included.isEmpty() ? null : included);
                String excluded = mExcludedSubnets.getText().toString().trim();
@@ -681,6 +688,7 @@ public class VpnProfileDetailActivity extends AppCompatActivity
        private void loadProfileData(Bundle savedInstanceState)
        {
                String useralias = null, local_id = null, alias = null;
+               Integer flags = null;
 
                getSupportActionBar().setTitle(R.string.add_profile);
                if (mId != null && mId != 0)
@@ -703,6 +711,7 @@ public class VpnProfileDetailActivity extends AppCompatActivity
                                mBlockIPv6.setChecked(mProfile.getSplitTunneling() != null && (mProfile.getSplitTunneling() & VpnProfile.SPLIT_TUNNELING_BLOCK_IPV6) != 0);
                                mSelectedAppsHandling = mProfile.getSelectedAppsHandling();
                                mSelectedApps = mProfile.getSelectedAppsSet();
+                               flags = mProfile.getFlags();
                                useralias = mProfile.getUserCertificateAlias();
                                local_id = mProfile.getLocalId();
                                alias = mProfile.getCertificateAlias();
@@ -717,6 +726,7 @@ public class VpnProfileDetailActivity extends AppCompatActivity
                }
 
                mSelectVpnType.setSelection(mVpnType.ordinal());
+               mCertReq.setChecked(flags == null || (flags & VpnProfile.FLAGS_SUPPRESS_CERT_REQS) == 0);
 
                /* check if the user selected a user certificate previously */
                useralias = savedInstanceState == null ? useralias : savedInstanceState.getString(VpnProfileDataSource.KEY_USER_CERTIFICATE);
index 472efbc83a347f4cff132f47127aa17f0fbe2aa1..199a7dfeeb33f5f9206080a33a4c80ceef2ccaa9 100644 (file)
 
             </org.strongswan.android.ui.widget.TextInputLayoutHelper>
 
+            <Switch
+                android:id="@+id/cert_req"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="4dp"
+                android:layout_marginStart="4dp"
+                android:text="@string/profile_cert_req_label" />
+
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginBottom="10dp"
+                android:layout_marginLeft="4dp"
+                android:layout_marginStart="4dp"
+                android:textSize="12sp"
+                android:text="@string/profile_cert_req_hint" />
+
             <TextView
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
index c7c4160f225c122ffb674fa88bf7fe81ed113783..34fe846099d1301679707a5b28221512ea612e9e 100644 (file)
@@ -81,6 +81,8 @@
     <string name="profile_port_hint">UDP-Port zu dem verbunden wird, falls dieser vom Standard-Port abweicht</string>
     <string name="profile_nat_keepalive_label">NAT-T Keepalive Intervall</string>
     <string name="profile_nat_keepalive_hint">Kleine Pakete werden gesendet, um Mappings auf NAT-Routern am Leben zu erhalten, wenn sonst nichts gesendet wird. Um Energie zu sparen, ist das Standardintervall auf 45 Sekunden gesetzt. Hinter NAT-Routern die Mappings früh entfernen, ist dies möglicherweise zu hoch. 20 Sekunden oder weniger können in diesem Fall helfen.</string>
+    <string name="profile_cert_req_label">Zertifikatsanforderungen senden</string>
+    <string name="profile_cert_req_hint">Zertifikatsanforderungen werden für alle oder ausgewählte CA-Zertifikate gesendet. Um die Grösse der IKE_AUTH Nachricht zu reduzieren, kann dies deaktiviert werden. Allerdings funktioniert dies nur, falls der Server sein Zertifikat auch sendet, wenn er zuvor keine Zertifikatsanforderungen erhalten hat.</string>
     <string name="profile_split_tunneling_label">Split-Tunneling</string>
     <string name="profile_split_tunneling_intro">Standardmässig leitet der Client allen Netzwerkverkehr durch den VPN Tunnel, ausser der Server schränkt die Subnetze beim Verbindungsaufbau ein, in welchem Fall nur der Verkehr via VPN geleitet wird, den der Server erlaubt (der Rest wird standardmässig behandelt, als ob kein VPN vorhanden wäre).</string>
     <string name="profile_split_tunnelingv4_title">Blockiere IPv4 Verkehr der nicht für das VPN bestimmt ist</string>
index d551909945e4203d9b43d6f7a15cb4e21a963e77..a87381aa1e794bee3b12d3d0ed5021e05748a1ef 100644 (file)
@@ -81,6 +81,8 @@
     <string name="profile_port_hint">UDP port to connect to, if different from the default</string>
     <string name="profile_nat_keepalive_label">NAT-T keepalive interval</string>
     <string name="profile_nat_keepalive_hint">Small packets are sent to keep mappings on NAT routers alive if there is no other traffic. In order to save energy the default interval is 45 seconds. Behind NAT routers that remove mappings early this might be too high, try 20 seconds or less in that case.</string>
+    <string name="profile_cert_req_label">Send certificate requests</string>
+    <string name="profile_cert_req_hint">Certificate requests are sent for all available or selected CA certificates. To reduce the size of the IKE_AUTH message this can be disabled. However, this only works if the server sends its certificate even if it didn\'t receive any certificate requests.</string>
     <string name="profile_split_tunneling_label">Split tunneling</string>
     <string name="profile_split_tunneling_intro">By default, the client will route all network traffic through the VPN, unless the server narrows the subnets when the connection is established, in which case only traffic the server allows will be routed via VPN (by default, all other traffic is routed as if there was no VPN).</string>
     <string name="profile_split_tunnelingv4_title">Block IPv4 traffic not destined for the VPN</string>
index 666e5be0834a0661f3b6cc155450a841f6de9a1d..0ce54e56e2a0716d2314797a55eb47662a1be104 100644 (file)
@@ -78,6 +78,8 @@
     <string name="profile_port_hint">UDP port to connect to, if different from the default</string>
     <string name="profile_nat_keepalive_label">NAT-T keepalive interval</string>
     <string name="profile_nat_keepalive_hint">Small packets are sent to keep mappings on NAT routers alive if there is no other traffic. In order to save energy the default interval is 45 seconds. Behind NAT routers that remove mappings early this might be too high, try 20 seconds or less in that case.</string>
+    <string name="profile_cert_req_label">Send certificate requests</string>
+    <string name="profile_cert_req_hint">Certificate requests are sent for all available or selected CA certificates. To reduce the size of the IKE_AUTH message this can be disabled. However, this only works if the server sends its certificate even if it didn\'t receive any certificate requests.</string>
     <string name="profile_split_tunneling_label">Split tunneling</string>
     <string name="profile_split_tunneling_intro">By default, the client will route all network traffic through the VPN, unless the server narrows the subnets when the connection is established, in which case only traffic the server allows will be routed via VPN (by default, all other traffic is routed as if there was no VPN).</string>
     <string name="profile_split_tunnelingv4_title">Block IPv4 traffic not destined for the VPN</string>
index 2ba7ef86415402309edb88912089d11627081d90..5b769b787087a6b9921f49195fafdf889b5d14a9 100644 (file)
@@ -79,6 +79,8 @@
     <string name="profile_port_hint">UDP port to connect to, if different from the default</string>
     <string name="profile_nat_keepalive_label">NAT-T keepalive interval</string>
     <string name="profile_nat_keepalive_hint">Small packets are sent to keep mappings on NAT routers alive if there is no other traffic. In order to save energy the default interval is 45 seconds. Behind NAT routers that remove mappings early this might be too high, try 20 seconds or less in that case.</string>
+    <string name="profile_cert_req_label">Send certificate requests</string>
+    <string name="profile_cert_req_hint">Certificate requests are sent for all available or selected CA certificates. To reduce the size of the IKE_AUTH message this can be disabled. However, this only works if the server sends its certificate even if it didn\'t receive any certificate requests.</string>
     <string name="profile_split_tunneling_label">Split tunneling</string>
     <string name="profile_split_tunneling_intro">By default, the client will route all network traffic through the VPN, unless the server narrows the subnets when the connection is established, in which case only traffic the server allows will be routed via VPN (by default, all other traffic is routed as if there was no VPN).</string>
     <string name="profile_split_tunnelingv4_title">Block IPv4 traffic not destined for the VPN</string>
index b8fccadadfd68ee1bab83d4aeafae3f746284a6e..4202c5f846f1b633d7a5de4bb9636b5fcebfdb37 100644 (file)
@@ -78,6 +78,8 @@
     <string name="profile_port_hint">如不同于默认值,则所需连接的UDP端口</string>
     <string name="profile_nat_keepalive_label">NAT-T keepalive interval</string>
     <string name="profile_nat_keepalive_hint">Small packets are sent to keep mappings on NAT routers alive if there is no other traffic. In order to save energy the default interval is 45 seconds. Behind NAT routers that remove mappings early this might be too high, try 20 seconds or less in that case.</string>
+    <string name="profile_cert_req_label">Send certificate requests</string>
+    <string name="profile_cert_req_hint">Certificate requests are sent for all available or selected CA certificates. To reduce the size of the IKE_AUTH message this can be disabled. However, this only works if the server sends its certificate even if it didn\'t receive any certificate requests.</string>
     <string name="profile_split_tunneling_label">拆分隧道</string>
     <string name="profile_split_tunneling_intro">By default, the client will route all network traffic through the VPN, unless the server narrows the subnets when the connection is established, in which case only traffic the server allows will be routed via VPN (by default, all other traffic is routed as if there was no VPN).</string>
     <string name="profile_split_tunnelingv4_title">屏蔽不通过VPN的IPV4流量</string>
index 2108a8b304e29947610ee047e78bef319fc1c3b2..6c0e104b53aeeba5cb14a5d7c3c1c0467531d9a7 100644 (file)
@@ -78,6 +78,8 @@
     <string name="profile_port_hint">如果和預設值不同,則需要連接的UDP Port</string>
     <string name="profile_nat_keepalive_label">NAT-T keepalive interval</string>
     <string name="profile_nat_keepalive_hint">Small packets are sent to keep mappings on NAT routers alive if there is no other traffic. In order to save energy the default interval is 45 seconds. Behind NAT routers that remove mappings early this might be too high, try 20 seconds or less in that case.</string>
+    <string name="profile_cert_req_label">Send certificate requests</string>
+    <string name="profile_cert_req_hint">Certificate requests are sent for all available or selected CA certificates. To reduce the size of the IKE_AUTH message this can be disabled. However, this only works if the server sends its certificate even if it didn\'t receive any certificate requests.</string>
     <string name="profile_split_tunneling_label">拆分隧道</string>
     <string name="profile_split_tunneling_intro">By default, the client will route all network traffic through the VPN, unless the server narrows the subnets when the connection is established, in which case only traffic the server allows will be routed via VPN (by default, all other traffic is routed as if there was no VPN).</string>
     <string name="profile_split_tunnelingv4_title">屏蔽不通过VPN的IPV4流量</string>
index 0f22cc8cf992caa3d043c40cc8e5b56f36a855c9..f99f7dea5aea0ee6093d939db4417992b25baa39 100644 (file)
@@ -81,6 +81,8 @@
     <string name="profile_port_hint">UDP port to connect to, if different from the default</string>
     <string name="profile_nat_keepalive_label">NAT-T keepalive interval</string>
     <string name="profile_nat_keepalive_hint">Small packets are sent to keep mappings on NAT routers alive if there is no other traffic. In order to save energy the default interval is 45 seconds. Behind NAT routers that remove mappings early this might be too high, try 20 seconds or less in that case.</string>
+    <string name="profile_cert_req_label">Send certificate requests</string>
+    <string name="profile_cert_req_hint">Certificate requests are sent for all available or selected CA certificates. To reduce the size of the IKE_AUTH message this can be disabled. However, this only works if the server sends its certificate even if it didn\'t receive any certificate requests.</string>
     <string name="profile_split_tunneling_label">Split tunneling</string>
     <string name="profile_split_tunneling_intro">By default, the client will route all network traffic through the VPN, unless the server narrows the subnets when the connection is established, in which case only traffic the server allows will be routed via VPN (by default, all other traffic is routed as if there was no VPN).</string>
     <string name="profile_split_tunnelingv4_title">Block IPv4 traffic not destined for the VPN</string>