Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi there,
Is there an easy way to log the names of the actual processes that initiate, let's say, outbound connections from the Linux machine, for instance track what process initiates an outbound connection to MySQL port to remote machine and stuff like that?
Please try to be clear and avoid vague phrasing like "easy way", "stuff like that" and "without way too much hassle".
A process argv[0], its name, should not be considered as a selector. What is authoritative is that on a "clean" machine each process, however shortlived, will be visible in /proc. So, what you have related to processes are their PIDs and, in terms of filtering, the IP address of the remote machine and a remote port number. The only default Netfilter module that tracks process-related details directly is the "owner" module. Logging that information makes it available for further processing by any logwatcher. Since you didn't specify why you need to go through iptables I'd like to point out that there are other, possibly quicker, ways to get the information. If we assert that MySQL listens on its default port TCP/3306, then running 'netstat -tnpe|awk '/3306/ {print $NF}' will return the PIDs of processes using TCP and port 3306. But running 'lsof -t -P -w -n -i tcp:3306' should be even quicker. Having the PID you can find your name information in /proc/$PID/.* .
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.