changes for new securety layer
This commit is contained in:
parent
21acd568b1
commit
6b3fc6183e
|
@ -572,7 +572,7 @@ public class OrbotMainActivity extends AppCompatActivity
|
||||||
stopVpnService();
|
stopVpnService();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableHiddenServicePort (String hsName, int hsPort, int hsRemotePort, boolean allowBackups) throws RemoteException, InterruptedException
|
private void enableHiddenServicePort (String hsName, int hsPort, int hsRemotePort) throws RemoteException, InterruptedException
|
||||||
{
|
{
|
||||||
String onionHostname = null;
|
String onionHostname = null;
|
||||||
|
|
||||||
|
@ -593,15 +593,6 @@ public class OrbotMainActivity extends AppCompatActivity
|
||||||
Cursor row = cr.query(HSContentProvider.CONTENT_URI, mProjection, "port=" + mHsPort, null, null);
|
Cursor row = cr.query(HSContentProvider.CONTENT_URI, mProjection, "port=" + mHsPort, null, null);
|
||||||
|
|
||||||
if(row == null) {
|
if(row == null) {
|
||||||
/*
|
|
||||||
* For security reasons:
|
|
||||||
*
|
|
||||||
* Allow managed backups option can only be set to a arbitrary true or false value when a service is created
|
|
||||||
* Subsequently an application can only change this value to false via Intent service
|
|
||||||
* Modifying this value to true again can only be performed by the user through the Orbot interface
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
fields.put("allow_managed_backups", allowBackups);
|
|
||||||
cr.insert(HSContentProvider.CONTENT_URI, fields);
|
cr.insert(HSContentProvider.CONTENT_URI, fields);
|
||||||
} else {
|
} else {
|
||||||
onionHostname = row.getString(row.getColumnIndex(HSContentProvider.HiddenService.DOMAIN));
|
onionHostname = row.getString(row.getColumnIndex(HSContentProvider.HiddenService.DOMAIN));
|
||||||
|
@ -674,7 +665,6 @@ public class OrbotMainActivity extends AppCompatActivity
|
||||||
final int hiddenServicePort = getIntent().getIntExtra("hs_port", -1);
|
final int hiddenServicePort = getIntent().getIntExtra("hs_port", -1);
|
||||||
final int hiddenServiceRemotePort = getIntent().getIntExtra("hs_onion_port", -1);
|
final int hiddenServiceRemotePort = getIntent().getIntExtra("hs_onion_port", -1);
|
||||||
final String hiddenServiceName = getIntent().getStringExtra("hs_name");
|
final String hiddenServiceName = getIntent().getStringExtra("hs_name");
|
||||||
final boolean hiddenServiceAllowBackups = getIntent().getBooleanExtra("hs_allow_namaged_backup",false);
|
|
||||||
|
|
||||||
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
|
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
|
||||||
|
|
||||||
|
@ -684,8 +674,7 @@ public class OrbotMainActivity extends AppCompatActivity
|
||||||
|
|
||||||
try {
|
try {
|
||||||
enableHiddenServicePort (
|
enableHiddenServicePort (
|
||||||
hiddenServiceName, hiddenServicePort,
|
hiddenServiceName, hiddenServicePort, hiddenServiceRemotePort
|
||||||
hiddenServiceRemotePort, hiddenServiceAllowBackups
|
|
||||||
);
|
);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
|
|
|
@ -16,7 +16,6 @@ public class HSDatabase extends SQLiteOpenHelper {
|
||||||
"name TEXT, " +
|
"name TEXT, " +
|
||||||
"domain TEXT, " +
|
"domain TEXT, " +
|
||||||
"onion_port INTEGER, " +
|
"onion_port INTEGER, " +
|
||||||
"allow_managed_backups INTEGER DEFAULT 0, " +
|
|
||||||
"port INTEGER);";
|
"port INTEGER);";
|
||||||
|
|
||||||
public HSDatabase(Context context) {
|
public HSDatabase(Context context) {
|
||||||
|
|
|
@ -45,10 +45,8 @@ public class HSDataDialog extends DialogFragment {
|
||||||
((EditText) dialog_view.findViewById(R.id.hsOnionPort)).getText().toString()
|
((EditText) dialog_view.findViewById(R.id.hsOnionPort)).getText().toString()
|
||||||
);
|
);
|
||||||
|
|
||||||
Boolean allowBackups = ((CheckBox) dialog_view.findViewById(R.id.allow_managed_backup)).isEnabled();
|
|
||||||
|
|
||||||
if (checkInput(localPort,onionPort)) {
|
if (checkInput(localPort,onionPort)) {
|
||||||
saveData(serverName, localPort,onionPort,allowBackups);
|
saveData(serverName, localPort,onionPort);
|
||||||
serverDataDialog.dismiss();
|
serverDataDialog.dismiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,12 +78,11 @@ public class HSDataDialog extends DialogFragment {
|
||||||
return is_ok;
|
return is_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveData(String name, Integer local, Integer remote, Boolean allowBackups) {
|
private void saveData(String name, Integer local, Integer remote) {
|
||||||
ContentValues fields = new ContentValues();
|
ContentValues fields = new ContentValues();
|
||||||
fields.put("name", name);
|
fields.put("name", name);
|
||||||
fields.put("port", local);
|
fields.put("port", local);
|
||||||
fields.put("onion_port", remote);
|
fields.put("onion_port", remote);
|
||||||
fields.put("allow_managed_backups", allowBackups);
|
|
||||||
|
|
||||||
ContentResolver cr = getContext().getContentResolver();
|
ContentResolver cr = getContext().getContentResolver();
|
||||||
|
|
||||||
|
|
|
@ -53,13 +53,6 @@
|
||||||
android:id="@+id/hsOnionPort"
|
android:id="@+id/hsOnionPort"
|
||||||
android:inputType="number" />
|
android:inputType="number" />
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:text="@string/allow_managed_backup"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/allow_managed_backup"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -339,5 +339,4 @@
|
||||||
<string name="onion_port">Onion Port</string>
|
<string name="onion_port">Onion Port</string>
|
||||||
<string name="name">Name</string>
|
<string name="name">Name</string>
|
||||||
<string name="invalid_port">Invalid Port</string>
|
<string name="invalid_port">Invalid Port</string>
|
||||||
<string name="allow_managed_backup">Allow managed backups</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue