<div>This comment made me smile:</div><div>"Ports numbered 64000 (an arbitrary number which might be varied as aresult of experience) or above will not be blocked because, as far as
On 4/08/2024 12:26 pm, George at Clug wrote:
If I go to the local coffee shop and connect my laptop to their WiFi,
which incoming and now outgoing ports should I have blocked to ensure
that no nefarious people are able to communicate with my laptop
The rules for public networks are very simple.
- Allow all outgoing traffic
On 8/4/24 06:48, jeremy ardley wrote:
On 4/08/2024 12:26 pm, George at Clug wrote:
If I go to the local coffee shop and connect my laptop to their WiFi,
which incoming and now outgoing ports should I have blocked to ensure
that no nefarious people are able to communicate with my laptop
The rules for public networks are very simple.
- Allow all outgoing traffic
On a laptop, inbound connections should be restricted unless you want services to be accessible on your laptop by way of FWing and and
securing the services.
Outbound connections is up to you.
--
John Doe
On Sun, Aug 4, 2024 at 3:12 AM George at Clug <Clug@goproject.info> wrote:
On Sunday, 04-08-2024 at 16:15 john doe wrote:
On 8/4/24 06:48, jeremy ardley wrote:
On 4/08/2024 12:26 pm, George at Clug wrote:
If I go to the local coffee shop and connect my laptop to their WiFi, >> which incoming and now outgoing ports should I have blocked to ensure >> that no nefarious people are able to communicate with my laptop
The rules for public networks are very simple.
- Allow all outgoing traffic
On a laptop, inbound connections should be restricted unless you want services to be accessible on your laptop by way of FWing and and
securing the services.
Outbound connections is up to you.
Thanks, John,
I do like the idea of blocking all outbound connections, and only opening ports that are required for whatever services I want to use.
For servers I often do, but for workstations, sadly I am often lazy and default to allowing all outgoing traffic.
When asked to explain why I want to block outgoing connections, I do find it difficult to justify but here are a few thoughts:
1) I like the principle of making this as hard as possible for the 'bad' guys. If they break in, they might as well not have it easy. As analogy, I can have a gate at the front of my house, then I have a dead locked door (not just a lock from the outside). then if I had valuables, they would be in a steel safe, and the safe would be bolted to the concrete floor. All of this will not stop the determined, but why let it be easy.
2) Staying with analogies, I like having double locked doors. If someone breaks in through the window, they have to exit the same way, and not just walk out through the front/back door, making it bit more difficult to carry everything out. In IT terms, is someone has gained access to my server via a service level exploit, they (hopefully) only have that service's level of access. If the local network is blocked, port scanning is going to be more challenging, as would a number of other network based attacks.
3) I believe a number of exploits, once gain a small footprint, then
create a listening service to allow remote access to the system. If this cannot be achieved, then again, I have made their lives harder.
The main challenge as I see it is to ensure no 'bad' guys gain root
access, but as above, until then, make their lives hard as possible to do anything by limiting and locking down anything you can while still allowing the system achieve its intended purpose.
Any comments on the above thoughts?
George.
Outbound ports are selected randomly. If you block outbound ports, you'll block your ability to communicate with anything over the network. If you
want to "block outbound stuff" block all outbound connections to any destination, then allow outbound connections to address ranges you want to connect to, from any local port.
You'll find this is an exercise in frustration, however, in today's cloud powered Internet.
It's best to follow Jeremy Ardley's advice.
--
Chris
"If you wish to make an apple pie from scratch, you must first invent the Universe." -- Carl Sagan
I do like the idea of blocking all outbound connections, and only
opening ports that are required for whatever services I want to use.
For servers I often do, but for workstations, sadly I am often lazy and default to allowing all outgoing traffic.
On 2024-08-04, George at Clug wrote:
I think I finally have success (had to fix way too many typos).
Please review, and please comment if it can be improved.
Don't fix typo and instead rewrite your rules with nftables https://wiki.nftables.org/wiki-nftables/index.php/Moving_from_iptables_to_nftables
It's so much easier and cleaner with nftables :)
Down below is the output of the translation commands for my Iptables commands. Interesting but again, I will need to learn what this means,
it does not look self explanatory. But hopefully, like everything
computer related, it is usually not that complex, just you need to
understand the new syntax and how to use it.
I am also a bit concerned about the statement "table ip nat", I do not
want [e.g. need] any Network Address Translation occurring.
table ip filter {
chain INPUT {
type filter hook input priority filter; policy drop;
iifname "lo" counter packets 0 bytes 0 accept
iifname "enp1s0" ct state established,related counter packets 243 bytes 27964 accept
iifname "enp1s0" ct state new tcp dport 22 counter packets 0 bytes 0 accept
iifname "enp1s0" ct state new tcp dport 25565 counter packets 0 bytes 0 accept
iifname "enp1s0" ct state new tcp dport 8123 counter packets 0 bytes 0 accept
}
chain OUTPUT {
type filter hook output priority filter; policy drop;
oifname "lo" counter packets 0 bytes 0 accept
oifname "enp1s0" ct state established,related counter packets 189 bytes 33916 accept
oifname "enp1s0" ct state new udp dport 53 counter packets 16 bytes 984 accept
oifname "enp1s0" ct state new tcp dport { 22, 53, 80, 123, 443 } counter packets 9 bytes 540 accept
}
On Monday, 05-08-2024 at 17:25 Michel Verdier wrote:complex, just you need to understand the new syntax and how to use it.
On 2024-08-04, George at Clug wrote:
I think I finally have success (had to fix way too many typos).
Please review, and please comment if it can be improved.
Don't fix typo and instead rewrite your rules with nftables
https://wiki.nftables.org/wiki-nftables/index.php/Moving_from_iptables_to_nftables
It's so much easier and cleaner with nftables :)
Thanks for the link, Michel, it had an interesting translation commands which I put to good use.
There will be some new learning if I am going to be able to do as it suggests, "implement new nftables mechanisms such as sets, maps, verdict maps, concatenations and more".
Down below is the output of the translation commands for my Iptables commands. Interesting but again, I will need to learn what this means, it does not look self explanatory. But hopefully, like everything computer related, it is usually not that
On Sunday, 04-08-2024 at 16:15 john doe wrote:
On 8/4/24 06:48, jeremy ardley wrote:
On 4/08/2024 12:26 pm, George at Clug wrote:
If I go to the local coffee shop and connect my laptop to their WiFi,
which incoming and now outgoing ports should I have blocked to ensure
that no nefarious people are able to communicate with my laptop
The rules for public networks are very simple.
- Allow all outgoing traffic
On a laptop, inbound connections should be restricted unless you want services to be accessible on your laptop by way of FWing and and
securing the services.
Outbound connections is up to you.
Thanks, John,
I do like the idea of blocking all outbound connections, and only
opening ports that are required for whatever services I want to use.
For servers I often do, but for workstations, sadly I am often lazy
and default to allowing all outgoing traffic.
On Aug 04, 2024, George at Clug wrote:
On Sunday, 04-08-2024 at 16:15 john doe wrote:
On 8/4/24 06:48, jeremy ardley wrote:
On 4/08/2024 12:26 pm, George at Clug wrote:
If I go to the local coffee shop and connect my laptop to their WiFi, >> which incoming and now outgoing ports should I have blocked to ensure >> that no nefarious people are able to communicate with my laptop
The rules for public networks are very simple.
- Allow all outgoing traffic
On a laptop, inbound connections should be restricted unless you want services to be accessible on your laptop by way of FWing and and
securing the services.
Outbound connections is up to you.
Thanks, John,
I do like the idea of blocking all outbound connections, and only
opening ports that are required for whatever services I want to use.
For servers I often do, but for workstations, sadly I am often lazy
and default to allowing all outgoing traffic.
It's perfectly fine for a server or other installation that's setup to
do "one thing" -- but the idea just falls over when you want to do
"generic things" on the machine.
There's just too much out there that's running behind AWS / Cloudflare /
etc. that you can't just block them; likewise, new protocols and the
like (which, yes, are focused to "the web", but details) will just fail
if you only allow certain ports to be reached.
As for the (snipped) analogies you made -- they more addressed the ideas
of 'security in depth' as a general concept, rather than addressed
"outbound firewalls" at all.
--
|_|O|_|
|_|_|O| Github: https://github.com/dpurgert
|O|O|O| PGP: DDAB 23FB 19FA 7D85 1CC1 E067 6D65 70E5 4CE7 2860
On 8/5/24 12:50, George at Clug wrote:
complex, just you need to understand the new syntax and how to use it.On Monday, 05-08-2024 at 17:25 Michel Verdier wrote:
On 2024-08-04, George at Clug wrote:
I think I finally have success (had to fix way too many typos).
Please review, and please comment if it can be improved.
Don't fix typo and instead rewrite your rules with nftables
https://wiki.nftables.org/wiki-nftables/index.php/Moving_from_iptables_to_nftables
It's so much easier and cleaner with nftables :)
Thanks for the link, Michel, it had an interesting translation commands which I put to good use.
There will be some new learning if I am going to be able to do as it suggests, "implement new nftables mechanisms such as sets, maps, verdict maps, concatenations and more".
Down below is the output of the translation commands for my Iptables commands. Interesting but again, I will need to learn what this means, it does not look self explanatory. But hopefully, like everything computer related, it is usually not that
YOu realy need to be intimate with nftables, you might want to consider
a frontend to nftables.
--
John Doe
On 2024-08-05, George at Clug wrote:
Down below is the output of the translation commands for my Iptables commands. Interesting but again, I will need to learn what this means,
it does not look self explanatory. But hopefully, like everything
computer related, it is usually not that complex, just you need to understand the new syntax and how to use it.
I am also a bit concerned about the statement "table ip nat", I do not
want [e.g. need] any Network Address Translation occurring.
Simply remove table ip nat and table ip mangle as they are empty and you don't use them.
table ip filter {
chain INPUT {
type filter hook input priority filter; policy drop;
iifname "lo" counter packets 0 bytes 0 accept
iifname "enp1s0" ct state established,related counter packets 243 bytes 27964 accept
iifname "enp1s0" ct state new tcp dport 22 counter packets 0 bytes 0 accept
iifname "enp1s0" ct state new tcp dport 25565 counter packets 0 bytes 0 accept
iifname "enp1s0" ct state new tcp dport 8123 counter packets 0 bytes 0 accept
}
Remove "packets nnn bytes nnn", syntax is:
iifname lo counter accept
The action "counter" will count packets matching the rule. If you do the shell command:
nft list ruleset
the line will be listed with the packets and bytes counters.
Also you don't need to test iifname "enp1s0" if you don't have multiple interfaces or don't want to differenciate them.
Only loopback (lo) is to be tested.
chain OUTPUT {
type filter hook output priority filter; policy drop;
oifname "lo" counter packets 0 bytes 0 accept
oifname "enp1s0" ct state established,related counter packets 189 bytes 33916 accept
oifname "enp1s0" ct state new udp dport 53 counter packets 16 bytes 984 accept
oifname "enp1s0" ct state new tcp dport { 22, 53, 80, 123, 443 } counter packets 9 bytes 540 accept
}
Same as for input don't test oifname "enp1s0" if not needed.
So you drop packets not accepted. Here for workstation I add a last rule
like this one:
log level warn prefix "[FW accept output] " counter accept
This will log a warning but still accept the packet out.
It would be nice if systems were not so complex that they required
frontends to be usable.
I am feeling a little overwhelmed by how confusing nftables is, but
that is how I felt about iptables before getting to a point I could
set up a simple set of rules.
On Tue, 06 Aug 2024 01:12:08 +1000
George at Clug <Clug@goproject.info> wrote:
It would be nice if systems were not so complex that they required frontends to be usable.
Perhaps it would be nice. But that's not the way of the world. I wrote
6502 assembly code and hand-assembled it way back when. I was very glad
to get my hands on an assembler and a computer with enough ram to run
it. Hiding complexity is a good thing.
I am feeling a little overwhelmed by how confusing nftables is, but
that is how I felt about iptables before getting to a point I could
set up a simple set of rules.
I'm lazy. I use a front end precisely so I don't have to learn nftables
in all its complexity. I suggest you look at firewalld and its two
front ends, firewalld-config (GUI) and firewall-cmd (command line). As
an extra added bonus, it integrates nicely with Network Manager.
--
Does anybody read signatures any more?
https://charlescurley.com
https://charlescurley.com/blog/
This morning, after thinking on these things I realise I am wrong.
I am showing both my ignorance and my stupidity.
"Times have changed", "That was then, this is now".
While I find it difficult to let go, I do need to learn to use
firewalld and make use of firewall-cmd, you are correct.
On Aug 04, 2024, George at Clug wrote:
On Sunday, 04-08-2024 at 16:15 john doe wrote:
On 8/4/24 06:48, jeremy ardley wrote:
On 4/08/2024 12:26 pm, George at Clug wrote:
If I go to the local coffee shop and connect my laptop to their WiFi, >> which incoming and now outgoing ports should I have blocked to ensure >> that no nefarious people are able to communicate with my laptop
The rules for public networks are very simple.
- Allow all outgoing traffic
On a laptop, inbound connections should be restricted unless you want services to be accessible on your laptop by way of FWing and and
securing the services.
Outbound connections is up to you.
Thanks, John,
I do like the idea of blocking all outbound connections, and only
opening ports that are required for whatever services I want to use.
For servers I often do, but for workstations, sadly I am often lazy
and default to allowing all outgoing traffic.
It's perfectly fine for a server or other installation that's setup to
do "one thing" -- but the idea just falls over when you want to do
"generic things" on the machine.
There's just too much out there that's running behind AWS / Cloudflare /
etc. that you can't just block them; likewise, new protocols and the
like (which, yes, are focused to "the web", but details) will just fail
if you only allow certain ports to be reached.
As for the (snipped) analogies you made -- they more addressed the ideas
of 'security in depth' as a general concept, rather than addressed
"outbound firewalls" at all.
--
|_|O|_|
|_|_|O| Github: https://github.com/dpurgert
|O|O|O| PGP: DDAB 23FB 19FA 7D85 1CC1 E067 6D65 70E5 4CE7 2860
To disable port forwarding would this be a better method?
# echo 0 > /proc/sys/net/ipv4/ip_forward
# cat /etc/sysctl.conf
# Uncomment the next line to enable packet forwarding for IPv4 #net.ipv4.ip_forward=1
# Uncomment the next line to enable packet forwarding for IPv6
# Enabling this option disables Stateless Address Autoconfiguration
# based on Router Advertisements for this host #net.ipv6.conf.all.forwarding=1
On Monday, 05-08-2024 at 22:25 john doe wrote:
On 8/5/24 12:50, George at Clug wrote:
On Monday, 05-08-2024 at 17:25 Michel Verdier wrote:
On 2024-08-04, George at Clug wrote:
YOu realy need to be intimate with nftables, you might want to consider
a frontend to nftables.
It is hard to give up on iptables, but you are correct, in both your points. Thank you.
(I do recall being taught programming using machine code, once I
reached an environment that used assembler, I only used machine code
for debugging. At that time I was also introduced to programming
using BASIC via punch cards. I am not going to give up using IDEs and
go back to those days, so I should apply the same logic to firewalld)
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (1 / 15) |
Uptime: | 159:51:19 |
Calls: | 10,385 |
Calls today: | 2 |
Files: | 14,056 |
Messages: | 6,416,491 |