Skip to content

Commit

Permalink
moved auparse to working directory
Browse files Browse the repository at this point in the history
  • Loading branch information
raianand committed Apr 15, 2024
1 parent 072649d commit c78e80b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 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.
8 changes: 5 additions & 3 deletions dist/index.js

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

3 changes: 3 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ async function run() {
const trustedGithubAccounts = getTrustedGithubAccounts()

const workingDir = process.env.GITHUB_WORKSPACE; // e.g. /home/runner/work/bolt
core.info(`Working directory: ${workingDir}`)
const repoName = process.env.GITHUB_REPOSITORY; // e.g. koalalab-inc/bolt
const repoOwner = repoName.split('/')[0]; // e.g. koalalab-inc

Expand Down Expand Up @@ -131,6 +132,8 @@ async function run() {
await exec(`sudo chown ${boltUser}:${boltUser} /home/${boltUser}/mitmdump`)
await exec(`sudo cp bolt/intercept.py /home/${boltUser}/`)
await exec(`sudo chown ${boltUser}:${boltUser} /home/${boltUser}/intercept.py`)
await exec(`cp bolt/auparse ${workingDir}/auparse`)
await exec(`chmod +x ${workingDir}/auparse`)
const cwd = process.cwd()
core.info(`Current working directory: ${cwd}`)
core.saveState('boltCWD', cwd)
Expand Down
5 changes: 2 additions & 3 deletions src/summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ function resultToRow(result) {
}

async function generateSummary() {
const workingDir = process.env.GITHUB_WORKSPACE
const outputFile = core.getState('outputFile')
const homeDir = core.getState('homeDir')
const boltUser = core.getState('boltUser')
const boltPID = core.getState('boltPID')
const boltCWD = core.getState('boltCWD')
const githubRunnerPID = core.getState('githubRunnerPID')

const egressRulesYAML = YAML.stringify(egressRules)
Expand All @@ -97,9 +97,8 @@ async function generateSummary() {
)
core.info(`Created bolt auditd log artifact with id: ${id} (bytes: ${size}`)

await exec(`chmod +x ${boltCWD}/bolt/auparse`)
await exec(
`${boltCWD}/bolt/auparse -format=json -i -out bolt/audit.json /var/log/audit/audit.log `
`${workingDir}/auparse -format=json -i -out bolt/audit.json /var/log/audit/audit.log `
)

await artifactClient.uploadArtifact('bolt-audit-json', ['audit.json'], 'bolt')
Expand Down

0 comments on commit c78e80b

Please sign in to comment.