예제 #1
0
    def new_config(self):
        ConfigParser.SafeConfigParser.__init__(self)

        self.add_section("config")
        self.set("config", "version", CONFIG_VERSION)

        self.add_section("postgresql")
        self.set("postgresql", "host", "localhost")
        self.set("postgresql", "port", "5432")
        self.set("postgresql", "user", "openmolar")
        self.set("postgresql", "password", new_password())

        plain, hash = pass_hash(8)
        f = open(PASSWORD_FILE, "w")
        f.write(PASSWORD_HEADER)
        f.write(plain+"\n")
        f.close()

        self.add_section("managers-md5")
        self.set("managers-md5", "admin", hash)

        self.add_section("230server")
        self.set("230server", "listen", "")
        self.set("230server", "port", "1430")

        self.add_section("ssl")
        self.set("ssl", "cert", os.path.join(KEY_DIR, "cert.pem"))
        self.set("ssl", "key", os.path.join(KEY_DIR, "privatekey.pem"))
예제 #2
0
    def new_config(self):
        ConfigParser.SafeConfigParser.__init__(self)

        self.add_section("config")
        self.set("config", "version", CONFIG_VERSION)

        self.add_section("postgresql")
        self.set("postgresql", "host", "localhost")
        self.set("postgresql", "port", "5432")
        self.set("postgresql", "user", "openmolar")
        self.set("postgresql", "password", new_password())

        plain, hash = pass_hash(8)
        f = open(PASSWORD_FILE, "w")
        f.write(PASSWORD_HEADER)
        f.write(plain + "\n")
        f.close()

        self.add_section("managers-md5")
        self.set("managers-md5", "admin", hash)

        self.add_section("230server")
        self.set("230server", "listen", "")
        self.set("230server", "port", "1430")

        self.add_section("ssl")
        self.set("ssl", "cert", os.path.join(KEY_DIR, "cert.pem"))
        self.set("ssl", "key", os.path.join(KEY_DIR, "privatekey.pem"))
예제 #3
0
    def create_user(self, username, password=None):
        '''
        create a user (remote user)
        '''
        LOGGER.info("add a login user with name '%s' and password" % username)

        if password is None:
            password = new_password()

        try:
            self._execute("create user %s" % username)
            self._execute("alter user %s with login encrypted password '%s' " %
                          (username, password))
            return True
        except Exception:
            LOGGER.exception("Serious Error")
        return False
예제 #4
0
    def create_user(self, username, password=None):
        '''
        create a user (remote user)
        '''
        LOGGER.info("add a login user with name '%s' and password"% username)

        if password is None:
            password = new_password()

        try:
            self._execute("create user %s"% username)
            self._execute(
                "alter user %s with login encrypted password '%s' "% (
                    username, password))
            return True
        except Exception:
            LOGGER.exception("Serious Error")
        return False