Iptables? - Prevent Request To Particular IP & Port, Redirect To Local
I'm running a Debian 5 machine and am in need of a way to stop a daemon (bacula-fd) from calling an IP address (which is external) at port 9103 and rather have the request be redirected to the localhost on the same port. I have been trying to setup all sorts of iptables rules for forwarding and prerouting but just can't get this to work.
The reason I want to do this is to have the request go through a SSH tunnel for security purposes. I do not have a way to change the IP address nor port that the daemon is using. This is because it gets it from bacula-sd daemon on the main server and I have many other clients connecting to it.
To summarize and hopefully make this a little more clear, I'm looking for:
Daemon makes request to eth0 for IP xxx.xxx.xxx.xxx, port 9103. Something (iptables or something else) prevents request from going out on internet and redirects to 127.0.0.1, port 9103.
Am I making sense? Can this be done?
Any help is much appreciated. Thanks!