From: Matthias Heiserer <m.heiserer@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 1/3] fix #3939: add default-realm field to node config
Date: Wed, 23 Mar 2022 14:01:09 +0100 [thread overview]
Message-ID: <20220323130111.2552347-1-m.heiserer@proxmox.com> (raw)
This is probably not ideal, but I like it better than storing the
default value in the domains config, especially as pam and pbs
auth are hardcoded in the domains endpoint.
Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com>
---
pbs-api-types/src/lib.rs | 2 +-
src/api2/node/config.rs | 4 ++++
src/config/node.rs | 12 ++++++++++--
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/pbs-api-types/src/lib.rs b/pbs-api-types/src/lib.rs
index 421566f7..e1544d76 100644
--- a/pbs-api-types/src/lib.rs
+++ b/pbs-api-types/src/lib.rs
@@ -59,7 +59,7 @@ pub use userid::Userid;
pub use userid::{Realm, RealmRef};
pub use userid::{Tokenname, TokennameRef};
pub use userid::{Username, UsernameRef};
-pub use userid::{PROXMOX_GROUP_ID_SCHEMA, PROXMOX_TOKEN_ID_SCHEMA, PROXMOX_TOKEN_NAME_SCHEMA};
+pub use userid::{PROXMOX_GROUP_ID_SCHEMA, PROXMOX_TOKEN_ID_SCHEMA, PROXMOX_TOKEN_NAME_SCHEMA, PROXMOX_AUTH_REALM_SCHEMA};
#[macro_use]
mod user;
diff --git a/src/api2/node/config.rs b/src/api2/node/config.rs
index 3b267adc..068d54ca 100644
--- a/src/api2/node/config.rs
+++ b/src/api2/node/config.rs
@@ -66,6 +66,8 @@ pub enum DeletableProperty {
default_lang,
/// Delete any description
description,
+ /// Delete the default-realm property.
+ default_realm,
}
#[api(
@@ -127,6 +129,7 @@ pub fn update_node_config(
DeletableProperty::ciphers_tls_1_2 => { config.ciphers_tls_1_2 = None; },
DeletableProperty::default_lang => { config.default_lang = None; },
DeletableProperty::description => { config.description = None; },
+ DeletableProperty::default_realm => { config.default_realm = None; },
}
}
}
@@ -143,6 +146,7 @@ pub fn update_node_config(
if update.ciphers_tls_1_2.is_some() { config.ciphers_tls_1_2 = update.ciphers_tls_1_2; }
if update.default_lang.is_some() { config.default_lang = update.default_lang; }
if update.description.is_some() { config.description = update.description; }
+ if update.default_realm.is_some() { config.default_realm = update.default_realm; }
crate::config::node::save_config(&config)?;
diff --git a/src/config/node.rs b/src/config/node.rs
index ac6774e3..c6f2e50d 100644
--- a/src/config/node.rs
+++ b/src/config/node.rs
@@ -10,7 +10,7 @@ use proxmox_http::ProxyConfig;
use pbs_api_types::{
EMAIL_SCHEMA, MULTI_LINE_COMMENT_SCHEMA, OPENSSL_CIPHERS_TLS_1_2_SCHEMA,
- OPENSSL_CIPHERS_TLS_1_3_SCHEMA,
+ OPENSSL_CIPHERS_TLS_1_3_SCHEMA, PROXMOX_AUTH_REALM_SCHEMA
};
use pbs_buildcfg::configdir;
@@ -175,7 +175,11 @@ pub enum Translation {
"description" : {
optional: true,
schema: MULTI_LINE_COMMENT_SCHEMA,
- }
+ },
+ "default-realm": {
+ schema: PROXMOX_AUTH_REALM_SCHEMA,
+ optional: true,
+ },
},
)]
#[derive(Deserialize, Serialize, Updater)]
@@ -222,6 +226,10 @@ pub struct NodeConfig {
/// Node description
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
+
+ /// Default realm for authenticating
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub default_realm: Option<String>,
}
impl NodeConfig {
--
2.30.2
next reply other threads:[~2022-03-23 13:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-23 13:01 Matthias Heiserer [this message]
2022-03-23 13:01 ` [pbs-devel] [PATCH proxmox-backup 2/3] fix #3939: set default value in domains endpoint Matthias Heiserer
2022-04-11 8:12 ` Thomas Lamprecht
2022-04-11 10:20 ` Matthias Heiserer
2022-04-11 11:34 ` Thomas Lamprecht
2022-03-23 13:01 ` [pbs-devel] [PATCH proxmox-backup 3/3] fix #3939: ui: default realm setting in NodeOptionView Matthias Heiserer
2022-04-11 8:13 ` Thomas Lamprecht
2022-04-11 10:03 ` Matthias Heiserer
2022-04-11 11:41 ` Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220323130111.2552347-1-m.heiserer@proxmox.com \
--to=m.heiserer@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.