summaryrefslogtreecommitdiff
path: root/src/leap/platform_init
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2013-07-29 12:17:40 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2013-07-30 10:18:40 -0300
commitdf200f6379608b379c5fec47ddb030b6d72ce93a (patch)
treeb4e6cb37cb3d10ecc92b8a3ac7c15d5c7478839e /src/leap/platform_init
parentb39584175fda25d812dbb90d3fa171f7a50e3914 (diff)
Refactor policies to the policies module.
Diffstat (limited to 'src/leap/platform_init')
-rw-r--r--src/leap/platform_init/initializers.py42
1 files changed, 3 insertions, 39 deletions
diff --git a/src/leap/platform_init/initializers.py b/src/leap/platform_init/initializers.py
index d04daca6..bbdc7f29 100644
--- a/src/leap/platform_init/initializers.py
+++ b/src/leap/platform_init/initializers.py
@@ -31,7 +31,7 @@ from PySide import QtGui
from leap.config.leapsettings import LeapSettings
from leap.services.eip import vpnlaunchers
from leap.util import first
-from leap.config.providerconfig import ProviderConfig
+from leap.util import privilege_policies
logger = logging.getLogger(__name__)
@@ -331,36 +331,6 @@ def DarwinInitializer():
#
# Linux initializers
#
-
-POLICY_TEMPLATE = """<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE policyconfig PUBLIC
- "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
-<policyconfig>
-
- <vendor>LEAP Project</vendor>
- <vendor_url>http://leap.se/</vendor_url>
-
- <action id="net.openvpn.gui.leap.run-openvpn">
- <description>Runs the openvpn binary</description>
- <description xml:lang="es">Ejecuta el binario openvpn</description>
- <message>OpenVPN needs that you authenticate to start</message>
- <message xml:lang="es">
- OpenVPN necesita autorizacion para comenzar
- </message>
- <icon_name>package-x-generic</icon_name>
- <defaults>
- <allow_any>yes</allow_any>
- <allow_inactive>yes</allow_inactive>
- <allow_active>yes</allow_active>
- </defaults>
- <annotate key="org.freedesktop.policykit.exec.path">{path}</annotate>
- <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
- </action>
-</policyconfig>
-"""
-
-
def _linux_install_missing_scripts(badexec, notfound):
"""
Tries to install the missing up/down scripts.
@@ -381,14 +351,8 @@ def _linux_install_missing_scripts(badexec, notfound):
fd, tempscript = tempfile.mkstemp(prefix="leap_installer-")
polfd, pol_tempfile = tempfile.mkstemp(prefix="leap_installer-")
try:
- # We need to do the config/../apps/openvpn otherwise the
- # policy file won't work
- openvpn_path = os.path.join(
- ProviderConfig().get_path_prefix(),
- "..", "apps", "eip",
- launcher.OPENVPN_BIN)
-
- policy_contents = POLICY_TEMPLATE.format(path=openvpn_path)
+ path = launcher.get_path_prefix()
+ policy_contents = privilege_policies.get_policy_contents(path)
with os.fdopen(polfd, 'w') as f:
f.write(policy_contents)