mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-01 06:45:38 +00:00
utils: move app path from primary window to more info
In this change, I'm also removing the messagebox window and reusing the more info GUI already implemented Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
import tkinter.ttk as ttk
|
import tkinter.ttk as ttk
|
||||||
import tkinter.messagebox as messagebox
|
|
||||||
import tkinter.font as font
|
import tkinter.font as font
|
||||||
import subprocess
|
import subprocess
|
||||||
import ttkthemes
|
import ttkthemes
|
||||||
@@ -15,7 +14,7 @@ from apparmor.translations import init_translation
|
|||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
notification_custom_msg = {
|
notification_custom_msg = {
|
||||||
'userns': _('Application {0} wants to create an user namespace which could be used to compromise your system\nDo you want to allow it next time {0} is run?\nApplication path is {1}')
|
'userns': _('Application {0} wants to create an user namespace which could be used to compromise your system\nDo you want to allow it next time {0} is run?')
|
||||||
}
|
}
|
||||||
|
|
||||||
global interface_theme
|
global interface_theme
|
||||||
@@ -136,7 +135,7 @@ class UsernsGUI(GUI):
|
|||||||
|
|
||||||
self.master.title(_('AppArmor - User namespace creation restricted'))
|
self.master.title(_('AppArmor - User namespace creation restricted'))
|
||||||
|
|
||||||
label_text = notification_custom_msg['userns'].format(name, path)
|
label_text = notification_custom_msg['userns'].format(name)
|
||||||
self.label = ttk.Label(self.label_frame, text=label_text, wraplength=460)
|
self.label = ttk.Label(self.label_frame, text=label_text, wraplength=460)
|
||||||
self.label.pack()
|
self.label.pack()
|
||||||
link = ttk.Label(self.master, text=_('More information'), foreground='blue', cursor='hand2')
|
link = ttk.Label(self.master, text=_('More information'), foreground='blue', cursor='hand2')
|
||||||
@@ -152,18 +151,17 @@ class UsernsGUI(GUI):
|
|||||||
self.do_nothing_button = ttk.Button(self.master, text=_('Do nothing'), command=self.master.destroy)
|
self.do_nothing_button = ttk.Button(self.master, text=_('Do nothing'), command=self.master.destroy)
|
||||||
self.do_nothing_button.pack(side=tk.LEFT, fill=tk.BOTH, expand=True, padx=5, pady=5)
|
self.do_nothing_button.pack(side=tk.LEFT, fill=tk.BOTH, expand=True, padx=5, pady=5)
|
||||||
|
|
||||||
@staticmethod
|
def more_info(self, ev):
|
||||||
def more_info(ev):
|
|
||||||
more_info_text = _("""
|
more_info_text = _("""
|
||||||
In Linux, user namespaces enable non-root users to perform certain privileged operations. This feature can be useful for several legitimate use cases.
|
In Linux, user namespaces enable non-root users to perform certain privileged operations. This feature can be useful for several legitimate use cases.
|
||||||
|
|
||||||
However, this feature also introduces security risks, (e.g. privilege escalation exploits).
|
However, this feature also introduces security risks, (e.g. privilege escalation exploits).
|
||||||
|
|
||||||
This dialog allows you to choose whether you want to enable user namespaces for this application.""")
|
This dialog allows you to choose whether you want to enable user namespaces for this application.
|
||||||
messagebox.showinfo(
|
|
||||||
_('AppArmor: More info'),
|
The application path is {}""".format(self.path))
|
||||||
more_info_text,
|
more_gui = ShowMoreGUI(self.path, more_info_text, profile_found=False)
|
||||||
)
|
more_gui.show()
|
||||||
|
|
||||||
def set_result(self, result):
|
def set_result(self, result):
|
||||||
self.result = result
|
self.result = result
|
||||||
|
Reference in New Issue
Block a user