I am using telnet because of a barcode reader. It is pretty old before 2000 i think and it seems that it supports only telnet via wifi connection. However how can i restrict telnet access to only this device ip and to only one user?
How can i force that only a terminal application is executed and when it is closed no one can make any change to the system?
2 Answers
I don't use telnet for a long time but the following should work:
Edit /etc/hosts.allow and add:
telnetd: allowed_IP
About restricting the telnet login ability to a single user check the following answer: https://serverfault.com/questions/36322/how-can-i-use-pam-to-restrict-telnet-login-by-user
You can define the user shell so that a specific application is invoked during login, but please note that depending on the application or shell profile there could be workarounds to manually escape to a full shells.
You could manage all of this with iptables. As long as your default INPUT rules were not allow everything this would work.
/sbin/iptables -A INPUT -p tcp --dport 23 -s IP_ADDRESS -j ACCEPT /sbin/iptables -A INPUT -p tcp --syn --dport 23 -m connlimit --connlimit-above 1 -j REJECT