Пример #1
0
def test_dbs_migration(directory):
    GLSettings.gldb_path = os.path.join(GLSettings.ramdisk_path, 'db_test')
    path = os.path.join(os.path.dirname(os.path.realpath(__file__)), directory)
    for (path, dirs, files) in os.walk(path):
        for f in files:
            os.mkdir(GLSettings.gldb_path)
            dbpath = os.path.join(path, f)
            shutil.copyfile(dbpath, ('%s/%s' % (GLSettings.gldb_path, f)))
            check_db_files()
            shutil.rmtree(GLSettings.gldb_path)
Пример #2
0
def test_dbs_migration(directory):
    GLSetting.gldb_path = 'db_test'    # path where check_db_files looks in
    path = os.path.join(os.path.dirname(os.path.realpath(__file__)), directory)
    for (path, dirs, files) in os.walk(path):
        for f in files:
            os.mkdir('db_test')
            dbpath = os.path.join(path, f)
            shutil.copyfile(dbpath, ('db_test/%s' % f))
            check_db_files()
            shutil.rmtree('db_test/')
Пример #3
0
def test_dbs_migration(directory):
    GLSetting.gldb_path = 'db_test'  # path where check_db_files looks in
    path = os.path.join(os.path.dirname(os.path.realpath(__file__)), directory)
    for (path, dirs, files) in os.walk(path):
        for f in files:
            os.mkdir('db_test')
            dbpath = os.path.join(path, f)
            shutil.copyfile(dbpath, ('db_test/%s' % f))
            check_db_files()
            shutil.rmtree('db_test/')
Пример #4
0
 def _test(self, path, f):
     init_glsettings_for_unit_tests()
     GLSettings.db_path = os.path.join(GLSettings.ramdisk_path, 'db_test')
     os.mkdir(GLSettings.db_path)
     dbpath = os.path.join(path, f)
     shutil.copyfile(dbpath, '%s/%s' % (GLSettings.db_path, f))
     ret = check_db_files()
     shutil.rmtree(GLSettings.db_path)
     self.assertNotEqual(ret, -1)
Пример #5
0
 def _test_dbs_migration(self, directory):
     GLSettings.db_path = os.path.join(GLSettings.ramdisk_path, "db_test")
     path = os.path.join(os.path.dirname(os.path.realpath(__file__)), directory)
     for (path, dirs, files) in os.walk(path):
         for f in files:
             os.mkdir(GLSettings.db_path)
             dbpath = os.path.join(path, f)
             shutil.copyfile(dbpath, ("%s/%s" % (GLSettings.db_path, f)))
             ret = check_db_files()
             shutil.rmtree(GLSettings.db_path)
             self.assertNotEqual(ret, -1)
Пример #6
0
    def start_globaleaks(self):
        try:
            GLSettings.fix_file_permissions()
            GLSettings.drop_privileges()
            GLSettings.check_directories()

            # Check presence of an existing database and eventually perform its migration
            check = check_db_files()
            if check == -1:
                self._reactor.stop()
            elif check == 0:
                yield init_db()
            else:
                yield update_version()
                yield init_appdata()

            yield clean_untracked_files()

            yield refresh_memory_variables()

            if GLSettings.cmdline_options:
                yield apply_cmdline_options()

            self.start_asynchronous_jobs()

            log.msg("GLBackend is now running")
            for ip in GLSettings.bind_addresses:
                log.msg("Visit http://%s:%d to interact with me" %
                        (ip, GLSettings.bind_port))

            for host in GLSettings.accepted_hosts:
                if host not in GLSettings.bind_addresses:
                    log.msg("Visit http://%s:%d to interact with me" %
                            (host, GLSettings.bind_port))

            for other in GLSettings.configured_hosts:
                if other:
                    log.msg("Visit %s to interact with me" % other)

            log.msg(
                "Remind: GlobaLeaks is not accessible from other URLs, this is strictly enforced"
            )
            log.msg(
                "Check documentation in https://github.com/globaleaks/GlobaLeaks/wiki/ for special enhancement"
            )

        except Exception as excep:
            log.err(
                "ERROR: Cannot start GlobaLeaks; please manual check the error."
            )
            log.err("EXCEPTION: %s" % excep)
            self._reactor.stop()
Пример #7
0
    def start_globaleaks(self):
        try:
            GLSettings.fix_file_permissions()
            GLSettings.drop_privileges()
            GLSettings.check_directories()

            # Check presence of an existing database and eventually perform its migration
            check = check_db_files()
            if check == -1:
                 self._reactor.stop()
            elif check == 0:
                yield init_db()
            else:
                yield update_version()
                yield init_appdata()

            yield clean_untracked_files()

            yield refresh_memory_variables()

            if GLSettings.cmdline_options:
                yield apply_cmdline_options()

            self.start_asynchronous_jobs()

            log.msg("GLBackend is now running")
            for ip in GLSettings.bind_addresses:
                log.msg("Visit http://%s:%d to interact with me" % (ip, GLSettings.bind_port))

            for host in GLSettings.accepted_hosts:
                if host not in GLSettings.bind_addresses:
                    log.msg("Visit http://%s:%d to interact with me" % (host, GLSettings.bind_port))

            for other in GLSettings.configured_hosts:
                if other:
                    log.msg("Visit %s to interact with me" % other)

            log.msg("Remind: GlobaLeaks is not accessible from other URLs, this is strictly enforced")
            log.msg("Check documentation in https://github.com/globaleaks/GlobaLeaks/wiki/ for special enhancement")

        except Exception as excep:
            log.err("ERROR: Cannot start GlobaLeaks; please manual check the error.")
            log.err("EXCEPTION: %s" % excep)
            self._reactor.stop()