Example #1
0
    def __init__(self, parent):
        DialogBase.__init__(self, "rule_list_dialog", parent)

        self.task = _TaskTable(
            self.window,
            self.task_table,
            self.task_up,
            self.task_down,
            self.task_insert,
            self.task_delete,
            self.task_edit,
        )
        self.entry = _EntryTable(
            self.window,
            self.entry_table,
            self.entry_up,
            self.entry_down,
            self.entry_insert,
            self.entry_delete,
            self.entry_edit,
        )
        self.exit = _ExitTable(
            self.window,
            self.exit_table,
            self.exit_up,
            self.exit_down,
            self.exit_insert,
            self.exit_delete,
            self.exit_edit,
        )
Example #2
0
    def __init__(self, parent):
        DialogBase.__init__(self, 'type_list_dialog', parent)

        self.user = _UserTable(self.window, self.user_table, self.user_up,
                               self.user_down, self.user_insert,
                               self.user_delete, self.user_edit)
        self.exclude = _ExcludeTable(self.window, self.msg_table, self.msg_up,
                                     self.msg_down, self.msg_insert,
                                     self.msg_delete, self.msg_edit)
Example #3
0
    def __init__(self, parent):
        DialogBase.__init__(self, 'watch_dialog', parent)

        util.connect_and_run(self.watch_keys_present, 'toggled',
                             self.__watch_keys_present_toggled)
        self.watch_keys_change.connect('clicked',
                                       self.__watch_keys_change_clicked)
        self._setup_browse_button(self.watch_path_browse, self.watch_path,
                                  _('Watched File'),
                                  gtk.FILE_CHOOSER_ACTION_SAVE)

        self.keys = []
Example #4
0
    def __init__(self, parent):
        DialogBase.__init__(self, 'key_list_dialog', parent)

        self.keys_store = gtk.ListStore(gobject.TYPE_STRING)
        self.keys_list.set_model(self.keys_store)
        c = gtk.TreeViewColumn(_('Key'), gtk.CellRendererText(), text = 0)
        self.keys_list.append_column(c)
        self.keys_list.connect('row-activated', self.__keys_edit_clicked)
        self.keys_selection = self.keys_list.get_selection()
        util.connect_and_run(self.keys_selection, 'changed',
                             self.__keys_selection_changed)
        self.keys_up.connect('clicked', self.__keys_up_clicked)
        self.keys_down.connect('clicked', self.__keys_down_clicked)
        self.keys_delete.connect('clicked', self.__keys_delete_clicked)
        self.keys_add.connect('clicked', self.__keys_add_clicked)
        self.keys_edit.connect('clicked', self.__keys_edit_clicked)
Example #5
0
    def __init__(self):
        DialogBase.__init__(self, 'app_window', None)

        self.window.connect('delete-event', self.__menu_quit_activate)
        self.menu_quit.connect('activate', self.__menu_quit_activate)
        self.menu_about.connect('activate', self.__menu_about_activate)

        self.enabled_change_button.connect('clicked',
                                           self.__enabled_change_button_clicked)
        self.status_refresh.connect('clicked', self.__status_refresh_clicked)
        self.config_save.connect('clicked', self.__config_save_clicked)

        self.config_watches_edit.connect('clicked',
                                         self.__config_watches_edit_clicked)
        self.config_rules_edit.connect('clicked',
                                       self.__config_rules_edit_clicked)
        self.config_types_edit.connect('clicked',
                                       self.__config_types_edit_clicked)
        self.config_global_edit.connect('clicked',
                                        self.__config_global_edit_clicked)
Example #6
0
 def __init__(self, parent):
     DialogBase.__init__(self, 'key_dialog', parent)
     util.connect_and_run(self.key_is_text, 'toggled',
                          self.__key_is_text_toggled)
     self.key_text.set_max_length(audit.AUDIT_MAX_KEY_LEN)
     util.connect_and_run(self.key_is_ids, 'toggled',
                          self.__key_is_ids_toggled)
     self.type_store = gtk.ListStore(gobject.TYPE_STRING,
                                     gobject.TYPE_STRING)
     for (type_, label) in lists.ids_types:
         self.type_store.append((type_, _(label)))
     self.key_ids_type.set_model(self.type_store)
     cell = gtk.CellRendererText()
     self.key_ids_type.pack_start(cell, True)
     self.key_ids_type.set_attributes(cell, text = 1)
     self.severity_store = gtk.ListStore(gobject.TYPE_STRING,
                                         gobject.TYPE_STRING)
     for (severity, label) in lists.ids_severities:
         self.severity_store.append((severity, _(label)))
     self.key_ids_severity.set_model(self.severity_store)
     cell = gtk.CellRendererText()
     self.key_ids_severity.pack_start(cell, True)
     self.key_ids_severity.set_attributes(cell, text = 1)
Example #7
0
    def __init__(self, parent):
        DialogBase.__init__(self, "event_type_dialog", parent)

        util.connect_and_run(self.event_type_condition, "toggled", self.__event_type_condition_toggled)
        self.op_store = gtk.ListStore(gobject.TYPE_STRING)
        # Most operators are unlikely to be used, but the dialog must be able to
        # represent them
        for op in (Field.OP_EQ, Field.OP_NE, ""):
            self.op_store.append((op,))
        for op in Field.all_operators:
            if op not in (Field.OP_EQ, Field.OP_NE):
                self.op_store.append((op,))
        self.event_type_op.set_model(self.op_store)
        cell = gtk.CellRendererText()
        self.event_type_op.pack_start(cell, True)
        self.event_type_op.set_attributes(cell, text=0)
        self.event_type_op.set_row_separator_func(util.is_row_separator)

        store = gtk.ListStore(gobject.TYPE_STRING)
        for name in lists.event_type_names:
            store.append((name,))
        self.event_type_value.set_model(store)
        self.event_type_value.set_text_column(0)
Example #8
0
 def __init__(self, parent):
     DialogBase.__init__(self, 'save_dialog', parent)
Example #9
0
    def __init__(self, parent, excluded_fields, action_always_label,
                 action_never_label):
        '''Initialize a rule dialog, removing fields for excluded_fields.

        If audit.AUDIT_ARCH is in excluded_fields, all syscall handling is
        removed as well.

        '''
        DialogBase.__init__(self, 'rule_dialog', parent,
                            notebook_name = 'rule_notebook')
        self.excluded_fields = excluded_fields

        self.rule_always.set_label(action_always_label)
        util.connect_and_run(self.rule_always, 'toggled',
                             self.__rule_always_toggled)
        if audit.AUDIT_FILTERKEY not in self.excluded_fields:
            util.connect_and_run(self.rule_keys_present, 'toggled',
                                 self.__rule_keys_present_toggled)
            self.rule_keys_change.connect('clicked',
                                          self.__rule_keys_change_clicked)
        else:
            self.rule_keys_hbox.destroy()
        self.rule_never.set_label(action_never_label)
        if audit.AUDIT_ARCH not in self.excluded_fields:
            util.connect_and_run(self.rule_arch_present, 'toggled',
                                 self.__rule_arch_present_toggled)
            self.arch_store = gtk.ListStore(gobject.TYPE_STRING)
            for name in lists.sorted_machine_names:
                self.arch_store.append((name,))
            for name in ('', 'b32', 'b64'):
                self.arch_store.append((name,))
            self.rule_arch.set_model(self.arch_store)
            self.rule_arch.set_text_column(0)
            self.rule_arch.set_row_separator_func(util.is_row_separator)
        else:
            self.rule_arch_vbox.destroy()

        if audit.AUDIT_ARCH not in self.excluded_fields:
            util.connect_and_run(self.rule_syscalls_not_all, 'toggled',
                                 self.__rule_syscalls_not_all_toggled)
            self.syscall_store = gtk.ListStore(gobject.TYPE_STRING)
            self.rule_syscalls.set_model(self.syscall_store)
            c = gtk.TreeViewColumn(_('System Call'), gtk.CellRendererText(),
                                   text = 0)
            self.rule_syscalls.append_column(c)
            self.syscalls_selection = self.rule_syscalls.get_selection()
            util.connect_and_run(self.syscalls_selection, 'changed',
                                 self.__syscalls_selection_changed)
            self.rule_syscall_delete.connect('clicked',
                                             self.__rule_syscall_delete_clicked)
            self.syscall_name_store = gtk.ListStore(gobject.TYPE_STRING)
            self.rule_syscall_name.set_model(self.syscall_name_store)
            self.rule_syscall_name.set_text_column(0)
            self.rule_syscall_add.connect('clicked',
                                          self.__rule_syscall_add_clicked)
            self.fields_page = 2
        else:
            self.rule_notebook.remove_page(1)
            self.fields_page = 1

        self.fields_store = gtk.ListStore(gobject.TYPE_PYOBJECT,
                                          gobject.TYPE_STRING)
        self.rule_fields.set_model(self.fields_store)
        c = gtk.TreeViewColumn(_('Condition'), gtk.CellRendererText(), text = 1)
        self.rule_fields.append_column(c)
        self.fields_selection = self.rule_fields.get_selection()
        util.connect_and_run(self.fields_selection, 'changed',
                             self.__fields_selection_changed)
        self.rule_field_up.connect('clicked', self.__rule_field_up_clicked)
        self.rule_field_down.connect('clicked', self.__rule_field_down_clicked)
        self.rule_field_delete.connect('clicked',
                                       self.__rule_field_delete_clicked)
        self.rule_field_add.connect('clicked', self.__rule_field_add_clicked)
        self.field_var_store = gtk.ListStore(gobject.TYPE_STRING)
        fields = (field for field in lists.field_vars
                  if (field not in (audit.AUDIT_ARCH, audit.AUDIT_FILTERKEY) and
                      field not in self.excluded_fields))
        for name in sorted(lists.ids_to_names(fields,
                                              audit.audit_field_to_name)):
            self.field_var_store.append((name,))
        self.rule_field_var.set_model(self.field_var_store)
        cell = gtk.CellRendererText()
        self.rule_field_var.pack_start(cell, True)
        self.rule_field_var.set_attributes(cell, text = 0)
        util.connect_and_run(self.rule_field_var, 'changed',
                             self.__rule_field_var_changed)
        self.field_op_store = gtk.ListStore(gobject.TYPE_STRING)
        for op in Field.all_operators:
            self.field_op_store.append((op,))
        self.rule_field_op.set_model(self.field_op_store)
        cell = gtk.CellRendererText()
        self.rule_field_op.pack_start(cell, True)
        self.rule_field_op.set_attributes(cell, text = 0)
        self.rule_field_op.set_row_separator_func(util.is_row_separator)
        self.field_value_store = gtk.ListStore(gobject.TYPE_STRING)
        self.rule_field_value.set_model(self.field_value_store)
        self.rule_field_value.set_text_column(0)

        self.keys = []
        self.machine_id = None
        self.last_arch_name = None
        if audit.AUDIT_ARCH not in self.excluded_fields:
            util.connect_and_run(self.rule_arch.child, 'focus-out-event',
                                 self.__rule_arch_focus_out)
Example #10
0
    def __init__(self, parent):
        DialogBase.__init__(self, 'global_config', parent,
                            notebook_name = 'global_config_notebook')

        util.connect_and_run(self.rate_limit_enabled, 'toggled',
                             self.__rate_limit_enabled_toggled)

        util.connect_and_run(self.dispatcher_enabled, 'toggled',
                             self.__dispatcher_enabled_toggled)
        self._setup_browse_button(self.dispatcher_browse, self.dispatcher,
                                  _('Program'), gtk.FILE_CHOOSER_ACTION_OPEN)

        util.connect_and_run(self.log_format_raw, 'toggled',
                             self.__log_format_raw_toggled)
        util.connect_and_run(self.log_file, 'focus-out-event',
                             self.__log_file_focus_out)
        self._setup_browse_button(self.log_file_browse, self.log_file,
                                  _('Log File'), gtk.FILE_CHOOSER_ACTION_SAVE)
        util.connect_and_run(self.flush_incremental, 'toggled',
                             self.__flush_incremental_toggled)
        self.freq.connect('value-changed', self.__freq_value_changed)
        util.connect_and_run(self.max_log_file_keep_logs, 'toggled',
                             self.__max_log_file_keep_logs_toggled)
        util.connect_and_run(self.max_log_file_rotate, 'toggled',
                             self.__max_log_file_rotate_toggled)
        util.connect_and_run(self.name_format_not_none, 'toggled',
                             self.__name_format_not_none_toggled)
        hostname = socket.gethostname()
        self.name_format_hostname.set_label(_('Host name as-_is (%s)')
                                            % hostname)
        try:
            # AI_PASSIVE is probably not necessary, but that's what auditd uses.
            addrs = socket.getaddrinfo(hostname, None, socket.AF_UNSPEC,
                                       socket.SOCK_STREAM, 0,
                                       socket.AI_ADDRCONFIG |
                                       socket.AI_CANONNAME | socket.AI_PASSIVE)
        except socket.gaierror:
            addrs = ()
        if addrs:
            fqd_label = _('_Fully-qualified host name (%s)') % addrs[0][3]
            numeric_label = _('I_P address (%s)') % addrs[0][4][0]
        else:
            fqd_label = _('_Fully-qualified host name')
            numeric_label = _('I_P address')
        self.name_format_fqd.set_label(fqd_label)
        self.name_format_numeric.set_label(numeric_label)
        util.connect_and_run(self.name_format_user, 'toggled',
                             self.__name_format_user_toggled)

        util.connect_and_run(self.space_left_exec, 'toggled',
                             self.__space_left_exec_toggled)
        self._setup_browse_button(self.space_left_exe_browse,
                                  self.space_left_exe, _('Program'),
                                  gtk.FILE_CHOOSER_ACTION_OPEN)
        util.connect_and_run(self.admin_space_left_exec, 'toggled',
                             self.__admin_space_left_exec_toggled)
        self._setup_browse_button(self.admin_space_left_exe_browse,
                                  self.admin_space_left_exe, _('Program'),
                                  gtk.FILE_CHOOSER_ACTION_OPEN)

        util.connect_and_run(self.disk_full_exec, 'toggled',
                             self.__disk_full_exec_toggled)
        self._setup_browse_button(self.disk_full_exe_browse, self.disk_full_exe,
                                  _('Program'), gtk.FILE_CHOOSER_ACTION_OPEN)
        util.connect_and_run(self.disk_error_exec, 'toggled',
                             self.__disk_error_exec_toggled)
        self._setup_browse_button(self.disk_error_exe_browse,
                                  self.disk_error_exe, _('Program'),
                                  gtk.FILE_CHOOSER_ACTION_OPEN)
Example #11
0
    def __init__(self, parent):
        DialogBase.__init__(self, 'watch_list_dialog', parent)

        self.table = _WatchTable(self.window, self.watch_table, self.watch_up,
                                 self.watch_down, self.watch_insert,
                                 self.watch_delete, self.watch_edit)