LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 09-06-2023, 02:14 PM   #1
cdunavent
LQ Newbie
 
Registered: Sep 2023
Posts: 3

Rep: Reputation: 0
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.
 
Old 09-06-2023, 03:46 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,710

Rep: Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972
Quote:
Originally Posted by cdunavent View Post
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.
 
Old 09-06-2023, 06:51 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,760

Rep: Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931
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
 
Old 09-06-2023, 08:36 PM   #4
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 794

Rep: Reputation: 253Reputation: 253Reputation: 253
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.
 
Old 09-06-2023, 08:48 PM   #5
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,360
Blog Entries: 28

Rep: Reputation: 6148Reputation: 6148Reputation: 6148Reputation: 6148Reputation: 6148Reputation: 6148Reputation: 6148Reputation: 6148Reputation: 6148Reputation: 6148Reputation: 6148
One option might be to block the port in the firewall.
 
Old 09-07-2023, 07:34 AM   #6
cdunavent
LQ Newbie
 
Registered: Sep 2023
Posts: 3

Original Poster
Rep: Reputation: 0
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?
 
Old 09-07-2023, 07:37 AM   #7
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,710

Rep: Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972
Quote:
Originally Posted by cdunavent View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Redirect port 443 requests to port 3000 on hostmonster (Centos 6.8) for Node Express Application listening on port 3000 brentw Linux - Server 8 12-20-2016 11:38 AM
How to disable particular port on centos SinclairJ Linux - Newbie 10 10-05-2012 12:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 04:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration