/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:
337
337
            try:
338
338
                logger.info(u"Starting checker %r for %s",
339
339
                            command, self.name)
 
340
                # We don't need to redirect stdout and stderr, since
 
341
                # in normal mode, that is already done by daemon(),
 
342
                # and in debug mode we don't want to.  (Stdin is
 
343
                # always replaced by /dev/null.)
340
344
                self.checker = subprocess.Popen(command,
341
345
                                                close_fds=True,
342
346
                                                shell=True, cwd="/")
343
347
                self.checker_callback_tag = gobject.child_watch_add\
344
348
                                            (self.checker.pid,
345
349
                                             self.checker_callback)
346
 
            except subprocess.OSError, error:
 
350
            except OSError, error:
347
351
                logger.error(u"Failed to start subprocess: %s",
348
352
                             error)
349
353
        # Re-run this periodically if run by gobject.timeout_add
737
741
    # Parse config file with clients
738
742
    client_defaults = { "timeout": "1h",
739
743
                        "interval": "5m",
740
 
                        "checker": "fping -q -- %%(host)s",
 
744
                        "checker": "fping -q -- %(host)s",
741
745
                        "host": "",
742
746
                        }
743
747
    client_config = ConfigParser.SafeConfigParser(client_defaults)
778
782
        logger.critical(u"No clients defined")
779
783
        sys.exit(1)
780
784
    
781
 
    if not debug:
 
785
    if debug:
 
786
        # Redirect stdin so all checkers get /dev/null
 
787
        null = os.open(os.path.devnull, os.O_NOCTTY | os.O_RDWR)
 
788
        os.dup2(null, sys.stdin.fileno())
 
789
        if null > 2:
 
790
            os.close(null)
 
791
    else:
 
792
        # No console logging
782
793
        logger.removeHandler(console)
 
794
        # Close all input and output, do double fork, etc.
783
795
        daemon()
784
796
    
785
797
    pidfilename = "/var/run/mandos/mandos.pid"