/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: 2011-11-26 22:22:20 UTC
  • mto: (518.1.8 mandos-persistent)
  • mto: This revision was merged to the branch mainline in revision 524.
  • Revision ID: teddy@recompile.se-20111126222220-1ubwjpb5ugqnrhec
Directory with persistent state can now be changed with the "statedir"
option.  The state directory /var/lib/mandos now gets created on
installation.  Added documentation about "restore" and "statedir"
options.

* Makefile (USER, GROUP, STATEDIR): New.
  (maintainer-clean): Also remove "statedir".
  (run-server): Replaced "--no-restore" with "--statedir=statedir".
  (statedir): New.
  (install-server): Make $(STATEDIR) directory.
* debian/mandos.dirs (var/lib/mandos): Added.
* debian/mandos.postinst: Fix ownership of /var/lib/mandos.
* mandos: New --statedir option.
  (stored_state_path): Not global anymore.
  (stored_state_file): New global.
* mandos.conf: Fix whitespace.
  (restore, statedir): Added.
* mandos.conf.xml (OPTIONS, EXAMPLE): Added "restore" and "statedir".
  mandos.xml (SYNOPSIS, OPTIONS): Added "--statedir".
  (FILES): Added "/var/lib/mandos".

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
 
88
88
 
89
89
version = "1.4.1"
90
 
stored_state_path = "/var/lib/mandos/clients.pickle"
 
90
stored_state_file = "clients.pickle"
91
91
 
92
92
logger = logging.getLogger()
93
93
syslogger = (logging.handlers.SysLogHandler
1972
1972
                        dest="use_ipv6", help="Do not use IPv6")
1973
1973
    parser.add_argument("--no-restore", action="store_false",
1974
1974
                        dest="restore", help="Do not restore stored"
1975
 
                        " state", default=True)
 
1975
                        " state")
 
1976
    parser.add_argument("--statedir", metavar="DIR",
 
1977
                        help="Directory to save/restore state in")
1976
1978
    
1977
1979
    options = parser.parse_args()
1978
1980
    
1992
1994
                        "use_dbus": "True",
1993
1995
                        "use_ipv6": "True",
1994
1996
                        "debuglevel": "",
 
1997
                        "restore": "True",
 
1998
                        "statedir": "/var/lib/mandos"
1995
1999
                        }
1996
2000
    
1997
2001
    # Parse config file for server-global settings
2014
2018
    # options, if set.
2015
2019
    for option in ("interface", "address", "port", "debug",
2016
2020
                   "priority", "servicename", "configdir",
2017
 
                   "use_dbus", "use_ipv6", "debuglevel", "restore"):
 
2021
                   "use_dbus", "use_ipv6", "debuglevel", "restore",
 
2022
                   "statedir"):
2018
2023
        value = getattr(options, option)
2019
2024
        if value is not None:
2020
2025
            server_settings[option] = value
2032
2037
    debuglevel = server_settings["debuglevel"]
2033
2038
    use_dbus = server_settings["use_dbus"]
2034
2039
    use_ipv6 = server_settings["use_ipv6"]
 
2040
    stored_state_path = os.path.join(server_settings["statedir"],
 
2041
                                     stored_state_file)
2035
2042
    
2036
2043
    if debug:
2037
2044
        initlogger(logging.DEBUG)