]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
android: Imported VPN profile files may contain passwords
authorTobias Brunner <tobias@strongswan.org>
Tue, 18 Feb 2025 12:26:08 +0000 (13:26 +0100)
committerTobias Brunner <tobias@strongswan.org>
Tue, 18 Feb 2025 13:12:43 +0000 (14:12 +0100)
A warning is displayed to the users, reminding them that there is a
cleartext password in the file.

src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnProfileImportActivity.java
src/frontends/android/app/src/main/res/layout/profile_import_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-uk/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 7239679454b0b6abb1547b2a317ffabec9c97ad5..08565d67bb3fd95f0c74b5a998197c8a8b0d37b7 100644 (file)
@@ -99,6 +99,7 @@ public class VpnProfileImportActivity extends AppCompatActivity
        private boolean mHideImport;
        private androidx.core.widget.ContentLoadingProgressBar mProgressBar;
        private TextView mExistsWarning;
+       private TextView mSharedSecretWarning;
        private ViewGroup mBasicDataGroup;
        private TextView mName;
        private TextView mGateway;
@@ -206,6 +207,7 @@ public class VpnProfileImportActivity extends AppCompatActivity
 
                mProgressBar = findViewById(R.id.progress_bar);
                mExistsWarning = findViewById(R.id.exists_warning);
+               mSharedSecretWarning = findViewById(R.id.shared_secret_warning);
                mBasicDataGroup = findViewById(R.id.basic_data_group);
                mName = findViewById(R.id.name);
                mGateway = findViewById(R.id.gateway);
@@ -224,6 +226,7 @@ public class VpnProfileImportActivity extends AppCompatActivity
                mRemoteCert = findViewById(R.id.remote_certificate);
 
                mExistsWarning.setVisibility(View.GONE);
+               mSharedSecretWarning.setVisibility(View.GONE);
                mBasicDataGroup.setVisibility(View.GONE);
                mUsernamePassword.setVisibility(View.GONE);
                mUserCertificate.setVisibility(View.GONE);
@@ -400,10 +403,16 @@ public class VpnProfileImportActivity extends AppCompatActivity
                if (mProfile.getVpnType().has(VpnTypeFeature.USER_PASS))
                {
                        mUsername.setText(mProfile.getUsername());
-                       if (mProfile.getUsername() != null && !mProfile.getUsername().isEmpty())
+                       if (!TextUtils.isEmpty(mProfile.getUsername()))
                        {
                                mUsername.setEnabled(false);
                        }
+                       mPassword.setText(mProfile.getPassword());
+                       if (!TextUtils.isEmpty(mProfile.getPassword()))
+                       {
+                               mPassword.setEnabled(false);
+                               mSharedSecretWarning.setVisibility(View.VISIBLE);
+                       }
                }
 
                mUserCertificate.setVisibility(mProfile.getVpnType().has(VpnTypeFeature.CERTIFICATE) ? View.VISIBLE : View.GONE);
@@ -523,6 +532,7 @@ public class VpnProfileImportActivity extends AppCompatActivity
                        if (type.has(VpnTypeFeature.USER_PASS))
                        {
                                profile.setUsername(local.optString("eap_id", null));
+                               profile.setPassword(local.optString("shared_secret", null));
                        }
 
                        if (type.has(VpnTypeFeature.CERTIFICATE))
index bca3ac853c5a24a5140557e67468aa1c699b04ce..231b552c930ea91b2cb294b8edefaf57ce868788 100644 (file)
             android:textAppearance="?android:attr/textAppearanceSmall"
             android:textColor="?android:attr/textColorPrimary" />
 
+        <TextView
+            android:id="@+id/shared_secret_warning"
+            android:background="@drawable/state_background"
+            android:padding="8dp"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginBottom="8dp"
+            app:drawableStartCompat="@android:drawable/ic_dialog_alert"
+            android:drawablePadding="8dp"
+            android:textStyle="bold"
+            android:text="@string/profile_import_shared_secret"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textColor="?android:attr/textColorPrimary" />
+
         <LinearLayout
             android:id="@+id/basic_data_group"
             android:layout_width="match_parent"
index 4e16f5d8dd19124e289f7a3dd26f7034eb1c2841..f1d2975565062d02c2e34eaa5ba818860d53001d 100644 (file)
     <string name="profile_import_failed_tls">TLS-Handshake fehlgeschlagen</string>
     <string name="profile_import_failed_value">Ungültiger Wert in \"%1$s\"</string>
     <string name="profile_import_exists">Dieses VPN Profil existiert bereits, die bestehenden Einstellungen werden ersetzt.</string>
+    <string name="profile_import_shared_secret">Diese Datei enthält ein Klartext-Passwort. Denken Sie daran, sie nach dem Importieren zu löschen.</string>
     <string name="profile_cert_import">Zertifikat aus VPN Profil importieren</string>
     <string name="profile_cert_alias">Zertifikat für \"%1$s\"</string>
     <string name="profile_profile_id">Profil-ID</string>
index 68089da9383fcae8693f488651ad847527ef30cc..cdf4eccc18e545eb49f0a321640d4a2cfd8b9747 100644 (file)
     <string name="profile_import_failed_tls">TLS handshake failed</string>
     <string name="profile_import_failed_value">Invalid value in \"%1$s\"</string>
     <string name="profile_import_exists">This VPN profile already exists, its current settings will be replaced.</string>
+    <string name="profile_import_shared_secret">This file contains a cleartext password. Remember to delete it after importing.</string>
     <string name="profile_cert_import">Import certificate from VPN profile</string>
     <string name="profile_cert_alias">Certificate for \"%1$s\"</string>
     <string name="profile_profile_id">Profile ID</string>
index ab35f29e751e5fc8fbfb8f96e6bedf4e22a07e1f..d879c9ebede8f8f240e57a66aeceedb6869dcb4d 100644 (file)
     <string name="profile_import_failed_tls">TLS handshake failed</string>
     <string name="profile_import_failed_value">Invalid value in \"%1$s\"</string>
     <string name="profile_import_exists">This VPN profile already exists, its current settings will be replaced.</string>
+    <string name="profile_import_shared_secret">This file contains a cleartext password. Remember to delete it after importing.</string>
     <string name="profile_cert_import">Import certificate from VPN profile</string>
     <string name="profile_cert_alias">Certificate for \"%1$s\"</string>
     <string name="profile_profile_id">Profile ID</string>
index 677d7c95d2eaf45f5b9e173813d0476bbe738c2b..8eadc5cb319f4634fcf1589a856005fae8c32df9 100644 (file)
     <string name="profile_import_failed_tls">TLS handshake failed</string>
     <string name="profile_import_failed_value">Invalid value in \"%1$s\"</string>
     <string name="profile_import_exists">This VPN profile already exists, its current settings will be replaced.</string>
+    <string name="profile_import_shared_secret">This file contains a cleartext password. Remember to delete it after importing.</string>
     <string name="profile_cert_import">Import certificate from VPN profile</string>
     <string name="profile_cert_alias">Certificate for \"%1$s\"</string>
     <string name="profile_profile_id">Profile ID</string>
index 43d3134d956834d57214d476013d714023ba270a..4cc7295a27852cf4d74f69395baa8ceaf21d2caf 100644 (file)
     <string name="profile_import_failed_tls">TLS握手失败</string>
     <string name="profile_import_failed_value">无效的值: \"%1$s\"</string>
     <string name="profile_import_exists">此VPN配置已经存在,当前设定将被覆盖。</string>
+    <string name="profile_import_shared_secret">This file contains a cleartext password. Remember to delete it after importing.</string>
     <string name="profile_cert_import">从VPN配置导入证书</string>
     <string name="profile_cert_alias">\"%1$s\" 所对应的证书</string>
     <string name="profile_profile_id">配置文件ID</string>
index 731682f660fb693c9e41a86074dc97989c30f929..303679112409c1ef5449517269d6750a09ebc437 100644 (file)
     <string name="profile_import_failed_tls">TLS連線失敗</string>
     <string name="profile_import_failed_value">Invalid value in \"%1$s\"</string>
     <string name="profile_import_exists">這個VPN設定檔已經存在,當前設定檔會被覆蓋。</string>
+    <string name="profile_import_shared_secret">This file contains a cleartext password. Remember to delete it after importing.</string>
     <string name="profile_cert_import">從VPN設定檔匯入憑證</string>
     <string name="profile_cert_alias">\"%1$s\" 對應的憑證</string>
     <string name="profile_profile_id">Profile ID</string>
index 71dc6e851b36771af7a9fccc844aceca51fea529..aaf7dd4c285745d3ce999861b3030e379ebc6adc 100644 (file)
     <string name="profile_import_failed_tls">TLS handshake failed</string>
     <string name="profile_import_failed_value">Invalid value in \"%1$s\"</string>
     <string name="profile_import_exists">This VPN profile already exists, its current settings will be replaced.</string>
+    <string name="profile_import_shared_secret">This file contains a cleartext password. Remember to delete it after importing.</string>
     <string name="profile_cert_import">Import certificate from VPN profile</string>
     <string name="profile_cert_alias">Certificate for \"%1$s\"</string>
     <string name="profile_profile_id">Profile ID</string>