In my previous article i showed how we can write a mini database firewall using systemtap.In the second post of this series i will extend the previous script by adding a simple data masking functionality .This is what we are going to achieve :
NOTE : This script is only for demonstration purpose so don’t play with it in production !
The basic idea is to add a probe point on the syscall “write” checking for the correct file descriptor “17” (the one used by our target socket “220.127.116.11”) before processing and then modifying the buffer with the replacement string (in this case “HATEM” with “*****”).
DOWNLOAD : mini_db_firewall.stp
That’s it 😀