Problem with firewall rules / SSH

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Goto page 1, 2  Next
Author Message
jauch888888
DD-WRT User


Joined: 23 Apr 2020
Posts: 101

PostPosted: Fri Mar 15, 2024 1:28    Post subject: Problem with firewall rules / SSH Reply with quote
Hi,

I added that to firewall to secure my ssh :
Code:
iptables -I INPUT -p tcp --dport 22 -j DROP
iptables -I INPUT -i br0 -p tcp --dport 443 -m mac --mac-source 2c:xx:xx:xx:bc:xx -j ACCEPT

And when I save that in firewall, I losse my wifi network 5 and 2.4, but only my guest network is still working, do you have an idea?
Thanks, I run last build, march 13th o R7800
Sponsor
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6447
Location: UK, London, just across the river..

PostPosted: Fri Mar 15, 2024 8:31    Post subject: Reply with quote
hmm... it seams I dont have a troubles with the current config on my R7800...so...we need way more details about your current config...on this particular device...

in general once you save those rules firewall will restart rebuild towards the new changes and it will restart/re-execute some services too...what does reboot doing in this case...
there must be something that interferes...
did you replace 2c:xx:xx:xx:bc:xx with your mac address as it was advised or you pasted the rule like that Razz Razz even thou it shouldn't behave like that...

just to question your rules again...what is the overall goal on those...?

fist rule will block ssh port 22 (if its not changed)...bear in mind this rule will, block it only locally as INPUT is used..and it will block in general for every interface...

iptables -I INPUT -p tcp --dport 22 -j DROP

second rule will accept traffic on port tcp 443 on bridge br0 destination again localy
iptables -I INPUT -i br0 -p tcp --dport 443 -m mac --mac-source 2c:xx:xx:xx:bc:xx -j ACCEPT

Tthere must be a something wrong in your config that will cause such a ridicule behaviour... Cool

just for the record...

i do have those 2 in the same order..
iptables -I INPUT -i br0 -p tcp --dport 443 -j REJECT
iptables -I INPUT -i br0 -p tcp --dport 443 -m mac --mac-source AC:4C:21:3E:62:A2 -j ACCEPT
(i do also have those for ssh, but i selected a different port for it 44550, also i do have few bridges so, its all set accordingly)

if you want to stop SSH in general disable it generally form services page...instead of drop rule...but anyway...we dont know details that may be vital if you decide post pic of your firewall config...

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55630 WAP
TP-Link WR1043NDv2 -DD-WRT 55723 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55779 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55819 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55779 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
jauch888888
DD-WRT User


Joined: 23 Apr 2020
Posts: 101

PostPosted: Fri Mar 15, 2024 11:12    Post subject: Reply with quote
HI,

yes I added my own mac address, also, in my firewall config, I have a firewall for my guest network.

What I try to do is to secure my ssh session, like in open wrt, I choose '' only from lan''
jauch888888
DD-WRT User


Joined: 23 Apr 2020
Posts: 101

PostPosted: Fri Mar 15, 2024 11:13    Post subject: Reply with quote
and last one...
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 3005
Location: Germany

PostPosted: Fri Mar 15, 2024 11:52    Post subject: Reply with quote
I don't know what you want with the rules.

the first rule blocks all ssh accesses
the second rule has nothing to do with ssh at all

_________________
Quickstart guides:
use Pi-Hole as simple DNS-Server with DD-WRT
VLAN configuration via GUI - 1 CPU port
VLAN configuration via GUI - 2 CPU ports (R7800, EA8500 etc)

Routers
Marvell OCTEON TX2 - QHora-322 - OpenWrt 23.05.3 - Gateway
Qualcomm IPQ8065 - R7800 - DD-WRT - WAP
jauch888888
DD-WRT User


Joined: 23 Apr 2020
Posts: 101

PostPosted: Fri Mar 15, 2024 12:07    Post subject: Reply with quote
ho1Aetoo wrote:
I don't know what you want with the rules.

the first rule blocks all ssh accesses
the second rule has nothing to do with ssh at all


I try to enable ssh only from one of my device, my pc, and on the lan side.
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 3005
Location: Germany

PostPosted: Fri Mar 15, 2024 12:31    Post subject: Reply with quote
Code:
iptables -I INPUT -p tcp --dport 22 -j DROP
iptables -I INPUT -p tcp --dport 22 -m mac --mac-source xx:xx:xx:xx:xx:xx -j ACCEPT


does not work?

_________________
Quickstart guides:
use Pi-Hole as simple DNS-Server with DD-WRT
VLAN configuration via GUI - 1 CPU port
VLAN configuration via GUI - 2 CPU ports (R7800, EA8500 etc)

Routers
Marvell OCTEON TX2 - QHora-322 - OpenWrt 23.05.3 - Gateway
Qualcomm IPQ8065 - R7800 - DD-WRT - WAP
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6447
Location: UK, London, just across the river..

PostPosted: Fri Mar 15, 2024 12:47    Post subject: Reply with quote
jauch888888 wrote:
HI,

yes I added my own mac address, also, in my firewall config, I have a firewall for my guest network.

What I try to do is to secure my ssh session, like in open wrt, I choose '' only from lan''


In general DDWRT is not like OpenWRT...both very different...

By default DDWRT SSh is not turned on...and when you turn it on from Services tab ..it operates only on LAN side...it does not propagate on WAN at all..if you need it on a WAN side than you go to Administration tab remote administration section and enable it there for WAN access...
as ho1Aetoo noted those should be ok...

iptables -I INPUT -p tcp --dport 22 -j DROP
iptables -I INPUT -p tcp --dport 22 -m mac --mac-source xx:xx:xx:xx:xx:xx -j ACCEPT

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55630 WAP
TP-Link WR1043NDv2 -DD-WRT 55723 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55779 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55819 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55779 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
bushant
DD-WRT Guru


Joined: 18 Nov 2015
Posts: 2037

PostPosted: Fri Mar 15, 2024 14:04    Post subject: Reply with quote
Seems to me this setting is at odds with your goal:


_________________
Forum Guide Lines (with helpful pointers about how to research your router, where and what firmware to download, where and how to post and many other helpful tips!)
How to get help the right way

Before asking for help - Read the forum guidelines AND Upgrade DD-WRT!
Adblock by eibgrad (1.1M blocked) + Blocklist Collection

jauch888888
DD-WRT User


Joined: 23 Apr 2020
Posts: 101

PostPosted: Fri Mar 15, 2024 14:14    Post subject: Reply with quote
bushant wrote:
Seems to me this setting is at odds with your goal:



Yep, I disabled web ui just for that time.
jauch888888
DD-WRT User


Joined: 23 Apr 2020
Posts: 101

PostPosted: Fri Mar 15, 2024 14:16    Post subject: Reply with quote
ho1Aetoo wrote:
I don't know what you want with the rules.

the first rule blocks all ssh accesses
the second rule has nothing to do with ssh at all


You said those lines have nothing to do but on the other post below you say that are supposed to work? Maybe I did not understand?
Thanks
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 3005
Location: Germany

PostPosted: Fri Mar 15, 2024 14:18    Post subject: Reply with quote
Open your eyes!
i posted a different rule!!!

_________________
Quickstart guides:
use Pi-Hole as simple DNS-Server with DD-WRT
VLAN configuration via GUI - 1 CPU port
VLAN configuration via GUI - 2 CPU ports (R7800, EA8500 etc)

Routers
Marvell OCTEON TX2 - QHora-322 - OpenWrt 23.05.3 - Gateway
Qualcomm IPQ8065 - R7800 - DD-WRT - WAP
bushant
DD-WRT Guru


Joined: 18 Nov 2015
Posts: 2037

PostPosted: Fri Mar 15, 2024 14:21    Post subject: Reply with quote
jauch888888 wrote:
I try to enable ssh only from one of my device, my pc, and on the lan side.


You have stated this but allow remote access?

_________________
Forum Guide Lines (with helpful pointers about how to research your router, where and what firmware to download, where and how to post and many other helpful tips!)
How to get help the right way

Before asking for help - Read the forum guidelines AND Upgrade DD-WRT!
Adblock by eibgrad (1.1M blocked) + Blocklist Collection

jauch888888
DD-WRT User


Joined: 23 Apr 2020
Posts: 101

PostPosted: Fri Mar 15, 2024 14:51    Post subject: Reply with quote
ho1Aetoo wrote:
Open your eyes!
i posted a different rule!!!


you are right, I've read too fast.
jauch888888
DD-WRT User


Joined: 23 Apr 2020
Posts: 101

PostPosted: Fri Mar 15, 2024 15:05    Post subject: Reply with quote
ho1Aetoo wrote:
Code:
iptables -I INPUT -p tcp --dport 22 -j DROP
iptables -I INPUT -p tcp --dport 22 -m mac --mac-source xx:xx:xx:xx:xx:xx -j ACCEPT


does not work?


nope, still loosing my wifi network when I add it
Goto page 1, 2  Next Display posts from previous:    Page 1 of 2
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum