Convert qubesagent module to python3
This and all files using it. QubesOS/qubes-issues#5297
This commit is contained in:
parent
73648ca038
commit
a899adb69e
2
Makefile
2
Makefile
@ -11,7 +11,7 @@ BINDIR ?= /usr/bin
|
|||||||
LIBDIR ?= /usr/lib
|
LIBDIR ?= /usr/lib
|
||||||
SYSLIBDIR ?= /lib
|
SYSLIBDIR ?= /lib
|
||||||
|
|
||||||
PYTHON ?= /usr/bin/python2
|
PYTHON ?= /usr/bin/python3
|
||||||
PYTHON_SITEARCH = $(shell python2 -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1)')
|
PYTHON_SITEARCH = $(shell python2 -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1)')
|
||||||
PYTHON2_SITELIB = $(shell python2 -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib()')
|
PYTHON2_SITELIB = $(shell python2 -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib()')
|
||||||
PYTHON3_SITELIB = $(shell python3 -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())')
|
PYTHON3_SITELIB = $(shell python3 -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())')
|
||||||
|
@ -61,10 +61,10 @@ build() {
|
|||||||
# * core systemd services and drop-ins
|
# * core systemd services and drop-ins
|
||||||
# * basic network functionality (setting IP address, DNS, default gateway)
|
# * basic network functionality (setting IP address, DNS, default gateway)
|
||||||
package_qubes-vm-core() {
|
package_qubes-vm-core() {
|
||||||
depends=("qubes-vm-utils>=3.1.3" python2 python2-xdg ethtool ntp net-tools
|
depends=("qubes-vm-utils>=3.1.3" python2 python3-xdg ethtool ntp net-tools
|
||||||
gnome-packagekit imagemagick fakeroot notification-daemon dconf
|
gnome-packagekit imagemagick fakeroot notification-daemon dconf
|
||||||
zenity qubes-libvchan "qubes-db-vm>=3.2.1" haveged python2-gobject
|
zenity qubes-libvchan "qubes-db-vm>=3.2.1" haveged python3-gobject
|
||||||
python2-dbus xdg-utils notification-daemon gawk sed procps-ng librsvg
|
python3-dbus xdg-utils notification-daemon gawk sed procps-ng librsvg
|
||||||
socat
|
socat
|
||||||
)
|
)
|
||||||
optdepends=(gnome-keyring gnome-settings-daemon python2-nautilus gpk-update-viewer qubes-vm-networking qubes-vm-keyring)
|
optdepends=(gnome-keyring gnome-settings-daemon python2-nautilus gpk-update-viewer qubes-vm-networking qubes-vm-keyring)
|
||||||
@ -74,7 +74,7 @@ package_qubes-vm-core() {
|
|||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
make -C qrexec install DESTDIR="$pkgdir" SBINDIR=/usr/bin LIBDIR=/usr/lib SYSLIBDIR=/usr/lib
|
make -C qrexec install DESTDIR="$pkgdir" SBINDIR=/usr/bin LIBDIR=/usr/lib SYSLIBDIR=/usr/lib
|
||||||
|
|
||||||
PYTHON=python2 make install-corevm DESTDIR="$pkgdir" SBINDIR=/usr/bin LIBDIR=/usr/lib SYSLIBDIR=/usr/lib SYSTEM_DROPIN_DIR=/usr/lib/systemd/system USER_DROPIN_DIR=/usr/lib/systemd/user DIST=archlinux
|
make install-corevm DESTDIR="$pkgdir" SBINDIR=/usr/bin LIBDIR=/usr/lib SYSLIBDIR=/usr/lib SYSTEM_DROPIN_DIR=/usr/lib/systemd/system USER_DROPIN_DIR=/usr/lib/systemd/user DIST=archlinux
|
||||||
|
|
||||||
# Remove things non wanted in archlinux
|
# Remove things non wanted in archlinux
|
||||||
rm -r "$pkgdir/etc/yum"*
|
rm -r "$pkgdir/etc/yum"*
|
||||||
@ -122,13 +122,13 @@ EOF
|
|||||||
#
|
#
|
||||||
package_qubes-vm-networking() {
|
package_qubes-vm-networking() {
|
||||||
pkgdesc="Qubes OS tools allowing to use a Qubes VM as a NetVM/ProxyVM"
|
pkgdesc="Qubes OS tools allowing to use a Qubes VM as a NetVM/ProxyVM"
|
||||||
depends=(qubes-vm-core "qubes-vm-utils>=3.1.3" python2 ethtool net-tools
|
depends=(qubes-vm-core "qubes-vm-utils>=3.1.3" python3 ethtool net-tools
|
||||||
"qubes-db-vm>=3.2.1" networkmanager iptables tinyproxy nftables
|
"qubes-db-vm>=3.2.1" networkmanager iptables tinyproxy nftables
|
||||||
)
|
)
|
||||||
install=PKGBUILD-networking.install
|
install=PKGBUILD-networking.install
|
||||||
|
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
PYTHON=python2 make install-netvm DESTDIR="$pkgdir" SBINDIR=/usr/bin LIBDIR=/usr/lib SYSLIBDIR=/usr/lib SYSTEM_DROPIN_DIR=/usr/lib/systemd/system USER_DROPIN_DIR=/usr/lib/systemd/user DIST=archlinux
|
make install-netvm DESTDIR="$pkgdir" SBINDIR=/usr/bin LIBDIR=/usr/lib SYSLIBDIR=/usr/lib SYSTEM_DROPIN_DIR=/usr/lib/systemd/system USER_DROPIN_DIR=/usr/lib/systemd/user DIST=archlinux
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
debian/control
vendored
12
debian/control
vendored
@ -7,7 +7,7 @@ Build-Depends:
|
|||||||
libqubes-rpc-filecopy-dev (>= 3.1.3),
|
libqubes-rpc-filecopy-dev (>= 3.1.3),
|
||||||
libvchan-xen-dev,
|
libvchan-xen-dev,
|
||||||
python,
|
python,
|
||||||
python-setuptools,
|
python3-setuptools,
|
||||||
debhelper,
|
debhelper,
|
||||||
quilt,
|
quilt,
|
||||||
libxen-dev,
|
libxen-dev,
|
||||||
@ -40,11 +40,11 @@ Depends:
|
|||||||
util-linux,
|
util-linux,
|
||||||
e2fsprogs,
|
e2fsprogs,
|
||||||
python2.7,
|
python2.7,
|
||||||
python-daemon,
|
python3-daemon,
|
||||||
python-qubesdb,
|
python3-qubesdb,
|
||||||
python-gi,
|
python3-gi,
|
||||||
python-xdg,
|
python3-xdg,
|
||||||
python-dbus,
|
python3-dbus,
|
||||||
qubes-utils (>= 3.1.3),
|
qubes-utils (>= 3.1.3),
|
||||||
qubes-core-qrexec,
|
qubes-core-qrexec,
|
||||||
qubesdb-vm,
|
qubesdb-vm,
|
||||||
|
4
debian/qubes-core-agent.install
vendored
4
debian/qubes-core-agent.install
vendored
@ -107,8 +107,8 @@ usr/bin/qvm-connect-tcp
|
|||||||
usr/bin/qvm-console
|
usr/bin/qvm-console
|
||||||
usr/bin/qvm-sync-clock
|
usr/bin/qvm-sync-clock
|
||||||
usr/bin/xenstore-watch-qubes
|
usr/bin/xenstore-watch-qubes
|
||||||
usr/lib/python2.7/dist-packages/qubesagent-*.egg-info/*
|
usr/lib/python3/dist-packages/qubesagent-*.egg-info/*
|
||||||
usr/lib/python2.7/dist-packages/qubesagent/*
|
usr/lib/python3/dist-packages/qubesagent/*
|
||||||
usr/lib/qubes-bind-dirs.d/30_cron.conf
|
usr/lib/qubes-bind-dirs.d/30_cron.conf
|
||||||
usr/lib/qubes/close-window
|
usr/lib/qubes/close-window
|
||||||
usr/lib/qubes/init/bind-dirs.sh
|
usr/lib/qubes/init/bind-dirs.sh
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python2
|
#!/usr/bin/python3
|
||||||
|
|
||||||
from qubesagent.xdg import launch
|
from qubesagent.xdg import launch
|
||||||
import sys
|
import sys
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#!/usr/bin/python2
|
#!/usr/bin/python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# The Qubes OS Project, http://www.qubes-os.org
|
# The Qubes OS Project, http://www.qubes-os.org
|
||||||
#
|
#
|
||||||
# Copyright (C) 2015 Marek Marczykowski-Górecki
|
# Copyright (C) 2015-2019 Marek Marczykowski-Górecki
|
||||||
# <marmarek@invisiblethingslab.com>
|
# <marmarek@invisiblethingslab.com>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or
|
||||||
@ -21,7 +21,6 @@
|
|||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
import subprocess
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from xdg.DesktopEntry import DesktopEntry
|
from xdg.DesktopEntry import DesktopEntry
|
||||||
@ -78,8 +77,9 @@ def process_autostart(environments):
|
|||||||
if entry_should_be_started(entry, environments):
|
if entry_should_be_started(entry, environments):
|
||||||
launch(entry_path, wait=False)
|
launch(entry_path, wait=False)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print >>sys.stderr, "Failed to process '{}': {}".format(
|
print("Failed to process '{}': {}".format(
|
||||||
entry_name, str(e)
|
entry_name, str(e)),
|
||||||
|
file=sys.stderr
|
||||||
)
|
)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#!/usr/bin/python2 -O
|
|
||||||
# vim: fileencoding=utf-8
|
# vim: fileencoding=utf-8
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -103,7 +102,8 @@ class FirewallWorker(object):
|
|||||||
entries = self.qdb.multiread('/qubes-firewall/{}/'.format(target))
|
entries = self.qdb.multiread('/qubes-firewall/{}/'.format(target))
|
||||||
assert isinstance(entries, dict)
|
assert isinstance(entries, dict)
|
||||||
# drop full path
|
# drop full path
|
||||||
entries = dict(((k.split('/')[3], v) for k, v in entries.items()))
|
entries = dict(((k.split('/')[3], v.decode())
|
||||||
|
for k, v in entries.items()))
|
||||||
if 'policy' not in entries:
|
if 'policy' not in entries:
|
||||||
raise RuleParseError('No \'policy\' defined')
|
raise RuleParseError('No \'policy\' defined')
|
||||||
policy = entries.pop('policy')
|
policy = entries.pop('policy')
|
||||||
@ -377,7 +377,7 @@ class IptablesWorker(FirewallWorker):
|
|||||||
try:
|
try:
|
||||||
self.run_ipt(family, ['-F', chain])
|
self.run_ipt(family, ['-F', chain])
|
||||||
p = self.run_ipt_restore(family, ['-n'])
|
p = self.run_ipt_restore(family, ['-n'])
|
||||||
(output, _) = p.communicate(iptables)
|
(output, _) = p.communicate(iptables.encode())
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise RuleApplyError(
|
raise RuleApplyError(
|
||||||
'iptables-restore failed: {}'.format(output))
|
'iptables-restore failed: {}'.format(output))
|
||||||
@ -437,7 +437,7 @@ class NftablesWorker(FirewallWorker):
|
|||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT)
|
stderr=subprocess.STDOUT)
|
||||||
stdout, _ = p.communicate(nft_input)
|
stdout, _ = p.communicate(nft_input.encode())
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise RuleApplyError('nft failed: {}'.format(stdout))
|
raise RuleApplyError('nft failed: {}'.format(stdout))
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ class DummyIptablesRestore(object):
|
|||||||
self.returncode = 0
|
self.returncode = 0
|
||||||
|
|
||||||
def communicate(self, stdin=None):
|
def communicate(self, stdin=None):
|
||||||
self._worker_mock.loaded_iptables[self._family] = stdin
|
self._worker_mock.loaded_iptables[self._family] = stdin.decode()
|
||||||
return ("", None)
|
return ("", None)
|
||||||
|
|
||||||
class DummyQubesDB(object):
|
class DummyQubesDB(object):
|
||||||
@ -480,18 +480,18 @@ class TestFirewallWorker(TestCase):
|
|||||||
self.obj = FirewallWorker()
|
self.obj = FirewallWorker()
|
||||||
rules = {
|
rules = {
|
||||||
'10.137.0.1': {
|
'10.137.0.1': {
|
||||||
'policy': 'accept',
|
'policy': b'accept',
|
||||||
'0000': 'proto=tcp dstports=80-80 action=drop',
|
'0000': b'proto=tcp dstports=80-80 action=drop',
|
||||||
'0001': 'proto=udp specialtarget=dns action=accept',
|
'0001': b'proto=udp specialtarget=dns action=accept',
|
||||||
'0002': 'proto=udp action=drop',
|
'0002': b'proto=udp action=drop',
|
||||||
},
|
},
|
||||||
'10.137.0.2': {'policy': 'accept'},
|
'10.137.0.2': {'policy': b'accept'},
|
||||||
# no policy
|
# no policy
|
||||||
'10.137.0.3': {'0000': 'proto=tcp action=accept'},
|
'10.137.0.3': {'0000': b'proto=tcp action=accept'},
|
||||||
# no action
|
# no action
|
||||||
'10.137.0.4': {
|
'10.137.0.4': {
|
||||||
'policy': 'drop',
|
'policy': b'drop',
|
||||||
'0000': 'proto=tcp'
|
'0000': b'proto=tcp'
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for addr, entries in rules.items():
|
for addr, entries in rules.items():
|
||||||
|
@ -124,9 +124,9 @@ Requires: hostname
|
|||||||
Requires: xterm
|
Requires: xterm
|
||||||
# for qubes-desktop-run
|
# for qubes-desktop-run
|
||||||
Requires: pygobject3-base
|
Requires: pygobject3-base
|
||||||
Requires: dbus-python
|
Requires: python3-dbus
|
||||||
# for qubes-session-autostart, xdg-icon
|
# for qubes-session-autostart, xdg-icon
|
||||||
Requires: pyxdg
|
Requires: python3-pyxdg
|
||||||
Requires: python3-daemon
|
Requires: python3-daemon
|
||||||
# for qvm-feature-request
|
# for qvm-feature-request
|
||||||
Requires: python3-qubesdb
|
Requires: python3-qubesdb
|
||||||
@ -654,7 +654,6 @@ rm -f %{name}-%{version}
|
|||||||
/usr/lib/qubes/init/resize-rootfs-if-needed.sh
|
/usr/lib/qubes/init/resize-rootfs-if-needed.sh
|
||||||
/usr/lib/qubes/init/setup-rw.sh
|
/usr/lib/qubes/init/setup-rw.sh
|
||||||
/usr/lib/qubes/init/setup-rwdev.sh
|
/usr/lib/qubes/init/setup-rwdev.sh
|
||||||
/usr/lib/qubes/init/functions
|
|
||||||
%dir /usr/lib/qubes-bind-dirs.d
|
%dir /usr/lib/qubes-bind-dirs.d
|
||||||
/usr/lib/qubes-bind-dirs.d/30_cron.conf
|
/usr/lib/qubes-bind-dirs.d/30_cron.conf
|
||||||
/usr/share/applications/qubes-run-terminal.desktop
|
/usr/share/applications/qubes-run-terminal.desktop
|
||||||
@ -666,13 +665,14 @@ rm -f %{name}-%{version}
|
|||||||
/usr/share/glib-2.0/schemas/20_org.gnome.desktop.wm.preferences.qubes.gschema.override
|
/usr/share/glib-2.0/schemas/20_org.gnome.desktop.wm.preferences.qubes.gschema.override
|
||||||
%{_mandir}/man1/qvm-*.1*
|
%{_mandir}/man1/qvm-*.1*
|
||||||
|
|
||||||
%dir %{python2_sitelib}/qubesagent-*-py2.7.egg-info
|
%dir %{python3_sitelib}/qubesagent-*-py*.egg-info
|
||||||
%{python2_sitelib}/qubesagent-*-py2.7.egg-info/*
|
%{python3_sitelib}/qubesagent-*-py*.egg-info/*
|
||||||
%dir %{python2_sitelib}/qubesagent
|
%{python3_sitelib}/qubesagent/__pycache__
|
||||||
%{python2_sitelib}/qubesagent/__init__.py*
|
%dir %{python3_sitelib}/qubesagent
|
||||||
%{python2_sitelib}/qubesagent/firewall.py*
|
%{python3_sitelib}/qubesagent/__init__.py*
|
||||||
%{python2_sitelib}/qubesagent/test_firewall.py*
|
%{python3_sitelib}/qubesagent/firewall.py*
|
||||||
%{python2_sitelib}/qubesagent/xdg.py*
|
%{python3_sitelib}/qubesagent/test_firewall.py*
|
||||||
|
%{python3_sitelib}/qubesagent/xdg.py*
|
||||||
|
|
||||||
/usr/share/qubes/mime-override/globs
|
/usr/share/qubes/mime-override/globs
|
||||||
/usr/share/qubes/qubes-master-key.asc
|
/usr/share/qubes/qubes-master-key.asc
|
||||||
|
Loading…
Reference in New Issue
Block a user