fsapi is a python RESTful api for setting permissions/ ACLs on Windows Shares using predefined ACL JSON schemas associated with projects/file systems.
fsapi is a python RESTful api for setting permissions/ ACLs on Windows Shares using predefined ACL JSON schemas associated with projects/file systems.
fsapi utilizes the swagger/OpenAPI Specification, serve_swagger, falcon, waitress, pymongo, pymodm, and pywin32.
fsapi is in beta.
fsapi was built to allow non-admin users to set permissions / ACLs on files dynamically, especially for file structures that break Windows’ ACL inheritance. Other methodologies of allowing local scripts to login as privileged user were entirely insecure.
The best way forward is to expose the pywin32 api via REST, laying a fsapi user, project, and schema based system on top to provide security and predicability in ACLs. The reason for making an independent user system was to avoid tying further into AD, possibly opening fsapi in the future to other filesystems / permissions management.
Additionally, fsapi allowed for a more dynamic setting of permissions via schemas that harness regex matching.
You can preview using Swagger’s online Swagger UI.
Paste the following into the text box and hit Explore:https://raw.githubusercontent.com/r0b0tAnthony/fsapi/master/swagger.json
pip -r requirements.txt
POST
request to http://hostname:8080/api/users
, please reference the API Specification for query syntax.fsapi has an independent user system from Windows or it’s host platform in general. fsapi Users have permissions that allow them certain CRUD abilities within fsapi.
Users are assigned to projects and based on their user permissions they have certain abilities in projects.
Projects in fsapi map to a multi-platform(Linux, Windows, MacOS/Darwin) root folder and have an ACLSchema object assigned as well.
ACLSchemas are JSON hierarchical structures of the filesystem relative to a Project’s root folder.
{
"pathcomponent":{
"type": "file",
"owner: {
"name": "UserName"
"domain": "DomainName"
},
"acl": [{
"owner": {
"name": "Username",
"domain": "DomaineName"
},
"mask": ["READ_DATA", "GENERIC_EXECUTE"],
"inheritance": ["OBJECT_INHERIT", "CONTAINER_INHERIT"]
"type": "allow",
}],
"children": {
"child_pathcomponent":{
"type": "file",
"owner: {
"name": "UserName"
"domain": "DomainName"
},
"acl": [{
"owner": {
"name": "Username",
"domain": "DomaineName"
},
"mask": ["READ_DATA", "GENERIC_EXECUTE"],
"inheritance": ["OBJECT_INHERIT", "CONTAINER_INHERIT"]
"type": "allow",
}],
ignore_inheritance: True
}
}
ignore_inheritance: True
}
}
pathcomponent: A string or regex to match against a path component.
type: Either file
or folder
representing what kind of file this ACL should be applied to.
owner:
acl: An array of Objects that represent ACEs
allow
or deny
.ignore_inheritance: Boolean whether to break/ignore the inheritance of this pathcomponent. Effectively, clearing all inherited ACEs for this file/folder.
children: Another dictionary definition of child path components, following the schema of the parent. Any children not defined will receive the same schema defined as their parent schema. This object setting is recursive allowing for creating full hierarchical representations of the file system.
These are bit-wise masks that represent permissions for file and directories. You can read more on these at Microsoft’s Documentation on Access Masks.
Base Access Masks:
READ_DATA
, LIST_DIRECTORY
, WRITE_DATA
, ADD_FILE
, APPEND_DATA
, ADD_SUBDIRECTORY
, CREATE_PIPE_INSTANCE
, READ_EA
, WRITE_EA
, EXECUTE
, TRAVERSE
, DELETE_CHILD
, DELETE
, READ_CONTROL
, READ_ATTRIBUTES
, WRITE_ATTRIBUTES
, GENERIC_READ
, GENERIC_WRITE
, GENERIC_EXECUTE
, WRITE_DAC
, WRITE_OWNER
, SYNCHRONIZE
Computed Access Masks:
Are made of certain base access masks.
CUSTOM_ALL_ACCESS
is made of: SYNCHRONIZE
, READ_DATA
, LIST_DIRECTORY
, WRITE_DATA
, ADD_FILE
, APPEND_DATA
, ADD_SUBDIRECTORY
, CREATE_PIPE_INSTANCE
, READ_EA
, WRITE_EA
, EXECUTE
, TRAVERSE
, DELETE_CHILD
, READ_ATTRIBUTES
, WRITE_ATTRIBUTES
CUSTOM_MODIFY
is made of: DELETE
, READ_CONTROL
, SYNCHRONIZE
, READ_DATA
, LIST_DIRECTORY
, WRITE_DATA
, ADD_FILE
, APPEND_DATA
, ADD_SUBDIRECTORY
, CREATE_PIPE_INSTANCE
, READ_EA
, WRITE_EA
, EXECUTE
, TRAVERSE
, DELETE_CHILD
, READ_ATTRIBUTES
, WRITE_ATTRIBUTES
These are bit-wise masks that represent how an ACE should be inherited in a file a structure. You can read more about Windows Inheritance Masks here.
Base Inheritance Masks:
OBJECT_INHERIT
, CONTAINER_INHERIT
, NO_PROPOGATE_INHERIT
, INHERIT_ONLY