To install a SOCKS4 server on Debian you may apt-get the SOCKS4 server package (apt-get install socks4-server):
socks4-server – SOCKS4 server for proxying IP-based services over a firewall
After the installation you need to edit your inetd configration by typing:
update-inetd –add "socks stream tcp nowait nobody /usr/sbin/sockd"
It will edit the /etc/inetd.conf configuration and reload the daemon.
Now just edit the /etc/sockd.conf access list file for authorized connections, example:
permit 192.168.0.2 255.255.255.255
deny ALL 0.0.0.0 .my.domain 0.0.0.0