-
-
Notifications
You must be signed in to change notification settings - Fork 220
feat: supascan audit feature #1963
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
base: develop
Are you sure you want to change the base?
Conversation
Pull request was converted to draft
03182b8 to
6b23b1e
Compare
| @@ -0,0 +1,37 @@ | |||
| #!/bin/bash | |||
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.
nit: Can we use /usr/bin/env bash here?
| baselinesDir := args[0] | ||
|
|
||
| // Verify baselines directory exists | ||
| if _, err := os.Stat(baselinesDir); os.IsNotExist(err) { |
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.
nit: Can probably add another check here to verify the goss binary path exists and fail fast with a clear error message rather than a backtrace when it's not found later on
LGUG2Z
left a comment
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.
This looks great!
|
Will address all nits thanks @LGUG2Z |
* feat: audit feature * feat: shallow dirs * feat: include dirs * fix: deal with various dirs * fix: excludes * feat: baseline test * tests: upload baseline * fix: move audit to end of image build * feat: supascan * fix: cleanup * fix: upload * fix: consolidate installation etc * fix: install * fix: sudo for validate * fix: ubuntu user path * feat: organize into ami build and deployed * fix: rename * fix: package not present at ami build * fix: include users, groups perms * fix: align perms with build stage * fix: restore sh files undo formatting * chore: restore version in package * fix: update conf.d * chore: rename task
Supascan - System Scanner and Validator
A comprehensive system auditing toolkit for generating and validating baseline specifications using GOSS.
Features
One Unified CLI with Three Commands:
supascan genspec- Generate complete machine baseline (packages, services, configs, users, groups, mounts, kernel params)supascan validate- Validate machines against baseline specifications with critical/advisory categorizationsupascan split- Split a monolithic baseline into separate section files for easier auditingUse Cases:
Quick Start
Generate a Machine Baseline
Split Baseline into Sections
Validate Against Baselines
Installation
Using Nix Flake
Development Environment
git clone https://github.com/supabase/postgres cd postgres nix developThis gives you access to:
supascanCLIgossbinaryUsage
supascan genspec
Generate a comprehensive baseline specification from a running machine.
Captures:
Options:
--format <yaml|json>--config <file>--include-dynamic--include-ports--include-processes--shallow-dirs <path>--shallow-depth <n>--strict--verbose--debugsupascan split
Split a monolithic baseline file into separate section files for targeted auditing.
Creates separate files:
service.yml- Systemd servicesuser.yml- User accountsgroup.yml- Groupsmount.yml- Mount pointspackage.yml- Installed packageskernel-param.yml- Kernel parametersfiles-security.yml- Security-related files (fail2ban, nftables)files-ssl.yml- SSL certificates and keysfiles-postgres-config.yml- PostgreSQL configurationfiles-postgres-data.yml- PostgreSQL data directoryfiles-etc.yml- General /etc filesfiles-systemd.yml- Systemd unit filesfiles-usr.yml,files-usr-local.yml- Application filessupascan validate
Validate the system against multiple baseline specification files with critical/advisory categorization.
Validation Categories:
Critical specs (must pass):
service.yml- Service configurationuser.yml- User accountsgroup.yml- Group membershipsmount.yml- Mount pointspackage.yml- Required packagesfiles-security.yml- Security configurationsfiles-ssl.yml- SSL/TLS filesfiles-postgres-config.yml- Database configurationfiles-postgres-data.yml- Database data permissionsAdvisory specs (informational):
kernel-param.yml- Kernel parametersfiles-etc.yml- General configuration filesfiles-systemd.yml- Systemd unitsfiles-*.yml- Other file categoriesExit Codes:
0- All critical checks passed1- One or more critical checks failedOptions:
--format <tap|documentation|json>--goss <path>--verboseWorkflow Examples
Baseline-Driven Compliance
git add baselines/ git commit -m "Add production baselines"CI/CD Image Validation
Add to your image build pipeline:
Example output:
Configuration
Exclusion Config File
Create a YAML config file to customize exclusions:
Use with:
Default Exclusions
The following are excluded by default to reduce noise:
Paths:
/proc/*,/sys/*,/dev/*,/run/*/tmp/*,/var/tmp/*/var/cache/*,*/.cache/*/var/log/**/__pycache__/*,*.pyc*/.bash_history,*/.zsh_historyShallow Directories:
/nix/store- Nix store (scan top-level only)/data/pgdata- PostgreSQL data/opt/saltstack- Salt installation/usr/local/share,/usr/local/libKernel Parameters:
fs.dentry-state,fs.file-nr,kernel.random.*fs.epoll.max_user_watches,net.netfilter.*Repository Structure
Development
Building
Code Quality
Requirements
sudoaccess for scanning and validation (many checks require root)Credits