Skip to content

Commit

Permalink
fix audit rules
Browse files Browse the repository at this point in the history
  • Loading branch information
raianand committed Sep 5, 2024
1 parent 776a5d9 commit 868211e
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 10 deletions.
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 23 additions & 5 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions src/audit_rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ async function auditRulesTemplate({ homeDir, workingDir }) {
-a exit,always -S execve -k bolt_monitored_process_exec
# logs file changes (writes, deletes, renames, etc.)
-a exit,always -F dir=%s -F perm=wa -S open,openat,creat,truncate,ftruncate -k file_change
# -a exit,always -F dir=%s -F perm=wa -S open,openat,creat,truncate,ftruncate -k file_change
-w ${homeDir} -p wa -k bolt_monitored_bolt_home_changes
-w ${workingDir} -p wa -k bolt_monitored_working_dir_changes
-w /etc/passwd -p wa -k bolt_monitored_passwd_changes
-w /etc/shadow -p wa -k bolt_monitored_shadow_changes
Expand Down
20 changes: 20 additions & 0 deletions src/audit_summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,26 @@ function parentAction(node) {
return null
}

async function getBuildEnvironmentTamperingActions() {
const boltPID = core.getState('boltPID')
const githubRunnerPID = core.getState('githubRunnerPID')
const audit = await generateTestResults('audit.json')

const buildEnvironmentTamperingEvents = [
'bolt_monitored_passwd_changes',
'bolt_monitored_shadow_changes',
'bolt_monitored_group_changes',
'bolt_monitored_sudoers_changes',
'bolt_monitored_docker_daemon_changes',
'bolt_monitored_audit_log_changes',
'bolt_monitored_bolt_home_changes'
]

const processTamperingBuildEnv = audit.filter(a =>
a.tags?.some(tag => buildEnvironmentTamperingEvents.includes(tag))
)
}

async function getSudoCallingActions() {
const boltPID = core.getState('boltPID')
const githubRunnerPID = core.getState('githubRunnerPID')
Expand Down
7 changes: 7 additions & 0 deletions src/scripts/audit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@ mv audit.rules /etc/audit/rules.d/

# Restart auditd service to apply the new rules
service auditd restart

auditctl -w $2 -p wa -k bolt_monitored_wd_changes

auditctl -e 2



2 changes: 1 addition & 1 deletion src/version.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const releaseVersion = 'v1.7.0-rc.1'
const releaseVersion = 'v1.7.0-rc.2'

module.exports = {
releaseVersion
Expand Down

0 comments on commit 868211e

Please sign in to comment.