/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos

  • Committer: Teddy Hogeborn
  • Date: 2008-08-22 00:16:20 UTC
  • mfrom: (24.1.57 mandos)
  • Revision ID: teddy@fukt.bsnet.se-20080822001620-vxpn1evy0t0kyvj0
* clients.conf ([DEFAULT]/checker): Update to new default value.

* mandos (Client.start_checker): Bug fix: OSError, not
                                 subprocess.OSError.
  (main): Use "fping -q -- %(host)s" instead of "fping -q --
          %%(host)s" as default value for "checker".  Always redirect
          stdin to be from /dev/null, even if in debug mode.

* mandos-clients.conf.xml (DESCRIPTION): Improved wording and refer to
                                         the EXPANSION section.
  (OPTIONS): Added synopsis and improved wording for "checker",
             "fingerprint", and "secret".  Refer to the RUNTIME
             EXPANSION section for the "checker" option.
  (EXAMPLE): Update to new default value for "checker".

* mandos-keygen (trap): Split lines and add "set +e".

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#     GNU General Public License for more details.
25
25
26
26
# You should have received a copy of the GNU General Public License
27
 
# along with this program.  If not, see
28
 
# <http://www.gnu.org/licenses/>.
 
27
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
29
28
30
29
# Contact the authors at <mandos@fukt.bsnet.se>.
31
30
124
123
    def rename(self):
125
124
        """Derived from the Avahi example code"""
126
125
        if self.rename_count >= self.max_renames:
127
 
            logger.critical(u"No suitable Zeroconf service name found"
128
 
                            u" after %i retries, exiting.",
129
 
                            rename_count)
 
126
            logger.critical(u"No suitable service name found after %i"
 
127
                            u" retries, exiting.", rename_count)
130
128
            raise AvahiServiceError("Too many renames")
131
129
        self.name = server.GetAlternativeServiceName(self.name)
132
 
        logger.info(u"Changing Zeroconf service name to %r ...",
133
 
                    str(self.name))
 
130
        logger.info(u"Changing name to %r ...", str(self.name))
134
131
        syslogger.setFormatter(logging.Formatter\
135
132
                               ('Mandos (%s): %%(levelname)s:'
136
133
                               ' %%(message)s' % self.name))
151
148
                     avahi.DBUS_INTERFACE_ENTRY_GROUP)
152
149
            group.connect_to_signal('StateChanged',
153
150
                                    entry_group_state_changed)
154
 
        logger.debug(u"Adding Zeroconf service '%s' of type '%s' ...",
 
151
        logger.debug(u"Adding service '%s' of type '%s' ...",
155
152
                     service.name, service.type)
156
153
        group.AddService(
157
154
                self.interface,         # interface
413
410
    gnutls.library.functions.gnutls_openpgp_crt_import\
414
411
                    (crt, ctypes.byref(datum),
415
412
                     gnutls.library.constants.GNUTLS_OPENPGP_FMT_RAW)
416
 
    # Verify the self signature in the key
417
 
    crtverify = ctypes.c_uint();
418
 
    gnutls.library.functions.gnutls_openpgp_crt_verify_self\
419
 
        (crt, 0, ctypes.byref(crtverify))
420
 
    if crtverify.value != 0:
421
 
        gnutls.library.functions.gnutls_openpgp_crt_deinit(crt)
422
 
        raise gnutls.errors.CertificateSecurityError("Verify failed")
423
413
    # New buffer for the fingerprint
424
414
    buffer = ctypes.create_string_buffer(20)
425
415
    buffer_length = ctypes.c_size_t()
606
596
def server_state_changed(state):
607
597
    """Derived from the Avahi example code"""
608
598
    if state == avahi.SERVER_COLLISION:
609
 
        logger.error(u"Zeroconf server name collision")
 
599
        logger.error(u"Server name collision")
610
600
        service.remove()
611
601
    elif state == avahi.SERVER_RUNNING:
612
602
        service.add()
614
604
 
615
605
def entry_group_state_changed(state, error):
616
606
    """Derived from the Avahi example code"""
617
 
    logger.debug(u"Avahi state change: %i", state)
 
607
    logger.debug(u"state change: %i", state)
618
608
    
619
609
    if state == avahi.ENTRY_GROUP_ESTABLISHED:
620
 
        logger.debug(u"Zeroconf service established.")
 
610
        logger.debug(u"Service established.")
621
611
    elif state == avahi.ENTRY_GROUP_COLLISION:
622
 
        logger.warning(u"Zeroconf service name collision.")
 
612
        logger.warning(u"Service name collision.")
623
613
        service.rename()
624
614
    elif state == avahi.ENTRY_GROUP_FAILURE:
625
 
        logger.critical(u"Avahi: Error in group state changed %s",
 
615
        logger.critical(u"Error in group state changed %s",
626
616
                        unicode(error))
627
617
        raise AvahiGroupError("State changed: %s", str(error))
628
618
 
762
752
    service = AvahiService(name = server_settings["servicename"],
763
753
                           type = "_mandos._tcp", );
764
754
    if server_settings["interface"]:
765
 
        service.interface = if_nametoindex\
766
 
                            (server_settings["interface"])
 
755
        service.interface = if_nametoindex(server_settings["interface"])
767
756
    
768
757
    global main_loop
769
758
    global bus
772
761
    DBusGMainLoop(set_as_default=True )
773
762
    main_loop = gobject.MainLoop()
774
763
    bus = dbus.SystemBus()
775
 
    server = dbus.Interface(bus.get_object(avahi.DBUS_NAME,
776
 
                                           avahi.DBUS_PATH_SERVER),
777
 
                            avahi.DBUS_INTERFACE_SERVER)
 
764
    server = dbus.Interface(
 
765
            bus.get_object( avahi.DBUS_NAME, avahi.DBUS_PATH_SERVER ),
 
766
            avahi.DBUS_INTERFACE_SERVER )
778
767
    # End of Avahi example code
779
768
    
780
769
    clients = Set()