gate ssh signing per agent: ssh permission, signing policy on the login role, ca key endpoint
This commit is contained in:
parent
aeb9317ad1
commit
910f9a6f50
1 changed files with 805 additions and 57 deletions
|
|
@ -65,6 +65,21 @@ pub(crate) trait AccessStore {
|
|||
name: &str,
|
||||
) -> impl Future<Output = Result<(), Error>> + Send;
|
||||
|
||||
/// As [`SecretStore::cert_role_policies`].
|
||||
fn cert_role_policies(
|
||||
&self,
|
||||
mount: &str,
|
||||
name: &str,
|
||||
) -> impl Future<Output = Result<Option<Vec<String>>, Error>> + Send;
|
||||
|
||||
/// As [`SecretStore::set_cert_role_policies`].
|
||||
fn set_cert_role_policies(
|
||||
&self,
|
||||
mount: &str,
|
||||
name: &str,
|
||||
policies: &[&str],
|
||||
) -> impl Future<Output = Result<(), Error>> + Send;
|
||||
|
||||
/// As [`SecretStore::auth_mount_accessor`].
|
||||
fn auth_mount_accessor(
|
||||
&self,
|
||||
|
|
@ -142,6 +157,23 @@ impl AccessStore for SecretStore {
|
|||
SecretStore::set_cert_role_token_ttls(self, mount, name).await
|
||||
}
|
||||
|
||||
async fn cert_role_policies(
|
||||
&self,
|
||||
mount: &str,
|
||||
name: &str,
|
||||
) -> Result<Option<Vec<String>>, Error> {
|
||||
SecretStore::cert_role_policies(self, mount, name).await
|
||||
}
|
||||
|
||||
async fn set_cert_role_policies(
|
||||
&self,
|
||||
mount: &str,
|
||||
name: &str,
|
||||
policies: &[&str],
|
||||
) -> Result<(), Error> {
|
||||
SecretStore::set_cert_role_policies(self, mount, name, policies).await
|
||||
}
|
||||
|
||||
async fn auth_mount_accessor(&self, mount: &str) -> Result<String, Error> {
|
||||
SecretStore::auth_mount_accessor(self, mount).await
|
||||
}
|
||||
|
|
@ -385,6 +417,35 @@ pub(crate) mod fake {
|
|||
Ok(self.role(name).map(|r| r.ttls))
|
||||
}
|
||||
|
||||
async fn cert_role_policies(
|
||||
&self,
|
||||
_mount: &str,
|
||||
name: &str,
|
||||
) -> Result<Option<Vec<String>>, Error> {
|
||||
self.log(format!("cert_role_policies {name}"));
|
||||
Ok(self.role(name).map(|r| r.policies))
|
||||
}
|
||||
|
||||
async fn set_cert_role_policies(
|
||||
&self,
|
||||
_mount: &str,
|
||||
name: &str,
|
||||
policies: &[&str],
|
||||
) -> Result<(), Error> {
|
||||
self.log(format!(
|
||||
"set_cert_role_policies {name} {}",
|
||||
policies.join(",")
|
||||
));
|
||||
if self.unwritable_roles.iter().any(|r| r == name) {
|
||||
return Err(Self::denied());
|
||||
}
|
||||
// Only the policies: the store keeps the fields a write omits.
|
||||
if let Some(role) = self.roles.lock().expect("not poisoned").get_mut(name) {
|
||||
role.policies = policies.iter().map(|p| (*p).to_owned()).collect();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn set_cert_role_token_ttls(&self, _mount: &str, name: &str) -> Result<(), Error> {
|
||||
self.log(format!("set_cert_role_token_ttls {name}"));
|
||||
if self.unwritable_roles.iter().any(|r| r == name) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue