Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth-type now a mandatory parameter (breaking change) #196

Merged
merged 3 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Changelog

## 2024-12-14 unftp v0.14.8
## 2024-12-14 unftp v0.15.0

- [#184](https://github.com/bolcom/unFTP/pull/184) Support for Azure blob storage with [OpenDAL](https://github.com/apache/OpenDAL)
- [#185](https://github.com/bolcom/unFTP/pull/185) Support for shipping logs to [Google Logging](https://cloud.google.com/logging/docs/)
- [#196](https://github.com/bolcom/unFTP/pull/196) --auth-type is now mandatory to prevent security risks from omission or typos that could leave the FTP server open

## 2023-12-24 unftp v0.14.7

Expand Down
2 changes: 1 addition & 1 deletion docs/server/ftps.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ openssl req -new -x509 -days 365 \
-key unftp_client_ca.key \
-subj '/CN=unftp-ca.mysite.com/O=bol.com/C=NL' \
-out unftp_client_ca.crt
````
```

Create a client side key:

Expand Down
9 changes: 7 additions & 2 deletions docs/server/starting.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ program arguments type the following:
unftp --help
```

To run unFTP with everything set to the defaults:
To run passwordless unFTP with everything set to the defaults:

```sh
unftp
unftp --auth-type anonymous
```

{% info Note %}
The `--auth-type` switch is required, but will be omitted in many other examples for brevity.
Choose the appropriate authentication type for your use case—do not use anonymous unless explicitly intended.
{% end %}

This will start unFTP:

- with a filesystem back-end rooted at your OS temporary directory.
Expand Down
3 changes: 1 addition & 2 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,7 @@ pub(crate) fn clap_app(tmp_dir: &str) -> clap::Command {
.help("The type of authorization to use")
//.case_insensitive(true)
.env("UNFTP_AUTH_TYPE")
.takes_value(true)
.default_value("anonymous"),
.takes_value(true),
)
.arg(
Arg::new(AUTH_PAM_SERVICE)
Expand Down
15 changes: 9 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -858,15 +858,18 @@ async fn run(arg_matches: ArgMatches) -> Result<(), String> {
let (root_logger, google_shipper) = logging::create_logger(&arg_matches)?;
let log = root_logger.new(o!("module" => "main"));

let addr = String::from(arg_matches.value_of(args::BIND_ADDRESS).unwrap());
let http_addr = String::from(arg_matches.value_of(args::HTTP_BIND_ADDRESS).unwrap());
let auth_type = String::from(arg_matches.value_of(args::AUTH_TYPE).unwrap());
let sbe_type = String::from(arg_matches.value_of(args::STORAGE_BACKEND_TYPE).unwrap());
let addr = arg_matches.value_of(args::BIND_ADDRESS).unwrap();
let http_addr = arg_matches.value_of(args::HTTP_BIND_ADDRESS).unwrap();
let auth_type = arg_matches.value_of(args::AUTH_TYPE).unwrap_or_else(|| {
eprintln!("Required option --auth-type is missing. To disable authentication, use: `--auth-type=anonymous` or set the `UNFTP_AUTH_TYPE=anonymous` environment variable.");
::std::process::exit(1)
});
let sbe_type = arg_matches.value_of(args::STORAGE_BACKEND_TYPE).unwrap();

let home_dir = String::from(match &*sbe_type {
let home_dir = match sbe_type {
"gcs" => arg_matches.value_of(args::GCS_ROOT).unwrap(),
_ => arg_matches.value_of(args::ROOT_DIR).unwrap(),
});
};

info!(log, "Starting {} server.", app::NAME;
"version" => app::VERSION,
Expand Down
Loading