mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 01:26:04 -08:00
Rust-ftp finally with tls-native :D
This commit is contained in:
81
Cargo.lock
generated
81
Cargo.lock
generated
@@ -41,9 +41,9 @@ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.65"
|
version = "1.0.66"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "95752358c8f7552394baf48cd82695b345628ad3f170d607de3ca03b8dacca15"
|
checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
@@ -88,6 +88,22 @@ dependencies = [
|
|||||||
"bitflags",
|
"bitflags",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-foundation"
|
||||||
|
version = "0.9.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62"
|
||||||
|
dependencies = [
|
||||||
|
"core-foundation-sys",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-foundation-sys"
|
||||||
|
version = "0.8.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossterm"
|
name = "crossterm"
|
||||||
version = "0.18.2"
|
version = "0.18.2"
|
||||||
@@ -131,11 +147,11 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ftp"
|
name = "ftp"
|
||||||
version = "3.0.1"
|
version = "3.0.1"
|
||||||
source = "git+https://github.com/ChristianVisintin/rust-ftp#08108bfb728b031d5d6ad5cd0a9ef4b0904fb500"
|
source = "git+https://github.com/ChristianVisintin/rust-ftp#e32e45d5b2fb0d05456add2af558175139e44d89"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"openssl",
|
"native-tls",
|
||||||
"regex",
|
"regex",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -271,6 +287,24 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "native-tls"
|
||||||
|
version = "0.2.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6fcc7939b5edc4e4f86b1b4a04bb1498afaaf871b1a6691838ed06fcb48d3a3f"
|
||||||
|
dependencies = [
|
||||||
|
"lazy_static",
|
||||||
|
"libc",
|
||||||
|
"log",
|
||||||
|
"openssl",
|
||||||
|
"openssl-probe",
|
||||||
|
"openssl-sys",
|
||||||
|
"schannel",
|
||||||
|
"security-framework",
|
||||||
|
"security-framework-sys",
|
||||||
|
"tempfile",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ntapi"
|
name = "ntapi"
|
||||||
version = "0.3.6"
|
version = "0.3.6"
|
||||||
@@ -313,6 +347,12 @@ dependencies = [
|
|||||||
"openssl-sys",
|
"openssl-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "openssl-probe"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl-sys"
|
name = "openssl-sys"
|
||||||
version = "0.9.58"
|
version = "0.9.58"
|
||||||
@@ -490,12 +530,45 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "schannel"
|
||||||
|
version = "0.1.19"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75"
|
||||||
|
dependencies = [
|
||||||
|
"lazy_static",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "scopeguard"
|
name = "scopeguard"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "security-framework"
|
||||||
|
version = "2.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"core-foundation",
|
||||||
|
"core-foundation-sys",
|
||||||
|
"libc",
|
||||||
|
"security-framework-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "security-framework-sys"
|
||||||
|
version = "2.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b"
|
||||||
|
dependencies = [
|
||||||
|
"core-foundation-sys",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "signal-hook"
|
name = "signal-hook"
|
||||||
version = "0.1.16"
|
version = "0.1.16"
|
||||||
|
|||||||
26
README.md
26
README.md
@@ -15,10 +15,6 @@ Current version: 0.1.0 (??/??/2020)
|
|||||||
- [Why TermSCP](#why-termscp)
|
- [Why TermSCP](#why-termscp)
|
||||||
- [Features](#features)
|
- [Features](#features)
|
||||||
- [Installation](#installation)
|
- [Installation](#installation)
|
||||||
- [Requirements](#requirements)
|
|
||||||
- [Install OpenSSL on Windows](#install-openssl-on-windows)
|
|
||||||
- [Precompiled Binaries](#precompiled-binaries)
|
|
||||||
- [Vcpkg](#vcpkg)
|
|
||||||
- [Cargo](#cargo)
|
- [Cargo](#cargo)
|
||||||
- [Deb / Rpm](#deb--rpm)
|
- [Deb / Rpm](#deb--rpm)
|
||||||
- [Usage](#usage)
|
- [Usage](#usage)
|
||||||
@@ -53,27 +49,6 @@ It happens very often to me when using SCP at work to forget the path of a file
|
|||||||
If you're considering to install TermSCP I want to thank you 💛 ! I hope this project can be useful for you!
|
If you're considering to install TermSCP I want to thank you 💛 ! I hope this project can be useful for you!
|
||||||
If you want to contribute to this project, don't forget to check out our contribute guide. [Read More](CONTRIBUTING.md)
|
If you want to contribute to this project, don't forget to check out our contribute guide. [Read More](CONTRIBUTING.md)
|
||||||
|
|
||||||
### Requirements
|
|
||||||
|
|
||||||
- OpenSSL: only if you want **FTPS** support
|
|
||||||
|
|
||||||
#### Install OpenSSL on Windows
|
|
||||||
|
|
||||||
To install OpenSSL on Windows you have basically two options:
|
|
||||||
|
|
||||||
##### Precompiled Binaries
|
|
||||||
|
|
||||||
Download the precompiled binaries from <http://slproweb.com/products/Win32OpenSSL.html> (Non light installation); install to system path and then add to your environmental variables `OPENSSL_DIR=path\to\the\installation\dir`
|
|
||||||
|
|
||||||
##### Vcpkg
|
|
||||||
|
|
||||||
You can use [vcpkg](https://github.com/Microsoft/vcpkg) to install OpenSSL and then run
|
|
||||||
|
|
||||||
```dos
|
|
||||||
vcpkg install openssl:x64-windows
|
|
||||||
set VCPKG_ROOT=PATH_TO_VCPKG_INSTALLATION
|
|
||||||
```
|
|
||||||
|
|
||||||
### Cargo
|
### Cargo
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@@ -107,7 +82,6 @@ TODO:
|
|||||||
## Upcoming Features
|
## Upcoming Features
|
||||||
|
|
||||||
- **File viewer**: possibility to show in a popup the file content from the explorer.
|
- **File viewer**: possibility to show in a popup the file content from the explorer.
|
||||||
- **OpenSSL Replacement**: OpenSSL is kinda an annoying stuff, especially for Windows. Unfortunately rust-ftp requires OpenSSL to build. I'm working on replacing it on [rust-ftp](https://github.com/ChristianVisintin/rust-ftp/tree/rust-tls). If you want to give me a hand, feel free to contribute.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ use crate::fs::{FsDirectory, FsEntry, FsFile};
|
|||||||
use crate::utils::lstime_to_systime;
|
use crate::utils::lstime_to_systime;
|
||||||
|
|
||||||
// Includes
|
// Includes
|
||||||
use ftp::openssl::ssl::{SslContext, SslMethod};
|
use ftp::native_tls::TlsConnector;
|
||||||
use ftp::FtpStream;
|
use ftp::FtpStream;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
@@ -238,9 +238,14 @@ impl FileTransfer for FtpFileTransfer {
|
|||||||
};
|
};
|
||||||
// If SSL, open secure session
|
// If SSL, open secure session
|
||||||
if self.ftps {
|
if self.ftps {
|
||||||
let ctx = SslContext::builder(SslMethod::tls()).unwrap();
|
let ctx = match TlsConnector::builder().danger_accept_invalid_certs(true).danger_accept_invalid_hostnames(true).build() {
|
||||||
let ctx = ctx.build();
|
Ok(tls) => tls,
|
||||||
stream = match stream.into_secure(ctx) {
|
Err(err) => return Err(FileTransferError::new_ex(
|
||||||
|
FileTransferErrorType::SslError,
|
||||||
|
format!("{}", err),
|
||||||
|
))
|
||||||
|
};
|
||||||
|
stream = match stream.into_secure(ctx, address.as_str()) {
|
||||||
Ok(s) => s,
|
Ok(s) => s,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
return Err(FileTransferError::new_ex(
|
return Err(FileTransferError::new_ex(
|
||||||
|
|||||||
Reference in New Issue
Block a user