add client IP to audit logs
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-19 10:56:37 +11:00
parent 317e0ab83d
commit 8799f0f796
6 changed files with 32 additions and 12 deletions

View File

@@ -86,6 +86,7 @@ const createAudit string = `
UserId INTEGER DEFAULT 0,
SecretId INTEGER DEFAULT 0,
EventText VARCHAR,
IpAddress VARCHAR,
EventTime datetime
);
`
@@ -394,6 +395,17 @@ func CreateTables() {
os.Exit(1)
}
}
// Add IpAddress column to audit table
auditIPCheck, _ := CheckColumnExists("audit", "IpAddress")
if !auditIPCheck {
// Add the column for LdapGroup in the roles table
_, err := db.Exec("ALTER TABLE audit ADD COLUMN IpAddress VARCHAR;")
if err != nil {
log.Printf("Error altering audit table to add IpAddress column : '%s'\n", err)
os.Exit(1)
}
}
}
// Count the number of records in the sqlite database