Commit Graph

1021 Commits

Author SHA1 Message Date
Stefan Reiter
ce007e99ff tools: get_host_arch: return raw uname machine entry
The current version had only one user in LXC, so move the LXC-specific
code there to reuse this in QemuServer.

Also cache, since the host's architecture can't change during runtime.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-10-29 07:13:54 +01:00
Wolfgang Bumiller
a79f03d9a6 OTP: support v2 secret format
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-10-29 06:27:39 +01:00
Wolfgang Bumiller
6e2343254e JSONSchema: add TFA-secret format; support longer secrets
The old format used 16 base32 chars or 40 hex digits. Since they have
a common subset it's hard to distinguish them without the our
previous length constraints, so prefix a 'v2-' of the format to
support arbitrary lengths properly.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-29 06:26:55 +01:00
Thomas Lamprecht
4074d3722c bump version to 6.0-5
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-20 16:39:38 +02:00
Alexandre Derumier
f48815f8b6 etc_network_interfaces : handle autostart for ovs
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2019-09-20 16:39:38 +02:00
Thomas Lamprecht
bd9cc42d82 network: followup code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-20 09:43:29 +02:00
Alexandre Derumier
4ac94c72a2 network_interfaces: use allow-ovs for OVSBridge
new openvswitch-switch service use "ifup --allow-ovs",
and this race with "auto ..." used by networking service

bug reported here:
https://forum.proxmox.com/threads/so-is-openvswitch-bonding-just-broken-on-pve-6-whats-going-on.58020/

This is also fixing ovs with ifupdown2

Openvswitch github have a note about this:
e0dfd67b45 (diff-555e6da95251766b76e83867900bd8fe)

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2019-09-20 09:06:47 +02:00
Thomas Lamprecht
9bbc4e174c tree wide trailing whitespace cleanup
generated with:
 # find . -name '*.pm' -exec sed -i 's/\s\+$//' {} \;

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-09 16:42:12 +02:00
Alexandre Derumier
d949babe56 etc_network_interfaces : add uplink-id option
uplink-id is an integer

it's used to abstract the interface name (could be different on
differents hosts)
and map it to a transportzone.

uplink-id is only allowed on physical interfaces (bond,eth,vlan)
as it's used for traffic to external

example:

auto eth0
iface eth0 inet manual
        uplink-id 1

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2019-09-09 16:41:12 +02:00
Thomas Lamprecht
c5c5812e23 add postinst hook to fix /etc/aliases whitespace error
This was wrongly shipped by our ISO since quite a bit (AFAICT, at
least 4.x), so fix it up in a versioned postinst snippet.

Do so by usind sed with the following pattern:
 # sed -E -i -e 's/^www:(\w)/www: \1/' /etc/aliases
proposed by Musee Ullah[0]. It even catches a bit more than exactly
our misstep, may help if one copied this line, or added some other
addresses to this specific aliases entry.

Do this here, in pve-common, as it makes it sligthly simpler to roll
the change out to both, PVE and PMG.

[0]: https://pve.proxmox.com/pipermail/pve-user/2019-September/170998.html

Reported-by: Uwe Sauter <uwe.sauter.de@gmail.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-05 12:35:55 +02:00
Fabian Ebner
9e594bd42e SectionConfig: Cleanup to make style consistent
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2019-09-04 16:18:19 +02:00
Fabian Ebner
e1fbb779f7 Fix 2339: Handle multiple blank lines correctly in SectionConfig
It turns out that the line number counting was also broken (even on
files without multiple blanks), since the body of the while inside
the nextline subroutine would not be executed for a blank.
I guess the subroutine was intended to skip comments and blanks, but
since we use blanks to recognize the end of a section, I changed it
to only skip comments.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2019-09-04 16:17:55 +02:00
Wolfgang Bumiller
9e3aaec494 cli: prettify tables even more
Separate the header with a double line.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-04 15:58:58 +02:00
Thomas Lamprecht
454882c392 bump version to 6.0-4
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-08-17 11:31:53 +02:00
Fabian Grünbichler
6cf6b40469 tools: add fchownat syscall
and constant AT_EMPTY_PATH for chowning a directory/file opened via
openat(2), for example when walking/creating a directory tree without
following symlinks.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-08-14 15:33:19 +02:00
Stoiko Ivanov
6bd0783c11 CLIHandler: consider valid prefixes for completion
With the change introduced in 57c0d0c69c
completion of partial commands stopped working (e.g. typing qm res<TAB><TAB>
yields nothing instead of 'reset resize resume rescan')

By returning undef as 'ref' 'print_bash_completion' has no reference of the
available (sub) commands anymore.

By checking if the current argument is a valid prefix of a possible command,
and conditionally not setting the 'ref' hash to undef, the functionality is
restored.

Additionally a small whitespace glitch was fixed.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-08-14 11:13:06 +02:00
Stoiko Ivanov
93e9f666ab CLIHandler: remove spurious abort()
The abort currently cannot be reached, instead the error with the same
message (unknown command '$cmdstr') in handle_cmd is raised.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-08-14 11:13:06 +02:00
Stefan Reiter
5c1556cd27 fix #2303: detect IPs of p2p interfaces
"ip address show" prints:

    inet ADDR peer PEERADDR/32 scope global DEVICE

for pointtopoint interfaces. We're not interested in the netmask itself,
just make the Regex match.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-07-29 16:07:09 +02:00
Thomas Lamprecht
8a27e4a457 buildsys: use dpkg-dev makefile helpers for pkg info
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-23 09:32:29 +02:00
Thomas Lamprecht
949db6e320 bump version to 6.0-3
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-23 09:15:34 +02:00
Thomas Lamprecht
3982313e8d array_intersect: allow passing list of references for convenience
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-23 09:14:34 +02:00
Thomas Lamprecht
26a68cf6d8 array_intersect: followup: early exit if first empty intersection found
no point in trying more

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-23 09:04:22 +02:00
Thomas Lamprecht
3858602867 followup: code comments and small "cleanups"
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-23 09:03:23 +02:00
Thomas Lamprecht
4c28a8bc69 follouwp: maker array_unique private for now
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-23 08:50:11 +02:00
Stefan Reiter
a59544e779 Add array_intersect and array_unique functions
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-07-23 08:46:49 +02:00
Stefan Reiter
568abb4bfb Include CPU flags in read_cpuinfo
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-07-23 08:46:49 +02:00
Alwin Antreich
96ab1135fe cert: add public key type & size to JSON schema
Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2019-07-23 08:39:33 +02:00
Fabian Grünbichler
afa3f36910 cert: add public key type and size to info
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Co-Authored-By: Alwin Antreich <a.antreich@proxmox.com>
2019-07-23 08:39:33 +02:00
Thomas Lamprecht
cca9c8642d section config: trailing whitespace cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-05 16:32:57 +02:00
Thomas Lamprecht
95ff6bd082 bump version to 6.0-2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-24 17:16:57 +02:00
Oguz Bektas
db02e0e74a use hmac_sha256 when assembling csrf token
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2019-06-19 12:29:35 +02:00
Thomas Lamprecht
5fe1f60c5f followup: fix quoting and comment
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-19 12:29:35 +02:00
Oguz Bektas
62fc2ad81e add fallback/new csrf token recognition
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2019-06-19 12:02:36 +02:00
Wolfgang Bumiller
b8d15bfd69 systemd: add wait_for_unit_removed
And split out the common code into a systemd_call() sub.

This connects to the systemd bus and waits for a UnitRemoved
event to occur for the specified unit, with an optional
timeout.

We'll use this in qemu-server to wait for a VM's scope to
disappear completely before trying to start a VM's scope
anew.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-19 10:11:03 +02:00
Thomas Lamprecht
2ccac1a40f bump version to 6.0-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-14 20:30:47 +02:00
Thomas Lamprecht
4515aaec1e inotify: network/interfaces: fix 'Use of uninitialized value' for netmask
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-12 12:01:08 +02:00
Dominik Csapak
cc6792c7af print defaulttxt as sprintf parameter
instead of having it verbatim in the format string.
This enables us to have '%' in the defaulttext without getting errors

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-06 11:29:19 +02:00
Wolfgang Bumiller
cf6a4c54d9 fixup for the last version bump
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-05 09:11:10 +02:00
Thomas Lamprecht
ec2fc9c2cd bump version to 6.0-0+2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-23 13:01:15 +02:00
Thomas Lamprecht
ffbc3c08b8 assemble_spice_ticket: ensure variable in interpolated string are correct
In older perl the following two where the same:

"$foo::$bar" == "${foo}::${bar}"

But in perl 5, version 28 it's not anymore,

"$foo::$bar" would be equivalent to "${foo::}${bar}", the double
colons are now not used as variable name boundary, so mark that
explicitly in the affected case and surrounding ones preventively

This fixes authentication with spice* related stuff again.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-23 12:52:22 +02:00
Thomas Lamprecht
4d7b1156cc buildsys: change upload dist to buster
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-21 18:23:03 +02:00
Thomas Lamprecht
9954f8c6d4 bump version for buster
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-21 18:23:03 +02:00
Thomas Lamprecht
b94d4081a0 d/control: fix priority-extra-is-replaced-by-priority-optional
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-16 17:12:51 +02:00
Thomas Lamprecht
7e7b29389e bump version to 5.0-52
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-15 14:16:17 +02:00
Thomas Lamprecht
821d408dc4 JSONSchema: sort keys when dumping config for stabillity
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-15 14:11:53 +02:00
Thomas Lamprecht
95244fd7fa followup: use defined to check if a hash element can be accessed
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-15 10:20:01 +02:00
Dominik Csapak
d0ba18e17e prevent autovivification of sectionconfig options
If, somehow, someone passes a config to check_config with keys set
that are not in the options for that type, this fixed check
lead to autovivification, meaning that any future calls to the same
worker had an additional option for that type which is not optional

this lead to a wrongfully deleting of entries when updating an entry of
a different type, since all entries of the original types suddenly
did not satisfy their required options and would not get parsed
by read_file anymore (thus missing when a successful write_file was done)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-05-15 10:16:33 +02:00
Thomas Lamprecht
c0b8717c44 print api res: always allow result to be undef if optional
If the return schema says that it's optionally returns something then
we want to allow returning nothing, i.e., undef

Co-developed-by: Dominic Jäger <d.jaeger@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-13 06:52:28 +00:00
Thomas Lamprecht
b610385849 followup code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-08 15:36:14 +00:00
Dominik Csapak
2896245e75 INotify: map address/netmask to cidr while parsing interfaces
this allows us to always show the 'address' the 'netmask' and the 'cidr'
both for ipv4 and ipv6

there is a small api change involved in one scenario:
if one manually changed the address to cidr format like
    '10.0.0.4/24'

we now get from the api the parsed values
    addr => 10.0.0.4
    netmask => 24
    cidr => 10.0.0.4/24

instead of
    addr => 10.0.0.4/24
    netmask =>

but i think that circumventing our api when writing the file, but still
relying on the api for reading is not a valid use case, i would argue
that we can change this, especially since we have a new field that
contains that information again (cidr)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-05-08 14:49:45 +00:00