public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox Backup Server development discussion
	<pbs-devel@lists.proxmox.com>, Oguz Bektas <o.bektas@proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup] add datastore info api call
Date: Thu, 22 Oct 2020 12:39:19 +0200	[thread overview]
Message-ID: <9e3ec247-1bb1-7975-fba8-e283c3025d1e@proxmox.com> (raw)
In-Reply-To: <20201022091729.GA14703@gaia.proxmox.com>

On 22.10.20 11:17, Oguz Bektas wrote:
> hi,
> 
> On Thu, Oct 22, 2020 at 10:02:23AM +0200, Fabian Grünbichler wrote:
>>
>> why READ and not AUDIT | BACKUP ? why partial if you only pass a single 
>> privilege?
> 
> i thought the minimum privilege should be view. one might want to add a
> datastore where only read access is given to them, to be able to restore
> backups from it for example. imposing audit/backup privs would prevent
> this, afaict
> 
>>
>>> +    },
>>> +)]
>>> +/// Get information about the datastore.
>>> +///
>>> +/// Provides PBS node fingerprint, address and datastore name
>>> +pub fn info(
>>> +    store: String,
>>> +    _info: &ApiMethod,
>>> +    _rpcenv: &mut dyn RpcEnvironment,
>>> +) -> Result<DataStoreInfo, Error> {
>>> +    let _datastore = DataStore::lookup_datastore(&store)?;
>>> +    let cert = CertInfo::new()?;
>>> +    let fingerprint = cert.fingerprint()?;
>>> +
>>> +    // get all possible interface IP addresses since there's
>>> +    // no explicit way to tell which is needed
>>> +    let (config, _) = network::config()?;
>>> +    let mut address_list = Vec::new();
>>> +    for (_ , interface) in config.interfaces.iter() {
>>> +        if let Some(cidr) = &interface.cidr {
>>> +            address_list.push(cidr.to_owned());
>>> +        }
>>> +    }
>>
>> doesn't this leak information that the user would/should not have access 
>> to? I mean, if I can do an API call I already have some way to reach the 
>> PBS server and we could just default to that on the client side.. 
>> possibly it would make sense to declare some interface as the 
>> 'external/public' one and return that if configured, but just returning 
>> all addresses of all interfaces seems a bit much..
> 
> yes, i wasn't sure how to handle this since in PVE we just take the
> corosync link but here it can be any interface.
> 
> i do like the suggestion to declare an interface the "public" one.
> but there could be multiple interfaces being utilized as well (like f.e.
> if the server has 2 addresses on two different subnets, with different
> datastores). then it would make things harder.
> 
> i'm open to different suggestions.
> 

The gui, or the CLI client could really just add the host/address used to make
the API call and put it into the presented encoded information.

One would have the client IP through the rpcenv, and could make some decision
based on that, theoretically, but I'd prefer the "client should fill in" 
approach over this.





  reply	other threads:[~2020-10-22 10:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-21 14:01 Oguz Bektas
2020-10-22  8:02 ` Fabian Grünbichler
2020-10-22  9:17   ` Oguz Bektas
2020-10-22 10:39     ` Thomas Lamprecht [this message]
2020-10-22 11:00     ` Fabian Grünbichler
2020-10-22 11:35       ` Oguz Bektas

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=9e3ec247-1bb1-7975-fba8-e283c3025d1e@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=o.bektas@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal