https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41310

--- Comment #11 from Saiful Amin <[email protected]> ---
Created attachment 194151
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=194151&action=edit
Bug 41310: Add remote_ip (REMOTE_ADDR) to action_logs table to improve security
auditing

What this patch does:
- Add an ip_address column to the action_logs table
- Uses VARCHAR(45) to accommodate both IPv4 and IPv6 addresses
- Modify the logaction function to capture and store the REMOTE_ADDR into
ip_address column
- Add ActionLogsEnableIPLogging system preference with GDPR compliance notice
- Add ActionLogsEnableIPLogging toggle in System preferences > Logs > Debugging
- Log IP address only if ActionLogsEnableIPLogging is set to 1
- Update kohastructure.sql: add `ip_address` column to action_logs table

Test Plan:
1. Apply the patch
2. Run the tests:
   `prove t/db_dependent/TestIpLogging.t`
   - Verify that all tests pass
3. Verification with IP Logging Disabled:
   - Go to Administration > System preferences > Logs > Debugging
   - Ensure that 'ActionLogsEnableIPLogging' is set to 'No'
   - Go to Administration > System preferences > Logs > Logging
   - Toggle any preference, e.g., AcquisitionLog
   - Connect to the Koha database (koha-mysql kohadev) and run:
   `SELECT * FROM action_logs ORDER BY action_id DESC LIMIT 1;`
   - The 'ip_address' column should be NULL
4. Verification with IP Logging Enabled:
   - Go to Administration > System preferences > Logs > Debugging
   - Ensure that 'ActionLogsEnableIPLogging' is set to 'Yes'
   - Go to Administration > System preferences > Logs > Logging
   - Toggle any preference, e.g., AcquisitionLog
   - Connect to the Koha database (koha-mysql kohadev) and run:
   `SELECT * FROM action_logs ORDER BY action_id DESC LIMIT 1;`
   - The 'ip_address' column should contain a valid IP address
5. Sign off

Future improvement: Add the IP Address column to Tools > Log viewer

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to