-
-
Notifications
You must be signed in to change notification settings - Fork 3
Document limited sudo access configuration #15
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -118,6 +118,55 @@ Configuration | |||||||||||
|
|
||||||||||||
| ### Configuration | ||||||||||||
|
|
||||||||||||
| ## Configuring Limited Sudo Access (Optional) | ||||||||||||
|
|
||||||||||||
| CortexAI operates with the privileges of the user running it. For certain tasks, like installing necessary tools or performing specific types of network scans, it might require elevated (`sudo`) privileges. To avoid needing to enter your password repeatedly and to limit the agent's root access, you can configure passwordless `sudo` for *specific* commands only. | ||||||||||||
|
|
||||||||||||
| > [!WARNING] | ||||||||||||
| > **Critical Warning:** Modifying sudo permissions is a sensitive operation. Incorrect configuration can compromise your system's security or lock you out. **Never** edit /etc/sudoers directly. Always use the visudo command, which performs syntax checks before saving: | ||||||||||||
|
|
||||||||||||
| ```bash | ||||||||||||
| sudo visudo | ||||||||||||
| ``` | ||||||||||||
| Granting Specific Passwordless Permissions | ||||||||||||
| Identify Required Commands: Determine the exact commands CortexAI might need sudo for (e.g., systemctl start <service>, specific nmap options). Be as specific as possible. | ||||||||||||
|
|
||||||||||||
| Edit Sudoers: Add a line in visudo for the user running CortexAI (replace cortexuser with the actual username YOU CREATE). | ||||||||||||
|
|
||||||||||||
| Allow cortexuser to run specific commands without a password for CortexAI | ||||||||||||
| ``` | ||||||||||||
| cortexuser ALL=(ALL) NOPASSWD: /usr/bin/specific/command1, /usr/bin/another/command --with-options * | ||||||||||||
| cortexuser: The username running CortexAI. | ||||||||||||
| ``` | ||||||||||||
|
Comment on lines
+136
to
+140
|
||||||||||||
| Allow cortexuser to run specific commands without a password for CortexAI | |
| ``` | |
| cortexuser ALL=(ALL) NOPASSWD: /usr/bin/specific/command1, /usr/bin/another/command --with-options * | |
| cortexuser: The username running CortexAI. | |
| ``` |
Allow cortexuser to run specific commands without a password for CortexAI
cortexuser ALL=(ALL) NOPASSWD: /usr/bin/specific/command1, /usr/bin/another/command --with-options *
cortexuser: The username running CortexAI.
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These explanatory bullet points lack proper markdown list formatting. They should use markdown list syntax (e.g., '- ALL=(ALL): ...') to improve readability and document structure.
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The heading 'Restricting Dangerous Commands' on line 150 is not formatted as a markdown heading. It should use markdown heading syntax (e.g., '### Restricting Dangerous Commands') to maintain proper document structure and hierarchy.
| Restricting Dangerous Commands | |
| ### Restricting Dangerous Commands |
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sudo deny rule '!/usr/bin/rm *' is ineffective because the wildcard doesn't work as intended in sudoers syntax. The rule should be '!/usr/bin/rm' without the wildcard, or use '/usr/bin/rm *' within quotes. Additionally, deny rules in sudoers are evaluated differently than allow rules, and this configuration may not provide the intended protection.
| cortexuser ALL=(ALL) !/usr/bin/rm *, !/usr/sbin/shutdown, !/usr/sbin/reboot, !/usr/bin/passwd, !/usr/bin/cat /path/to/your/secure/files/* | |
| cortexuser ALL=(ALL) !/usr/bin/rm, !/usr/sbin/shutdown, !/usr/sbin/reboot, !/usr/bin/passwd, !/usr/bin/cat /path/to/your/secure/files/* |
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment on line 153 should be inside the code block as a comment (prefixed with #), and the explanation on line 157 should be formatted as a proper paragraph or list item rather than appearing as a standalone line after the code block.
| Deny dangerous commands for cortexuser even with sudo | |
| ``` | |
| cortexuser ALL=(ALL) !/usr/bin/rm *, !/usr/sbin/shutdown, !/usr/sbin/reboot, !/usr/bin/passwd, !/usr/bin/cat /path/to/your/secure/files/* | |
| ``` | |
| The ! negates the permission for the specified command. |
Deny dangerous commands for cortexuser even with sudo
cortexuser ALL=(ALL) !/usr/bin/rm , !/usr/sbin/shutdown, !/usr/sbin/reboot, !/usr/bin/passwd, !/usr/bin/cat /path/to/your/secure/files/
- The `!` negates the permission for the specified command.
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The heading 'Important Note on Tool Installation' on line 159 is not formatted as a markdown heading. It should use markdown heading syntax (e.g., '### Important Note on Tool Installation') to maintain proper document structure and hierarchy.
| Important Note on Tool Installation | |
| ### Important Note on Tool Installation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The heading 'Granting Specific Passwordless Permissions' on line 131 is not formatted as a markdown heading. It should use markdown heading syntax (e.g., '### Granting Specific Passwordless Permissions') to maintain proper document structure and hierarchy.