Skip to content

Commit

Permalink
feat: secret key store for service and client auth keys (#9)
Browse files Browse the repository at this point in the history
refactor: config conversion, use secret store

chore: use xdg config dir for secrets, set umask

chore: update tests

chore: use remote service name from cli parser
  • Loading branch information
cmars authored Apr 30, 2023
1 parent 401c60c commit 70a15ca
Show file tree
Hide file tree
Showing 9 changed files with 558 additions and 164 deletions.
180 changes: 174 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ tokio-socks = "0.5.1"
regex = "1.7.0"
clap = { version = "4.1.4", features = ["env", "derive"] }
nom = "7.1.3"
crypto_box = "0.8.2"
libc = "0.2.142"
dirs = "5.0.0"
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ Local addresses may be bound. This forwards a specific interface address to an o
onionpipe 10.0.0.7:8443~443
```

### Persistent onion addresses

```
onionpipe 8000@my-app
```

### Import onion services


Expand Down Expand Up @@ -90,7 +96,6 @@ onionpipe --config config.json

- Security review. Rust code review, I'm kind of new to the language.
- CLI compatibility with the [Go implementation](https://github.com/cmars/onionpipe). What's still missing?
- Onion service key management
- Client authentication & key management
- More Tor options like anonymous vs fast, bridge support. Vanguard integration.
- UNIX socket support. Doable but a dependency will need some enhancement (torut)
Expand Down
11 changes: 11 additions & 0 deletions examples/config-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"exports": [{
"local_addr": "127.0.0.1:8080",
"service_name": "test",
"remote_ports": [80]
}],
"imports": [{
"remote_addr": "2gzyxa5ihm7nsggfxnu52rck2vv4rvmdlkiu3zzui5du4xyclen53wid.onion:80",
"local_addr": "127.0.0.1:8080"
}]
}
10 changes: 10 additions & 0 deletions src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,17 @@ async fn main() {
}

async fn run(cli: Cli) -> Result<()> {
unsafe {
libc::umask(0o077);
}

let mut pipe_builder = OnionPipe::defaults();

if let Some(config_dir) = dirs::config_dir() {
let secrets_dir = config_dir.join("onionpipe");
pipe_builder = pipe_builder.secrets_dir(secrets_dir.to_str().unwrap());
}

let cfg: config::Config;
if let Some(config_path) = cli.config.as_ref() {
let mut config_file = File::open(config_path)?;
Expand Down
Loading

0 comments on commit 70a15ca

Please sign in to comment.