Re: To disable the internet and allow only SSH connection to this server running Red Hat Enterprise Linux release 8.9 (Ootpa)

Matty Sarro <[email protected]> Fri, 8 Mar 2024 07:43:40 -0500
Newsgroups gmane.linux.redhat.general
Message-ID <CAHUGJcHYbddp+F2MxyKeo2=w3nZYopc=jCq-uwkK510iMURd+Q@mail.gmail.com>
--0000000000005676600613258b38
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

firewall-cmd --permanent --direct --add-rule ipv4 filter OUTPUT 1 -p tcp -m
tcp --dport=3D80 -j REJECT

firewall-cmd --permanent --direct --add-rule ipv4 filter OUTPUT 1 -p tcp -m
tcp --dport=3D443 -j REJECT

That should block the ports most commonly used for HTTP.

On Fri, Mar 8, 2024, 7:18=E2=80=AFAM Kaushal Shriyan <kaushalshriyan@gmail.=
com>
wrote:

> Hi,
>
> I am running Red Hat Enterprise Linux release 8.9 (Ootpa). Is there a way
> to disable the internet and allow only SSH connection to this server? I
> have followed the below steps to disable internet access and allow only S=
SH
> connections to the remote server.
>
> #systemctl stop NetworkManager
> #systemctl disable NetworkManager
>
> #vim /etc/sysconfig/network-scripts/ifcfg-enp1s0
>
> TYPE=3DEthernet
> PROXY_METHOD=3Dnone
> BROWSER_ONLY=3Dno
> BOOTPROTO=3Dnone
> DEFROUTE=3Dyes
> IPV4_FAILURE_FATAL=3Dyes
> IPV6INIT=3Dyes
> IPV6_AUTOCONF=3Dyes
> IPV6_DEFROUTE=3Dyes
> IPV6_FAILURE_FATAL=3Dno
> IPV6_ADDR_GEN_MODE=3Deui64
> NAME=3Denp1s0
> UUID=3D86cea6e1-ec03-49e7-9d6d-1d1b9d094cdc
> DEVICE=3Denp1s0
> ONBOOT=3Dyes
> IPADDR=3D192.168.0.114
> PREFIX=3D24
> GATEWAY=3D192.168.0.10
> DNS1=3D8.8.8.8
> DNS2=3D8.8.4.4
> ZONE=3Ddrop
>
> # systemctl restart network
> Failed to restart network.service: Unit network.service not found.
> #
>
> #firewall-cmd --permanent --zone=3Dpublic --add-service=3Dssh
> #firewall-cmd --permanent --zone=3Dpublic --remove-service=3Ddhcpv6-clien=
t
> #firewall-cmd --reload
>
> #vim /etc/sysctl.conf
> net.ipv6.conf.all.disable_ipv6 =3D 1
> net.ipv6.conf.default.disable_ipv6 =3D 1
>
> #sysctl -p
>
> ssh [email protected]
>
> ping google.com
>
>
> I am still able to reach out to google.com
>
> # ping google.com
> PING google.com (142.250.193.142) 56(84) bytes of data.
> 64 bytes from maa05s25-in-f14.1e100.net (142.250.193.142): icmp_seq=3D1
> ttl=3D57 time=3D10.5 ms
> 64 bytes from maa05s25-in-f14.1e100.net (142.250.193.142): icmp_seq=3D2
> ttl=3D57 time=3D10.1 ms
> 64 bytes from maa05s25-in-f14.1e100.net (142.250.193.142): icmp_seq=3D3
> ttl=3D57 time=3D10.7 ms
> ^C
> --- google.com ping statistics ---
> 3 packets transmitted, 3 received, 0% packet loss, time 2003ms
> rtt min/avg/max/mdev =3D 10.147/10.452/10.701/0.258 ms
>
> Please guide me. Thanks in advance.
>
> Best Regards,
>
> Kaushal
>
> --
> You received this message because you are subscribed to the Google Groups=
 "
> [email protected]" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
>

--=20
You received this message because you are subscribed to the Google Groups "=
[email protected]" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to [email protected].

--0000000000005676600613258b38
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">firewall-cmd --permanent --direct --add-rule ipv4 filter =
OUTPUT 1 -p tcp -m tcp --dport=3D80 -j REJECT<div dir=3D"auto"><br></div><d=
iv dir=3D"auto">firewall-cmd --permanent --direct --add-rule ipv4 filter OU=
TPUT 1 -p tcp -m tcp --dport=3D443 -j REJECT</div><div dir=3D"auto"><br></d=
iv><div dir=3D"auto">That should block the ports most commonly used for HTT=
P.</div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmai=
l_attr">On Fri, Mar 8, 2024, 7:18=E2=80=AFAM Kaushal Shriyan &lt;<a href=3D=
"mailto:[email protected]">[email protected]</a>&gt; wrote:<b=
r></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border=
-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Hi,<br><div><br></d=
iv><div>I am running Red Hat Enterprise Linux release 8.9 (Ootpa). Is there=
 a way to disable the internet and allow only=C2=A0SSH connection to this s=
erver? I have followed the below steps to disable internet access and allow=
 only SSH connections to the remote server.</div><div><br>#systemctl stop N=
etworkManager<br>#systemctl disable NetworkManager<br><br>#vim /etc/sysconf=
ig/network-scripts/ifcfg-enp1s0<br><br>TYPE=3DEthernet<br>PROXY_METHOD=3Dno=
ne<br>BROWSER_ONLY=3Dno<br>BOOTPROTO=3Dnone<br>DEFROUTE=3Dyes<br>IPV4_FAILU=
RE_FATAL=3Dyes<br>IPV6INIT=3Dyes<br>IPV6_AUTOCONF=3Dyes<br>IPV6_DEFROUTE=3D=
yes<br>IPV6_FAILURE_FATAL=3Dno<br>IPV6_ADDR_GEN_MODE=3Deui64<br>NAME=3Denp1=
s0<br>UUID=3D86cea6e1-ec03-49e7-9d6d-1d1b9d094cdc<br>DEVICE=3Denp1s0<br>ONB=
OOT=3Dyes<br>IPADDR=3D192.168.0.114<br>PREFIX=3D24<br>GATEWAY=3D192.168.0.1=
0<br>DNS1=3D8.8.8.8<br>DNS2=3D8.8.4.4<br>ZONE=3Ddrop<br><br># systemctl res=
tart network<br>Failed to restart network.service: Unit network.service not=
 found.<br>#<br><br>#firewall-cmd --permanent --zone=3Dpublic --add-service=
=3Dssh<br>#firewall-cmd --permanent --zone=3Dpublic --remove-service=3Ddhcp=
v6-client<br>#firewall-cmd --reload<br><br>#vim /etc/sysctl.conf<br>net.ipv=
6.conf.all.disable_ipv6 =3D 1<br>net.ipv6.conf.default.disable_ipv6 =3D 1<b=
r><br>#sysctl -p<br><br>ssh <a href=3D"mailto:[email protected]" target=3D=
"_blank" rel=3D"noreferrer">[email protected]</a><br><br>ping <a href=3D"h=
ttp://google.com" target=3D"_blank" rel=3D"noreferrer">google.com</a><br><b=
r><br>I am still able to reach out to <a href=3D"http://google.com" target=
=3D"_blank" rel=3D"noreferrer">google.com</a><br><br># ping <a href=3D"http=
://google.com" target=3D"_blank" rel=3D"noreferrer">google.com</a><br>PING =
<a href=3D"http://google.com" target=3D"_blank" rel=3D"noreferrer">google.c=
om</a> (142.250.193.142) 56(84) bytes of data.<br>64 bytes from <a href=3D"=
http://maa05s25-in-f14.1e100.net" target=3D"_blank" rel=3D"noreferrer">maa0=
5s25-in-f14.1e100.net</a> (142.250.193.142): icmp_seq=3D1 ttl=3D57 time=3D1=
0.5 ms<br>64 bytes from <a href=3D"http://maa05s25-in-f14.1e100.net" target=
=3D"_blank" rel=3D"noreferrer">maa05s25-in-f14.1e100.net</a> (142.250.193.1=
42): icmp_seq=3D2 ttl=3D57 time=3D10.1 ms<br>64 bytes from <a href=3D"http:=
//maa05s25-in-f14.1e100.net" target=3D"_blank" rel=3D"noreferrer">maa05s25-=
in-f14.1e100.net</a> (142.250.193.142): icmp_seq=3D3 ttl=3D57 time=3D10.7 m=
s<br>^C<br>--- <a href=3D"http://google.com" target=3D"_blank" rel=3D"noref=
errer">google.com</a> ping statistics ---<br>3 packets transmitted, 3 recei=
ved, 0% packet loss, time 2003ms<br>rtt min/avg/max/mdev =3D 10.147/10.452/=
10.701/0.258 ms<br><br>Please guide me. Thanks in advance.=C2=A0<br><br>Bes=
t Regards,<br><br>Kaushal<br></div></div>

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;<a href=3D"mailto:[email protected]" target=3D"_blank" rel=3D"nor=
eferrer">[email protected]</a>&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]" target=3D"_bl=
ank" rel=3D"noreferrer">[email protected]</a>.<br>
</blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;[email protected]&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">redhat-list+u=
[email protected]</a>.<br />

--0000000000005676600613258b38--