def verifyFileOnlyWritableByMunkiAndRoot(file_path):
    try:
        file_stat = os.stat(file_path)
    except OSError, err:
        raise VerifyFilePermissionsError(
            '%s does not exist. \n %s' % (file_path, str(err)))

    try:
        admin_gid = grp.getgrnam('admin').gr_gid
        wheel_gid = grp.getgrnam('wheel').gr_gid
        user_gid = os.getegid()
        # verify the munki process uid matches the file owner uid.
        if os.geteuid() != file_stat.st_uid:
            raise InsecureFilePermissionsError(
                'owner does not match munki process!')
        # verify the munki process gid matches the file owner gid, or the file
        # owner gid is wheel or admin gid.
        elif file_stat.st_gid not in [admin_gid, wheel_gid, user_gid]:
            raise InsecureFilePermissionsError(
                'group does not match munki process!')
        # verify other users cannot write to the file.
        elif file_stat.st_mode & stat.S_IWOTH != 0:
            raise InsecureFilePermissionsError('world writable!')
    except InsecureFilePermissionsError, err:
        raise InsecureFilePermissionsError(
            '%s is not secure! %s' % (file_path, err.args[0]))
Intercepts calls to :meth:`~slimta.edge.EdgeServer.handle`, reads
dataset/ETHPy150Open munki/munki/code/client/munkilib/utils.py/verifyFileOnlyWritableByMunkiAndRoot--crossover with--dataset/ETHPy150Open slimta/python-slimta/slimta/util/proxyproto.py/ProxyProtocol.handle