pax_global_header00006660000000000000000000000064141342746730014525gustar00rootroot0000000000000052 comment=7f600c40bc18d8180993edcd54daf45124736776 selinux-gui-3.3/000077500000000000000000000000001413427467300136435ustar00rootroot00000000000000selinux-gui-3.3/COPYING000066400000000000000000000431311413427467300147000ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. selinux-gui-3.3/Makefile000066400000000000000000000040631413427467300153060ustar00rootroot00000000000000# Installation directories. LINGUAS ?= ru PREFIX ?= /usr BINDIR ?= $(PREFIX)/bin SHAREDIR ?= $(PREFIX)/share/system-config-selinux DATADIR ?= $(PREFIX)/share MANDIR ?= $(PREFIX)/share/man DESKTOPDIR ?= $(PREFIX)/share/applications TARGETS= \ booleansPage.py \ domainsPage.py \ fcontextPage.py \ loginsPage.py \ modulesPage.py \ polgen.ui \ portsPage.py \ semanagePage.py \ statusPage.py \ system-config-selinux.png \ system-config-selinux.ui \ usersPage.py all: $(TARGETS) system-config-selinux.py polgengui.py install: all -mkdir -p $(DESTDIR)$(MANDIR)/man8 -mkdir -p $(DESTDIR)$(SHAREDIR) -mkdir -p $(DESTDIR)$(BINDIR) -mkdir -p $(DESTDIR)$(DATADIR)/pixmaps -mkdir -p $(DESTDIR)$(DATADIR)/icons/hicolor/24x24/apps -mkdir -p $(DESTDIR)$(DATADIR)/polkit-1/actions/ -mkdir -p $(DESTDIR)$(DESKTOPDIR) install -m 755 system-config-selinux.py $(DESTDIR)$(SHAREDIR) install -m 755 system-config-selinux $(DESTDIR)$(BINDIR) install -m 755 polgengui.py $(DESTDIR)$(BINDIR)/selinux-polgengui install -m 644 $(TARGETS) $(DESTDIR)$(SHAREDIR) install -m 644 system-config-selinux.8 $(DESTDIR)$(MANDIR)/man8 install -m 644 selinux-polgengui.8 $(DESTDIR)$(MANDIR)/man8 for lang in $(LINGUAS) ; do \ if [ -e $${lang} ] ; then \ mkdir -p $(DESTDIR)$(MANDIR)/$${lang}/man8 ; \ install -m 644 $${lang}/*.8 $(DESTDIR)$(MANDIR)/$${lang}/man8/ ; \ fi ; \ done install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/pixmaps install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/icons/hicolor/24x24/apps install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/system-config-selinux install -m 644 *.desktop $(DESTDIR)$(DESKTOPDIR) -mkdir -p $(DESTDIR)$(DATADIR)/pixmaps install -m 644 sepolicy_256.png $(DESTDIR)$(DATADIR)/pixmaps/sepolicy.png for i in 16 22 32 48 256; do \ mkdir -p $(DESTDIR)$(DATADIR)/icons/hicolor/$${i}x$${i}/apps; \ install -m 644 sepolicy_$${i}.png $(DESTDIR)$(DATADIR)/icons/hicolor/$${i}x$${i}/apps/sepolicy.png; \ done install -m 644 org.selinux.config.policy $(DESTDIR)$(DATADIR)/polkit-1/actions/ clean: indent: relabel: test: selinux-gui-3.3/VERSION000066400000000000000000000000041413427467300147050ustar00rootroot000000000000003.3 selinux-gui-3.3/booleansPage.py000066400000000000000000000174271413427467300166270ustar00rootroot00000000000000# # booleansPage.py - GUI for Booleans page in system-config-securitylevel # # Dan Walsh # # Copyright 2006, 2007 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # import sys from gi.repository import Gdk, GObject, Gtk import seobject import semanagePage INSTALLPATH = '/usr/share/system-config-selinux' sys.path.append(INSTALLPATH) try: from subprocess import getstatusoutput except ImportError: from commands import getstatusoutput ENFORCING = 0 PERMISSIVE = 1 DISABLED = 2 ## ## I18N ## PROGNAME = "policycoreutils" try: import gettext kwargs = {} if sys.version_info < (3,): kwargs['unicode'] = True gettext.install(PROGNAME, localedir="/usr/share/locale", codeset='utf-8', **kwargs) except: try: import builtins builtins.__dict__['_'] = str except ImportError: import __builtin__ __builtin__.__dict__['_'] = unicode class Modifier: def __init__(self, name, on, save): self.on = on self.name = name self.save = save def set(self, value): self.on = value self.save = True def isOn(self): return self.on class Boolean(Modifier): def __init__(self, name, val, save=False): Modifier.__init__(self, name, val, save) ACTIVE = 0 MODULE = 1 DESC = 2 BOOLEAN = 3 class booleansPage: def __init__(self, xml, doDebug=None): self.xml = xml self.window = self.xml.get_object("mainWindow").get_root_window() self.local = False self.types = [] self.selinuxsupport = True self.typechanged = False self.doDebug = doDebug self.busy_cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH) self.ready_cursor = Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR) # Bring in widgets from glade file. self.booleansFilter = xml.get_object("booleansFilter") self.booleansFilter.connect("focus_out_event", self.filter_changed) self.booleansFilter.connect("activate", self.filter_changed) self.booleansFilter.connect("changed", self.filter_changed) self.booleansView = xml.get_object("booleansView") self.revertButton = xml.get_object("booleanRevertButton") self.revertButton.set_sensitive(self.local) self.revertButton.connect("clicked", self.on_revert_clicked) listStore = Gtk.ListStore(GObject.TYPE_STRING) cell = Gtk.CellRendererText() self.store = Gtk.ListStore(GObject.TYPE_BOOLEAN, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING) self.store.set_sort_column_id(1, Gtk.SortType.ASCENDING) self.booleansView.set_model(self.store) checkbox = Gtk.CellRendererToggle() checkbox.connect("toggled", self.boolean_toggled) col = Gtk.TreeViewColumn('Active', checkbox, active=ACTIVE) col.set_clickable(True) col.set_sort_column_id(ACTIVE) self.booleansView.append_column(col) col = Gtk.TreeViewColumn("Module", Gtk.CellRendererText(), text=MODULE) col.set_sort_column_id(MODULE) col.set_resizable(True) self.booleansView.append_column(col) col = Gtk.TreeViewColumn("Description", Gtk.CellRendererText(), text=DESC) col.set_sizing(Gtk.TreeViewColumnSizing.FIXED) col.set_fixed_width(400) col.set_sort_column_id(DESC) col.set_resizable(True) self.booleansView.append_column(col) col = Gtk.TreeViewColumn("Name", Gtk.CellRendererText(), text=BOOLEAN) col.set_sort_column_id(BOOLEAN) col.set_resizable(True) self.booleansView.set_search_equal_func(self.__search) self.booleansView.append_column(col) self.filter = "" self.load(self.filter) def error(self, message): dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.ERROR, Gtk.ButtonsType.CLOSE, message) dlg.set_position(Gtk.WindowPosition.MOUSE) dlg.show_all() dlg.run() dlg.destroy() def __search(self, model, col, key, i): sort_col = self.store.get_sort_column_id()[0] if sort_col > 0: val = model.get_value(i, sort_col) if val.lower().startswith(key.lower()): return False return True def wait(self): self.window.set_cursor(self.busy_cursor) semanagePage.idle_func() def ready(self): self.window.set_cursor(self.ready_cursor) semanagePage.idle_func() def deleteDialog(self): store, iter = self.booleansView.get_selection().get_selected() if iter is None: return boolean = store.get_value(iter, BOOLEAN) # change cursor if boolean is None: return try: self.wait() (rc, out) = getstatusoutput("semanage boolean -d %s" % boolean) self.ready() if rc != 0: return self.error(out) self.load(self.filter) except ValueError as e: self.error(e.args[0]) def filter_changed(self, *arg): filter = arg[0].get_text() if filter != self.filter: self.load(filter) self.filter = filter def use_menus(self): return False def get_description(self): return _("Boolean") def match(self, key, filter=""): try: f = filter.lower() cat = self.booleans.get_category(key).lower() val = self.booleans.get_desc(key).lower() k = key.lower() return val.find(f) >= 0 or k.find(f) >= 0 or cat.find(f) >= 0 except: return False def load(self, filter=None): self.store.clear() self.booleans = seobject.booleanRecords() booleansList = self.booleans.get_all(self.local) for name in booleansList: rec = booleansList[name] if self.match(name, filter): iter = self.store.append() self.store.set_value(iter, ACTIVE, rec[2] == 1) self.store.set_value(iter, MODULE, self.booleans.get_category(name)) self.store.set_value(iter, DESC, self.booleans.get_desc(name)) self.store.set_value(iter, BOOLEAN, name) def boolean_toggled(self, widget, row): iter = self.store.get_iter(row) val = self.store.get_value(iter, ACTIVE) key = self.store.get_value(iter, BOOLEAN) self.store.set_value(iter, ACTIVE, not val) self.wait() setsebool = "/usr/sbin/setsebool -P %s %d" % (key, not val) rc, out = getstatusoutput(setsebool) if rc != 0: self.error(out) self.load(self.filter) self.ready() def on_revert_clicked(self, button): self.wait() setsebool = "semanage boolean --deleteall" getstatusoutput(setsebool) self.load(self.filter) self.ready() def on_local_clicked(self, button): self.local = not self.local self.revertButton.set_sensitive(self.local) if self.local: button.set_label(_("all")) else: button.set_label(_("Customized")) self.load(self.filter) return True selinux-gui-3.3/domainsPage.py000066400000000000000000000121631413427467300164470ustar00rootroot00000000000000## domainsPage.py - show selinux domains ## Copyright (C) 2009 Red Hat, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ## Author: Dan Walsh import os try: from subprocess import getstatusoutput except ImportError: from commands import getstatusoutput import sys from gi.repository import GObject, Gtk import sepolicy from semanagePage import * ## ## I18N ## PROGNAME = "policycoreutils" try: import gettext kwargs = {} if sys.version_info < (3,): kwargs['unicode'] = True gettext.install(PROGNAME, localedir="/usr/share/locale", codeset='utf-8', **kwargs) except: try: import builtins builtins.__dict__['_'] = str except ImportError: import __builtin__ __builtin__.__dict__['_'] = unicode class domainsPage(semanagePage): def __init__(self, xml): semanagePage.__init__(self, xml, "domains", _("Process Domain")) self.domain_filter = xml.get_object("domainsFilterEntry") self.domain_filter.connect("focus_out_event", self.filter_changed) self.domain_filter.connect("activate", self.filter_changed) self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING) self.view.set_model(self.store) self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) col = Gtk.TreeViewColumn(_("Domain Name"), Gtk.CellRendererText(), text=0) col.set_sort_column_id(0) col.set_resizable(True) self.view.append_column(col) self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) col = Gtk.TreeViewColumn(_("Mode"), Gtk.CellRendererText(), text=1) col.set_sort_column_id(1) col.set_resizable(True) self.view.append_column(col) self.view.get_selection().connect("changed", self.itemSelected) self.permissive_button = xml.get_object("permissiveButton") self.enforcing_button = xml.get_object("enforcingButton") self.domains = sepolicy.get_all_entrypoint_domains() self.load() def get_modules(self): modules = [] fd = os.popen("semodule -l") mods = fd.readlines() fd.close() for l in mods: modules.append(l.split()[0]) return modules def load(self, filter=""): self.filter = filter self.store.clear() try: modules = self.get_modules() for domain in self.domains: if not self.match(domain, filter): continue iter = self.store.append() self.store.set_value(iter, 0, domain) t = "permissive_%s_t" % domain if t in modules: self.store.set_value(iter, 1, _("Permissive")) else: self.store.set_value(iter, 1, "") except: pass self.view.get_selection().select_path((0,)) def itemSelected(self, selection): store, iter = selection.get_selected() if iter is None: return p = store.get_value(iter, 1) == _("Permissive") self.permissive_button.set_sensitive(not p) self.enforcing_button.set_sensitive(p) def deleteDialog(self): # Do nothing return self.delete() def delete(self): selection = self.view.get_selection() store, iter = selection.get_selected() domain = store.get_value(iter, 0) try: self.wait() status, output = getstatusoutput("semanage permissive -d %s_t" % domain) self.ready() if status != 0: self.error(output) else: domain = store.set_value(iter, 1, "") self.itemSelected(selection) except ValueError as e: self.error(e.args[0]) def propertiesDialog(self): # Do nothing return def addDialog(self): # Do nothing return self.add() def add(self): selection = self.view.get_selection() store, iter = selection.get_selected() domain = store.get_value(iter, 0) try: self.wait() status, output = getstatusoutput("semanage permissive -a %s_t" % domain) self.ready() if status != 0: self.error(output) else: domain = store.set_value(iter, 1, _("Permissive")) self.itemSelected(selection) except ValueError as e: self.error(e.args[0]) selinux-gui-3.3/fcontextPage.py000066400000000000000000000205401413427467300166450ustar00rootroot00000000000000## fcontextPage.py - show selinux mappings ## Copyright (C) 2006 Red Hat, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ## Author: Dan Walsh from gi.repository import GObject, Gtk import seobject try: from subprocess import getstatusoutput except ImportError: from commands import getstatusoutput from semanagePage import * SPEC_COL = 0 TYPE_COL = 1 FTYPE_COL = 2 class context: def __init__(self, scontext): self.scontext = scontext con = scontext.split(":") self.type = con[0] if len(con) > 1: self.mls = con[1] else: self.mls = "s0" def __str__(self): return self.scontext ## ## I18N ## PROGNAME = "policycoreutils" try: import gettext kwargs = {} if sys.version_info < (3,): kwargs['unicode'] = True gettext.install(PROGNAME, localedir="/usr/share/locale", codeset='utf-8', **kwargs) except: try: import builtins builtins.__dict__['_'] = str except ImportError: import __builtin__ __builtin__.__dict__['_'] = unicode class fcontextPage(semanagePage): def __init__(self, xml): semanagePage.__init__(self, xml, "fcontext", _("File Labeling")) self.fcontextFilter = xml.get_object("fcontextFilterEntry") self.fcontextFilter.connect("focus_out_event", self.filter_changed) self.fcontextFilter.connect("activate", self.filter_changed) self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING) self.view = xml.get_object("fcontextView") self.view.set_model(self.store) self.view.set_search_equal_func(self.search) col = Gtk.TreeViewColumn(_("File\nSpecification"), Gtk.CellRendererText(), text=SPEC_COL) col.set_sizing(Gtk.TreeViewColumnSizing.FIXED) col.set_fixed_width(250) col.set_sort_column_id(SPEC_COL) col.set_resizable(True) self.view.append_column(col) col = Gtk.TreeViewColumn(_("Selinux\nFile Type"), Gtk.CellRendererText(), text=TYPE_COL) col.set_sizing(Gtk.TreeViewColumnSizing.FIXED) col.set_fixed_width(250) col.set_sort_column_id(TYPE_COL) col.set_resizable(True) self.view.append_column(col) col = Gtk.TreeViewColumn(_("File\nType"), Gtk.CellRendererText(), text=2) col.set_sort_column_id(FTYPE_COL) col.set_resizable(True) self.view.append_column(col) self.store.set_sort_column_id(SPEC_COL, Gtk.SortType.ASCENDING) self.load() self.fcontextEntry = xml.get_object("fcontextEntry") self.fcontextFileTypeCombo = xml.get_object("fcontextFileTypeCombo") # Populate file type combo_box liststore = self.fcontextFileTypeCombo.get_model() for ftype in seobject.file_type_str_to_option.keys(): iter = liststore.append() liststore.set_value(iter, 0, ftype) iter = liststore.get_iter_first() self.fcontextFileTypeCombo.set_active_iter(iter) self.fcontextTypeEntry = xml.get_object("fcontextTypeEntry") self.fcontextMLSEntry = xml.get_object("fcontextMLSEntry") def match(self, fcon_dict, k, filter): try: f = filter.lower() for con in k: k = con.lower() if k.find(f) >= 0: return True for con in fcon_dict[k]: k = con.lower() if k.find(f) >= 0: return True except: pass return False def load(self, filter=""): self.filter = filter self.fcontext = seobject.fcontextRecords() self.store.clear() fcon_dict = self.fcontext.get_all(self.local) for k in sorted(fcon_dict.keys()): if not self.match(fcon_dict, k, filter): continue iter = self.store.append() self.store.set_value(iter, SPEC_COL, k[0]) self.store.set_value(iter, FTYPE_COL, k[1]) if fcon_dict[k]: rec = "%s:%s" % (fcon_dict[k][2], seobject.translate(fcon_dict[k][3], False)) else: rec = "<>" self.store.set_value(iter, TYPE_COL, rec) self.view.get_selection().select_path((0,)) def filter_changed(self, *arg): filter = arg[0].get_text() if filter != self.filter: self.load(filter) def dialogInit(self): store, iter = self.view.get_selection().get_selected() self.fcontextEntry.set_text(store.get_value(iter, SPEC_COL)) self.fcontextEntry.set_sensitive(False) scontext = store.get_value(iter, TYPE_COL) scon = context(scontext) self.fcontextTypeEntry.set_text(scon.type) self.fcontextMLSEntry.set_text(scon.mls) type = store.get_value(iter, FTYPE_COL) liststore = self.fcontextFileTypeCombo.get_model() iter = liststore.get_iter_first() while iter != None and liststore.get_value(iter, 0) != type: iter = liststore.iter_next(iter) if iter != None: self.fcontextFileTypeCombo.set_active_iter(iter) self.fcontextFileTypeCombo.set_sensitive(False) def dialogClear(self): self.fcontextEntry.set_text("") self.fcontextEntry.set_sensitive(True) self.fcontextFileTypeCombo.set_sensitive(True) self.fcontextFileTypeCombo.set_active(0) self.fcontextTypeEntry.set_text("") self.fcontextMLSEntry.set_text("s0") def delete(self): store, iter = self.view.get_selection().get_selected() try: fspec = store.get_value(iter, SPEC_COL) ftype = store.get_value(iter, FTYPE_COL) self.wait() (rc, out) = getstatusoutput("semanage fcontext -d -f '%s' '%s'" % (seobject.file_type_str_to_option[ftype], fspec)) self.ready() if rc != 0: return self.error(out) store.remove(iter) self.view.get_selection().select_path((0,)) except ValueError as e: self.error(e.args[0]) def add(self): fspec = self.fcontextEntry.get_text().strip() type = self.fcontextTypeEntry.get_text().strip() mls = self.fcontextMLSEntry.get_text().strip() list_model = self.fcontextFileTypeCombo.get_model() it = self.fcontextFileTypeCombo.get_active_iter() ftype = list_model.get_value(it, 0) self.wait() (rc, out) = getstatusoutput("semanage fcontext -a -t %s -r %s -f '%s' '%s'" % (type, mls, seobject.file_type_str_to_option[ftype], fspec)) self.ready() if rc != 0: self.error(out) return False iter = self.store.append() self.store.set_value(iter, SPEC_COL, fspec) self.store.set_value(iter, FTYPE_COL, ftype) self.store.set_value(iter, TYPE_COL, "%s:%s" % (type, mls)) def modify(self): fspec = self.fcontextEntry.get_text().strip() type = self.fcontextTypeEntry.get_text().strip() mls = self.fcontextMLSEntry.get_text().strip() list_model = self.fcontextFileTypeCombo.get_model() iter = self.fcontextFileTypeCombo.get_active_iter() ftype = list_model.get_value(iter, 0) self.wait() (rc, out) = getstatusoutput("semanage fcontext -m -t %s -r %s -f '%s' '%s'" % (type, mls, seobject.file_type_str_to_option[ftype], fspec)) self.ready() if rc != 0: self.error(out) return False store, iter = self.view.get_selection().get_selected() self.store.set_value(iter, SPEC_COL, fspec) self.store.set_value(iter, FTYPE_COL, ftype) self.store.set_value(iter, TYPE_COL, "%s:%s" % (type, mls)) selinux-gui-3.3/loginsPage.py000066400000000000000000000155151413427467300163140ustar00rootroot00000000000000## loginsPage.py - show selinux mappings ## Copyright (C) 2006 Red Hat, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ## Author: Dan Walsh import sys try: from subprocess import getstatusoutput except ImportError: from commands import getstatusoutput from gi.repository import GObject, Gtk import seobject from semanagePage import * ## ## I18N ## PROGNAME = "policycoreutils" try: import gettext kwargs = {} if sys.version_info < (3,): kwargs['unicode'] = True gettext.install(PROGNAME, localedir="/usr/share/locale", codeset='utf-8', **kwargs) except: try: import builtins builtins.__dict__['_'] = str except ImportError: import __builtin__ __builtin__.__dict__['_'] = unicode class loginsPage(semanagePage): def __init__(self, xml): self.firstTime = False semanagePage.__init__(self, xml, "logins", _("User Mapping")) self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING) self.view.set_model(self.store) self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) col = Gtk.TreeViewColumn(_("Login\nName"), Gtk.CellRendererText(), text=0) col.set_sort_column_id(0) col.set_resizable(True) self.view.append_column(col) col = Gtk.TreeViewColumn(_("SELinux\nUser"), Gtk.CellRendererText(), text=1) col.set_resizable(True) self.view.append_column(col) col = Gtk.TreeViewColumn(_("MLS/\nMCS Range"), Gtk.CellRendererText(), text=2) col.set_resizable(True) self.view.append_column(col) self.load() self.loginsNameEntry = xml.get_object("loginsNameEntry") self.loginsSelinuxUserCombo = xml.get_object("loginsSelinuxUserCombo") self.loginsMLSEntry = xml.get_object("loginsMLSEntry") def load(self, filter=""): self.filter = filter self.login = seobject.loginRecords() dict = self.login.get_all(0) self.store.clear() for k in sorted(dict.keys()): range = seobject.translate(dict[k][1]) if not (self.match(k, filter) or self.match(dict[k][0], filter) or self.match(range, filter)): continue iter = self.store.append() self.store.set_value(iter, 0, k) self.store.set_value(iter, 1, dict[k][0]) self.store.set_value(iter, 2, range) self.view.get_selection().select_path((0,)) def __dialogSetup(self): if self.firstTime: return self.firstTime = True liststore = Gtk.ListStore(GObject.TYPE_STRING) self.loginsSelinuxUserCombo.set_model(liststore) cell = Gtk.CellRendererText() self.loginsSelinuxUserCombo.pack_start(cell, True) self.loginsSelinuxUserCombo.add_attribute(cell, 'text', 0) selusers = seobject.seluserRecords().get_all(0) for k in sorted(selusers.keys()): if k != "system_u": self.loginsSelinuxUserCombo.append_text(k) iter = liststore.get_iter_first() while liststore.get_value(iter, 0) != "user_u": iter = liststore.iter_next(iter) self.loginsSelinuxUserCombo.set_active_iter(iter) def dialogInit(self): self.__dialogSetup() store, iter = self.view.get_selection().get_selected() self.loginsNameEntry.set_text(store.get_value(iter, 0)) self.loginsNameEntry.set_sensitive(False) self.loginsMLSEntry.set_text(store.get_value(iter, 2)) seuser = store.get_value(iter, 1) liststore = self.loginsSelinuxUserCombo.get_model() iter = liststore.get_iter_first() while iter != None and liststore.get_value(iter, 0) != seuser: iter = liststore.iter_next(iter) if iter != None: self.loginsSelinuxUserCombo.set_active_iter(iter) def dialogClear(self): self.__dialogSetup() self.loginsNameEntry.set_text("") self.loginsNameEntry.set_sensitive(True) self.loginsMLSEntry.set_text("s0") def delete(self): store, iter = self.view.get_selection().get_selected() try: login = store.get_value(iter, 0) if login == "root" or login == "__default__": raise ValueError(_("Login '%s' is required") % login) self.wait() (rc, out) = getstatusoutput("semanage login -d %s" % login) self.ready() if rc != 0: self.error(out) return False store.remove(iter) self.view.get_selection().select_path((0,)) except ValueError as e: self.error(e.args[0]) def add(self): target = self.loginsNameEntry.get_text().strip() serange = self.loginsMLSEntry.get_text().strip() if serange == "": serange = "s0" list_model = self.loginsSelinuxUserCombo.get_model() iter = self.loginsSelinuxUserCombo.get_active_iter() seuser = list_model.get_value(iter, 0) self.wait() (rc, out) = getstatusoutput("semanage login -a -s %s -r %s %s" % (seuser, serange, target)) self.ready() if rc != 0: self.error(out) return False iter = self.store.append() self.store.set_value(iter, 0, target) self.store.set_value(iter, 1, seuser) self.store.set_value(iter, 2, seobject.translate(serange)) def modify(self): target = self.loginsNameEntry.get_text().strip() serange = self.loginsMLSEntry.get_text().strip() if serange == "": serange = "s0" list_model = self.loginsSelinuxUserCombo.get_model() iter = self.loginsSelinuxUserCombo.get_active_iter() seuser = list_model.get_value(iter, 0) self.wait() (rc, out) = getstatusoutput("semanage login -m -s %s -r %s %s" % (seuser, serange, target)) self.ready() if rc != 0: self.error(out) return False store, iter = self.view.get_selection().get_selected() self.store.set_value(iter, 0, target) self.store.set_value(iter, 1, seuser) self.store.set_value(iter, 2, seobject.translate(serange)) selinux-gui-3.3/modulesPage.py000066400000000000000000000155111413427467300164650ustar00rootroot00000000000000## modulesPage.py - show selinux mappings ## Copyright (C) 2006-2009 Red Hat, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ## Author: Dan Walsh import sys from subprocess import Popen, PIPE try: from subprocess import getstatusoutput except ImportError: from commands import getstatusoutput from gi.repository import GObject, Gtk import selinux from semanagePage import * ## ## I18N ## PROGNAME = "policycoreutils" try: import gettext kwargs = {} if sys.version_info < (3,): kwargs['unicode'] = True gettext.install(PROGNAME, localedir="/usr/share/locale", codeset='utf-8', **kwargs) except: try: import builtins builtins.__dict__['_'] = str except ImportError: import __builtin__ __builtin__.__dict__['_'] = unicode class modulesPage(semanagePage): def __init__(self, xml): semanagePage.__init__(self, xml, "modules", _("Policy Module")) self.module_filter = xml.get_object("modulesFilterEntry") self.module_filter.connect("focus_out_event", self.filter_changed) self.module_filter.connect("activate", self.filter_changed) self.audit_enabled = False self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING) self.view.set_model(self.store) self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) col = Gtk.TreeViewColumn(_("Module Name"), Gtk.CellRendererText(), text=0) col.set_sort_column_id(0) col.set_resizable(True) self.view.append_column(col) self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) col = Gtk.TreeViewColumn(_("Priority"), Gtk.CellRendererText(), text=1) self.enable_audit_button = xml.get_object("enableAuditButton") self.enable_audit_button.connect("clicked", self.enable_audit) self.new_button = xml.get_object("newModuleButton") self.new_button.connect("clicked", self.new_module) col.set_sort_column_id(1) col.set_resizable(True) self.view.append_column(col) self.store.set_sort_column_id(2, Gtk.SortType.ASCENDING) col = Gtk.TreeViewColumn(_("Kind"), Gtk.CellRendererText(), text=2) col.set_sort_column_id(2) col.set_resizable(True) self.view.append_column(col) self.store.set_sort_func(1, self.sort_int, "") status, self.policy_type = selinux.selinux_getpolicytype() self.load() def sort_int(self, treemodel, iter1, iter2, user_data): try: p1 = int(treemodel.get_value(iter1, 1)) p2 = int(treemodel.get_value(iter1, 1)) if p1 > p2: return 1 if p1 == p2: return 0 return -1 except: return 0 def load(self, filter=""): self.filter = filter self.store.clear() try: fd = Popen("semodule -lfull", shell=True, stdout=PIPE).stdout l = fd.readlines() fd.close() for i in l: priority, module, kind = i.decode('utf-8').split() if not (self.match(module, filter) or self.match(priority, filter)): continue iter = self.store.append() self.store.set_value(iter, 0, module.strip()) self.store.set_value(iter, 1, priority.strip()) self.store.set_value(iter, 2, kind.strip()) except: pass self.view.get_selection().select_path((0,)) def new_module(self, args): try: Popen(["selinux-polgengui"]) except ValueError as e: self.error(e.args[0]) def delete(self): store, iter = self.view.get_selection().get_selected() module = store.get_value(iter, 0) priority = store.get_value(iter, 1) try: self.wait() status, output = getstatusoutput("semodule -X %s -r %s" % (priority, module)) self.ready() if status != 0: self.error(output) else: store.remove(iter) self.view.get_selection().select_path((0,)) except ValueError as e: self.error(e.args[0]) def enable_audit(self, button): self.audit_enabled = not self.audit_enabled try: self.wait() if self.audit_enabled: status, output = getstatusoutput("semodule -DB") button.set_label(_("Disable Audit")) else: status, output = getstatusoutput("semodule -B") button.set_label(_("Enable Audit")) self.ready() if status != 0: self.error(output) except ValueError as e: self.error(e.args[0]) def disable_audit(self, button): try: self.wait() status, output = getstatusoutput("semodule -B") self.ready() if status != 0: self.error(output) except ValueError as e: self.error(e.args[0]) def propertiesDialog(self): # Do nothing return def addDialog(self): dialog = Gtk.FileChooserDialog(_("Load Policy Module"), None, Gtk.FileChooserAction.OPEN, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK)) dialog.set_default_response(Gtk.ResponseType.OK) filter = Gtk.FileFilter() filter.set_name("Policy Files") filter.add_pattern("*.pp") dialog.add_filter(filter) response = dialog.run() if response == Gtk.ResponseType.OK: self.add(dialog.get_filename()) dialog.destroy() def add(self, file): try: self.wait() status, output = getstatusoutput("semodule -i %s" % file) self.ready() if status != 0: self.error(output) else: self.load() except ValueError as e: self.error(e.args[0]) selinux-gui-3.3/org.selinux.config.policy000066400000000000000000000016401413427467300206060ustar00rootroot00000000000000 System Config SELinux http://fedorahosted.org/system-config-selinux Run System Config SELinux Authentication is required to run system-config-selinux system-selinux no no auth_admin /usr/share/system-config-selinux/system-config-selinux.py true selinux-gui-3.3/polgen.ui000066400000000000000000004223041413427467300154730ustar00rootroot00000000000000 False 5 normal Red Hat 2007 www.redhat.com GPL Daniel Walsh <dwalsh@redhat.com> translator-credits False False False True end 0 False 12 Add Booleans Dialog mouse 400 dialog True False 6 True False end gtk-cancel True True True False True False False 0 gtk-add True True True False True False False 1 False True end 0 True False 2 2 12 6 True False 0 Boolean Name GTK_FILL True False 0 Description 1 2 GTK_FILL True True False False True True 1 2 True True False False True True 1 2 1 2 True True 1 cancelbutton1 okbutton1 False 5 mouse dialog True True True False 24 True False end gtk-cancel True True True False True False False 0 gtk-add True True True True False True False False 1 False True end 0 button5 button6 True False SELinux Policy Generation Tool True False 18 True False left False True False True False 0 <b>Select the policy type for the application or user role you want to confine:</b> True False False 5 0 True False True False True False 12 True False 6 True False 0 <b>Applications</b> True False False 0 True False True False False False 0 True False 6 Standard Init Daemon True True False Standard Init Daemon are daemons started on boot via init scripts. Usually requires a script in /etc/rc.d/init.d True True False False 0 DBUS System Daemon True True False Standard Init Daemon are daemons started on boot via init scripts. Usually requires a script in /etc/rc.d/init.d True True init_radiobutton False False 1 Internet Services Daemon (inetd) True True False Internet Services Daemon are daemons started by xinetd True True init_radiobutton False False 2 Web Application/Script (CGI) True True False Web Applications/Script (CGI) CGI scripts started by the web server (apache) True True init_radiobutton False False 3 User Application True True False User Application are any application that you would like to confine that is started by a user True True init_radiobutton False False 4 Sandbox True True False User Application are any application that you would like to confine that is started by a user True True init_radiobutton False False 5 False False 1 True True 1 False True 0 True False 6 True False 0 <b>Login Users</b> True False False 0 True False True False False False 0 True False 6 Existing User Roles True True False Modify an existing login user record. True True init_radiobutton False False 0 Minimal Terminal User Role True True False This user will login to a machine only via a terminal or remote login. By default this user will have no setuid, no networking, no su, no sudo. True True init_radiobutton False False 1 Minimal X Windows User Role True True False This user can login to a machine via X or terminal. By default this user will have no setuid, no networking, no sudo, no su True True init_radiobutton False False 2 User Role True True False User with full networking, no setuid applications without transition, no sudo, no su. True True init_radiobutton False False 3 Admin User Role True True False User with full networking, no setuid applications without transition, no su, can sudo to Root Administration Roles True True init_radiobutton False False 4 True False 1 True True 1 False True 1 True False 6 True False 0 <b>Root Users</b> True False False 0 True False True False False False 0 True False Root Admin User Role True True False Select Root Administrator User Role, if this user will be used to administer the machine while running as root. This user will not be able to login to the system directly. True True init_radiobutton False False 0 False False 1 True True 1 True True 2 True True 0 True True 0 True True 1 True False Main Tab False True False True False 0 <b>Enter name of application or user role:</b> True False False 5 0 True False 3 3 12 6 True False 0 Name GTK_FILL True True Enter complete path for executable to be confined. False False True True 1 2 1 2 ... True True False True 2 3 1 2 GTK_FILL True True Enter unique name for the confined application or user role. False False True True 1 3 True False 0 Executable 1 2 GTK_FILL True False 0 Init script 2 3 GTK_FILL True True Enter complete path to init script used to start the confined application. False False True True 1 2 2 3 ... True True False True 2 3 2 3 GTK_FILL True True 1 True False Name Tab 1 False True False True False 0 <b>Select existing role to modify:</b> True False False 5 0 True True automatic automatic in True True Select the user roles that will transition to the %s domain. False True True 1 True False role tab 2 False True False True False 0 <b>Select roles that %s will transition to:</b> True False False 5 0 True True True True Select applications domains that %s will transition to. False True True 1 True False transition role tab 3 False True False True False 0 <b>Select the user_roles that will transition to %s:</b> True False False 5 0 True True True True Select the user roles that will transition to this applications domains. False True True 1 True False User Tab 4 False True False True False 0 <b>Select domains that %s will administer:</b> True False False 5 0 True True True True Select the domains that you would like this user administer. False True True 1 True False Admin Tab 5 False True False True False 0 <b>Select additional roles for %s:</b> True False False 5 0 True True True True Select the domains that you would like this user administer. False True True 1 True False Roles Tab 6 False True False True False 0 <b>Enter network ports that %s binds on:</b> True False False 5 0 True False 6 True False 0 <b>TCP Ports</b> True False False 0 True False True False False False 0 True False 6 True False 12 All True True False Allows %s to bind to any udp port True True False False 10 0 600-1024 True True False Allow %s to call bindresvport with 0. Binding to port 600-1024 True True False False 10 1 Unreserved Ports (>1024) True True False Enter a comma separated list of udp ports or ranges of ports that %s binds to. Example: 612, 650-660 True True False False 10 2 True True 0 True False 12 True False 0 Select Ports False False 5 0 True True Allows %s to bind to any udp ports > 1024 False False True True True True 1 True True 1 True True 1 True True 1 True True 1 True False 6 True False 0 <b>UDP Ports</b> True False False 0 True False True False False False 0 True False 6 True False 12 All True True False Allows %s to bind to any udp port True True False False 10 0 600-1024 True True False Allow %s to call bindresvport with 0. Binding to port 600-1024 True True False False 10 1 Unreserved Ports (>1024) True True False Enter a comma separated list of udp ports or ranges of ports that %s binds to. Example: 612, 650-660 True True False False 10 2 True True 0 True False 12 True False 0 Select Ports False False 5 0 True True Allows %s to bind to any udp ports > 1024 False False True True True True 1 True True 1 True True 1 True True 1 True True 2 True False Network Bind tab 7 False True False True False 0 <b>Select network ports that %s connects to:</b> True False False 5 0 True False 6 True False 0 <b>TCP Ports</b> True False False 0 True False True False False False 0 True False 12 All True True False Allows %s to connect to any tcp port True True False False 10 0 True False 0 Select Ports False False 5 1 True True Enter a comma separated list of tcp ports or ranges of ports that %s connects to. Example: 612, 650-660 False False True True True True 2 True True 1 True True 1 True True 1 True False 6 True False 0 <b>UDP Ports</b> True False False 0 True False True False False False 0 True False 12 All True True False Allows %s to connect to any udp port True True False False 10 0 True False 0 Select Ports False False 5 1 True True Enter a comma separated list of udp ports or ranges of ports that %s connects to. Example: 612, 650-660 False False True True True True 2 True True 1 True True 1 True True 2 True False Network Connect Tab 8 False True False True False 0 <b>Select common application traits for %s:</b> True False False 5 0 True False 6 Writes syslog messages True True False True True False False 0 Create/Manipulate temporary files in /tmp True True False True True False False 1 Uses Pam for authentication True True False True True False False 2 Uses nsswitch or getpw* calls True True False True True False False 3 Uses dbus True True False True True False False 4 Sends audit messages True True False True True False False 5 Interacts with the terminal True True False True True False False 6 Sends email True True False True True False False 7 True True 1 True False Common Tab 9 False True False True False 0 <b>Add files/directories that %s manages</b> True False False 5 0 True False 12 True False 6 True True False True False 0 0 True False 2 True False gtk-add False False 0 True False Add File True False False 1 False False 0 True True False True False 0 0 True False 2 True False gtk-add False False 0 True False Add Directory True False False 1 False False 1 gtk-delete True True False True False False 2 False False 4 0 True True automatic automatic in True True Files/Directories which the %s "manages". Pid Files, Log Files, /var/lib Files ... False True True 1 True True 1 True False Add Tab 10 False True False True False 0 <b>Add booleans from the %s policy:</b> True False False 5 0 True False 12 True False 6 True True False True False 0 0 True False 2 True False gtk-add False False 0 True False Add Boolean True False False 1 False False 0 gtk-delete True True False True False False 1 False True 4 0 True True automatic automatic in True True Add/Remove booleans used by the %s domain True True 1 True True 1 True False 11 False True False True False 0 <b>Which directory you will generate the %s policy?</b> True False False 0 True False 12 True False Policy Directory False False 5 0 True True False False True True True True 1 ... True True False True False False 2 False False 12 1 True False 12 False True True 0 True False end gtk-cancel True True True False True False False 0 gtk-go-back True True True False True False False 1 gtk-go-forward True True True False True False False 2 False False 5 1 selinux-gui-3.3/polgengui.py000066400000000000000000001017331413427467300162130ustar00rootroot00000000000000#!/usr/bin/python3 -Es # # polgengui.py - GUI for SELinux Config tool in system-config-selinux # # Dan Walsh # # Copyright (C) 2007-2013 Red Hat # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # import signal import string import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk import os from gi.repository import GObject import sys try: import sepolicy except ValueError as e: sys.stderr.write("%s: %s\n" % (e.__class__.__name__, str(e))) sys.exit(1) import sepolicy.generate import sepolicy.interface try: from subprocess import getstatusoutput except ImportError: from commands import getstatusoutput import re def get_all_modules(): try: all_modules = [] rc, output = getstatusoutput("semodule -l 2>/dev/null") if rc == 0: l = output.split("\n") for i in l: all_modules.append(i.split()[0]) except: pass return all_modules ## ## I18N ## PROGNAME = "policycoreutils" try: import gettext kwargs = {} if sys.version_info < (3,): kwargs['unicode'] = True gettext.install(PROGNAME, localedir="/usr/share/locale", codeset='utf-8', **kwargs) except: try: import builtins builtins.__dict__['_'] = str except ImportError: import __builtin__ __builtin__.__dict__['_'] = unicode version = "1.0" sys.path.append('/usr/share/system-config-selinux') sys.path.append('.') # From John Hunter http://www.daa.com.au/pipermail/pygtk/2003-February/004454.html def foreach(model, path, iter, selected): selected.append(model.get_value(iter, 0)) ## ## Pull in the Glade file ## xml = Gtk.Builder() xml.set_translation_domain(PROGNAME) if os.access("polgen.ui", os.F_OK): xml.add_from_file("polgen.ui") else: xml.add_from_file("/usr/share/system-config-selinux/polgen.ui") FILE = 1 DIR = 2 class childWindow: START_PAGE = 0 SELECT_TYPE_PAGE = 0 APP_PAGE = 1 EXISTING_USER_PAGE = 2 TRANSITION_PAGE = 3 USER_TRANSITION_PAGE = 4 ADMIN_PAGE = 5 ROLE_PAGE = 6 IN_NET_PAGE = 7 OUT_NET_PAGE = 8 COMMON_APPS_PAGE = 9 FILES_PAGE = 10 BOOLEAN_PAGE = 11 SELECT_DIR_PAGE = 12 FINISH_PAGE = 12 def __init__(self): self.xml = xml self.notebook = xml.get_object("notebook") self.label_dict = {} self.tooltip_dict = {} label = xml.get_object("select_label") self.label_dict[label] = label.get_text() label = xml.get_object("select_user_roles_label") self.label_dict[label] = label.get_text() label = xml.get_object("select_dir_label") self.label_dict[label] = label.get_text() label = xml.get_object("select_domain_admin_label") self.label_dict[label] = label.get_text() label = xml.get_object("select_in_label") self.label_dict[label] = label.get_text() label = xml.get_object("select_out_label") self.label_dict[label] = label.get_text() label = xml.get_object("select_common_label") self.label_dict[label] = label.get_text() label = xml.get_object("select_manages_label") self.label_dict[label] = label.get_text() label = xml.get_object("select_booleans_label") self.label_dict[label] = label.get_text() label = xml.get_object("existing_user_treeview") self.tooltip_dict[label] = label.get_tooltip_text() label = xml.get_object("transition_treeview") self.tooltip_dict[label] = label.get_tooltip_text() label = xml.get_object("in_tcp_all_checkbutton") self.tooltip_dict[label] = label.get_tooltip_text() label = xml.get_object("in_tcp_reserved_checkbutton") self.tooltip_dict[label] = label.get_tooltip_text() label = xml.get_object("in_tcp_unreserved_checkbutton") self.tooltip_dict[label] = label.get_tooltip_text() label = xml.get_object("in_tcp_entry") self.tooltip_dict[label] = label.get_tooltip_text() label = xml.get_object("in_udp_all_checkbutton") self.tooltip_dict[label] = label.get_tooltip_text() label = xml.get_object("in_udp_reserved_checkbutton") self.tooltip_dict[label] = label.get_tooltip_text() label = xml.get_object("in_udp_unreserved_checkbutton") self.tooltip_dict[label] = label.get_tooltip_text() label = xml.get_object("in_udp_entry") self.tooltip_dict[label] = label.get_tooltip_text() label = xml.get_object("out_tcp_entry") self.tooltip_dict[label] = label.get_tooltip_text() label = xml.get_object("out_udp_entry") self.tooltip_dict[label] = label.get_tooltip_text() label = xml.get_object("out_tcp_all_checkbutton") self.tooltip_dict[label] = label.get_tooltip_text() label = xml.get_object("out_udp_all_checkbutton") self.tooltip_dict[label] = label.get_tooltip_text() label = xml.get_object("boolean_treeview") self.tooltip_dict[label] = label.get_tooltip_text() label = xml.get_object("write_treeview") self.tooltip_dict[label] = label.get_tooltip_text() try: self.all_types = sepolicy.generate.get_all_types() self.all_modules = get_all_modules() self.all_roles = sepolicy.generate.get_all_roles() self.all_users = sepolicy.generate.get_all_users() except RuntimeError as e: self.all_types = [] self.all_modules = [] self.all_roles = [] self.all_users = [] self.error(str(e)) self.name = "" handlers = { "on_delete_clicked": self.delete, "on_delete_boolean_clicked": self.delete_boolean, "on_exec_select_clicked": self.exec_select, "on_init_script_select_clicked": self.init_script_select, "on_add_clicked": self.add, "on_add_boolean_clicked": self.add_boolean, "on_add_dir_clicked": self.add_dir, "on_about_clicked": self.on_about_clicked } xml.connect_signals(handlers) xml.get_object("cancel_button").connect("clicked", self.quit) self.forward_button = xml.get_object("forward_button") self.forward_button.connect("clicked", self.forward) self.back_button = xml.get_object("back_button") self.back_button.connect("clicked", self.back) self.boolean_dialog = xml.get_object("boolean_dialog") self.boolean_name_entry = xml.get_object("boolean_name_entry") self.boolean_description_entry = xml.get_object("boolean_description_entry") self.pages = {} for i in sepolicy.generate.USERS: self.pages[i] = [self.SELECT_TYPE_PAGE, self.APP_PAGE, self.TRANSITION_PAGE, self.ROLE_PAGE, self.IN_NET_PAGE, self.OUT_NET_PAGE, self.BOOLEAN_PAGE, self.SELECT_DIR_PAGE] self.pages[sepolicy.generate.RUSER] = [self.SELECT_TYPE_PAGE, self.APP_PAGE, self.ADMIN_PAGE, self.USER_TRANSITION_PAGE, self.BOOLEAN_PAGE, self.SELECT_DIR_PAGE] self.pages[sepolicy.generate.LUSER] = [self.SELECT_TYPE_PAGE, self.APP_PAGE, self.TRANSITION_PAGE, self.IN_NET_PAGE, self.OUT_NET_PAGE, self.BOOLEAN_PAGE, self.SELECT_DIR_PAGE] self.pages[sepolicy.generate.SANDBOX] = [self.SELECT_TYPE_PAGE, self.APP_PAGE, self.IN_NET_PAGE, self.OUT_NET_PAGE, self.BOOLEAN_PAGE, self.SELECT_DIR_PAGE] self.pages[sepolicy.generate.EUSER] = [self.SELECT_TYPE_PAGE, self.EXISTING_USER_PAGE, self.TRANSITION_PAGE, self.ROLE_PAGE, self.IN_NET_PAGE, self.OUT_NET_PAGE, self.BOOLEAN_PAGE, self.SELECT_DIR_PAGE] for i in sepolicy.generate.APPLICATIONS: self.pages[i] = [self.SELECT_TYPE_PAGE, self.APP_PAGE, self.IN_NET_PAGE, self.OUT_NET_PAGE, self.COMMON_APPS_PAGE, self.FILES_PAGE, self.BOOLEAN_PAGE, self.SELECT_DIR_PAGE] self.pages[sepolicy.generate.USER] = [self.SELECT_TYPE_PAGE, self.APP_PAGE, self.USER_TRANSITION_PAGE, self.IN_NET_PAGE, self.OUT_NET_PAGE, self.COMMON_APPS_PAGE, self.FILES_PAGE, self.BOOLEAN_PAGE, self.SELECT_DIR_PAGE] self.current_page = 0 self.back_button.set_sensitive(0) self.network_buttons = {} self.in_tcp_all_checkbutton = xml.get_object("in_tcp_all_checkbutton") self.in_tcp_reserved_checkbutton = xml.get_object("in_tcp_reserved_checkbutton") self.in_tcp_unreserved_checkbutton = xml.get_object("in_tcp_unreserved_checkbutton") self.in_tcp_entry = self.xml.get_object("in_tcp_entry") self.network_buttons[self.in_tcp_all_checkbutton] = [self.in_tcp_reserved_checkbutton, self.in_tcp_unreserved_checkbutton, self.in_tcp_entry] self.out_tcp_all_checkbutton = xml.get_object("out_tcp_all_checkbutton") self.out_tcp_reserved_checkbutton = xml.get_object("out_tcp_reserved_checkbutton") self.out_tcp_unreserved_checkbutton = xml.get_object("out_tcp_unreserved_checkbutton") self.out_tcp_entry = self.xml.get_object("out_tcp_entry") self.network_buttons[self.out_tcp_all_checkbutton] = [self.out_tcp_entry] self.in_udp_all_checkbutton = xml.get_object("in_udp_all_checkbutton") self.in_udp_reserved_checkbutton = xml.get_object("in_udp_reserved_checkbutton") self.in_udp_unreserved_checkbutton = xml.get_object("in_udp_unreserved_checkbutton") self.in_udp_entry = self.xml.get_object("in_udp_entry") self.network_buttons[self.in_udp_all_checkbutton] = [self.in_udp_reserved_checkbutton, self.in_udp_unreserved_checkbutton, self.in_udp_entry] self.out_udp_all_checkbutton = xml.get_object("out_udp_all_checkbutton") self.out_udp_entry = self.xml.get_object("out_udp_entry") self.network_buttons[self.out_udp_all_checkbutton] = [self.out_udp_entry] for b in self.network_buttons.keys(): b.connect("clicked", self.network_all_clicked) self.boolean_treeview = self.xml.get_object("boolean_treeview") self.boolean_store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING) self.boolean_treeview.set_model(self.boolean_store) self.boolean_store.set_sort_column_id(0, Gtk.SortType.ASCENDING) col = Gtk.TreeViewColumn(_("Name"), Gtk.CellRendererText(), text=0) self.boolean_treeview.append_column(col) col = Gtk.TreeViewColumn(_("Description"), Gtk.CellRendererText(), text=1) self.boolean_treeview.append_column(col) self.role_treeview = self.xml.get_object("role_treeview") self.role_store = Gtk.ListStore(GObject.TYPE_STRING) self.role_treeview.set_model(self.role_store) self.role_treeview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE) self.role_store.set_sort_column_id(0, Gtk.SortType.ASCENDING) col = Gtk.TreeViewColumn(_("Role"), Gtk.CellRendererText(), text=0) self.role_treeview.append_column(col) self.existing_user_treeview = self.xml.get_object("existing_user_treeview") self.existing_user_store = Gtk.ListStore(GObject.TYPE_STRING) self.existing_user_treeview.set_model(self.existing_user_store) self.existing_user_store.set_sort_column_id(0, Gtk.SortType.ASCENDING) col = Gtk.TreeViewColumn(_("Existing_User"), Gtk.CellRendererText(), text=0) self.existing_user_treeview.append_column(col) for i in self.all_roles: iter = self.role_store.append() self.role_store.set_value(iter, 0, i[:-2]) self.in_tcp_reserved_checkbutton = xml.get_object("in_tcp_reserved_checkbutton") self.transition_treeview = self.xml.get_object("transition_treeview") self.transition_store = Gtk.ListStore(GObject.TYPE_STRING) self.transition_treeview.set_model(self.transition_store) self.transition_treeview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE) self.transition_store.set_sort_column_id(0, Gtk.SortType.ASCENDING) col = Gtk.TreeViewColumn(_("Application"), Gtk.CellRendererText(), text=0) self.transition_treeview.append_column(col) self.user_transition_treeview = self.xml.get_object("user_transition_treeview") self.user_transition_store = Gtk.ListStore(GObject.TYPE_STRING) self.user_transition_treeview.set_model(self.user_transition_store) self.user_transition_treeview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE) self.user_transition_store.set_sort_column_id(0, Gtk.SortType.ASCENDING) col = Gtk.TreeViewColumn(_("Application"), Gtk.CellRendererText(), text=0) self.user_transition_treeview.append_column(col) for i in self.all_users: iter = self.user_transition_store.append() self.user_transition_store.set_value(iter, 0, i[:-2]) iter = self.existing_user_store.append() self.existing_user_store.set_value(iter, 0, i[:-2]) self.admin_treeview = self.xml.get_object("admin_treeview") self.admin_store = Gtk.ListStore(GObject.TYPE_STRING) self.admin_treeview.set_model(self.admin_store) self.admin_treeview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE) self.admin_store.set_sort_column_id(0, Gtk.SortType.ASCENDING) col = Gtk.TreeViewColumn(_("Application"), Gtk.CellRendererText(), text=0) self.admin_treeview.append_column(col) try: for u in sepolicy.interface.get_user(): iter = self.transition_store.append() self.transition_store.set_value(iter, 0, u) for a in sepolicy.interface.get_admin(): iter = self.admin_store.append() self.admin_store.set_value(iter, 0, a) except ValueError as e: self.error(e.message) def confine_application(self): return self.get_type() in sepolicy.generate.APPLICATIONS def forward(self, arg): type = self.get_type() if self.current_page == self.START_PAGE: self.back_button.set_sensitive(1) if self.pages[type][self.current_page] == self.SELECT_TYPE_PAGE: if self.on_select_type_page_next(): return if self.pages[type][self.current_page] == self.IN_NET_PAGE: if self.on_in_net_page_next(): return if self.pages[type][self.current_page] == self.OUT_NET_PAGE: if self.on_out_net_page_next(): return if self.pages[type][self.current_page] == self.APP_PAGE: if self.on_name_page_next(): return if self.pages[type][self.current_page] == self.EXISTING_USER_PAGE: if self.on_existing_user_page_next(): return if self.pages[type][self.current_page] == self.SELECT_DIR_PAGE: outputdir = self.output_entry.get_text() if not os.path.isdir(outputdir): self.error(_("%s must be a directory") % outputdir) return False if self.pages[type][self.current_page] == self.FINISH_PAGE: self.generate_policy() self.xml.get_object("cancel_button").set_label(Gtk.STOCK_CLOSE) else: self.current_page = self.current_page + 1 self.notebook.set_current_page(self.pages[type][self.current_page]) if self.pages[type][self.current_page] == self.FINISH_PAGE: self.forward_button.set_label(Gtk.STOCK_APPLY) def back(self, arg): type = self.get_type() if self.pages[type][self.current_page] == self.FINISH_PAGE: self.forward_button.set_label(Gtk.STOCK_GO_FORWARD) self.current_page = self.current_page - 1 self.notebook.set_current_page(self.pages[type][self.current_page]) if self.pages[type][self.current_page] == self.START_PAGE: self.back_button.set_sensitive(0) def network_all_clicked(self, button): active = button.get_active() for b in self.network_buttons[button]: b.set_sensitive(not active) def verify(self, message, title=""): dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, Gtk.ButtonsType.YES_NO, message) dlg.set_title(title) dlg.set_position(Gtk.WindowPosition.MOUSE) dlg.show_all() rc = dlg.run() dlg.destroy() return rc def info(self, message): dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, Gtk.ButtonsType.OK, message) dlg.set_position(Gtk.WindowPosition.MOUSE) dlg.show_all() dlg.run() dlg.destroy() def error(self, message): dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.ERROR, Gtk.ButtonsType.CLOSE, message) dlg.set_position(Gtk.WindowPosition.MOUSE) dlg.show_all() dlg.run() dlg.destroy() def get_name(self): if self.existing_user_radiobutton.get_active(): store, iter = self.existing_user_treeview.get_selection().get_selected() if iter == None: raise ValueError(_("You must select a user")) return store.get_value(iter, 0) else: return self.name_entry.get_text() def get_type(self): if self.sandbox_radiobutton.get_active(): return sepolicy.generate.SANDBOX if self.cgi_radiobutton.get_active(): return sepolicy.generate.CGI if self.user_radiobutton.get_active(): return sepolicy.generate.USER if self.init_radiobutton.get_active(): return sepolicy.generate.DAEMON if self.dbus_radiobutton.get_active(): return sepolicy.generate.DBUS if self.inetd_radiobutton.get_active(): return sepolicy.generate.INETD if self.login_user_radiobutton.get_active(): return sepolicy.generate.LUSER if self.admin_user_radiobutton.get_active(): return sepolicy.generate.AUSER if self.xwindows_user_radiobutton.get_active(): return sepolicy.generate.XUSER if self.terminal_user_radiobutton.get_active(): return sepolicy.generate.TUSER if self.root_user_radiobutton.get_active(): return sepolicy.generate.RUSER if self.existing_user_radiobutton.get_active(): return sepolicy.generate.EUSER def generate_policy(self, *args): outputdir = self.output_entry.get_text() try: my_policy = sepolicy.generate.policy(self.get_name(), self.get_type()) iter = self.boolean_store.get_iter_first() while(iter): my_policy.add_boolean(self.boolean_store.get_value(iter, 0), self.boolean_store.get_value(iter, 1)) iter = self.boolean_store.iter_next(iter) if self.get_type() in sepolicy.generate.APPLICATIONS: my_policy.set_program(self.exec_entry.get_text()) my_policy.gen_symbols() my_policy.set_use_syslog(self.syslog_checkbutton.get_active() == 1) my_policy.set_use_tmp(self.tmp_checkbutton.get_active() == 1) my_policy.set_use_uid(self.uid_checkbutton.get_active() == 1) my_policy.set_use_pam(self.pam_checkbutton.get_active() == 1) my_policy.set_use_dbus(self.dbus_checkbutton.get_active() == 1) my_policy.set_use_audit(self.audit_checkbutton.get_active() == 1) my_policy.set_use_terminal(self.terminal_checkbutton.get_active() == 1) my_policy.set_use_mail(self.mail_checkbutton.get_active() == 1) if self.get_type() is sepolicy.generate.DAEMON: my_policy.set_init_script(self.init_script_entry.get_text()) if self.get_type() == sepolicy.generate.USER: selected = [] self.user_transition_treeview.get_selection().selected_foreach(foreach, selected) my_policy.set_transition_users(selected) else: if self.get_type() == sepolicy.generate.RUSER: selected = [] self.admin_treeview.get_selection().selected_foreach(foreach, selected) my_policy.set_admin_domains(selected) selected = [] self.user_transition_treeview.get_selection().selected_foreach(foreach, selected) my_policy.set_transition_users(selected) else: selected = [] self.transition_treeview.get_selection().selected_foreach(foreach, selected) my_policy.set_transition_domains(selected) selected = [] self.role_treeview.get_selection().selected_foreach(foreach, selected) my_policy.set_admin_roles(selected) my_policy.set_in_tcp(self.in_tcp_all_checkbutton.get_active(), self.in_tcp_reserved_checkbutton.get_active(), self.in_tcp_unreserved_checkbutton.get_active(), self.in_tcp_entry.get_text()) my_policy.set_in_udp(self.in_udp_all_checkbutton.get_active(), self.in_udp_reserved_checkbutton.get_active(), self.in_udp_unreserved_checkbutton.get_active(), self.in_udp_entry.get_text()) my_policy.set_out_tcp(self.out_tcp_all_checkbutton.get_active(), self.out_tcp_entry.get_text()) my_policy.set_out_udp(self.out_udp_all_checkbutton.get_active(), self.out_udp_entry.get_text()) iter = self.store.get_iter_first() while(iter): if self.store.get_value(iter, 1) == FILE: my_policy.add_file(self.store.get_value(iter, 0)) else: my_policy.add_dir(self.store.get_value(iter, 0)) iter = self.store.iter_next(iter) self.info(my_policy.generate(outputdir)) return False except ValueError as e: self.error(e.message) def delete(self, args): store, iter = self.view.get_selection().get_selected() if iter != None: store.remove(iter) self.view.get_selection().select_path((0,)) def delete_boolean(self, args): store, iter = self.boolean_treeview.get_selection().get_selected() if iter != None: store.remove(iter) self.boolean_treeview.get_selection().select_path((0,)) def add_boolean(self, type): self.boolean_name_entry.set_text("") self.boolean_description_entry.set_text("") rc = self.boolean_dialog.run() self.boolean_dialog.hide() if rc == Gtk.ResponseType.CANCEL: return iter = self.boolean_store.append() self.boolean_store.set_value(iter, 0, self.boolean_name_entry.get_text()) self.boolean_store.set_value(iter, 1, self.boolean_description_entry.get_text()) def __add(self, type): rc = self.file_dialog.run() self.file_dialog.hide() if rc == Gtk.ResponseType.CANCEL: return for i in self.file_dialog.get_filenames(): iter = self.store.append() self.store.set_value(iter, 0, i) self.store.set_value(iter, 1, type) def exec_select(self, args): self.file_dialog.set_select_multiple(0) self.file_dialog.set_title(_("Select executable file to be confined.")) self.file_dialog.set_action(Gtk.FileChooserAction.OPEN) self.file_dialog.set_current_folder("/usr/sbin") rc = self.file_dialog.run() self.file_dialog.hide() if rc == Gtk.ResponseType.CANCEL: return self.exec_entry.set_text(self.file_dialog.get_filename()) def init_script_select(self, args): self.file_dialog.set_select_multiple(0) self.file_dialog.set_title(_("Select init script file to be confined.")) self.file_dialog.set_action(Gtk.FileChooserAction.OPEN) self.file_dialog.set_current_folder("/etc/rc.d/init.d") rc = self.file_dialog.run() self.file_dialog.hide() if rc == Gtk.ResponseType.CANCEL: return self.init_script_entry.set_text(self.file_dialog.get_filename()) def add(self, args): self.file_dialog.set_title(_("Select file(s) that confined application creates or writes")) self.file_dialog.set_current_folder("/") self.file_dialog.set_action(Gtk.FileChooserAction.OPEN) self.file_dialog.set_select_multiple(1) self.__add(FILE) def add_dir(self, args): self.file_dialog.set_title(_("Select directory(s) that the confined application owns and writes into")) self.file_dialog.set_current_folder("/") self.file_dialog.set_select_multiple(1) self.file_dialog.set_action(Gtk.FileChooserAction.SELECT_FOLDER) self.__add(DIR) def on_about_clicked(self, args): dlg = xml.get_object("about_dialog") dlg.run() dlg.hide() def quit(self, args): Gtk.main_quit() def setupScreen(self): # Bring in widgets from glade file. self.mainWindow = self.xml.get_object("main_window") self.druid = self.xml.get_object("druid") self.type = 0 self.name_entry = self.xml.get_object("name_entry") self.name_entry.connect("insert_text", self.on_name_entry_changed) self.name_entry.connect("focus_out_event", self.on_focus_out_event) self.exec_entry = self.xml.get_object("exec_entry") self.exec_button = self.xml.get_object("exec_button") self.init_script_entry = self.xml.get_object("init_script_entry") self.init_script_button = self.xml.get_object("init_script_button") self.output_entry = self.xml.get_object("output_entry") self.output_entry.set_text(os.getcwd()) self.xml.get_object("output_button").connect("clicked", self.output_button_clicked) self.xwindows_user_radiobutton = self.xml.get_object("xwindows_user_radiobutton") self.terminal_user_radiobutton = self.xml.get_object("terminal_user_radiobutton") self.root_user_radiobutton = self.xml.get_object("root_user_radiobutton") self.login_user_radiobutton = self.xml.get_object("login_user_radiobutton") self.admin_user_radiobutton = self.xml.get_object("admin_user_radiobutton") self.existing_user_radiobutton = self.xml.get_object("existing_user_radiobutton") self.user_radiobutton = self.xml.get_object("user_radiobutton") self.init_radiobutton = self.xml.get_object("init_radiobutton") self.inetd_radiobutton = self.xml.get_object("inetd_radiobutton") self.dbus_radiobutton = self.xml.get_object("dbus_radiobutton") self.cgi_radiobutton = self.xml.get_object("cgi_radiobutton") self.sandbox_radiobutton = self.xml.get_object("sandbox_radiobutton") self.tmp_checkbutton = self.xml.get_object("tmp_checkbutton") self.uid_checkbutton = self.xml.get_object("uid_checkbutton") self.pam_checkbutton = self.xml.get_object("pam_checkbutton") self.dbus_checkbutton = self.xml.get_object("dbus_checkbutton") self.audit_checkbutton = self.xml.get_object("audit_checkbutton") self.terminal_checkbutton = self.xml.get_object("terminal_checkbutton") self.mail_checkbutton = self.xml.get_object("mail_checkbutton") self.syslog_checkbutton = self.xml.get_object("syslog_checkbutton") self.view = self.xml.get_object("write_treeview") self.file_dialog = self.xml.get_object("filechooserdialog") self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_INT) self.view.set_model(self.store) col = Gtk.TreeViewColumn("", Gtk.CellRendererText(), text=0) col.set_resizable(True) self.view.append_column(col) self.view.get_selection().select_path((0,)) def output_button_clicked(self, *args): self.file_dialog.set_title(_("Select directory to generate policy files in")) self.file_dialog.set_action(Gtk.FileChooserAction.SELECT_FOLDER) self.file_dialog.set_select_multiple(0) rc = self.file_dialog.run() self.file_dialog.hide() if rc == Gtk.ResponseType.CANCEL: return self.output_entry.set_text(self.file_dialog.get_filename()) def on_name_entry_changed(self, entry, text, size, position): if text.find(" ") >= 0: entry.stop_emission_by_name("insert-text") def on_focus_out_event(self, entry, third): name = entry.get_text() if self.name != name: if name in self.all_types: if self.verify(_("Type %s_t already defined in current policy.\nDo you want to continue?") % name, _("Verify Name")) == Gtk.ResponseType.NO: entry.set_text("") return False if name in self.all_modules: if self.verify(_("Module %s already loaded in current policy.\nDo you want to continue?") % name, _("Verify Name")) == Gtk.ResponseType.NO: entry.set_text("") return False file = "/etc/rc.d/init.d/" + name if os.path.isfile(file) and self.init_script_entry.get_text() == "": self.init_script_entry.set_text(file) file = "/usr/sbin/" + name if os.path.isfile(file) and self.exec_entry.get_text() == "": self.exec_entry.set_text(file) self.name = name return False def on_in_net_page_next(self, *args): try: sepolicy.generate.verify_ports(self.in_tcp_entry.get_text()) sepolicy.generate.verify_ports(self.in_udp_entry.get_text()) except ValueError as e: self.error(e.message) return True def on_out_net_page_next(self, *args): try: sepolicy.generate.verify_ports(self.out_tcp_entry.get_text()) sepolicy.generate.verify_ports(self.out_udp_entry.get_text()) except ValueError as e: self.error(e.message) return True def on_select_type_page_next(self, *args): self.exec_entry.set_sensitive(self.confine_application()) self.exec_button.set_sensitive(self.confine_application()) self.init_script_entry.set_sensitive(self.init_radiobutton.get_active()) self.init_script_button.set_sensitive(self.init_radiobutton.get_active()) def on_existing_user_page_next(self, *args): store, iter = self.view.get_selection().get_selected() if iter != None: self.error(_("You must select a user")) return True def on_name_page_next(self, *args): name = self.name_entry.get_text() if not name.isalnum(): self.error(_("You must add a name made up of letters and numbers and containing no spaces.")) return True for i in self.label_dict: text = '%s' % (self.label_dict[i] % ("'" + name + "'")) i.set_markup(text) for i in self.tooltip_dict: text = self.tooltip_dict[i] % ("'" + name + "'") i.set_tooltip_text(text) if self.confine_application(): exe = self.exec_entry.get_text() if exe == "": self.error(_("You must enter a executable")) return True policy = sepolicy.generate.policy(name, self.get_type()) policy.set_program(exe) policy.gen_writeable() policy.gen_symbols() for f in policy.files.keys(): iter = self.store.append() self.store.set_value(iter, 0, f) self.store.set_value(iter, 1, FILE) for f in policy.dirs.keys(): iter = self.store.append() self.store.set_value(iter, 0, f) self.store.set_value(iter, 1, DIR) self.tmp_checkbutton.set_active(policy.use_tmp) self.uid_checkbutton.set_active(policy.use_uid) self.pam_checkbutton.set_active(policy.use_pam) self.dbus_checkbutton.set_active(policy.use_dbus) self.audit_checkbutton.set_active(policy.use_audit) self.terminal_checkbutton.set_active(policy.use_terminal) self.mail_checkbutton.set_active(policy.use_mail) self.syslog_checkbutton.set_active(policy.use_syslog) def stand_alone(self): desktopName = _("Configure SELinux") self.setupScreen() self.mainWindow.connect("destroy", self.quit) self.mainWindow.show_all() Gtk.main() if __name__ == "__main__": signal.signal(signal.SIGINT, signal.SIG_DFL) app = childWindow() app.stand_alone() selinux-gui-3.3/portsPage.py000066400000000000000000000243111413427467300161620ustar00rootroot00000000000000## portsPage.py - show selinux mappings ## Copyright (C) 2006 Red Hat, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ## Author: Dan Walsh import sys from gi.repository import GObject, Gtk import seobject TYPE_COL = 0 PROTOCOL_COL = 1 MLS_COL = 2 PORT_COL = 3 try: from subprocess import getstatusoutput except ImportError: from commands import getstatusoutput from semanagePage import * ## ## I18N ## PROGNAME = "policycoreutils" try: import gettext kwargs = {} if sys.version_info < (3,): kwargs['unicode'] = True gettext.install(PROGNAME, localedir="/usr/share/locale", codeset='utf-8', **kwargs) except: try: import builtins builtins.__dict__['_'] = str except ImportError: import __builtin__ __builtin__.__dict__['_'] = unicode class portsPage(semanagePage): def __init__(self, xml): semanagePage.__init__(self, xml, "ports", _("Network Port")) group_listview = xml.get_object("listViewButton") group_listview.connect("clicked", self.on_group_clicked) self.group = False self.ports_filter = xml.get_object("portsFilterEntry") self.ports_filter.connect("focus_out_event", self.filter_changed) self.ports_filter.connect("activate", self.filter_changed) self.ports_name_entry = xml.get_object("portsNameEntry") self.ports_protocol_combo = xml.get_object("portsProtocolCombo") self.ports_number_entry = xml.get_object("portsNumberEntry") self.ports_mls_entry = xml.get_object("portsMLSEntry") self.ports_add_button = xml.get_object("portsAddButton") self.ports_properties_button = xml.get_object("portsPropertiesButton") self.ports_delete_button = xml.get_object("portsDeleteButton") liststore = self.ports_protocol_combo.get_model() iter = liststore.get_iter_first() self.ports_protocol_combo.set_active_iter(iter) self.init_store() self.edit = True self.load() def filter_changed(self, *arg): filter = arg[0].get_text() if filter != self.filter: if self.edit: self.load(filter) else: self.group_load(filter) def init_store(self): self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING) self.view.set_model(self.store) self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) self.view.set_search_equal_func(self.search) col = Gtk.TreeViewColumn(_("SELinux Port\nType"), Gtk.CellRendererText(), text=TYPE_COL) col.set_sort_column_id(TYPE_COL) col.set_resizable(True) self.view.append_column(col) self.store.set_sort_column_id(TYPE_COL, Gtk.SortType.ASCENDING) col = Gtk.TreeViewColumn(_("Protocol"), Gtk.CellRendererText(), text=PROTOCOL_COL) col.set_sort_column_id(PROTOCOL_COL) col.set_resizable(True) self.view.append_column(col) self.mls_col = Gtk.TreeViewColumn(_("MLS/MCS\nLevel"), Gtk.CellRendererText(), text=MLS_COL) self.mls_col.set_resizable(True) self.mls_col.set_sort_column_id(MLS_COL) self.view.append_column(self.mls_col) col = Gtk.TreeViewColumn(_("Port"), Gtk.CellRendererText(), text=PORT_COL) col.set_sort_column_id(PORT_COL) col.set_resizable(True) self.view.append_column(col) self.store.set_sort_func(PORT_COL, self.sort_int, "") def sort_int(self, treemodel, iter1, iter2, user_data): try: p1 = int(treemodel.get_value(iter1, PORT_COL).split('-')[0]) p2 = int(treemodel.get_value(iter2, PORT_COL).split('-')[0]) if p1 > p2: return 1 if p1 == p2: return 0 return -1 except: return 0 def load(self, filter=""): self.filter = filter self.port = seobject.portRecords() dict = self.port.get_all(self.local) self.store.clear() for k in sorted(dict.keys()): if not (self.match(str(k[0]), filter) or self.match(dict[k][0], filter) or self.match(k[2], filter) or self.match(dict[k][1], filter) or self.match(dict[k][1], filter)): continue iter = self.store.append() if k[0] == k[1]: self.store.set_value(iter, PORT_COL, str(k[0])) else: rec = "%s-%s" % k[:2] self.store.set_value(iter, PORT_COL, rec) self.store.set_value(iter, TYPE_COL, dict[k][0]) self.store.set_value(iter, PROTOCOL_COL, k[2]) self.store.set_value(iter, MLS_COL, dict[k][1]) self.view.get_selection().select_path((0,)) def group_load(self, filter=""): self.filter = filter self.port = seobject.portRecords() dict = self.port.get_all_by_type(self.local) self.store.clear() for k in sorted(dict.keys()): ports_string = ", ".join(dict[k]) if not (self.match(ports_string, filter) or self.match(k[0], filter) or self.match(k[1], filter)): continue iter = self.store.append() self.store.set_value(iter, TYPE_COL, k[0]) self.store.set_value(iter, PROTOCOL_COL, k[1]) self.store.set_value(iter, PORT_COL, ports_string) self.store.set_value(iter, MLS_COL, "") self.view.get_selection().select_path((0,)) def propertiesDialog(self): if self.edit: semanagePage.propertiesDialog(self) def dialogInit(self): store, iter = self.view.get_selection().get_selected() self.ports_number_entry.set_text(store.get_value(iter, PORT_COL)) self.ports_number_entry.set_sensitive(False) self.ports_protocol_combo.set_sensitive(False) self.ports_name_entry.set_text(store.get_value(iter, TYPE_COL)) self.ports_mls_entry.set_text(store.get_value(iter, MLS_COL)) protocol = store.get_value(iter, PROTOCOL_COL) liststore = self.ports_protocol_combo.get_model() iter = liststore.get_iter_first() while iter != None and liststore.get_value(iter, 0) != protocol: iter = liststore.iter_next(iter) if iter != None: self.ports_protocol_combo.set_active_iter(iter) def dialogClear(self): self.ports_number_entry.set_text("") self.ports_number_entry.set_sensitive(True) self.ports_protocol_combo.set_sensitive(True) self.ports_name_entry.set_text("") self.ports_mls_entry.set_text("s0") def delete(self): store, iter = self.view.get_selection().get_selected() port = store.get_value(iter, PORT_COL) protocol = store.get_value(iter, 1) try: self.wait() (rc, out) = getstatusoutput("semanage port -d -p %s %s" % (protocol, port)) self.ready() if rc != 0: return self.error(out) store.remove(iter) self.view.get_selection().select_path((0,)) except ValueError as e: self.error(e.args[0]) def add(self): target = self.ports_name_entry.get_text().strip() mls = self.ports_mls_entry.get_text().strip() port_number = self.ports_number_entry.get_text().strip() if port_number == "": port_number = "1" for i in port_number.split("-"): if not i.isdigit(): self.error(_("Port number \"%s\" is not valid. 0 < PORT_NUMBER < 65536 ") % port_number) return False list_model = self.ports_protocol_combo.get_model() iter = self.ports_protocol_combo.get_active_iter() protocol = list_model.get_value(iter, 0) self.wait() (rc, out) = getstatusoutput("semanage port -a -p %s -r %s -t %s %s" % (protocol, mls, target, port_number)) self.ready() if rc != 0: self.error(out) return False iter = self.store.append() self.store.set_value(iter, TYPE_COL, target) self.store.set_value(iter, PORT_COL, port_number) self.store.set_value(iter, PROTOCOL_COL, protocol) self.store.set_value(iter, MLS_COL, mls) def modify(self): target = self.ports_name_entry.get_text().strip() mls = self.ports_mls_entry.get_text().strip() port_number = self.ports_number_entry.get_text().strip() list_model = self.ports_protocol_combo.get_model() iter = self.ports_protocol_combo.get_active_iter() protocol = list_model.get_value(iter, 0) self.wait() (rc, out) = getstatusoutput("semanage port -m -p %s -r %s -t %s %s" % (protocol, mls, target, port_number)) self.ready() if rc != 0: self.error(out) return False store, iter = self.view.get_selection().get_selected() self.store.set_value(iter, TYPE_COL, target) self.store.set_value(iter, PORT_COL, port_number) self.store.set_value(iter, PROTOCOL_COL, protocol) self.store.set_value(iter, MLS_COL, mls) def on_group_clicked(self, button): self.ports_add_button.set_sensitive(self.group) self.ports_properties_button.set_sensitive(self.group) self.ports_delete_button.set_sensitive(self.group) self.mls_col.set_visible(self.group) self.group = not self.group if self.group: button.set_label(_("List View")) self.group_load(self.filter) else: button.set_label(_("Group View")) self.load(self.filter) return True selinux-gui-3.3/ru/000077500000000000000000000000001413427467300142715ustar00rootroot00000000000000selinux-gui-3.3/ru/selinux-polgengui.8000066400000000000000000000025621413427467300200450ustar00rootroot00000000000000.TH "selinux-polgengui" "8" "8 апреля 2013" "Руководство по утилитам настройки системы" .SH ИМЯ selinux\-polgengui \- утилита для создания политики SELinux .SH ОБЗОР .B selinux-polgengui .SH ОПИСАНИЕ \fBselinux-polgengui\fP - графическая утилита, которую можно использовать, чтобы создать платформу для сборки политики SELinux. .SH ПАРАМЕТРЫ Нет .SH ФАЙЛЫ \fi/usr/bin/selinux-polgengui\fP .SH Примеры Чтобы запустить программу, введите: selinux-polgengui .PP .SH "СМОТРИТЕ ТАКЖЕ" .TP selinux(1), sepolicy(8), sepolicy-generate(8) .PP .SH СООБЩЕНИЯ ОБ ОШИБКАХ Отправляйте сообщения об ошибках по адресу . .SH ЛИЦЕНЗИЯ И АВТОРЫ \fBselinux-polgengui\fP распространяется на условиях Стандартной Общественной Лицензии GNU, авторские права принадлежат Red Hat, Inc. .br Эта man-страница была написана Daniel Walsh . Перевод на русский язык выполнила Герасименко Олеся . selinux-gui-3.3/ru/system-config-selinux.8000066400000000000000000000025111413427467300206350ustar00rootroot00000000000000.TH "system-config-selinux" "8" "8 апреля 2013" "Руководство по утилитам настройки системы" .SH ИМЯ system\-config\-selinux \- утилита для управления SELinux .SH ОБЗОР .B system-config-selinux .SH ОПИСАНИЕ Утилита \fBsystem-config-selinux\fP предоставляет графический интерфейс для управления конфигурацией SELinux. .SH ПАРАМЕТРЫ Нет .SH ФАЙЛЫ \fi/usr/bin/system-config-selinux\fP .SH Примеры Чтобы запустить программу, введите: system-config-selinux .PP .SH "СМОТРИТЕ ТАКЖЕ" .TP selinux(1), semanage(8) .PP .SH СООБЩЕНИЯ ОБ ОШИБКАХ Отправляйте сообщения об ошибках по адресу . .SH ЛИЦЕНЗИЯ И АВТОРЫ \fBsystem-config-selinux\fP распространяется на условиях Стандартной Общественной Лицензии GNU, авторские права принадлежат Red Hat, Inc. .br Эта man-страница была написана Daniel Walsh . Перевод на русский язык выполнила Герасименко Олеся . selinux-gui-3.3/selinux-polgengui.8000066400000000000000000000014241413427467300174130ustar00rootroot00000000000000.TH "selinux-polgengui" "8" "8 April 2013" "System Config Tools Manual" "System Config Tools Manual" .SH NAME selinux\-polgengui \- SELinux Policy Generation Tool .SH SYNOPSIS .B selinux-polgengui .SH DESCRIPTION \fBselinux-polgengui\fP is a graphical tool, which can be used to create a framework for building SELinux Policy. .SH OPTIONS None .SH FILES \fi/usr/bin/selinux-polgengui\fP .SH Examples To run the program type: selinux-polgengui .PP .SH "SEE ALSO" .TP selinux(1), sepolicy(8), sepolicy-generate(8) .PP .SH REPORTING BUGS Report bugs to . .SH LICENSE AND AUTHORS \fBselinux-polgengui\fP is licensed under the GNU General Public License and is copyrighted by Red Hat, Inc. .br This man page was written by Daniel Walsh selinux-gui-3.3/selinux-polgengui.desktop000066400000000000000000000073361413427467300207250ustar00rootroot00000000000000[Desktop Entry] Name=SELinux Policy Generation Tool Name[bn_IN]=SELinux Policy নির্মাণের সামগ্রী Name[ca]=Eina de generació de polítiques del SELinux Name[da]=Regelsætgenereringsværktøj til SELinux Name[de]=Tool zur Erstellung von SELinux-Richtlinien Name[es]=Generador de Políticas de SELinux Name[fi]=SELinux-käytäntöjen generointityökalu Name[fr]=Outil de génération de stratégies SELinux Name[gu]=SELinux પોલિસી બનાવટ સાધન Name[hi]=SELinux पॉलिसी जनन औजार Name[it]=Tool di generazione della policy di SELinux Name[ja]=SELinux ポリシー生成ツール Name[kn]=SELinux ಪಾಲಿಸಿ ಉತ್ಪಾದನಾ ಉಪಕರಣ Name[ko]=SELinux 정책 생성 도구 Name[ml]=SELinux പോളിസി ഉത്പാദന പ്രയോഗം Name[mr]=SELinux करार निर्माण साधन Name[nl]=SELinux tactiek generatie gereedschap Name[or]=SELinux ନୀତି ସୃଷ୍ଟି ଉପକରଣ Name[pa]=SELinux ਪਾਲਿਸੀ ਨਿਰਮਾਣ ਜੰਤਰ Name[pl]=Narzędzie tworzenia polityki SELinuksa Name[pt]=Ferramenta de Geração de Políticas SELinux Name[pt_BR]=Ferramenta de criação de políticas do SELinux Name[ru]=Средство создания политики SELinux Name[sv]=Genereringsverktyg för SELinuxpolicy Name[ta]=SELinux பாலிசி உற்பத்தி கருவி Name[te]=SELinux నిర్వహణ Name[uk]=Утиліта генерації правил SELinux Name[zh_CN]=SELinux 策略生成工具 Name[zh_TW]=SELinux 政策產生工具(SELinux Policy Generation Tool) Comment=Generate SELinux policy modules Comment[bn_IN]=SELinux নিয়মনীতির মডিউল নির্মাণ করুন Comment[ca]=Genera els mòduls de les polítiques de SELinux Comment[da]=Generér SELinux-regelsætmodul Comment[de]=Tool zur Erstellung von SELinux-Richtlinien Comment[es]=Generar módulos de política de SELinux Comment[fi]=Generoi SELinuxin käytäntömoduuleja Comment[fr]=Génére des modules de stratégie SELinux Comment[gu]=SELinux પોલિસી મોડ્યુલોને ઉત્પન્ન કરો Comment[hi]=नया पॉलिसी मॉड्यूल उत्पन्न करें Comment[it]=Genera moduli della politica di SELinux Comment[ja]=新しいポリシーモジュールの作成 Comment[kn]=SELinux ಪಾಲಿಸಿ ಘಟಕಗಳನ್ನು ಉತ್ಪಾದಿಸು Comment[ko]=SELinux 정책 모듈 생성 Comment[ml]=SELinux യ പോളിസി ഘങ്ങള്‍ തയ്യാറാക്കുക Comment[mr]=SELinux करार घटके निर्माण करा Comment[nl]=Maak een SELinux tactiek module aan Comment[or]=SELinux ନୀତି ଏକକାଂଶ ସୃଷ୍ଟିକରନ୍ତୁ Comment[pa]=SELinux ਪਾਲਿਸੀ ਮੈਡਿਊਲ ਬਣਾਓ Comment[pl]=Tworzenie nowych modułów polityki SELinuksa Comment[pt]=Gerar módulos de políticas SELinux Comment[pt_BR]=Gerar módulos de política do SELinux Comment[ru]=Генерация модулей политики SELinux Comment[sv]=Generera SELinux-policymoduler Comment[ta]=SELinux கொள்கை தொகுதியை உருவாக்கவும் Comment[te]=SELinux పాలసీ మాడ్యూళ్ళను వుద్భవింపచేయుము Comment[uk]=Створення модулів контролю доступу SELinux Comment[zh_CN]=生成 SELinux 策略模块 Comment[zh_TW]=產生 SELinux 政策模組 StartupNotify=true Icon=system-config-selinux Exec=/usr/bin/selinux-polgengui Type=Application Terminal=false Categories=System;Security; X-Desktop-File-Install-Version=0.2 selinux-gui-3.3/semanagePage.py000066400000000000000000000124621413427467300165770ustar00rootroot00000000000000## semanagePage.py - show selinux mappings ## Copyright (C) 2006 Red Hat, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ## Author: Dan Walsh import sys from gi.repository import Gdk, Gtk ## ## I18N ## PROGNAME = "policycoreutils" try: import gettext kwargs = {} if sys.version_info < (3,): kwargs['unicode'] = True gettext.install(PROGNAME, localedir="/usr/share/locale", codeset='utf-8', **kwargs) except: try: import builtins builtins.__dict__['_'] = str except ImportError: import __builtin__ __builtin__.__dict__['_'] = unicode def idle_func(): while Gtk.events_pending(): Gtk.main_iteration() class semanagePage: def __init__(self, xml, name, description): self.xml = xml self.window = self.xml.get_object("mainWindow").get_root_window() self.busy_cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH) self.ready_cursor = Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR) self.local = False self.view = xml.get_object("%sView" % name) self.dialog = xml.get_object("%sDialog" % name) self.filter_entry = xml.get_object("%sFilterEntry" % name) self.filter_entry.connect("focus_out_event", self.filter_changed) self.filter_entry.connect("activate", self.filter_changed) self.filter_entry.connect("changed", self.filter_changed) self.view.connect("row_activated", self.rowActivated) self.view.get_selection().connect("changed", self.itemSelected) self.description = description def wait(self): self.window.set_cursor(self.busy_cursor) idle_func() def ready(self): self.window.set_cursor(self.ready_cursor) idle_func() def get_description(self): return self.description def itemSelected(self, selection): return def filter_changed(self, *arg): filter = arg[0].get_text() if filter != self.filter: self.load(filter) def search(self, model, col, key, i): sort_col = self.store.get_sort_column_id()[0] val = model.get_value(i, sort_col) if val.lower().startswith(key.lower()): return False return True def match(self, target, filter): try: f = filter.lower() t = target.lower() if t.find(f) >= 0: return True except: pass return False def rowActivated(self, view, row, Column): self.propertiesDialog() def verify(self, message, title=""): dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, Gtk.ButtonsType.YES_NO, message) dlg.set_title(title) dlg.set_position(Gtk.WindowPosition.MOUSE) dlg.show_all() rc = dlg.run() dlg.destroy() return rc def error(self, message): dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.ERROR, Gtk.ButtonsType.CLOSE, message) dlg.set_position(Gtk.WindowPosition.MOUSE) dlg.show_all() dlg.run() dlg.destroy() def deleteDialog(self): store, it = self.view.get_selection().get_selected() if (it is not None) and (self.verify(_("Are you sure you want to delete %s '%s'?" % (self.description, store.get_value(it, 0))), _("Delete %s" % self.description)) == Gtk.ResponseType.YES): self.delete() def use_menus(self): return True def addDialog(self): self.dialogClear() self.dialog.set_title(_("Add %s" % self.description)) self.dialog.set_position(Gtk.WindowPosition.MOUSE) while self.dialog.run() == Gtk.ResponseType.OK: try: if self.add() is False: continue break except ValueError as e: self.error(e.args[0]) self.dialog.hide() def propertiesDialog(self): self.dialogInit() self.dialog.set_title(_("Modify %s" % self.description)) self.dialog.set_position(Gtk.WindowPosition.MOUSE) while self.dialog.run() == Gtk.ResponseType.OK: try: if self.modify() is False: continue break except ValueError as e: self.error(e.args[0]) self.dialog.hide() def on_local_clicked(self, button): self.local = not self.local if self.local: button.set_label(_("all")) else: button.set_label(_("Customized")) self.load(self.filter) return True selinux-gui-3.3/sepolgen000066400000000000000000000000371413427467300154020ustar00rootroot00000000000000#!/bin/sh sepolicy generate $* selinux-gui-3.3/sepolicy.desktop000066400000000000000000000004311413427467300170630ustar00rootroot00000000000000[Desktop Entry] Name=SELinux Policy Management Tool Comment=Generate SELinux policy modules Icon=sepolicy Exec=/usr/bin/sepolicy gui Type=Application Terminal=false Categories=System;Security; X-Desktop-File-Install-Version=0.2 Keywords=policy;security;selinux;avc;permission;mac; selinux-gui-3.3/sepolicy_16.png000066400000000000000000000027651413427467300165200ustar00rootroot00000000000000PNG  IHDRatEXtSoftwareAdobe ImageReadyqe<hiTXtXML:com.adobe.xmp fd#IDATxbd@m-@IhBUeM!0^CC 7ndO#А\0!>|pY0 a4`tF % $(gʊjF A C`$;y3`AJ,`i m]kߊәچ w73xegkbd˱z@6P4W>i30 /3/gy>Ǡj *9]RvDM4H-w e8_>cXpɓ7~#g0J+ IF`.AQώAHR`ZF,p/0{7'~0<"b1@vQp2q3ܼz ̿z0 Im03ϗDH3k[F#r@J]0 r6   q\-E32ʂ ?y' 3`# d뿿d5-\> @h(5 N@t`a ?IENDB`selinux-gui-3.3/sepolicy_22.png000066400000000000000000000036331413427467300165100ustar00rootroot00000000000000PNG  IHDRĴl;tEXtSoftwareAdobe ImageReadyqe<hiTXtXML:com.adobe.xmp 5>IDATxڔU_lSe[/]ns]Ge8¢dj\}EhB@^xI 1aY6ddCݶv}nkU;;9s+H(OI- &2D(m"sYE)[Qtsf166NVM%xhzW TJFle$EQJbkť| ek3XlzrJask=>ԺXrS)%$|8:);7~Q/ӡ.(}K \m/O+ _!9E N@[7oxfϮPʬ$T沩pF>{?+ XgT _?,tˏuEcy..j3j4x5%`VS [a$IDATx $gu&zXr%n--k̨%f{`l#!ac7gyfsGdbZ`[hGjm[TwK?ʬʬʪ+EgV.}b-iJ| b-&b-&b-&b-&b-&b-&bmagc=87sѹuoq{ڹO ?vَk/ eȏ@t:T~ S = Qo? KRBZmtO;ۣGR8*]ߏKuFGЧ J \r\;qa?&84 (KP*P*WR.eqH_b蜬2?<< cc;=7=vO]H@w/PF"(JsH8\ &$LJl6 v}a`pZnz|P繷_,1mb^iZPK@Ln7ݻvny{'8  ׇ5n%AJ@ ÆB &I80W\:d2sv=j㑏UG sB_!&X~H 8O@Le~W#Gdc~CCГ7$pT~uJe _#?22oz!ɂ4꼾AHB# /_-)ٙyn‚P `K<}>W\~ {_uA%$)7)RD50C&& )ֿuppַB&irk ^@]X ~Y b0*%y}"(WSs`T iaØ65}[z'2{d!B6}D~}ÁVr ߊ BgM1 l=#pkrd}HR^[xO((  uދY}",ܳɋ{/!2euDm{Nnh9ض)[Gx]IP|ޛ׼(!>>YCcv_7ok$'l_:&-l:)^{ |G;!L%jOz2~AMQ0MM0 ÌCp1+jT"_O{l ?B p l~]){\1׌" v?E(#iFCHލXsIA{- ģM*iݻwd1/u=z@aր9mKpooc bߗ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C8EdU<7HֲP-DhGTc! Y*LsdWRrgY,Y{[tE򂇸YtISFч%+wDN1HN,CR/u&~$m5"5@-b4Mw>XcJQhNOxWrw|}|6 T;A5lg* Ko.$Z}xoDxMMzц5JN ^ ԗWjre4JYWݯ &5ɟ 0lL@D.>4hSGRg; 9i2g9yA8PyY ?M܉d])Cb%3r'E6)*ܹFB: )'Zeݺs||!l2w਴t]υX g̹%\v}{п5esn Vlf'!1~Np^ Uْq }kΓǪÞ;t% ƽH>[ޜ c?u]oϿfRjWAeV_R`` m'3IENDB`selinux-gui-3.3/statusPage.py000066400000000000000000000171141413427467300163410ustar00rootroot00000000000000# statusPage.py - show selinux status ## Copyright (C) 2006-2009 Red Hat, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ## Author: Dan Walsh import os import sys from gi.repository import Gtk import selinux INSTALLPATH = '/usr/share/system-config-selinux' sys.path.append(INSTALLPATH) ENFORCING = 1 PERMISSIVE = 0 DISABLED = -1 modearray = ("disabled", "permissive", "enforcing") SELINUXDIR = "/etc/selinux/" RELABELFILE = "/.autorelabel" ## ## I18N ## PROGNAME = "policycoreutils" try: import gettext kwargs = {} if sys.version_info < (3,): kwargs['unicode'] = True gettext.install(PROGNAME, localedir="/usr/share/locale", codeset='utf-8', **kwargs) except: try: import builtins builtins.__dict__['_'] = str except ImportError: import __builtin__ __builtin__.__dict__['_'] = unicode class statusPage: def __init__(self, xml): self.xml = xml self.needRelabel = False self.type = selinux.selinux_getpolicytype() # Bring in widgets from glade file. self.selinuxTypeOptionMenu = xml.get_object("selinuxTypeOptionMenu") self.typeLabel = xml.get_object("typeLabel") self.enabledOptionMenu = xml.get_object("enabledOptionMenu") self.currentOptionMenu = xml.get_object("currentOptionMenu") self.relabel_checkbutton = xml.get_object("relabelCheckbutton") self.relabel_checkbutton.set_active(self.is_relabel()) self.relabel_checkbutton.connect("toggled", self.on_relabel_toggle) if self.get_current_mode() == ENFORCING or self.get_current_mode() == PERMISSIVE: self.currentOptionMenu.append_text(_("Permissive")) self.currentOptionMenu.append_text(_("Enforcing")) self.currentOptionMenu.set_active(self.get_current_mode()) self.currentOptionMenu.connect("changed", self.set_current_mode) self.currentOptionMenu.set_sensitive(True) else: self.currentOptionMenu.append_text(_("Disabled")) self.currentOptionMenu.set_active(0) self.currentOptionMenu.set_sensitive(False) if self.read_selinux_config() is None: self.selinuxsupport = False else: self.enabledOptionMenu.connect("changed", self.enabled_changed) # # This line must come after read_selinux_config # self.selinuxTypeOptionMenu.connect("changed", self.typemenu_changed) self.typeLabel.set_mnemonic_widget(self.selinuxTypeOptionMenu) def use_menus(self): return False def get_description(self): return _("Status") def get_current_mode(self): if selinux.is_selinux_enabled(): if selinux.security_getenforce() > 0: return ENFORCING else: return PERMISSIVE else: return DISABLED def set_current_mode(self, menu): selinux.security_setenforce(menu.get_active() == 1) def is_relabel(self): return os.access(RELABELFILE, os.F_OK) != 0 def on_relabel_toggle(self, button): if button.get_active(): fd = open(RELABELFILE, "w") fd.close() else: if os.access(RELABELFILE, os.F_OK) != 0: os.unlink(RELABELFILE) def verify(self, message): dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, Gtk.ButtonsType.YES_NO, message) dlg.set_position(Gtk.WindowPosition.MOUSE) dlg.show_all() rc = dlg.run() dlg.destroy() return rc def typemenu_changed(self, menu): type = self.get_type() enabled = self.enabledOptionMenu.get_active() if self.initialtype != type: if self.verify(_("Changing the policy type will cause a relabel of the entire file system on the next boot. Relabeling takes a long time depending on the size of the file system. Do you wish to continue?")) == Gtk.ResponseType.NO: menu.set_active(self.typeHistory) return None self.relabel_checkbutton.set_active(True) self.write_selinux_config(modearray[enabled], type) self.typeHistory = menu.get_active() def enabled_changed(self, combo): enabled = combo.get_active() type = self.get_type() if self.initEnabled != DISABLED and enabled == DISABLED: if self.verify(_("Changing to SELinux disabled requires a reboot. It is not recommended. If you later decide to turn SELinux back on, the system will be required to relabel. If you just want to see if SELinux is causing a problem on your system, you can go to permissive mode which will only log errors and not enforce SELinux policy. Permissive mode does not require a reboot Do you wish to continue?")) == Gtk.ResponseType.NO: combo.set_active(self.enabled) return None if self.initEnabled == DISABLED and enabled < 2: if self.verify(_("Changing to SELinux enabled will cause a relabel of the entire file system on the next boot. Relabeling takes a long time depending on the size of the file system. Do you wish to continue?")) == Gtk.ResponseType.NO: combo.set_active(self.enabled) return None self.relabel_checkbutton.set_active(True) self.write_selinux_config(modearray[enabled], type) self.enabled = enabled def write_selinux_config(self, enforcing, type): path = selinux.selinux_path() + "config" backup_path = path + ".bck" fd = open(path) lines = fd.readlines() fd.close() fd = open(backup_path, "w") for l in lines: if l.startswith("SELINUX="): fd.write("SELINUX=%s\n" % enforcing) continue if l.startswith("SELINUXTYPE="): fd.write("SELINUXTYPE=%s\n" % type) continue fd.write(l) fd.close() os.rename(backup_path, path) def read_selinux_config(self): self.initialtype = selinux.selinux_getpolicytype()[1] try: self.initEnabled = selinux.selinux_getenforcemode()[1] except: self.initEnabled = False pass self.enabled = self.initEnabled self.enabledOptionMenu.set_active(self.enabled + 1) self.types = [] n = 0 current = n for i in os.listdir(SELINUXDIR): if os.path.isdir(SELINUXDIR + i) and os.path.isdir(SELINUXDIR + i + "/policy"): self.types.append(i) self.selinuxTypeOptionMenu.append_text(i) if i == self.initialtype: current = n n = n + 1 self.selinuxTypeOptionMenu.set_active(current) self.typeHistory = current return 0 def get_type(self): return self.types[self.selinuxTypeOptionMenu.get_active()] selinux-gui-3.3/system-config-selinux000077500000000000000000000001321413427467300200410ustar00rootroot00000000000000#!/bin/sh exec /usr/bin/pkexec /usr/share/system-config-selinux/system-config-selinux.py selinux-gui-3.3/system-config-selinux.8000066400000000000000000000014021413427467300202050ustar00rootroot00000000000000.TH "system-config-selinux" "8" "8 April 2013" "System Config Tools Manual" "System Config Tools Manual" .SH NAME system\-config\-selinux \- SELinux Management tool .SH SYNOPSIS .B system-config-selinux .SH DESCRIPTION \fBsystem-config-selinux\fP provides a graphical interface for managing the SELinux configuration. .SH OPTIONS None .SH FILES \fi/usr/bin/system-config-selinux\fP .SH Examples To run the program type: system-config-selinux .PP .SH "SEE ALSO" .TP selinux(1), semanage(8) .PP .SH REPORTING BUGS Report bugs to . .SH LICENSE AND AUTHORS \fBsystem-config-selinux\fP is licensed under the GNU General Public License and is copyrighted by Red Hat, Inc. .br This man page was written by Daniel Walsh selinux-gui-3.3/system-config-selinux.desktop000066400000000000000000000070101413427467300215100ustar00rootroot00000000000000[Desktop Entry] Name=SELinux Management Name[bn_IN]=SELinux পরিচালনা Name[da]=Håndtering af SELinux Name[de]=SELinux-Management Name[ca]=Gestió de SELinux Name[es]=Administración de SELinux Name[fi]=SELinuxin ylläpito Name[fr]=Gestion de SELinux Name[gu]=SELinux સંચાલન Name[hi]=SELinux प्रबंधन Name[jp]=SELinux 管理 Name[it]=Gestione di SELinux Name[kn]=SELinux ವ್ಯವಸ್ಥಾಪನೆ Name[ko]=SELinux 관리 Name[ml]=SELinux മാനേജ്മെന്റ് Name[mr]=SELinux मॅनेजमेंट Name[nl]=SELinux beheer Name[or]=SELinux ପରିଚାଳନା Name[pa]=SELinux ਮੈਨੇਜਮੈਂਟ Name[pl]=Zarządzanie SELinuksem Name[pt_BR]=Gerenciamento do SELinux Name[pt]=Gestão de SELinux Name[ru]=Управление SELinux Name[sv]=SELinux-hantering Name[ta]=SELinux மேலாண்மை Name[te]=SELinux నిర్వహణ Name[uk]=Керування SELinux Name[zh_CN]=SELinux 管理 Name[zh_TW]=SELinux 管理 Comment=Configure SELinux in a graphical setting Comment[bn_IN]=গ্রাফিক্যাল পরিবেশে SELinux কনফিগার করুন Comment[ca]=Configura SELinuc an mode de preferències gràfiques Comment[da]=Konfigurér SELinux i et grafisk miljø Comment[de]=SELinux in einer grafischen Einstellung konfigurieren Comment[es]=Defina SELinux en una configuración de interfaz gráfica Comment[fi]=Tee SELinuxin asetukset graafisesti Comment[fr]=Configure SELinux dans un environnement graphique Comment[gu]=ગ્રાફિકલ સુયોજનમાં SELinux ને રૂપરેખાંકિત કરો Comment[hi]=SELinux को आलेखी सेटिंग में विन्यस्त करें Comment[it]=Configura SELinux in una impostazione grafica Comment[jp]=グラフィカルな設定画面で SELinux を設定する Comment[ko]=SELinux를 그래픽 사용자 인터페이스로 설정 Comment[kn]=SELinux ಅನ್ನು ಒಂದು ಚಿತ್ರಾತ್ಮಕ ಸಿದ್ದತೆಯಲ್ಲಿ ಸಂರಚಿಸಿ Comment[ml]=ഒരു ഗ്രാഫിക്കല്‍ സജ്ജീകരണത്തില്‍ SELinux ക്രമീകരിയ്ക്കുക Comment[mr]=ग्राफिकल सेटिंगमध्ये SELinux संरचीत करा Comment[nl]=Configureer SELinux in een grafische omgeving Comment[or]=SELinux କୁ ଆଲେଖିକ ସଂରଚନାରେ ବିନ୍ୟାସ କରନ୍ତୁ Comment[pa]=SELinux ਨੂੰ ਗਰਾਫੀਕਲ ਸੈਟਿੰਗ ਵਿੱਚ ਸੰਰਚਿਤ ਕਰੋ Comment[pl]=Konfiguracja SELinuksa w trybie graficznym Comment[pt]=Configurar o SELinux num ambiente gráfico Comment[pt_BR]=Configure o SELinux em uma configuração gráfica Comment[ru]=Настройка SELinux в графическом режиме Comment[sv]=Konfigurera SELinux i en grafisk miljö Comment[ta]=SELinuxஐ ஒரு வரைகலை அமைவில் கட்டமைக்கவும் Comment[te]=SELinuxను గ్రాఫికల్ అమర్పునందు ఆకృతీకరించుము Comment[uk]=Засіб для налаштування SELinux з графічним інтерфейсом Comment[zh_CN]=在图形设置中配置 SELinux Comment[zh_TW]=在圖形話設定中配置 SELinux StartupNotify=true Icon=system-config-selinux Exec=/usr/bin/system-config-selinux Type=Application Terminal=false Categories=System;Security; X-Desktop-File-Install-Version=0.2 selinux-gui-3.3/system-config-selinux.png000066400000000000000000000026471413427467300206360ustar00rootroot00000000000000PNG  IHDRw=gAMAOX2tEXtSoftwareAdobe ImageReadyqe<9IDATxڴV]Lg~c6Bafe2;B˂f2pKŒ-xKHlKAb6Q.J2)VZJ|mfٲ{=9梅1:L;ppKKKo@"l۶aV#LeZ<Nu9Ӊp87nAZp5t bmMg'k]?~|~D"bff&C L x\h|1?Z A6!pu U@mGyx[)kb߾}P(P"T*UΩd³Ph<+iB!},LSn:ŒYRYlCaTjD[[ԙDGN%0K'޹&q( i \ -,mLc*yÓC_m`!I5>="RaΝ]!D `dT_ jH g8:2xƕ@8TVVI;(ZA%q║i2iBnb_lX6V455l`]6*o>g7ʕT*tyTP;D7oc100z466H055(+FN*\BOٞ!LBxScISH^۵ΝU%IgmDђBح! M؎L/˚q!S v/c8&N+Vhd2aǎbN***x0pF>z1ޘ*8߾?Ut;{oe/ʖTljet V]] KXoVIU;h0>'ۄ@}2/%E($/_/x%I;-!^~IENDB`selinux-gui-3.3/system-config-selinux.py000066400000000000000000000141751413427467300205010ustar00rootroot00000000000000#!/usr/bin/python3 -Es # # system-config-selinux.py - GUI for SELinux Config tool in system-config-selinux # # Dan Walsh # # Copyright 2006-2009 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # import os import signal import sys import gi gi.require_version('Gtk', '3.0') try: from gi.repository import Gtk except RuntimeError as e: print("system-config-selinux:", e) print("This is a graphical application and requires DISPLAY to be set.") sys.exit(1) from gi.repository import GObject import statusPage import booleansPage import loginsPage import usersPage import portsPage import modulesPage import domainsPage import fcontextPage import selinux ## ## I18N ## PROGNAME = "policycoreutils" try: import gettext kwargs = {} if sys.version_info < (3,): kwargs['unicode'] = True gettext.install(PROGNAME, localedir="/usr/share/locale", codeset='utf-8', **kwargs) except: try: import builtins builtins.__dict__['_'] = str except ImportError: import __builtin__ __builtin__.__dict__['_'] = unicode version = "1.0" sys.path.append('/usr/share/system-config-selinux') ## ## Pull in the Glade file ## xml = Gtk.Builder() xml.set_translation_domain(PROGNAME) if os.access("system-config-selinux.ui", os.F_OK): xml.add_from_file("system-config-selinux.ui") else: xml.add_from_file("/usr/share/system-config-selinux/system-config-selinux.ui") class childWindow: def __init__(self): self.tabs = [] self.xml = xml xml.connect_signals({ "on_quit_activate": self.destroy, "on_delete_clicked": self.delete, "on_add_clicked": self.add, "on_properties_clicked": self.properties, "on_local_clicked": self.on_local_clicked, "on_policy_activate": self.policy, "on_logging_activate": self.logging, "on_about_activate": self.on_about_activate, }) self.add_page(statusPage.statusPage(xml)) if selinux.is_selinux_enabled() > 0: try: self.add_page(booleansPage.booleansPage(xml)) self.add_page(fcontextPage.fcontextPage(xml)) self.add_page(loginsPage.loginsPage(xml)) self.add_page(usersPage.usersPage(xml)) self.add_page(portsPage.portsPage(xml)) self.add_page(modulesPage.modulesPage(xml)) # modules self.add_page(domainsPage.domainsPage(xml)) # domains except ValueError as e: self.error(e.message) self.add_menu = xml.get_object("add_menu_item") self.properties_menu = xml.get_object("properties_menu_item") self.delete_menu = xml.get_object("delete_menu_item") def error(self, message): dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.ERROR, Gtk.ButtonsType.CLOSE, message) dlg.set_position(Gtk.WindowPosition.MOUSE) dlg.show_all() dlg.run() dlg.destroy() def add_page(self, page): self.tabs.append(page) def policy(self, args): os.spawnl(os.P_NOWAIT, "/usr/share/system-config-selinux/semanagegui.py") def logging(self, args): os.spawnl(os.P_NOWAIT, "/usr/bin/seaudit") def delete(self, args): self.tabs[self.notebook.get_current_page()].deleteDialog() def add(self, args): self.tabs[self.notebook.get_current_page()].addDialog() def properties(self, args): self.tabs[self.notebook.get_current_page()].propertiesDialog() def on_local_clicked(self, button): self.tabs[self.notebook.get_current_page()].on_local_clicked(button) def on_about_activate(self, args): dlg = xml.get_object("aboutWindow") dlg.run() dlg.hide() def destroy(self, args): Gtk.main_quit() def use_menus(self, use_menus): self.add_menu.set_sensitive(use_menus) self.properties_menu.set_sensitive(use_menus) self.delete_menu.set_sensitive(use_menus) def itemSelected(self, selection): store, rows = selection.get_selected_rows() if store != None and len(rows) > 0: self.notebook.set_current_page(rows[0][0]) self.use_menus(self.tabs[rows[0][0]].use_menus()) else: self.notebook.set_current_page(0) self.use_menus(self.tabs[0].use_menus()) def setupScreen(self): # Bring in widgets from glade file. self.mainWindow = self.xml.get_object("mainWindow") self.notebook = self.xml.get_object("notebook") self.view = self.xml.get_object("selectView") self.view.get_selection().connect("changed", self.itemSelected) self.store = Gtk.ListStore(GObject.TYPE_STRING) self.view.set_model(self.store) col = Gtk.TreeViewColumn("", Gtk.CellRendererText(), text=0) col.set_resizable(True) self.view.append_column(col) for page in self.tabs: iter = self.store.append() self.store.set_value(iter, 0, page.get_description()) self.view.get_selection().select_path((0,)) def stand_alone(self): desktopName = _("Configure SELinux") self.setupScreen() self.mainWindow.connect("destroy", self.destroy) self.mainWindow.show_all() Gtk.main() if __name__ == "__main__": signal.signal(signal.SIGINT, signal.SIG_DFL) app = childWindow() app.stand_alone() selinux-gui-3.3/system-config-selinux.ui000066400000000000000000003100011413427467300204510ustar00rootroot00000000000000 system-config-selinux False 5 normal Copyright (c)2006 Red Hat, Inc. Copyright (c) 2006 Dan Walsh <dwalsh@redhat.com> Daniel Walsh <dwalsh@redhat.com> translator-credits system-config-selinux.png False False False False 0 True False gtk-add True False gtk-properties True False gtk-delete False Add SELinux Login Mapping dialog True False True False end gtk-cancel True True True False True True True 0 gtk-ok True True True False True True True 1 False True end 0 True False vertical True False 4 6 True False Login Name 0 0 True False SELinux User 0 1 True False MLS/MCS Range 0 2 True True * 1 0 True False 1 1 True True * 1 2 True True 5 0 True True 1 cancelbutton1 okbutton1 tcp udp False Add SELinux Network Ports dialog True False True False end gtk-cancel True True True False True True True 0 gtk-ok True True True False True True True 1 False True end 0 True False vertical True False 4 6 True False Port Number 0 0 True False Protocol 0 1 True False SELinux Type 0 2 True True * 1 0 True False model1 0 1 1 True True * 1 2 True False MLS/MCS Level 0 3 True True * 1 3 True True 5 0 True True 1 button1 button2 False Add SELinux Login Mapping dialog True False True False end gtk-cancel True True True False True True True 0 gtk-ok True True True False True True True 1 False True end 0 True False vertical True False 4 6 True False File Specification 0 0 True False File Type 0 1 True False SELinux Type 0 2 True True * 1 0 True False model2 0 1 1 True True * 1 2 True False MLS 0 3 True True * 1 3 True True 5 0 True True 1 button5 button6 Disabled Permissive Enforcing False SELinux Administration 800 500 system-config-selinux.png True False vertical True False True False _File True True False _Add True False True image13 False _Properties True False True image14 False _Delete True False True image15 False gtk-quit True False True True True False _Help True True False gtk-about True False True True False True 0 True True True False 5 0 none True False 12 True True Select Management Object False True False <b>Select:</b> True True False True False False True False vertical True False 5 5 True False System Default Enforcing Mode 0 0 True False True model3 0 1 0 True False Current Enforcing Mode 0 1 True False True 1 1 True False System Default Policy Type: 0 2 True False True 1 2 True True False Select if you wish to relabel then entire file system on next reboot. Relabeling can take a very long time, depending on the size of the system. If you are changing policy types or going from disabled to enforcing, a relabel is required. False True True False True 0 0 True False True 2 True False gtk-refresh False False 0 True False Relabel on next reboot. True False False 1 0 3 2 True True end 0 True False vertical True False both True False Revert boolean setting to system default gtk-revert-to-saved False True True False Toggle between Customized and All Booleans Customized True gtk-find False True False False 0 True False True False Filter False False 10 0 True True True True 1 False True 10 1 True True always always True True Boolean True True 2 1 True False vertical True False both True False Add File Context gtk-add False True True False Modify File Context gtk-properties False True True False Delete File Context gtk-delete False True True False Toggle between all and customized file context Customized True gtk-find False True False False 0 True False True False Filter False False 10 0 True True True True 1 False False 1 True True always always True True File Labeling True True 2 2 True False vertical True False both True False Add SELinux User Mapping gtk-add False True True False Modify SELinux User Mapping gtk-properties False True True False Delete SELinux User Mapping gtk-delete False True False False 0 True False True False Filter False False 10 0 True True True True 1 False True 5 1 True True always always True True User Mapping True True 2 3 True False vertical True False both True False Add User gtk-add False True True False Modify User gtk-properties False True True False Delete User gtk-delete False True False False 0 True False True False Filter False False 10 0 True True True True 1 False True 5 1 True True always always True True SELinux User True True 2 4 True False vertical True False both True False Add Network Port gtk-add False True True False Edit Network Port gtk-properties False True True False Delete Network Port gtk-delete False True True False 32 True False vertical False False True False Toggle between Customized and All Ports Group View True gtk-indent False True True False Toggle between Customized and All Ports Customized True gtk-find False True False False 0 True False True False Filter False False 10 0 True True True True 1 False True 5 1 True True always always True True Network Port True True 2 5 True False vertical True False both True False Generate new policy module gtk-new False True True False Load policy module gtk-add False True True False Remove loadable policy module gtk-remove False True True False 10 True False vertical False False True False Enable/Disable additional audit rules, that are normally not reported in the log files. Enable Audit True gtk-zoom-in False True False False 0 True False True False Filter False False 10 0 True True True True 1 False True 5 1 True True always always True True Policy Module True True 2 6 True False vertical True False both True False Change process mode to permissive. Permissive True gtk-dialog-warning False True True False Change process mode to enforcing Enforcing True gtk-dialog-error False True False False 0 True False True False Filter False False 10 0 True True True True 1 False True 5 1 True True always always True True Process Domain True True 2 7 True True True True 1 False Add SELinux User dialog True False True False end gtk-cancel True True True False True True True 0 gtk-ok True True True False True True True 1 False True end 0 True False vertical True False 4 6 True False SELinux User 0 0 True False MLS/MCS Range 0 1 True True * 1 1 True False SELinux Roles 0 2 True True * 1 2 True True * 1 0 True True 5 0 True True 1 button7 button8 selinux-gui-3.3/usersPage.py000066400000000000000000000123571413427467300161630ustar00rootroot00000000000000## usersPage.py - show selinux mappings ## Copyright (C) 2006,2007,2008 Red Hat, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ## Author: Dan Walsh import sys try: from subprocess import getstatusoutput except ImportError: from commands import getstatusoutput from gi.repository import GObject, Gtk import seobject from semanagePage import * ## ## I18N ## PROGNAME = "policycoreutils" try: import gettext kwargs = {} if sys.version_info < (3,): kwargs['unicode'] = True gettext.install(PROGNAME, localedir="/usr/share/locale", codeset='utf-8', **kwargs) except: try: import builtins builtins.__dict__['_'] = str except ImportError: import __builtin__ __builtin__.__dict__['_'] = unicode class usersPage(semanagePage): def __init__(self, xml): semanagePage.__init__(self, xml, "users", _("SELinux User")) self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING) self.view.set_model(self.store) self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) col = Gtk.TreeViewColumn(_("SELinux\nUser"), Gtk.CellRendererText(), text=0) col.set_sort_column_id(0) col.set_resizable(True) self.view.append_column(col) col = Gtk.TreeViewColumn(_("MLS/\nMCS Range"), Gtk.CellRendererText(), text=1) col.set_resizable(True) self.view.append_column(col) col = Gtk.TreeViewColumn(_("SELinux Roles"), Gtk.CellRendererText(), text=2) col.set_resizable(True) self.view.append_column(col) self.load() self.selinuxUserEntry = xml.get_object("selinuxUserEntry") self.mlsRangeEntry = xml.get_object("mlsRangeEntry") self.selinuxRolesEntry = xml.get_object("selinuxRolesEntry") def load(self, filter=""): self.filter = filter self.user = seobject.seluserRecords() dict = self.user.get_all() self.store.clear() for k in sorted(dict.keys()): range = seobject.translate(dict[k][2]) if not (self.match(k, filter) or self.match(dict[k][0], filter) or self.match(range, filter) or self.match(dict[k][3], filter)): continue iter = self.store.append() self.store.set_value(iter, 0, k) self.store.set_value(iter, 1, range) self.store.set_value(iter, 2, dict[k][3]) self.view.get_selection().select_path((0,)) def dialogInit(self): store, iter = self.view.get_selection().get_selected() self.selinuxUserEntry.set_text(store.get_value(iter, 0)) self.selinuxUserEntry.set_sensitive(False) self.mlsRangeEntry.set_text(store.get_value(iter, 1)) self.selinuxRolesEntry.set_text(store.get_value(iter, 2)) def dialogClear(self): self.selinuxUserEntry.set_text("") self.selinuxUserEntry.set_sensitive(True) self.mlsRangeEntry.set_text("s0") self.selinuxRolesEntry.set_text("") def add(self): user = self.selinuxUserEntry.get_text() range = self.mlsRangeEntry.get_text() roles = self.selinuxRolesEntry.get_text() self.wait() (rc, out) = getstatusoutput("semanage user -a -R '%s' -r %s %s" % (roles, range, user)) self.ready() if rc != 0: self.error(out) return False iter = self.store.append() self.store.set_value(iter, 0, user) self.store.set_value(iter, 1, range) self.store.set_value(iter, 2, roles) def modify(self): user = self.selinuxUserEntry.get_text() range = self.mlsRangeEntry.get_text() roles = self.selinuxRolesEntry.get_text() self.wait() (rc, out) = getstatusoutput("semanage user -m -R '%s' -r %s %s" % (roles, range, user)) self.ready() if rc != 0: self.error(out) return False self.load(self.filter) def delete(self): store, iter = self.view.get_selection().get_selected() try: user = store.get_value(iter, 0) if user == "root" or user == "user_u": raise ValueError(_("SELinux user '%s' is required") % user) self.wait() (rc, out) = getstatusoutput("semanage user -d %s" % user) self.ready() if rc != 0: self.error(out) return False store.remove(iter) self.view.get_selection().select_path((0,)) except ValueError as e: self.error(e.args[0])