0
0
Jenkinsdevops~10 mins

Security audit logging in Jenkins - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to enable audit logging in Jenkins.

Jenkins
auditLogger = Jenkins.instance.getExtensionList('hudson.security.AuditLogger')[[1]]
Drag options to blanks, or click blank then click option'
A2
B1
C0
D-1
Attempts:
3 left
💡 Hint
Common Mistakes
Using index 1 or 2 causes an error because those indexes don't exist.
2fill in blank
medium

Complete the code to enable audit logging for all authentication events.

Jenkins
auditLogger.setEnabled(true)
auditLogger.setLogAuthentication([1])
Drag options to blanks, or click blank then click option'
Atrue
Bundefined
Cnull
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using false disables logging, so no audit logs are created.
3fill in blank
hard

Fix the error in the code to correctly log audit events to a file.

Jenkins
auditLogger.setLogFile(new File([1]))
Drag options to blanks, or click blank then click option'
A"/var/log/jenkins/audit.log"
B'/var/log/jenkins/audit.log'
C/var/log/jenkins/audit.log
D'var/log/jenkins/audit.log'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes causes syntax errors.
Using single quotes is valid but here double quotes are preferred.
4fill in blank
hard

Fill both blanks to configure audit logging to include user and timestamp.

Jenkins
auditLogger.setFormat("User: [1], Time: [2]")
Drag options to blanks, or click blank then click option'
A%u
B%t
C%T
D%U
Attempts:
3 left
💡 Hint
Common Mistakes
Using %T or %U are incorrect format specifiers for user or time.
5fill in blank
hard

Fill all three blanks to create a filter that logs only failed login attempts.

Jenkins
auditLogger.setFilter({ event -> event.getType() == [1] && event.getResult() == [2] && event.getUser() != [3] })
Drag options to blanks, or click blank then click option'
A"AUTHENTICATION"
B"FAILURE"
C"anonymous"
D"SUCCESS"
Attempts:
3 left
💡 Hint
Common Mistakes
Using "SUCCESS" instead of "FAILURE" logs successful logins, not failures.