Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fresh portscan and vulnscan instances have permissions issues for cyhy-runner data #662

Open
mcdonnnj opened this issue Jun 12, 2023 · 1 comment
Assignees
Labels
bug This issue or pull request addresses broken functionality

Comments

@mcdonnnj
Copy link
Member

mcdonnnj commented Jun 12, 2023

🐛 Bug Report

When spinning up fresh (no existing EBS volume for cyhy-runner data) portscan or vulnscan instances the cyhy-commander is unable to push work due to incorrect permissions on the scanner instance.

To Reproduce

  • Spin up a fresh portscan or vulnscan instance.
  • Watch the cyhy-commander log and see that it is unable to push work to the new instance.
  • SSH to the new instance and see that the /var/cyhy/runner/running and/or /var/cyhy/runner/done directories are owned by root instead of cyhy.

Expected behavior

A fresh scanner instance is able to immediately receive work after successfully starting up.

@mcdonnnj mcdonnnj added the bug This issue or pull request addresses broken functionality label Jun 12, 2023
@mcdonnnj mcdonnnj self-assigned this Jun 12, 2023
@mcdonnnj
Copy link
Member Author

mcdonnnj commented Jun 12, 2023

Upon investigation I believe that what happens is a freshly created EBS volume is attached at the mountpoint (/var/cyhy/runner) and the mount point is chowned during cloud-init per

part {
content = templatefile("${path.module}/cloud-init/disk_setup.tpl.sh", {
device_name = "/dev/xvdb"
fs_type = "ext4"
label = "cyhy_runner"
mount_options = "defaults"
mount_point = "/var/cyhy/runner"
num_disks = 2
})
content_type = "text/x-shellscript"
filename = "01_cyhy_runner_disk_setup.sh"
}
However, the running and done sub-directories do not exist so once cyhy-runner starts up (running under root) it will create those directories and they will be owned by root. I believe the easiest path forward is to modify the cloud-init configuration for scanner instances to create and ensure appropriate ownership of these sub-directories as the cyhy-runner service waits for cloud-init to finish before starting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue or pull request addresses broken functionality
Projects
Status: No status
Development

No branches or pull requests

1 participant