Skip to content

Commit 98d5c57

Browse files
committed
Add allowed-fingerprints option
Closes #4
1 parent 27c1cab commit 98d5c57

File tree

9 files changed

+324
-429
lines changed

9 files changed

+324
-429
lines changed

book/mdbook-admonish.css

-348
This file was deleted.

book/src/advanced_uses.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ ssh -L 4000:my.tunnel:3000
1818

1919
Then you can access `localhost:4000`, and all traffic will be redirected to port 2000 on the remote service. It's almost like a VPN!
2020

21-
Currently, there are no authentication options for local forwarding, but this is a planned feature.
21+
If you'd like to restrict which users can access your service, you can provide the allowed fingerprints as a comma-separated list at the end of the command, like so:
22+
23+
```shell
24+
ssh -R my.tunnel:3000:localhost:2000 server.com -p 2222 allowed-fingerprints=SHA256:GehKyA21BBK6eJCouziacUmqYDNl8BPMGG0CTtLSrbQ
25+
```
2226

2327
## Custom domains
2428

src/error.rs

+2
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ pub(crate) enum ServerError {
1010
RequestTimeout,
1111
#[error("Invalid file path")]
1212
InvalidFilePath,
13+
#[error("Fingerprint denied")]
14+
FingerprintDenied,
1315
}

src/handler.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
use async_trait::async_trait;
2+
#[cfg(test)]
3+
use mockall::automock;
4+
use tokio::sync::mpsc;
5+
6+
#[cfg_attr(test, automock)]
7+
#[async_trait]
8+
pub(crate) trait ConnectionHandler<T: Sync> {
9+
fn log_channel(&self) -> mpsc::UnboundedSender<Vec<u8>>;
10+
async fn tunneling_channel(
11+
&self,
12+
ip: &str,
13+
port: u16,
14+
fingerprint: Option<String>,
15+
) -> anyhow::Result<T>;
16+
}

0 commit comments

Comments
 (0)