Author - This is my first attempt to really build something like this, so my structure may not be comparable to common practice, but any suggestion would be appreciated.
This toolset, tentatively named Protocol Z, leverages AppArmor to automate critical security functions that are often unavailable or underutilized. The goal is to educate users on potential vulnerabilities, reduce intrusion risks, and create a secure yet user-friendly environment.
Many users unknowingly prioritize convenience over security, leaving their systems exposed. A hardened environment ensures that all activities, including internet traffic and program execution, undergo rigorous validation checks, minimizing the risk of unauthorized access or data exposure.
Modern threats have evolved from obvious scams to sophisticated, nearly invisible tactics. Attackers now target systems designed for defense, exploiting even advanced countermeasures. This shift underscores the importance of proactive and adaptive security measures.
While no system can be completely secure, Protocol Z focuses on continuous improvement and robust defense, evolving alongside the threat landscape.
Protocol Z employs AppArmor, a Linux kernel security module, to isolate applications using predefined access profiles. These profiles limit applications' capabilities without compromising functionality. The automated process detects new applications in designated folders, assigns profiles or guides users through a three-step vetting process to generate a profile to match the application.
- Sandbox: Isolate the application in a secure sandbox to monitor its behavior and detect any suspicious activity.
- Audit: Investigate the application for hidden malware and generate a report for user review. This includes listing events that trigger communication with external entities.
- Compliance: Find a balance between restricting the application's behavior and ensuring it remains 100% effective for the user.
Until an application completes the vetting process, it remains confined to a sandboxed user space, reducing potential security risks.
- Real-Time Monitoring: Detects new software installations and initiates the security vetting process.
- Profile Management: Automatically assigns existing profiles or generates new ones.
- Sandboxing: Restricts unvetted applications to a safe user space.
- Interactive Security: Prompts users during vetting for greater accuracy and oversight.
- Custom Rules: Supports predefined rules tailored to user environments.
The monitoring system includes three levels of visibility:
- Low (1): Minimal resource usage; checks triggered less frequently.
- Medium (2): Balanced monitoring and resource usage.
- High (3): Active, frequent checks with higher hardware demands.
- A new application,
example-app
, is detected. - No existing AppArmor profile is found, so a new profile is generated.
- The user is prompted to choose a profile mode:
- Enforce: Strictly enforces rules.
- Audit: Logs unauthorized actions without enforcing rules.
- Complain: Logs unauthorized actions while allowing operations.
New application detected: example-app
No AppArmor profile found. A new profile has been created.
Select profile mode:
1. Enforce
2. Audit
3. Complain
Enter your choice (1/2/3):
- Operating System: Linux (Ubuntu or any distribution with AppArmor enabled).
- Dependencies:
- AppArmor (
aa-genprof
,aa-complain
,aa-enforce
commands). - Bash shell.
- AppArmor (
sudo apt update && sudo apt install apparmor apparmor-utils
- Clone the repository:
git clone https://github.com/your-username/monitor-app-installs.git cd monitor-app-installs
- Make the script executable:
chmod +x monitor_app_installs.sh
- (Optional) Edit predefined rules in
config/predefined_rules.txt
.
Run the script:
./monitor_app_installs.sh
Follow the prompts to:
- Review detected installations.
- Set the profile mode (
enforce
,audit
, orcomplain
).
monitor-app-installs/
├── README.md # Documentation
├── LICENSE # License file
├── monitor_app_installs.sh # Main script
├── config/ # Predefined AppArmor rules
│ ├── predefined_rules.txt
├── docs/ # Additional documentation
├── tests/ # Test scripts (optional)
└── .gitignore # Ignored files
- Enhanced Alerts: Add support for email, Slack, or other notification channels.
- Logging: Implement detailed audit trails for improved tracking.
- Expanded Rules: Include profiles for a broader range of applications.
We welcome contributions! To get started:
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add feature: feature-name"
- Push your branch:
git push origin feature-name
- Open a pull request on GitHub.
This project is licensed under the MIT License. See the LICENSE file for details.
- AppArmor Documentation
- Community resources on Bash scripting.
- Add support for multiple alert channels (e.g., email, Slack).
- Implement logging for better audit trails.
- Expand predefined rules to cover more applications.
Feel free to explore, use, and contribute to this project. Happy monitoring!