mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-23 12:49:04 +00:00
add logs (#962)
This commit is contained in:
@@ -3781,10 +3781,8 @@ impl ObjectIO for SetDisks {
|
|||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
error!("get_object_with_fileinfo err {:?}", e);
|
error!("get_object_with_fileinfo {bucket}/{object} err {:?}", e);
|
||||||
};
|
};
|
||||||
|
|
||||||
// error!("get_object_with_fileinfo end {}/{}", bucket, object);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Ok(reader)
|
Ok(reader)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ use std::sync::LazyLock;
|
|||||||
use std::{collections::HashMap, sync::Arc};
|
use std::{collections::HashMap, sync::Arc};
|
||||||
use tokio::sync::mpsc::{self, Sender};
|
use tokio::sync::mpsc::{self, Sender};
|
||||||
use tokio_util::sync::CancellationToken;
|
use tokio_util::sync::CancellationToken;
|
||||||
use tracing::{debug, info, warn};
|
use tracing::{info, warn};
|
||||||
|
|
||||||
pub static IAM_CONFIG_PREFIX: LazyLock<String> = LazyLock::new(|| format!("{RUSTFS_CONFIG_PREFIX}/iam"));
|
pub static IAM_CONFIG_PREFIX: LazyLock<String> = LazyLock::new(|| format!("{RUSTFS_CONFIG_PREFIX}/iam"));
|
||||||
pub static IAM_CONFIG_USERS_PREFIX: LazyLock<String> = LazyLock::new(|| format!("{RUSTFS_CONFIG_PREFIX}/iam/users/"));
|
pub static IAM_CONFIG_USERS_PREFIX: LazyLock<String> = LazyLock::new(|| format!("{RUSTFS_CONFIG_PREFIX}/iam/users/"));
|
||||||
@@ -389,7 +389,7 @@ impl Store for ObjectStore {
|
|||||||
data = match Self::decrypt_data(&data) {
|
data = match Self::decrypt_data(&data) {
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
debug!("decrypt_data failed: {}", err);
|
warn!("delete the config file when decrypt failed failed: {}, path: {}", err, path.as_ref());
|
||||||
// delete the config file when decrypt failed
|
// delete the config file when decrypt failed
|
||||||
let _ = self.delete_iam_config(path.as_ref()).await;
|
let _ = self.delete_iam_config(path.as_ref()).await;
|
||||||
return Err(Error::ConfigNotFound);
|
return Err(Error::ConfigNotFound);
|
||||||
@@ -439,8 +439,10 @@ impl Store for ObjectStore {
|
|||||||
.await
|
.await
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
if is_err_config_not_found(&err) {
|
if is_err_config_not_found(&err) {
|
||||||
|
warn!("load_user_identity failed: no such user, name: {name}, user_type: {user_type:?}");
|
||||||
Error::NoSuchUser(name.to_owned())
|
Error::NoSuchUser(name.to_owned())
|
||||||
} else {
|
} else {
|
||||||
|
warn!("load_user_identity failed: {err:?}, name: {name}, user_type: {user_type:?}");
|
||||||
err
|
err
|
||||||
}
|
}
|
||||||
})?;
|
})?;
|
||||||
@@ -448,6 +450,9 @@ impl Store for ObjectStore {
|
|||||||
if u.credentials.is_expired() {
|
if u.credentials.is_expired() {
|
||||||
let _ = self.delete_iam_config(get_user_identity_path(name, user_type)).await;
|
let _ = self.delete_iam_config(get_user_identity_path(name, user_type)).await;
|
||||||
let _ = self.delete_iam_config(get_mapped_policy_path(name, user_type, false)).await;
|
let _ = self.delete_iam_config(get_mapped_policy_path(name, user_type, false)).await;
|
||||||
|
warn!(
|
||||||
|
"load_user_identity failed: user is expired, delete the user and mapped policy, name: {name}, user_type: {user_type:?}"
|
||||||
|
);
|
||||||
return Err(Error::NoSuchUser(name.to_owned()));
|
return Err(Error::NoSuchUser(name.to_owned()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,7 +470,7 @@ impl Store for ObjectStore {
|
|||||||
let _ = self.delete_iam_config(get_user_identity_path(name, user_type)).await;
|
let _ = self.delete_iam_config(get_user_identity_path(name, user_type)).await;
|
||||||
let _ = self.delete_iam_config(get_mapped_policy_path(name, user_type, false)).await;
|
let _ = self.delete_iam_config(get_mapped_policy_path(name, user_type, false)).await;
|
||||||
}
|
}
|
||||||
warn!("extract_jwt_claims failed: {}", err);
|
warn!("extract_jwt_claims failed: {err:?}, name: {name}, user_type: {user_type:?}");
|
||||||
return Err(Error::NoSuchUser(name.to_owned()));
|
return Err(Error::NoSuchUser(name.to_owned()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-1
@@ -89,10 +89,14 @@ impl S3Auth for IAMAuth {
|
|||||||
if let Ok(iam_store) = rustfs_iam::get() {
|
if let Ok(iam_store) = rustfs_iam::get() {
|
||||||
if let Some(id) = iam_store.get_user(access_key).await {
|
if let Some(id) = iam_store.get_user(access_key).await {
|
||||||
return Ok(SecretKey::from(id.credentials.secret_key.clone()));
|
return Ok(SecretKey::from(id.credentials.secret_key.clone()));
|
||||||
|
} else {
|
||||||
|
tracing::warn!("get_user failed: no such user, access_key: {access_key}");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
tracing::warn!("get_secret_key failed: iam not initialized, access_key: {access_key}");
|
||||||
}
|
}
|
||||||
|
|
||||||
Err(s3_error!(UnauthorizedAccess, "Your account is not signed up2"))
|
Err(s3_error!(UnauthorizedAccess, "Your account is not signed up2, access_key: {access_key}"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user