From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [RFC v2 proxmox-backup 5/5] remote.cfg: rename password to secret
Date: Thu, 5 Nov 2020 12:12:26 +0100 [thread overview]
Message-ID: <20201105111226.4105475-6-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20201105111226.4105475-1-f.gruenbichler@proxmox.com>
to make it a bit less confusing
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
or split it into two entirely? not sure..
debian/postinst | 1 +
src/api2/config/remote.rs | 22 +++++++++++-----------
src/config/remote.rs | 8 ++++----
www/window/RemoteEdit.js | 8 ++++----
4 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/debian/postinst b/debian/postinst
index 6a0cf9fd..030b4021 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -34,6 +34,7 @@ case "$1" in
flock -w 30 /etc/proxmox-backup/.remote.lck \
sed -i \
-e 's/^\s\+userid /\tauth-id /g' \
+ -e 's/^\s\+password /\tsecret /g' \
/etc/proxmox-backup/remote.cfg || true
fi
fi
diff --git a/src/api2/config/remote.rs b/src/api2/config/remote.rs
index 29b14472..3b9c1427 100644
--- a/src/api2/config/remote.rs
+++ b/src/api2/config/remote.rs
@@ -43,7 +43,7 @@ pub fn list_remotes(
let mut list: Vec<remote::Remote> = config.convert_to_typed_array("remote")?;
// don't return password in api
for remote in &mut list {
- remote.password = "".to_string();
+ remote.secret = "".to_string();
}
let list = list
@@ -81,8 +81,8 @@ pub fn list_remotes(
"auth-id": {
type: Authid,
},
- password: {
- schema: remote::REMOTE_PASSWORD_SCHEMA,
+ secret: {
+ schema: remote::REMOTE_SECRET_SCHEMA,
},
fingerprint: {
optional: true,
@@ -95,12 +95,12 @@ pub fn list_remotes(
},
)]
/// Create new remote.
-pub fn create_remote(password: String, param: Value) -> Result<(), Error> {
+pub fn create_remote(secret: String, param: Value) -> Result<(), Error> {
let _lock = open_file_locked(remote::REMOTE_CFG_LOCKFILE, std::time::Duration::new(10, 0), true)?;
let mut data = param.clone();
- data["password"] = Value::from(base64::encode(password.as_bytes()));
+ data["secret"] = Value::from(base64::encode(secret.as_bytes()));
let remote: remote::Remote = serde_json::from_value(data)?;
let (mut config, _digest) = remote::config()?;
@@ -140,7 +140,7 @@ pub fn read_remote(
) -> Result<remote::Remote, Error> {
let (config, digest) = remote::config()?;
let mut data: remote::Remote = config.lookup("remote", &name)?;
- data.password = "".to_string(); // do not return password in api
+ data.secret = "".to_string(); // do not return password in api
rpcenv["digest"] = proxmox::tools::digest_to_hex(&digest).into();
Ok(data)
}
@@ -182,9 +182,9 @@ pub enum DeletableProperty {
optional: true,
type: Authid,
},
- password: {
+ secret: {
optional: true,
- schema: remote::REMOTE_PASSWORD_SCHEMA,
+ schema: remote::REMOTE_SECRET_SCHEMA,
},
fingerprint: {
optional: true,
@@ -215,7 +215,7 @@ pub fn update_remote(
host: Option<String>,
port: Option<u16>,
auth_id: Option<Authid>,
- password: Option<String>,
+ secret: Option<String>,
fingerprint: Option<String>,
delete: Option<Vec<DeletableProperty>>,
digest: Option<String>,
@@ -253,7 +253,7 @@ pub fn update_remote(
if let Some(host) = host { data.host = host; }
if port.is_some() { data.port = port; }
if let Some(auth_id) = auth_id { data.auth_id = auth_id; }
- if let Some(password) = password { data.password = password; }
+ if let Some(secret) = secret { data.secret = secret; }
if let Some(fingerprint) = fingerprint { data.fingerprint = Some(fingerprint); }
@@ -306,7 +306,7 @@ pub fn delete_remote(name: String, digest: Option<String>) -> Result<(), Error>
/// Helper to get client for remote.cfg entry
pub async fn remote_client(remote: remote::Remote) -> Result<HttpClient, Error> {
let options = HttpClientOptions::new()
- .password(Some(remote.password.clone()))
+ .password(Some(remote.secret.clone()))
.fingerprint(remote.fingerprint.clone());
let client = HttpClient::new(
diff --git a/src/config/remote.rs b/src/config/remote.rs
index 20fd39d4..ee537c9a 100644
--- a/src/config/remote.rs
+++ b/src/config/remote.rs
@@ -21,7 +21,7 @@ lazy_static! {
static ref CONFIG: SectionConfig = init();
}
-pub const REMOTE_PASSWORD_SCHEMA: Schema = StringSchema::new("Password or auth token for remote host.")
+pub const REMOTE_SECRET_SCHEMA: Schema = StringSchema::new("Password or auth token for remote host.")
.format(&PASSWORD_FORMAT)
.min_length(1)
.max_length(1024)
@@ -47,8 +47,8 @@ pub const REMOTE_PASSWORD_SCHEMA: Schema = StringSchema::new("Password or auth t
"auth-id": {
type: Authid,
},
- password: {
- schema: REMOTE_PASSWORD_SCHEMA,
+ secret: {
+ schema: REMOTE_SECRET_SCHEMA,
},
fingerprint: {
optional: true,
@@ -69,7 +69,7 @@ pub struct Remote {
pub auth_id: Authid,
#[serde(skip_serializing_if="String::is_empty")]
#[serde(with = "proxmox::tools::serde::string_as_base64")]
- pub password: String,
+ pub secret: String,
#[serde(skip_serializing_if="Option::is_none")]
pub fingerprint: Option<String>,
}
diff --git a/www/window/RemoteEdit.js b/www/window/RemoteEdit.js
index 4a4d8114..b65f2da6 100644
--- a/www/window/RemoteEdit.js
+++ b/www/window/RemoteEdit.js
@@ -22,7 +22,7 @@ Ext.define('PBS.window.RemoteEdit', {
me.method = name ? 'PUT' : 'POST';
me.autoLoad = !!name;
return {
- passwordEmptyText: me.isCreate ? '' : gettext('Unchanged'),
+ secretEmptyText: me.isCreate ? '' : gettext('Unchanged'),
};
},
@@ -97,10 +97,10 @@ Ext.define('PBS.window.RemoteEdit', {
{
xtype: 'textfield',
inputType: 'password',
- fieldLabel: gettext('Password'),
- name: 'password',
+ fieldLabel: gettext('Password')+'/'+gettext('Secret'),
+ name: 'secret',
cbind: {
- emptyText: '{passwordEmptyText}',
+ emptyText: '{secretEmptyText}',
allowBlank: '{!isCreate}',
},
},
--
2.20.1
next prev parent reply other threads:[~2020-11-05 11:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-05 11:12 [pbs-devel] [PATCH v2 proxmox-backup 0/5] remote scanning Fabian Grünbichler
2020-11-05 11:12 ` [pbs-devel] [PATCH v2 proxmox-backup 1/5] types: extract DataStoreListItem Fabian Grünbichler
2020-11-05 12:20 ` [pbs-devel] applied: " Thomas Lamprecht
2020-11-05 11:12 ` [pbs-devel] [PATCH v2 proxmox-backup 2/5] api: refactor remote client and add remote scan Fabian Grünbichler
2020-11-05 12:20 ` [pbs-devel] applied: " Thomas Lamprecht
2020-11-05 11:12 ` [pbs-devel] [PATCH v2 proxmox-backup 3/5] www: add remote store selector Fabian Grünbichler
2020-11-05 12:21 ` [pbs-devel] applied: " Thomas Lamprecht
2020-11-05 11:12 ` [pbs-devel] [PATCH v2 proxmox-backup 4/5] remote.cfg: rename userid to 'auth-id' Fabian Grünbichler
2020-11-10 12:30 ` [pbs-devel] applied: " Thomas Lamprecht
2020-11-05 11:12 ` Fabian Grünbichler [this message]
2020-11-10 12:31 ` [pbs-devel] [RFC v2 proxmox-backup 5/5] remote.cfg: rename password to secret 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=20201105111226.4105475-6-f.gruenbichler@proxmox.com \
--to=f.gruenbichler@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox