Skip to content

Commit bdc30c3

Browse files
committed
Update manual connection guide with rpcallowip security and add PBaaS chain discovery with friendly names
1 parent 6adb8d1 commit bdc30c3

9 files changed

Lines changed: 257 additions & 191 deletions

File tree

MANUAL_CONNECTION_GUIDE.md

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,27 @@ Look for IP starting with `192.168.` or `10.0.`
4040

4141
**Edit the config file** (vrsctest.conf or VRSC.conf):
4242

43+
#### Option A: Specific IP Addresses (Recommended)
44+
45+
Use this if you know which devices will connect to your daemon. This is **more secure** as it only allows connections from specific IP addresses.
46+
47+
```
48+
rpchost=0.0.0.0
49+
rpcallowip=127.0.0.1
50+
rpcallowip=192.168.1.52
51+
rpcallowip=192.168.1.76
52+
rpcallowip=10.0.0.250
53+
rpcuser=your_username
54+
rpcpassword=your_password
55+
rpcport=18843
56+
```
57+
58+
You can add as many `rpcallowip=` lines as needed—one for each device/IP address that should be allowed to connect. The first line (`127.0.0.1`) keeps local access working.
59+
60+
#### Option B: Allow All Local Network IPs (Less Secure)
61+
62+
⚠️ **Security Warning**: This allows **any device** on your local network to connect to your daemon if they know your username and password.
63+
4364
```
4465
rpchost=0.0.0.0
4566
rpcallowip=0.0.0.0/0
@@ -48,6 +69,11 @@ rpcpassword=your_password
4869
rpcport=18843
4970
```
5071

72+
Only use this if:
73+
- You're on a trusted private network
74+
- You don't know which IPs you'll connect from
75+
- You understand the security implications
76+
5177
**Restart the daemon** after saving changes.
5278

5379
---
@@ -108,6 +134,29 @@ When connecting to a non-localhost daemon, the app will show a security warning.
108134
- You're on a trusted private network
109135
- You're using an SSH tunnel or VPN
110136

137+
### IP Allowlisting Best Practices
138+
139+
**Understanding `rpcallowip`:**
140+
- `rpcallowip=127.0.0.1` - Only allows connections from the same computer (localhost)
141+
- `rpcallowip=192.168.1.52` - Only allows connections from one specific IP address
142+
- `rpcallowip=0.0.0.0/0` - Allows connections from **any IP address** on your network
143+
144+
**Recommended approach:**
145+
1. Always keep `rpcallowip=127.0.0.1` for local access
146+
2. Add specific `rpcallowip=` lines for each device you'll connect from
147+
3. Use static IPs or DHCP reservations for devices that need RPC access
148+
4. Avoid `0.0.0.0/0` unless you fully understand the risks
149+
150+
**Example for multi-device setup:**
151+
```
152+
rpcallowip=127.0.0.1 # Local access
153+
rpcallowip=192.168.1.52 # Laptop
154+
rpcallowip=192.168.1.76 # Desktop in office
155+
rpcallowip=10.0.0.250 # Remote office VPN
156+
```
157+
158+
This way, even if someone on your network discovers your RPC port is open, they can't connect unless they're using one of the allowed IP addresses.
159+
111160
---
112161

113162
## Advanced: SSH Tunnel (Encrypted)
@@ -199,11 +248,12 @@ If this fails, firewall is blocking the connection.
199248
## Best Practices
200249

201250
1. **Use strong passwords** in RPC config
202-
2. **Don't remember credentials** for remote connections unless it's your own server
203-
3. **Use SSH tunnel** when connecting over internet or untrusted networks
204-
4. **Set network to Private** on Windows (not Public)
205-
5. **Restart daemon** after any config changes
206-
6. **Close port 18843** in firewall when not in use for added security
251+
2. **Limit `rpcallowip` to specific addresses** when possible—avoid `0.0.0.0/0` unless necessary
252+
3. **Don't remember credentials** for remote connections unless it's your own server
253+
4. **Use SSH tunnel** when connecting over internet or untrusted networks
254+
5. **Set network to Private** on Windows (not Public)
255+
6. **Restart daemon** after any config changes
256+
7. **Close port 18843** in firewall when not in use for added security
207257

208258
---
209259

src-tauri/src/commands/mod.rs

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Tauri command handlers
22
// These functions are called from the frontend
33

4-
use crate::rpc::{VerusRpcClient, RpcCredentials, ChainConfig, SupportedChain, ChainDiscovery, CredentialManager, CurrencyDefinition};
4+
use crate::rpc::{VerusRpcClient, RpcCredentials, ChainConfig, ChainDiscovery, CredentialManager, CurrencyDefinition};
55
use serde_json::{json, Value};
66
use tauri::State;
77
use std::sync::Arc;
@@ -517,15 +517,6 @@ pub async fn store_credentials(
517517
host: String,
518518
port: u16
519519
) -> Result<bool, String> {
520-
let chain = match chain_name.as_str() {
521-
"vrsc" => SupportedChain::Vrsc,
522-
"vrsctest" => SupportedChain::VrscTest,
523-
"varrr" => SupportedChain::Varrr,
524-
"vdex" => SupportedChain::Vdex,
525-
"chips" => SupportedChain::Chips,
526-
_ => return Err("Unsupported chain".to_string()),
527-
};
528-
529520
let credentials = RpcCredentials {
530521
username,
531522
password,
@@ -538,25 +529,16 @@ pub async fn store_credentials(
538529
.map_err(|e| e.to_string())?;
539530

540531
let cred_manager = CredentialManager::new();
541-
cred_manager.store_credentials(&chain, &credentials)
532+
cred_manager.store_credentials(&chain_name.to_lowercase(), &credentials)
542533
.map_err(|e| e.to_string())?;
543534

544535
Ok(true)
545536
}
546537

547538
#[tauri::command]
548539
pub async fn load_credentials(chain_name: String) -> Result<Value, String> {
549-
let chain = match chain_name.as_str() {
550-
"vrsc" => SupportedChain::Vrsc,
551-
"vrsctest" => SupportedChain::VrscTest,
552-
"varrr" => SupportedChain::Varrr,
553-
"vdex" => SupportedChain::Vdex,
554-
"chips" => SupportedChain::Chips,
555-
_ => return Err("Unsupported chain".to_string()),
556-
};
557-
558540
let cred_manager = CredentialManager::new();
559-
match cred_manager.load_credentials(&chain) {
541+
match cred_manager.load_credentials(&chain_name.to_lowercase()) {
560542
Ok(credentials) => {
561543
// Return credentials but redact the password for security
562544
let safe_creds = serde_json::json!({
@@ -573,30 +555,13 @@ pub async fn load_credentials(chain_name: String) -> Result<Value, String> {
573555

574556
#[tauri::command]
575557
pub async fn clear_credentials(chain_name: String) -> Result<bool, String> {
576-
let chain = match chain_name.as_str() {
577-
"vrsc" => SupportedChain::Vrsc,
578-
"vrsctest" => SupportedChain::VrscTest,
579-
"varrr" => SupportedChain::Varrr,
580-
"vdex" => SupportedChain::Vdex,
581-
"chips" => SupportedChain::Chips,
582-
_ => return Err("Unsupported chain".to_string()),
583-
};
584-
585558
let cred_manager = CredentialManager::new();
586-
cred_manager.clear_credentials(&chain)
559+
cred_manager.clear_credentials(&chain_name.to_lowercase())
587560
.map_err(|e| e.to_string())?;
588561

589562
Ok(true)
590563
}
591564

592-
#[tauri::command]
593-
pub async fn list_stored_chains() -> Result<Value, String> {
594-
let cred_manager = CredentialManager::new();
595-
let chains = cred_manager.list_stored_chains();
596-
let chain_names: Vec<String> = chains.iter().map(|c| c.to_string().to_string()).collect();
597-
Ok(serde_json::to_value(chain_names).unwrap())
598-
}
599-
600565
#[tauri::command]
601566
pub async fn get_expected_config_paths() -> Result<String, String> {
602567
Ok(crate::rpc::ChainConfig::get_expected_paths())

src-tauri/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use commands::{
66
get_info, get_wallet_info, get_mining_info, z_get_total_balance, get_blockchain_info,
77
list_identities, get_identity, get_identity_content, verify_message, verify_hash, list_currencies, get_currency, get_currency_converters, get_currency_state, get_offers, list_open_offers, close_offers, make_offer, take_offer,
88
discover_chains, get_discovered_chains, connect_to_chain, test_and_connect_manual, store_credentials,
9-
load_credentials, clear_credentials, list_stored_chains, get_expected_config_paths,
9+
load_credentials, clear_credentials, get_expected_config_paths,
1010
get_block_count, list_address_groupings, estimate_conversion, convert_currency, send_currency,
1111
convert_to_verusidx, register_name_commitment, register_identity, revoke_identity, recover_identity, update_identity, set_identity_timelock,
1212
list_transactions, get_currency_balance, get_new_address, get_addresses_by_account,
@@ -49,7 +49,6 @@ pub fn run() {
4949
store_credentials,
5050
load_credentials,
5151
clear_credentials,
52-
list_stored_chains,
5352
get_expected_config_paths,
5453
get_block_count,
5554
list_address_groupings,

0 commit comments

Comments
 (0)