pve-apiclient.git
4 weeks agod/compate: update to 10 master
Thomas Lamprecht [Mon, 14 Dec 2020 19:44:03 +0000 (20:44 +0100)]
d/compate: update to 10

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 weeks agobump version to 3.1-3
Thomas Lamprecht [Fri, 4 Dec 2020 11:25:32 +0000 (12:25 +0100)]
bump version to 3.1-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 weeks agoimprove protocol selection heuristic
Thomas Lamprecht [Fri, 4 Dec 2020 11:18:45 +0000 (12:18 +0100)]
improve protocol selection heuristic

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 weeks agobump version to 3.1-2
Thomas Lamprecht [Thu, 3 Dec 2020 15:09:08 +0000 (16:09 +0100)]
bump version to 3.1-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 weeks agodefault to verifying cert hostname if no fingerprint is passed
Thomas Lamprecht [Thu, 3 Dec 2020 15:07:50 +0000 (16:07 +0100)]
default to verifying cert hostname if no fingerprint is passed

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 weeks agocert verification: trust openssl result if hostnames are verified
Thomas Lamprecht [Thu, 3 Dec 2020 15:00:00 +0000 (16:00 +0100)]
cert verification: trust openssl result if hostnames are verified

If we verified that the hostname matches the cert we can also trust
the openssl verification result.

We get the openssl result as first parameter[0].

[0]: https://metacpan.org/pod/IO::Socket::SSL#SSL_verify_callback

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 weeks agoformat/code cleanup
Thomas Lamprecht [Thu, 3 Dec 2020 14:59:06 +0000 (15:59 +0100)]
format/code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 weeks agoclient exception: try to avoid HTTP code duplication in error string
Thomas Lamprecht [Thu, 3 Dec 2020 14:55:53 +0000 (15:55 +0100)]
client exception: try to avoid HTTP code duplication in error string

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 weeks agoexamples: add CLI like example for easier re-use with non-local host
Thomas Lamprecht [Thu, 3 Dec 2020 14:55:11 +0000 (15:55 +0100)]
examples: add CLI like example for easier re-use with non-local host

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 weeks agobump version to 3.1-1
Thomas Lamprecht [Mon, 30 Nov 2020 14:30:23 +0000 (15:30 +0100)]
bump version to 3.1-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 weeks agouse two-argument bless
Thomas Lamprecht [Mon, 30 Nov 2020 14:03:30 +0000 (15:03 +0100)]
use two-argument bless

else we'd break "inheriting" (or whatever perl does is called) to
child modules

> Never use the one-argument form of bless.
-- Perl Best Practices, Pg. 365

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 weeks agodo not save user-agent ssl_opts in $self
Thomas Lamprecht [Mon, 30 Nov 2020 14:02:29 +0000 (15:02 +0100)]
do not save user-agent ssl_opts in $self

one can always get it from the useragent, changing it here would not
do anything anyway, so this also avoids some possible confusion.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 weeks agorework FP verify callback to avoid creating refcount cycle
Thomas Lamprecht [Mon, 30 Nov 2020 14:00:38 +0000 (15:00 +0100)]
rework FP verify callback to avoid creating refcount cycle

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 weeks agosort use statements, drop Data::Dumper
Thomas Lamprecht [Mon, 30 Nov 2020 14:01:49 +0000 (15:01 +0100)]
sort use statements, drop Data::Dumper

print to_json($ref, {pretty=>1,utf8=>1,canonical=>1})."\n";

is nicer anyway ;-)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobump version to 3.0-3
Thomas Lamprecht [Fri, 7 Feb 2020 06:54:35 +0000 (07:54 +0100)]
bump version to 3.0-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agoimplement api token support
Fabian Grünbichler [Thu, 30 Jan 2020 11:07:52 +0000 (12:07 +0100)]
implement api token support

and add an example for it.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
16 months agofix #2227: enable totp codes to be passed in cli
Oguz Bektas [Fri, 16 Aug 2019 11:51:34 +0000 (13:51 +0200)]
fix #2227: enable totp codes to be passed in cli

this patch enables to pass totp codes during cluster join if tfa has
been enabled for root@pam (or any other user actually, but having it enabled on
root causes problems during cluster join).

u2f support is not yet implemented.

Co-developed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Co-developed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
18 months agobump version to 3.0-2
Thomas Lamprecht [Thu, 11 Jul 2019 17:29:54 +0000 (19:29 +0200)]
bump version to 3.0-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agologin TFA exception: also print username and use raise
Thomas Lamprecht [Thu, 27 Jun 2019 20:04:33 +0000 (22:04 +0200)]
login TFA exception: also print username and use raise

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agocheck for tfa during cluster join, abort if yes
Oguz Bektas [Thu, 27 Jun 2019 16:00:48 +0000 (18:00 +0200)]
check for tfa during cluster join, abort if yes

momentarily, we check for tfa in the cluster join and abort if it's
enabled, since the tfa ticket is not being handled correctly atm, which
caused a '401 No ticket' error[0][1].

todo is to ask with a prompt on gui and cli to enable totp and possible
u2f in the future

[0]: https://forum.proxmox.com/threads/failed-to-add-cluster-node-401-no-ticket.54882/
[1]: https://bugzilla.proxmox.com/show_bug.cgi?id=2227

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
19 months agobuildsys: change upload dist to buster
Thomas Lamprecht [Tue, 21 May 2019 16:34:43 +0000 (18:34 +0200)]
buildsys: change upload dist to buster

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
19 months agod/control: update standards version
Thomas Lamprecht [Tue, 21 May 2019 16:33:12 +0000 (18:33 +0200)]
d/control: update standards version

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
19 months agobump version to 3.0-1
Thomas Lamprecht [Tue, 21 May 2019 15:28:30 +0000 (17:28 +0200)]
bump version to 3.0-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
19 months agod/control: add defined ${perl:Depends} to dependency list
Thomas Lamprecht [Tue, 21 May 2019 14:47:49 +0000 (16:47 +0200)]
d/control: add defined ${perl:Depends} to dependency list

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
19 months agoset debian source format to 1.0
Thomas Lamprecht [Tue, 21 May 2019 14:46:45 +0000 (16:46 +0200)]
set debian source format to 1.0

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
19 months agodebian/rules should be executable
Thomas Lamprecht [Tue, 21 May 2019 14:46:27 +0000 (16:46 +0200)]
debian/rules should be executable

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
20 months agoMerge missing changelog entry
Dietmar Maurer [Wed, 24 Apr 2019 09:14:19 +0000 (11:14 +0200)]
Merge missing changelog entry

2 years agoGet version information from changelog
Rhonda D'Vine [Fri, 28 Dec 2018 17:24:07 +0000 (18:24 +0100)]
Get version information from changelog

The duplication of the version information both in the Makefile and in
debian/changelog is a potential error point, and an unneeded one.

Signed-off-by: Rhonda D'Vine <rhonda@proxmox.com>
2 years agoAdd SOURCE file
Rhonda D'Vine [Fri, 28 Dec 2018 17:24:06 +0000 (18:24 +0100)]
Add SOURCE file

This package was missing the SOURCE information from the binary package.

Signed-off-by: Rhonda D'Vine <rhonda@proxmox.com>
2 years agoAdd "make dsc" target
Rhonda D'Vine [Fri, 28 Dec 2018 17:24:05 +0000 (18:24 +0100)]
Add "make dsc" target

This target is required to make the package build automatically.

Signed-off-by: Rhonda D'Vine <rhonda@proxmox.com>
2 years agobump version to 2.0-5
Dietmar Maurer [Tue, 19 Jun 2018 11:05:58 +0000 (13:05 +0200)]
bump version to 2.0-5

2 years agoadd make target to copy and include files from pve-common - update Exception.pm
Dietmar Maurer [Thu, 14 Jun 2018 07:59:17 +0000 (09:59 +0200)]
add make target to copy and include files from pve-common - update Exception.pm

2 years agobump version to 2.0-4
Wolfgang Bumiller [Mon, 22 Jan 2018 14:15:09 +0000 (15:15 +0100)]
bump version to 2.0-4

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoavoid harmful '<>' pattern, explicitly read from STDIN
Thomas Lamprecht [Mon, 22 Jan 2018 09:52:13 +0000 (10:52 +0100)]
avoid harmful '<>' pattern, explicitly read from STDIN

Fixes problems in CLIHandler using the code pattern:

while (my $line = <>) {
    ...
}

For why this causes only _now_ problems lets first look how <>
behaves:

"The null filehandle <> is special: [...] Input from <> comes either
from standard input, or from each file listed on the command line.
Here's how it works: the first time <> is evaluated, the @ARGV array
is checked, and if it is empty, $ARGV[0] is set to "-" , which when
opened gives you standard input.  The @ARGV array is then processed
as a list of filenames." - 'perldoc perlop'

Recent changes in the CLIHandler code changed how we modfiied @ARGV
Earlier we assumed that the first argument must be the command and
thus shifted it out of @ARGV, now we can have multiple levels of
(sub)commands. This change also changed how we handle @ARGV, we do
not unshift anything but go through the arguments until we got to
the final command and copy the rest of @ARGV as we know that this
must be the commandos arguments.

For '<>' this means that ARGV was still fully populated and perl
tried to open element as a file, which naturally failed.
Thus the change in pve-common only exposed this 'dangerous' code
pattern.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 2.0-3
Fabian Grünbichler [Wed, 17 Jan 2018 13:17:10 +0000 (14:17 +0100)]
bump version to 2.0-3

3 years agoraise exception if manual fingerprint verification failed
Thomas Lamprecht [Thu, 14 Dec 2017 10:12:06 +0000 (11:12 +0100)]
raise exception if manual fingerprint verification failed

If a fingerprint could not be verified automatically or manually
raise an exception to ensure that we do not continue with handling
the problematic or even evil response.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agouse new Exception.pm class to signal errors to caller
Thomas Lamprecht [Thu, 14 Dec 2017 10:12:05 +0000 (11:12 +0100)]
use new Exception.pm class to signal errors to caller

Allows a caller to acces the HTTP response code, which may be useful
to handle application logic. E.g., catching a HTTP_NOT_IMPLEMENTED
and fallback to an older method.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoadd APIClient/Exception.pm class
Thomas Lamprecht [Thu, 14 Dec 2017 10:12:04 +0000 (11:12 +0100)]
add APIClient/Exception.pm class

As we do not want to depend on PVE libraries with this I forked of
the PVE::Exception class, removed all raise_* methods so that only
raise() itself was left over.

Also some minor adaptions to newer style for exporting where used.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobuildsys: also cleanup *.buildinfo files
Thomas Lamprecht [Thu, 14 Dec 2017 10:38:17 +0000 (11:38 +0100)]
buildsys: also cleanup *.buildinfo files

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoadd missing if
Fabian Grünbichler [Tue, 12 Dec 2017 10:02:48 +0000 (11:02 +0100)]
add missing if

3 years agocleanup Net::SSLeay error handling
Fabian Grünbichler [Mon, 27 Nov 2017 09:18:48 +0000 (10:18 +0100)]
cleanup Net::SSLeay error handling

X509_get_fingerprint does not die - it only returns undef in case of
errors (or segfaults if the $cert pointer is invalid).

3 years agobuild: reformat debian/control
Fabian Grünbichler [Wed, 4 Oct 2017 09:05:33 +0000 (11:05 +0200)]
build: reformat debian/control

using wrap-and-sort -abt

3 years agobump version to 2.0-2
Dietmar Maurer [Thu, 6 Apr 2017 09:04:48 +0000 (11:04 +0200)]
bump version to 2.0-2

3 years agoallow to specify cookie_name
Dietmar Maurer [Thu, 6 Apr 2017 09:03:41 +0000 (11:03 +0200)]
allow to specify cookie_name

3 years agobump version tp 2.0-1 for debain stretch
Dietmar Maurer [Fri, 10 Mar 2017 08:07:50 +0000 (09:07 +0100)]
bump version tp 2.0-1 for debain stretch

Makefile: use "--product pmg,pve --dist stretch" for upload target

4 years agoperftest1.pl: another example
Dietmar Maurer [Wed, 28 Dec 2016 10:35:30 +0000 (11:35 +0100)]
perftest1.pl: another example

4 years agoexample2.pl: add a second example
Dietmar Maurer [Wed, 28 Dec 2016 10:04:37 +0000 (11:04 +0100)]
example2.pl: add a second example

4 years agoexample1.pl: remove unnecessary perfix /api2/json/
Dietmar Maurer [Wed, 28 Dec 2016 09:52:09 +0000 (10:52 +0100)]
example1.pl: remove unnecessary perfix /api2/json/

4 years agoexample1.pl: use warnings instead of -w flag
Dietmar Maurer [Wed, 28 Dec 2016 09:49:20 +0000 (10:49 +0100)]
example1.pl: use warnings instead of -w flag

4 years agoadd simple example code, bump version to 1.0-2
Dietmar Maurer [Wed, 28 Dec 2016 09:47:23 +0000 (10:47 +0100)]
add simple example code, bump version to 1.0-2

4 years agoadd missing dependencies
Dietmar Maurer [Fri, 16 Dec 2016 08:34:14 +0000 (09:34 +0100)]
add missing dependencies

4 years agoadd dintsall target
Dietmar Maurer [Fri, 16 Dec 2016 08:23:14 +0000 (09:23 +0100)]
add dintsall target

4 years agoadd Makefile and debian package files
Dietmar Maurer [Fri, 16 Dec 2016 08:21:41 +0000 (09:21 +0100)]
add Makefile and debian package files

4 years agoinitial import
Dietmar Maurer [Fri, 16 Dec 2016 07:52:37 +0000 (08:52 +0100)]
initial import

copied from pve-gui-tests