LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Disable tenet (port 23) on CentOS 7 (https://www.linuxquestions.org/questions/linux-security-4/disable-tenet-port-23-on-centos-7-a-4175728704/)

cdunavent 09-06-2023 02:14 PM

Disable tenet (port 23) on CentOS 7
 
I am a new Linux admin setting up a brand new Linux virtual machine (VM). When I do a uname -r, I see it is running 3.10.0-1160.83.1.el7.x86_64, which I assume is CentOS.

About a week after the machine was turned up, I got an email from security stating they had performed a port scan on my machine and detected that telnet (port) 23 was turned on. They asked me to turn it off.

I immediately started Googling and found many references about editing /etc/xinetd.d/telnet. Most state that I open # vi /etc/xinetd.d/telnet and change diable=no to disable=yes.

Unfortunately, there is no such file /etc/xinetd.d/telnet on my machine to edit.

So, I am looking for an alternative way to permanently disable telnet port 23.

TB0ne 09-06-2023 03:46 PM

Quote:

Originally Posted by cdunavent (Post 6452117)
I am a new Linux admin setting up a brand new Linux virtual machine (VM). When I do a uname -r, I see it is running 3.10.0-1160.83.1.el7.x86_64, which I assume is CentOS.

You can also run "cat /etc/*release*", and you'll get output similar to:
Code:

NAME="openSUSE Tumbleweed"
# VERSION="20230904"
ID="opensuse-tumbleweed"
ID_LIKE="opensuse suse"
VERSION_ID="20230904"
PRETTY_NAME="openSUSE Tumbleweed"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:tumbleweed:20230904"
BUG_REPORT_URL="https://bugzilla.opensuse.org"
SUPPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org"
DOCUMENTATION_URL="https://en.opensuse.org/Portal:Tumbleweed"
LOGO="distributor-logo-Tumbleweed"

...which will tell you 100% what you have.
Quote:

About a week after the machine was turned up, I got an email from security stating they had performed a port scan on my machine and detected that telnet (port) 23 was turned on. They asked me to turn it off. I immediately started Googling and found many references about editing /etc/xinetd.d/telnet. Most state that I open # vi /etc/xinetd.d/telnet and change diable=no to disable=yes.

Unfortunately, there is no such file /etc/xinetd.d/telnet on my machine to edit. So, I am looking for an alternative way to permanently disable telnet port 23.
You can check with:
Code:

systemctl is-enabled telnet.socket
..and you should see the status. If it's not disabled, run:
Code:

systemctl disable telnet.socket
..and recheck.

That said, why on EARTH would you be putting a NEW CentOS7 server in place??? It's very old, and will hit end-of-life soon. Use a current version of Linux on a new server.

michaelk 09-06-2023 06:51 PM

Welcome to LinuxQuestions.

Is this some type hosted virtual machine? By default CentOS does not automatically install telnet (it is a stand alone server and does not run under xinetd) so I would think that would be on your hosted service provider. Have you verified that telnet or anything is running or port 23? As root or via sudo try running the command on the server:

lsof -i:23

jayjwa 09-06-2023 08:36 PM

The configs could be also /etc/xinetd.conf or maybe /etc/inetd.conf if using Inetd.

Quote:

They asked me to turn it off.
What business is it of theirs which services you run? I'd tell them off and stop scanning my machine while they are at it or take my money elsewhere.

frankbell 09-06-2023 08:48 PM

One option might be to block the port in the firewall.

cdunavent 09-07-2023 07:34 AM

I checked the version:

Code:

# cat /etc/*release*
CentOS Linux release 7.9.2009 (Core)
Derived from Red Hat Enterprise Linux 7.9 (Source)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.9.2009 (Core)
CentOS Linux release 7.9.2009 (Core)
cpe:/o:centos:centos:7

Then I checked to see if telnet is disabled:

Code:

# systemctl is-enabled telnet.socket
disabled

So it appears as if telnet is indeed disabled. Is there a way I can scan port 23 myself to verify it is not open?

TB0ne 09-07-2023 07:37 AM

Quote:

Originally Posted by cdunavent (Post 6452243)
I checked the version:

Code:

# cat /etc/*release*
CentOS Linux release 7.9.2009 (Core)
Derived from Red Hat Enterprise Linux 7.9 (Source)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.9.2009 (Core)
CentOS Linux release 7.9.2009 (Core)
cpe:/o:centos:centos:7

Then I checked to see if telnet is disabled:
Code:

# systemctl is-enabled telnet.socket
disabled

So it appears as if telnet is indeed disabled. Is there a way I can scan port 23 myself to verify it is not open?

You can use any network scanning tool to do this, aside from the fact you got other suggestions here on how to check it. You also seem to avoid addressing the issue of *WHY* you're using such an old version of CentOS on a brand-new server in a company environment.


All times are GMT -5. The time now is 09:35 AM.