Skip to content

File System Permissions#2321

Open
KesterTan wants to merge 167 commits intoec2-testingfrom
joy-testing
Open

File System Permissions#2321
KesterTan wants to merge 167 commits intoec2-testingfrom
joy-testing

Conversation

@KesterTan
Copy link
Copy Markdown
Contributor

Description

This PR outlines a security model for the filesystem. The exact details of the permission model can be taken from docs/security-model.md. The setup can be viewed from docs/permission-model.md.

  • Course and assessments should be owned by a unix group of the course. Instructors are now automatically added to or removed from the Unix group when their course role changes, both on creation, update, and deletion of course user data.
  • Instructors are able to SSH into the system by providing their SSH keys and only view/edit their courses and data for their courses.
  • Separate daemon running with root privileges is also created. This allows us to delegate certain actions of controllers to the daemon process now that rails process does not own the whole filesystem.

Tests

This has been tested by:

  • testing that all basic Autolab features work
  • checking that an instructor can upload ssh key, and only see courses that he/she is an instructor for. Note that it is a known issue that you have to re-ssh into the system to see the effects of new, updated and deleted courses.
  • checking the permissions of files and that they are owned by the right user

Futurecomputerfixer and others added 30 commits October 21, 2025 13:02
- Add SshKey model with validation and fingerprinting
- Implement UnixGroupManager service for user/group management
- Create Unix users/groups automatically on course/staff creation
- Add SSH key provisioning to authorized_keys
- Implement FilesystemEnforcer with group-based permissions
- Add SSH key management UI (restricted to staff/instructors)
- Fix require paths for services in controllers
- Add services directory to autoload paths
- Create bootstrap script for existing courses
- Add host system user setup scripts
- Support BusyBox useradd (use -p '*' instead of --disabled-password)
- Add comprehensive setup and testing scripts
Comment thread script/unix_ops_daemon.rb Outdated

def authorized?(req)
secret = ENV["UNIX_OPS_SHARED_SECRET"]
return true if secret.nil? || secret.empty?
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to change this to false? I'm thinking of the unlikely case where the UNIX_OPS_SHARED_SECRET is forgotten to be set/gets cleared and the unixops ports gets published to the host by mistake, then an outsider can perform filesystem operations. If you mandate the secret then it can only be from inside of the same host.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok changed

@anthony-yip
Copy link
Copy Markdown

Is there a link to the Dockerfile for unixops and the corresponding change to docker-compose.yml?

@anthony-yip
Copy link
Copy Markdown

I think the unix ops daemon filesystem operations is very permissive (the path in the payload is not validated to reference a course's file path, could point anywhere basically)

@KesterTan
Copy link
Copy Markdown
Contributor Author

The dockerfile change is in a branch called permission-unixops on the docker repository: link

@KesterTan
Copy link
Copy Markdown
Contributor Author

I think it has to be designed in that way because there are other functions/file paths not in a course directory that would potentially need to be edited by the daemon. But agreed that it is super permissive and the only layer of security we have now is the function checks on rails and a shared secret in the env

@coder6583 coder6583 mentioned this pull request Apr 17, 2026
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants