mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-28 21:13:40 +00:00
src/client/http_client.rs: try to login
use an environment var to store passphrase (PBS_PASSWORD)
This commit is contained in:
parent
fe3b25029b
commit
50ff21da59
@ -70,7 +70,7 @@ impl Service for ApiService {
|
||||
match result {
|
||||
Ok(res) => Ok::<_, hyper::Error>(res),
|
||||
Err(err) => {
|
||||
if let Some(apierr) = err.downcast_ref::<HttpError>() {
|
||||
if let Some(apierr) = err.downcast_ref::<HttpError>() {
|
||||
let mut resp = Response::new(Body::from(apierr.message.clone()));
|
||||
*resp.status_mut() = apierr.code;
|
||||
Ok(resp)
|
||||
@ -458,6 +458,8 @@ pub fn handle_request(api: Arc<ApiConfig>, req: Request<Body>) -> BoxFut {
|
||||
if let Some(_username) = rpcenv.get_user() {
|
||||
// fixme: check permissions
|
||||
} else {
|
||||
println!("Abort UNAUTHORIZED API REQUEST");
|
||||
|
||||
// always delay unauthorized calls by 3 seconds (from start of request)
|
||||
let resp = (formatter.format_error)(http_err!(UNAUTHORIZED, "permission check failed.".into()));
|
||||
let delayed_response = tokio::timer::Delay::new(delay_unauth_time)
|
||||
|
Loading…
Reference in New Issue
Block a user