date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,614,612,997,000 |
I am using a Ubuntu machine as a NAT router. How can I find out the following:
the ports on which the LAN machines are listening or communicating (both tcp and udp);
which local machines have established connections with which WAN ip's on those ports;
and the size of data that has been transfered on those ports.
|
I think you want to try netstat-nat I seem to remember using it when I had a Slackware box set up as a NAT-server.
| Port monitoring on GNU/Linux based NAT router |
1,614,612,997,000 |
I'm just beginning to dig into iptables for the first time today, so apologies for any naivete.
For reference, I'm using
Ubuntu 22.04.4 LTS (Jammy Jellyfish)
iptables v1.8.7 (nf_tables)
ufw 0.36.1
Now, I know (or, rather, recently learned) that ufw is just a wrapper for iptables. I decided I wanted to understand wha... |
So, what am I missing, here?
The -v option for verbose:
-v, --verbose
Verbose output. This option makes the list command show the
interface name, the rule options (if any), and the TOS masks. The
packet and byte counters are also listed, [...]
You probably used something like:
# iptables -L ufw-before-input
Chai... | Tracing iptables Rules |
1,614,612,997,000 |
Flowtables is an nftables feature for offloading traffic to a "fast path" that skips the typical forwarding path once a connection is established. Two things need to be configured to set up flowtables. First is the flowtable itself, which is defined as part of a table. Second is a flow offload statement, and this is w... |
There are a few key sentences that I first want to point out from the wiki:
You can select which flows you want to offload through the flow
expression from the forward chain.
Flows are offloaded after the state is created. That means that
usually the first reply packet will create the flowtable entry. A
firewall ru... | How should `flow offload` statements be configured when using flowtables? |
1,614,612,997,000 |
Is there anything I could I execute from a linux command line from 2 different linux clients, in 2 different locations, that may show the presence of absence of an ERR_CONNECTION_RESET message (or similar) in the output of the connection attempt? I'd like to know if there's a way I can do this when attempting the conn... |
The curl command will have an exit code of 56 when a connection reset by peer happens:
56 Failure in receiving network data.
curl http://someurl/
$ curl http://192.0.2.2:8080/
unfinished data...
curl: (56) Recv failure: Connection reset by peer
$ echo $?
56
There's no guarantee (from the documentation) that 56 is ... | Is there something I can execute via the CLI, to show the presence or absence of an ERR_CONNECTION_RESET when attempting connection to a domain/URI? |
1,614,612,997,000 |
I'd like to take a default drop approach to my firewall rules. I've created some rules for testing purposes:
table bridge vmbrfilter {
chain forward {
type filter hook forward priority -100; policy drop;
ip saddr 192.168.1.10 ip daddr 192.168.1.1 accept;
ip saddr 192.168.1.1 ip daddr 192.16... |
IPv4 over Ethernet relies on ARP to resolve the Ethernet MAC address of the peer in order to send later unicast packets to it.
As you're filtering any ARP request since there's no exception for it, those requests can't succeed and after a typical 3s timeout you'll get the standard "No route to host". There won't be an... | Nftables default drop chain problem |
1,614,612,997,000 |
I am using iptables recent module:
-A INPUT -m recent --rsource --name PORTSCAN --set -j DROP
The above line adds offending IP addresses to /proc/net/xt_recent/PORTSCAN.
Now I am looking for a way how to periodically (cron job) check this list, and remove entries that are older than n hours.
I am using the option xt_... |
It looks like --reap is what you are looking for, from iptables-extensions man page, section about recent:
--reap
This option can only be used in conjunction with --seconds. When used, this will cause entries older than the last given number of seconds to be purged.
As of how it works, here is the relevant source co... | iptables recent module: remove entries older than |
1,614,612,997,000 |
I'm running Gentoo Linux, so using plain iptbales to manage my firewall and networking.
I usually use wan0 for all my traffic, but since I have already a web-server behind that i would like wan1 (bind to another domain) for my second web-server.
I have three interfaces:
eth0 = LAN
wan0 = Primary used WAN (default gat... |
As the answer is tied to the configuration, I make some assumptions. You'll have to adapt the answer to fit the actual configuration.
wan1's LAN and gateway for wan1 arbitrarily chosen as 84.114.7.0/24 and 84.114.7.254.
no consideration of firewall rules made, but all this shouldn't interact with them.
On Linux ip... | iptables: MultiWAN and portforwarding & port redirection |
1,614,612,997,000 |
I recently started using iptables and i found that when running the wine command winecfg it freezes until i disable the iptables service. I also saw that applications like tshark freeze when ran. How can i fix this? Am i missing something?
Here are my current rules:
[Screenshot][1]:https://i.postimg.cc/xT1BwHY8/Scree... |
Solved it by adding the following rule to my iptables:
-A INPUT -p all -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT
| Iptables hangs winecfg |
1,614,612,997,000 |
On my CentOS I have firewalld running and my eth0 is in default zone. I use dockers for my services to communicate and in dockers I have enabled encryption. Docker creates an overlay network and uses IPSEC. But firewalld drops IPSEC connection. I found a link which has about 5-6 commands for IPSEC to work and if I pla... |
The masquerade rule tells the system to enable nat on outgoing connections, which is typical of networks using private internal addressing. It's a routing rule not technically related to ipsec specifically.
The port 4500 is used for ipsec nat traversal when one or both sides are behind other routers and don't have th... | enabling ipsec, ah and esp on CentOS with firewalld in place |
1,614,612,997,000 |
My workplace has several security policies that run counter to how I would usually set up my laptop. In particular, when connected to the network at work, we are forbidden from having an ssh daemon accepting connections. This generally leads to me getting in trouble at work (when I forget to shut down the sshd) or bei... |
If you are using the standard dhclient configuration of CentOS 6 then after DHCP has completed it will run a series of "post" scripts.
Of use, here, is the /etc/dhcp/dhclient.d directory. These scripts will be run after the IP address has been obtained.
It would be pretty simple to add a script in here that would loo... | Changing network settings depending on SSID |
1,614,612,997,000 |
I have a Fedora 24 server, serving an Angular2 project. Angular2 automatically opens ports 3000 and 3001 once the service is started. However, although running nmap localhost shows the ports are open, when I run an nmap from a remote computer, these ports are showing as closed.
Is there an iptables setting I can use t... |
In the end the solution was to run the following command:
firewall-cmd --zone=FedoraServer --add-port=3000/tcp
Seems that on Fedora 24, or the Fedora 24 as set up on linodes perhaps, iptables doesn't have a TCP entry.
| Fedora 24: ports show as open when scanned from server, but closed when nmapped from outside |
1,614,612,997,000 |
I just setup postfix but I just realized my ISP outgoing blocks port 25 (SMTP). How do I send email outside? I can see my mail queue is filling up. Any suggestion?
|
If your ISP is blocking outbound port 25, you've probably made a bad choice in the location of your mailserver. Because port 25 is blocked, I am assuming you have a machine inside your home/office, vs using a server.
I would highly recommend that you take what you've learned from setting up postfix and install it on ... | outgoing SMTP 25 port blocked by ISP? |
1,614,612,997,000 |
I need to block one incoming port with pf. I'm new to pf, and I can't figure out what I'm doing wrong here.
Here is my entire rule file, made to block incoming port 22:
set block-policy drop
pass in all keep state
pass out all keep state
block in proto tcp to port 22
After I start pf with sudo /sbin/pfctl -e -f /path... |
block all
pass in on fxp0 proto tcp from any to any port 22 flags S/SA
pass out on fxp0 proto tcp from any to any port 22 flags S/SA
Please consider you have to change fxp0 to your ethernet according to your operating OS.
Reverse of above:
pass in on fxp0 proto tcp from any to any port < 22 flags S/SA
pass out on fxp... | pf blocks all in/out traffic instead of just the one port I wanted to block |
1,392,509,316,000 |
I was recently delving into thoughts of building a small home server to run random things off of (maybe a TF2 server). Thinking about this further I realized I would need to get a better firewall system for my current home network. I was wondering what would be a good Linux distro to run for a home network firewall?... |
The distro called ipcop exists since 2007 and is designed exactly for your purpose.
http://distrowatch.com/table.php?distribution=ipcop
I think there are many reasons strongly in favor of ipcop that put it ahead of the bunch:
Designed for your purpose
Long history + high ranking in google search "linux firewall distr... | Linux Home Firewall |
1,392,509,316,000 |
I'm a long time fan of Slackware and I've always had a machine serving as my main server/firewall with the latest version installed.
I have it now but I'm struggling to find information on how to setup UPnP on it.
Can anyone please provide some good links where I can investigate further?
|
I think you are looking for linux-igd.
This project is a deamon that emulates
Microsoft's Internet Connection
Service (ICS). It implements the UPnP
Internet Gateway Device specification
(IGD) and allows UPnP aware clients,
such as MSN Messenger to work properly
from behind a NAT firewall.
This works fine with iptabl... | How would I go about getting UPnP working on a Slackware server/firewall? |
1,392,509,316,000 |
I have HPC that I want people to use it remotely without giving them access to other computers in the private network. Other computers are operating on network. I am using port forwarding.
sudo firewall-cmd --zone=public --add-source=192.34.1.145 --runtime-to-permanent
Where 192.34.1.145 is the particular remote IP. ... |
This doesn't exactly answer your question, however, one of the easiest ways to do this is by using two routers to put the computer you want to access from the Internet on a physically separated network from your other computers. A decent router will allow you to specify the source IP address and port forward to an int... | How to safely allow particular remote IP access to particular servers on private network? |
1,392,509,316,000 |
I have a server running Debian 8 Jessie that constantly loses it's internet access for seemingly no reason. The server has two wired connections, the internet access is on eth0 and the internal network is on eth1. The internal connection is working as normal.
The content of /etc/network/interfaces is:
# The loopback n... |
Comment out one gateway. The one without Internet connection:
#gateway 192.169.1.10
Standard configuration can have only one and your route shows it is the internal gateway used right now.
If there are other networks behind this gateway add this:
post-up /sbin/ip route add 192.169.X.0/24 via 192.169.1.10
post-down /s... | Debian Jessie server has no internet access |
1,392,509,316,000 |
I'm working on a live stream transcoder application using nginx + ffmpeg.
Everything works fine when I use avconv to transcode, but if I use ffmpeg, I get this error:
[tcp @ 0xb4e9da0] Failed to resolve hostname fso.dca.XXXX.edgecastcdn.net: System error
Any hints? Seems like an application specific firewall.
|
The problem is with the static build, as @slm mentioned. I've compiled ffmpeg from source and things work fine now.
| Application specific DNS problem? |
1,392,509,316,000 |
I have been trying to set up iptables on my archlinux server, however when I run iptables -nvL I receive the error
iptables v1.4.20: can't initialize iptables table 'filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
Having tried to load the modules and failin... |
As I run a custom kernel, I do not know if the module needed for the filter table is included in the stock arch kernel. But perhaps you do not even need exactly this table. On my system, I normally just use the nat table.
Pass the parameter -t to all iptables invocations to select a given table, for example trying ipt... | Archlinux not configured with iptables |
1,371,236,423,000 |
I would like to restrict access to the SSH port of a new CentOS 6.2 server to select IP addresses but the Firewall GUI utility seems to be an all-or-nothing scenario. Either the port is firewalled or it is opened.
If I make changes using the IPTABLES commands and save them out, and then later someone uses the Firewall... |
Yes, the changes in the GUI will overlay /etc/sysconfig/iptables. I found this out the hard way recently.
| Will the Firewall GUI in CentOS overwrite changes implemented by IPTABLES manual edits? |
1,371,236,423,000 |
It is possible using iptables (on Debian) to block all inbound connections for all the ports with a port number over (as an example) 16000.
Like this (using 16000 as reference):
The port 15999 is open for input, instead from port 16000 to 65535 inbound connections are dropped.
|
If the ports are contiguous, like yours are, then use the
--destination-port,--dport [!] port[:port]
syntax to set up the range:
... --destination-port 16000:65535 ...
| iptables: block all inbound traffic over a certain port number |
1,371,236,423,000 |
This question is a follow-up to my previous question.
Logic for me to says that an in-kernel firewall sits between the network access layer and the Internet layer, because it needs to have access to the IP-packet header to read the source and destination IP address in order to do filtering before determining if the p... |
A firewall does not exist in a single place in the kernel network stack. In Linux, for instance, the underlying infrastructure to support firewall functionality is provided by the netfilter packet filter framework.
The netfilter framework in itself is nothing more than a set of hooks at various points in the kernel p... | Does an in-kernel firewall sit between the network access layer and Internet layer? |
1,371,236,423,000 |
I'm trying to atomically replace nftables rules. Nftables's official wiki states that -f is the recommended way to achive this. However, when I run nft -f /path/to/new/rules on Debian Buster, the new rules get added to the current rules instead of replacing them, and I end up with a system enforcing both rule-sets sim... |
The operation done with nft -f /path/to/new/rules is atomic: that means it's either done completely or not done at all (ie: reverted), and will affect all at once the next packet hitting the rules only once committed. It won't end (because of an error) only half-done. So if you don't delete the previous ruleset before... | How do I replace nftables rules atomically? |
1,371,236,423,000 |
I'm a bit lost here, so I'm asking for your help. =D
I have three servers:
1# - LANs A and B
2# - LANs B and C
3# - LANs C and D
How can I make server 1# access through LAN B an ip that is in LAN D of the 3# server using the 2# server?
NOTE: We can use the firewall-cmd (iptables) or any other feature that is availabl... |
That's a very basic networking thing: If you want to connect different LAN segments, you need a router. You don't need NAT, you don't need iptables, you just route, plain and simple.
For some reason people seem to think routing needs at least NAT or iptables, and the internet is full of advice to that end. It's really... | Use the LANs of one server to access the LAN of another |
1,371,236,423,000 |
I would like to restrict visibility of my server from outside my country. I am connecting to my personal server always from one or two countries. Is there a way to block all the IPs coming from all the other countries?
I am running Debian with iptables.
I have found the following database of IPs associated to countrie... |
You can use xtable addons geoip match feature. On debian install the xtable-addons-common package and then use use the geoip target e.g. to allow ssh from Netherlands NL:
iptables -A INPUT -p tcp --dport 22 -m geoip --src-cc NL -j ACCEPT
Make sure xt_geoip module is loaded and geoip database is downloaded. You can re... | Block countries based on IP in firewall |
1,371,236,423,000 |
I have a domain which I want to point to my server.
But I don't want to allow other people to use this domain to reach the server, only specific ports on the server (web server, so port 80).
So if someone want to reach the server on my domain on port x then don't let it, but if the port is y then let.
Is it possible s... |
You can not, with one IP address. The server is not being addressed by name, only by address. It doesn't matter which hostname resolves to the address, the same connection will happen. The port also is not used in name resolution, so you cannot affect that in any way.
The only practical way would be to put the names t... | Domain only for web server |
1,371,236,423,000 |
Now I perform this:
create blockipset hash:ip
add blockipset 192.168.1.5 -exist
add blockipset 192.168.3.115 -exist
Is it possible for iptables and ipset to block ip,port and ip?
for example, the list contains:
192.168.1.5
192.168.3.115
192.168.1.55,80
192.168.1.53,22
|
You can't put different types of elements in the same set with the ipset command. But you can use different sets, one for each type (full list available with ipset help):
hash:ip
hash:ip,port
For example:
ipset create blocklistip hash:ip
ipset create blocklistipport hash:ip,port
ipset add blocklistip 192.0.2.3
ipset... | iptables add ip,port and also IP |
1,371,236,423,000 |
I have a very strange behaviour of my UFW on Ubuntu 18.04.
I set up basic rules, everything is OK until I connect client to this server through VPN. On the client side ping works fine but nslookup / domain ping is being refused. Once I will turn off ufw, it is working well.
UFW configuration: VPN subnet is 10.99.0.0/... |
If all you are looking at is the domain ping failure, the server and or client firewall needs to be made to allow forwarding:
# Allow TUN interface connections to OpenVPN server
iptables -A INPUT -i tun+ -j ACCEPT
# Allow TUN interface connections to be forwarded through other interfaces
iptables -A FORWARD -i tun+ -... | UFW is blocking DNS requests through VPN [closed] |
1,371,236,423,000 |
Right now I'm trying to figure out how to set up some IPv6 rules on a server of mine. My requirements are to disallow input echo-requests to the loopback device and local IP addresses (in this case, link-local), as well as open up ports 22, 80, and 443. Everything works great for IPv4, but I'm having an issue with ip6... |
Let's see what your rules are trying to do first, to see why they might not be working:
-A INPUT -i lo -j ACCEPT
All traffic arriving at the loopback interface will be processed, including ICMPv6 traffic.
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j... | Help with IPv6 rules and ip6tables |
1,371,236,423,000 |
I'm trying to configure Iptables of a server in order to permit SSH incoming connections only from a certain network.
by the way this is the rule chain :
# Drop anything we aren't explicitly allowing. All outbound traffic is okay
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT ... |
Am I doing the right thing by using the external IP of my router? or should I use the internal ip of my machine, or the range of internal ip addresses?
TL;DR: if your server is "across the Internet" from your own machine, you use the router's address in your iptables rules.
Longer answer:
The firewall rules work fro... | iptables configuration - ssh connection only from a remote network |
1,371,236,423,000 |
I have firewalld installed in a remote CentOS server. When I log into the server over the internet as root, I type the following command to access the firewalld logs:
journalctl --output=json-pretty UNIT=firewalld.service
The result is a few records indicating when the service was turned on, etc.
How do I get... |
If there is no logging specified in the firewall rule that rejects the connection attempts, then nothing will appear in the log.
I suggest you read the RedHat firewalld reference which discusses adding logging requirements to firewall rules. Unfortunately, it's fairly complex and there are no shortcuts that I know of.... | viewing firewalld logs via remote login to CentOS 7 server |
1,371,236,423,000 |
I was seeing this question which was concerned with blocking access to the users who do not belong to a particular region. I am sure that blocking is possible but I see there is a workaround to this.
I login to the region's proxy from here.
I give this URL as the site to visit.
Now, I am in the region's proxy and I ... |
This question looks very confused, but I think the confusion is part of the question, so I'll try to provide enough background to clarify things.
HTTP and SSH are different protocols. HTTP is spoken by HTTP clients (called web browsers) and HTTP servers (called web servers). SSH is spoken by SSH clients and SSH server... | Reject ssh connections made from proxies |
1,371,236,423,000 |
when I add following rule to iptables, everything works as expected. The offending IP is added to BLACKLIST and dropped.
iptables -A INPUT -m recent --rsource --name BLACKLIST --update -j DROP
when I list my iptables rules with iptables-save, I see that automatically a netmask 255.255.255.255 is used for matching:
-A... |
It's hard to figure out what's going on in your environment without seeing a complete netfilter configuration. However, we can try putting together a simple one here and see how it behaves.
Let's start with an empty netfilter ruleset and add the following rules:
iptables -N bl_add
iptables -A bl_add -j LOG --log-prefi... | iptables recent --mask not working |
1,371,236,423,000 |
I am restricting the traffic to specific port number using the below firewall rule.
/sbin/iptables -A INPUT -p tcp --destination-port <port_num> -j DROP
After sometime i want to allow traffic, so adding the below firewall rule.
/sbin/iptables -A INPUT -p tcp --destination-port <port_num> -j ACCEPT
Is it correc... |
The -A flag appends to the set of rules. Using -I inserts a rule either at the beginning of the chain or at the numbered position. Rules are processed in order, so the first rule you added will be processed first and the second will never be actioned.
You can see the full set of rules for your INPUT chain with iptable... | Which firewall rule is considered if i 'drop' first then later adding 'accept' rule. drop or accept? |
1,371,236,423,000 |
I want to check if I can connect to Rspamd's Fuzzy port and have a very strange problem - I can ping a the host and get an answer (0% packet loss). But when I try to telnet him, I get "No route to host":
# telnet 88.99.142.95 11335
Trying 88.99.142.95...
telnet: Unable to connect to remote host: No route to host
And ... |
The target port is blocked by the target firewall (at least for your and my IP addresses).
If you run tcpdump -i any -n icmp then you see a host unreachable - admin prohibited ICMP packet.
| Ping works, but I get 'No route to host' even though my firewall is off |
1,371,236,423,000 |
As you can see from the screenshot of GCP firewall rule page, should I remove ICMP Protocol from firewall rules base on security concern? Will it lower the chance of being attacked?
I'm using CentOS 7. I added net.ipv4.icmp_echo_ignore_all=1 to /etc/sysctl.d. Does this have the same effect as deleting the ICMP Protoc... |
As you can see from the screenshot of GCP firewall rule page, should I remove ICMP Protocol from firewall rules base on security concern? Will it lower the chance of being attacked?
Opinions differ about this, but it is generally not considered a security risk to accept ICMP packets.
I'm using CentOS 7. I added net... | Should I remove ICMP Protocol from firewall rules base on security concern? |
1,371,236,423,000 |
My server (on which bellow iptables rules are loaded) has the IP 192.168.3.110.
There is another computer in my LAN with IP 192.168.3.106.
I'm trying to redirect requests to my server on port 80 to 192.168.3.106.
I have the following iptables file which is loaded in my CentOS 7 server:
*nat
:PREROUTING DROP
:INPUT DR... |
iptables nat tables are only traversed for the first packet of a (psuedo-)connection. Later packets are mapped (or left alone) according to the mappings established by the first packet.
| Iptables not working as I expect: response package not DNATed as expected with DNAT in PREROUTING |
1,371,236,423,000 |
I just noticed that my server is being blocked for rsync from a firewall outside of my server, so I can't rsync to any target. Now, I would also like to know what are all the ports that are being blocked by that firewall.
Is there any way to use nmap to do that? I know I can use nmap to scan the opened ports in a spe... |
No, you can not nmap to scan one computer from the same computer.
By definition, packets won't travel, and packets traveling is the whole base of the internet.
You need a router, printer, light-bulb or external computer that could run some commands and use it to look back to that computer.
I believe that you can send... | How to scan outbound closed ports with nmap? |
1,371,236,423,000 |
If a service (or port) is blocked in both TCPwrapper and Iptables, which will block the request first and why?
|
Answer:
Its Iptable(firewall).
Why?
In simple words, TCPwrapper comes in between firewall and network Services.
In the OSI model, the TCPwrapper works in Application layer while iptable works mostly in Transport layer.
Source:: Access Control Using TCP-wrappers
| Which one will block first? tcp-wrapper or Iptables? |
1,371,236,423,000 |
I deleted the ufw files in /etc/ufw/, so I can start from scratch with a new generated port file. But after I deleted ufw per apt-get and reinstalled it, the files do not get generated. So what am I now supposed to do?
I get many connections from "outside", like 122.246.16.251:80 to every single port of my local ubunt... |
remove and install ufw, but you need to use apt-get remove --purge
sudo apt-get remove --purge ufw
| I need to regenerate the ufw files |
1,371,236,423,000 |
I am trying to follow this answer on OS X 11.x
block return from any to 192.0.2.2
The console displays :
-bash: block: command not found
So, I tried to install it using brew:
brew install block
However, I got another error .
How to install this firewall utility?
|
On recent versions of OS X, pf is installed and running by default. The linked question is referring to changing the pf configuration, not installing a new utility. Modifying a firewall on a production system is not something which should be done without reading the documentation (man pf.conf , man pfctl).
To add th... | block command line not found |
1,371,236,423,000 |
I am using the command below to allow all traffic from hosts on my internal network but it says "iptables v1.4.18: Couldn't load target `ALLOW':No such file or directory". What is the problem here?
iptables -A input -s 192.168.1.0/24 -j ALLOW
|
The target isn't ALLOW it should be ACCEPT.
$ iptables -A INPUT -s 192.168.1.0/24 -j ACCEPT
excerpt iptables man page
TARGETS
A firewall rule specifies criteria for a packet, and a target. If the
packet does not match, the next rule in the chain is the examined; if it
does match, then the next rule ... | iptables couldn't load target allow |
1,371,236,423,000 |
I've been poking around with KVM VM's on Centos 6.4 not having an internet connection on my VM's, I found something curious:
Upon booting the machine, iptables has rules in the FORWARD chain to allow traffic through to the VM's and all is well. When I run service iptables restart, however, it looks like it pulls the c... |
KVM itself doesn't do anything but run the VM. iptables rules are put in place by libvirt, (or the qemu-ifup scripts if you are doing things hardcore and manual)
In any case, if you want to avoid the iptables complication, don't use VMs in a NAT config, and switch to using a bridge or OVS instead.
OVS config
Bridged n... | How does KVM set its own netfilter rules? |
1,371,236,423,000 |
I have this configuration:
source: https://www.lucidchart.com/publicSegments/view/5256a1e5-afb0-4c7a-96fa-35750a00527d/image.png
Basically, I have to reach a service which is running on the virtual machine with IP address 192.168.0.20 from a remote machine; this service is reachable on the port 80 and is working via ... |
You need to forward the port by a user space program.
I can recommend you socat, e.g.
socat TCP4-LISTEN:80,fork,reuseaddr TCP4:192.168.0.20:80
It seems that you do not have root rights on the hypervisor. In this case you need to choose a port above 1023 for listening on the hypervisor.
See following question for more... | Reach service on VM with private address |
1,371,236,423,000 |
Is the iptables file in Fedora 17 moved from /etc/init.d/ to /etc/sysconfig/? I need do some patching to the iptables file to solve the firewall problem (Setting chains to policy ACCEPT: security raw nat mangle filter [FAILED]).
|
The firewall in F17 has changed from iptables to FirewallD.
The init daemon was also replaced with systemd in F15, so you'll see many of the old init.d bash scripts are not there anymore.
Here's some places to get started:
https://fedoraproject.org/wiki/FirewallD
https://ask.fedoraproject.org/question/7350/what-is-th... | Missing iptables file on directory /etc/init.d/ (Fedora 17) |
1,371,236,423,000 |
I was reading this interesting article today: http://www.moserware.com/2009/06/first-few-milliseconds-of-https.html
A crazy thought came to mind...Is it possible to write an iptable rule that only redirects https handshake requests?
|
No. You can't know it's a HTTPS handshake until the connection is open. At that point, it's too late to redirect it. The SYN packet doesn't tell you what's going to be transmitted; that's why we have port numbers to begin with.
| iptable rule to redirect only https handshake? |
1,371,236,423,000 |
I'm debugging a firewall .service unit and a few questions arise.
One of those questions is the unit's best service type, either exec or oneshot. Virtually no comparisons of the two appear in my searches, probably because exec is a relatively recent addition to systemd (v.249 IIRC).
By way of background, the unit (ca... |
You want type=oneshot. If you use type=exec, other services will be able to start before the firewall is configured. From the systemd.service man page, for exec:
...Or in other words: simple proceeds with further jobs right after fork() returns, while exec will not proceed before both fork() and execve() in the servi... | systemd Firewall .service Unit: Type=exec or Type=oneshot? |
1,371,236,423,000 |
I am using Ubuntu 20.04.3 LTS, although this question is probably not specific to Ubuntu but to any system using ufw.
I am setting up a rule for VNC vino connections.
I meant to do that via a configured app.
I created /etc/ufw/applications.d/vino-server with the following contents
[Vino Server]
title = “Vino VNC Serve... |
From man ufw:
ufw [--dry-run] [rule] [delete] [insert NUM] [prepend] allow|deny|reject|limit
[in|out [on INTERFACE]] [log|log-all] [proto PROTOCOL] [from ADDRESS [port PORT | app APPNAME ]]
[to ADDRESS [port PORT | app APPNAME ]] [comment COMMENT]
Accordingly, you have to specify from first.
sudo ufw allow ... | Ufw allow app: ERROR: Need 'from' or 'to' with 'app' |
1,371,236,423,000 |
From the nftables Quick reference:
family refers to a one of the following table types: ip, arp, ip6,
bridge, inet, netdev.
and
type refers to the kind of chain to be created. Possible types are:
filter: Supported by arp, bridge, ip, ip6 and inet table families.
route: Mark packets (like mangle for the output hook,... |
I am new one, but also interested in nftables rules. I found in nftables wiki: "The principal (only?) use for this (netdev) family is for base chains using the ingress hook, new in Linux kernel 4.2." More info here, in the end of article: https://wiki.nftables.org/wiki-nftables/index.php/Nftables_families
Ingress hook... | What chain types are supported by the nftables NETDEV family? |
1,371,236,423,000 |
This question is in a way related this and this
My question is about blocking incoming connections using iptables. I read different posts in unix.stackexchange.com and got a basic understanding of iptables. But I do not understand some particular points. Any help is appreciated.
iptables -A INPUT -m state --state RELA... |
Yes. All inbound traffic that isn't post of an existing session will be blocked
Only if (a) you've connected to that rogue host, or (b) it knows you should be there and by your lack if response it can infer you've a firewall
You're already covered by #1
| IP Tables - Blocking Incoming Traffic |
1,371,236,423,000 |
I assume the answer to this question is "no", but I would imagine there is some alternative method of achieving this.
What I want to do is add a second, even stronger password, for when I login with ssh externally. (From outside my private network.)
Is it possible to do this?
I envision something like this; some kind ... |
Best practise: Use key-based authentication, disable password-based authentication.
The best password-way to secure your SSH daemon is to disable password authentication altogether and force the use of key-based authentication.
This is considered more secure by a large factor and there is no more securing by password ... | Is it possible to add a strong external password to iptables on port 22? |
1,371,236,423,000 |
I have added a DNAT entry (in the host) for a port (say 30001) in PREROUTING using iptables
$ sudo iptables -t nat -A PREROUTING -p tcp --dport 30001 -j DNAT --to-destination <my guest vm ip>:80
Note: Above I have tried a port forwarding technique to allow ingress to guest vm.
Is it possible for a host process to bin... |
Yes, binding a port is part of the network stack, which is separate from netfilter where iptables belongs to. netfilter will not care or be aware of this new listening port and the network stack will not be informed that there will be something special about it done in its back later.
So it's fine to have a process bi... | Is it possible to bind to a port that has a entry for DNAT in iptables? |
1,371,236,423,000 |
I’m looking into a solution to prevent some application to accessing the internet when I’m connected to a specific wifi access point. My exact use case is that I would like to disable dropbox, spotify and similar apps to use all my data when connecting through my phone tethering.
The solution could be at another level... |
The problem can be split in two parts:
identify when a restricted access point (tethering's) is in use
identify which outgoing packets belong to restricted applications
Combining the two together will identify packets belonging to restricted applications going out using the restricted access point (in order to drop ... | Blocking internet access to some application with a specific wifi |
1,577,654,170,000 |
I have a lot of records in my firewall log that are related to HTTPS traffic. For some reason incoming connections are being made to ephemeral ports and they are blocked by my firewall because these ports are closed.
dec 08 11:49:12 hostname kernel: [UFW BLOCK] IN=enp31s0 OUT= MAC=- SRC=- DST=192.168.1.129 LEN=40 TOS=... |
... SPT=443 DPT=54426 ... RST URGP=0
These are not incoming connections. These are RST packets. These happen for example your client writes data to the server while the server has already shutdown the connection. It is unknown what exactly happens in your specific case though and if a proper iptables rules which al... | HTTPS connections are generating incoming connections |
1,577,654,170,000 |
I want to install gufw on my Fedora, but I do not know how to do that.
I tried to install with the dnf package manager command but it doesn't work and gets this output:
No match for argument: gufw
Error: Unable to find a match
So, I did an apt-get and again I got negative result:
E: Couldn't find package gufw
How ... |
You need the rpmsphere software repository which contains the gufw package.
The following works for Fedora 30, with root rights:
# install rpmsphere repository
rpm -Uvh 'https://github.com/rpmsphere/noarch/blob/master/r/rpmsphere-release-30-1.noarch.rpm?raw=true'
# install gufw
dnf install gufw
| How can I install gufw on fedora? |
1,577,654,170,000 |
Basically I have a armbian distro configured as NAT where wlan0 is the internal interface and eth0 is the "pubic" interface that provides internet (this set is provided out of the box by armbian-config).
My devices connect over wlan0 grabbing an IP, say 172.24.1.114
I have added a VPN to a remote network resulting in ... |
I have resolved all.
First the required iptables' rules are (these give access to the remote VPN's machines):
-A FORWARD -i wlan0 -o ppp0 -j ACCEPT
-A POSTROUTING -o ppp0 -j MASQUERADE
Then, to indicate which IP or range of IPs have to have a different route, you need policy rules:
open /etc/iproute2/rt_tables and p... | NAT a specific IP to go to ppp0 and others to go to eth0 coming from internal wifi interface |
1,577,654,170,000 |
I am running Red Hat Linux 6.2
Trying to install nfs packages using yum
Following is the
repository list
repo id repo name status
base ... |
yum (a python script) is written to honor proxies; the code is in urllib.py in the getproxies_environment function:
Scan the environment for variables named _proxy;
this seems to be the standard convention. In order to prefer lowercase
variables, we process the environment in two passes, first matches an... | yum install fails with 401 Authorization required [closed] |
1,577,654,170,000 |
When I see the official documentation of ipfw or the man pages it seems that it is sometimes incomplete. Specifically, there are a lot of options like,
firewall_myservices
firewall_allowservices
etc., which can be found in many online guides but not in the docs. They're even discussed in the lists.
So I would like ... |
So it seems that the options which are left out in the official docs are actually easily found in /etc/rc.firewall, which also happens to have the relevant explanations in the comments.
| Incomplete documentation for FreeBSD ipfw |
1,577,654,170,000 |
I tried to block all ports except 22(ssh), 80(http), 443(https). My current INPUT rules are these.
> iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT tcp -- anywhere a... |
The policy rules that you've created will allow outside hosts to connect to your TCP ports 22, 80 and 443, but not allow any other traffic, including your own! If you really want to prevent this host from accessing anything other than these three ports, and don't want outside hosts to access yours at all, you can put ... | Iptables - facing problems to allow specific ports and block others |
1,577,654,170,000 |
I've installed CSF-LFD as described here. in /etc/csf/csf.conf You have these two code blocks:
# Allow incoming TCP ports
TCP_IN = "20,21,22,25,53,80,110,143,443,465,587,993,995,2077,2078,2079,2080,2082,2083,2086,2087,2095,2096"
# Allow outgoing TCP ports
TCP_OUT = "20,21,22,25,37,43,53,80,110,113,443,587,873,993,995... |
It can be done is one pass with sed:
sed -Ei 's/^(TCP_(IN|OUT) = ).*/\1"22, 80, 443, 9000"/' /etc/csf/csf.conf
(IN|OUT) - regex alternation group, matches either IN or OUT substring
\1 - backreference, references the 1st captured group (...)
| Change CSF-LFD ports safely with sed |
1,577,654,170,000 |
The guide recommends the Gufw firewall GUI.
I installed it by apt
gufw/oldstable,oldstable,now 12.10.0-1 all [installed]
graphical user interface for ufw
Typing ẁindow key + gufw, I cannot see the application.
Only access is through terminal by gufw which is not enough.
I am thinking why so + how to fix the issu... |
Debian Stretch was released a couple of weeks ago. Upgrading your entire system to that would seem like the easiest solution to your conundrum.
The bug was fixed in the version in Debian Stretch, while the old stable release Jessie was still stuck on a version from almost five years ago.
| Why Linux firewall GUI Gufw not in Debian window-key search? |
1,577,654,170,000 |
A Raspberry Pi is located behind a hardware firewall which is configured to block all outgoing communication to any IP except my server (all ports are allowed) and to block all incoming communication except the response requested by the Pi (obviously from my server). I can access the Pi from my server by tunneling wit... |
2 and a half solutions - Do a ssh tunnel or set up a mirror or rather proxy connections to the mirror for the pi
Use a ssh tunnel.
From the pi, start a screen session or something and connect to your remote server via ssh with some arguments
ssh -L8000:hostname.of.apt.repo:80 user@remotebox
Then point your /etc/apt/s... | Access repository where direct access to the repository's URL is blocked |
1,577,654,170,000 |
Closing ports except 22 and 443. This dramatically slows down the nmap scans:
-A INPUT -i eth0 -p tcp -m multiport --dports 22,443 -j ACCEPT
-A INPUT -i eth0 -p tcp -j REJECT --reject-with icmp-port-unreachable
If I remove the REJECT rule, nmap is fast.
So how to make other ports look like closed ports without slowin... |
It's the 'tcp-reset' reject type that does what the OS normally does with the closed ports:
-A INPUT -i ens3 -p tcp -j REJECT --reject-with tcp-reset
| Why REJECT slows nmap? |
1,577,654,170,000 |
SITUATION:
I recently found the following shell script that works with iptables to block all internet access to/from the linux OS, except for terminals opened that were in a group called internet:
CODE:
This might sound complicated, but it's simple. First, create the
"internet" group like so:
sudo groupadd intern... |
Your interpretation is correct.
If you want the whole thing to also apply to UDP packets, you have to add the same set of rules once again, but with -p udp instead of -p tcp. Or just leave out this option and have the rules apply to all packets (though there could be some gotchas with ICMP packets, so it's probably s... | Understanding an iptables shell script |
1,577,654,170,000 |
I am new to iptables and am confused on how I am supposed to set this up. It looks like I have 2 ethernet cards but I have 4 IP addresses. No prob there. In my network/interfaces, it looks like they are all on enp2s0f0. Can I just change 2 of them to be on interface enp2s0f1 assuming that the network comming into the ... |
I quote some lines from man iptables:
[!] -p, --protocol protocol
The protocol of the rule or of the packet to check.
[!] -s, --source address[/mask][,...]
Source specification. Address can be either a network name, a hostname,
a net‐work IP address (with /mask), or a plain IP address.
... | How to set different rules to multiple IPs on the same interface? |
1,577,654,170,000 |
I have some devices that don't have firewall neither can't have, it's like an arduino, more specifically its a esp8266 with "ESP-Easy" Firmware.
And what i want/need is to only a certain computer be able to access it. like this:
1# ESP8266 board with ip 192.168.1.102
2# Computer with ip 192.168.1.100
3# Any other Dev... |
There is no secure solution to this if the devices are on the same LAN. Nodes on the same network talk directly to each other, there is no way to divert the traffic via an firewall. You will have to put the computer and the board on a separate LAN, with a firewall between the LANs. A cheap, but insecure, solution is t... | How prevent access to a device (192.168.1.102) from others devices than the one I allow (192.168.1.100) if the 192.168.1.102 don't have firewall |
1,577,654,170,000 |
Is it really necessary to run UFW behind my Gateway Router which already has Firewall/Port rules?
In this example, I am discussing running UFW on an Internet Accessible (Linux) Server that is behind a Natted Firewall Gateway Router.
Please be specific, don't just say yes because there are hackers out there! (Though th... |
Ultimately this is a security question more than a unix/linux question.
Technically the answer is no, it is not necessary to run it for things to work right (depending on what else you're running).
I don't run host firewalls on my network at home because I have my modem/router/accesspoint set up such that there are ... | Is UFW behind a firewall(ed) gateway router necessary |
1,577,654,170,000 |
I need to install some iptable ruels to block traffic that originates from a certain country, I found this script example on http://www.cyberciti.biz/faq/block-entier-country-using-iptables/ it works great on another host I have but on this one (an embedded box) I get:
./iptable_rules.sh
modprobe: module ip_tables n... |
You should be able to re-compile it using something to the similar commands.
make KERNEL_DIR=/usr/src/linux
make install KERNEL_DIR=/usr/src/linux
make dep
make bzImage
make
make install
make modules
Source: iptables: Table does not exist (do you need to insmod?)
| iptables - why do I get "Table does not exist (do you need to insmod?)" |
1,577,654,170,000 |
How can I define separate roles for users and administrator in OpenVPN running on CentOS 7 server? Specifically, the users must only be allowed to https, while the administrator must be allowed to both https and ssh.
PROGRESS SO FAR:
In translating the instructions from the link suggested by @garethTheRed, I have de... |
You could modify the zone and add a Rich Rule which blocks all ssh traffic other than from a certain range - the Employee subnet.
Find which zone your tun interface is in by listing all zones:
firewall-cmd --list-all-zones | less
In the output you should see something similar to:
internal (active)
interfaces: tun0
... | multiple user-types/access-rules for OpenVPN on CentOS 7 and firewalld |
1,577,654,170,000 |
I'm trying to secure my internet browsing. I just reinstalled Xubuntu 14.04 and GUFW firewall. I have 8 UDP ports open. I don't understand why. The software I currently have open are Firefox, GUFW, Mousepad, Ubuntu Software Center, Software Updater and Terminal. Would any of these correspond with the open software? Wh... |
avahi-daemon
Avahi is a low-level service discovery mechanism. It tends to be used by all kinds of random things, so there's no way I can tell you exactly who is using it, and for what.
Short of pulling out the packet sniffer and going hunting, your choices are basically to just live with it or disable the whole servi... | Open UDP Ports; Can I Close Them? |
1,577,654,170,000 |
I have a Raspberry Pi running Linux (Raspbian) which is connected to my corporate Internet over an Ethernet cable. The RPi also has a wifi adaptor plugged into a USB port. I've been following along the with Ada Fruit's Raspberry Pi Access Point Tutorial, but there is a snag.
I only want to allow connections from the w... |
The section you should ignore is the Configure Network Address Translation section. In fact if you want to guarantee that wireless clients can't go onto the Ethernet connection do the following:
Run sudo nano /etc/sysctl.conf. Scroll to the bottom and add net.ipv4.ip_forward=0
on a new line. Save the file. This will d... | Allow wifi connections only to a local service, don't route to the wired ethernet |
1,577,654,170,000 |
I tried to curl popular websites e.g. curl google.com or curl google.com:80 and there is always a timeout error.
Some troubleshooting steps performed:
Able to curl localhost with response
Able to ping google.com with response
Tried change DNS to google DNS but to no avail
Tried wget and it does not work for external... |
If this is a hosted webserver I would suspect that it's been configured in a classic webserver fashion. Meaning that it allows incoming connections on port 80 but for security they may have disallowed outgoing connections on port 80. I would guess this is the issue. curl and wget generally work out of the box with no ... | curl timeout troubleshooting |
1,577,654,170,000 |
I'm running a desktop computer, but one with high threat risk.
I've blocked all ports using a firewall except:
HTTP, HTTPS, DNS, one port for torrent client.
Do any common processes in distros like Ubuntu, Linux Mint, Debian use other ports that I need to allow?
|
In principle, modern firewalls are 'stateful'.
Meaning you don't need to allow anything from outside as it will find out itself which are the answers to requests that you have made and let them in automatically.
So you don't need incoming HTTP or HTTPS, etc. explicitely unless you're hosting a webserver.
However, if ... | What ports are essential and should generally be allowed on a Linux system? |
1,577,654,170,000 |
I'm new in CentOS and I'm trying to create a little script in Python, something like:
$ python -m SimpleHTTPServer
If I try to access port 8000 in my web browser, I don't get access, however if I turn off the firewall with:
$ system-config-firewall-tui
I'm able to access the service.
I just need to access port 3343 ... |
Try something like this:
$ iptables -A INPUT -p tcp --dport 3343 -j ACCEPT
$ iptables -A INPUT -p tcp --dport 8880 -j ACCEPT
| Open a port CentOS |
1,577,654,170,000 |
I´m having problems setting up network printing in Fedora 16. In the printer setup box it says FirewallD is not running and gives a list of protocols that need to be enabled. I cannot find a FirewallD but have gone into Firewall and enabled the protocols. There is obviously something I´m missing.
The printer is a Can... |
Finally found the answer in the Ask Fedora forums. Someone there had the same problem and one of the responces said to enter system-config-printer into Terminal and configure the printer that way. I can now print!
| Network Printing in Fedora |
1,577,654,170,000 |
I configured a Debian Squeeze virtual machine in VMWare on my laptop. I configured it with a very restrictive set of firewall rules using Firestarter. I then uploaded a copy of its disk image to use as a virtual private server on the internet.
On the internet version, I rather rashly removed my firewall settings via t... |
You can use iptables-save and iptables-restore, or you can once more install firestarter and use the config file from the old machine.
| How can I move firewall settings from one Debian Squeeze web server to another? |
1,577,654,170,000 |
I am feeling stupid. I have been searching for 3 hours with no success.
I installed Fedora 14 and tried to do yum install firestarter but the package was not found.
I also tried from a GUI and found nothing.
It is at fedoras repository?
Maybe I should configure the repository, but all I found are dated. Any help? T... |
Firestarter hasn't been in the fedora repository since Fedora 11. It's listed as a deprecated package on their wiki. It's recommended that you use system-config-firewall instead.
Do you have a particular reason for wanting to use firestarter? If you really want to install it you can try grabbing the source from sou... | I can't figure out how to install Firestarter Fedora |
1,577,654,170,000 |
I have an OpenWrt 10.03 router [ IP: 192.168.1.1 ], and it has a DHCP server pool: 192.168.1.0/24 - clients are using it through wireless/wired connection. Ok!
Here's the catch: I need to separate the users from each other.
How i need to do it: by IPTABLES rule [ /etc/firewall.user ]. Ok!
"Loud thinking": So i need... |
If you want to separate wireless and wired users why not match the interfaces?
Assuming ppp0 is facing the internet, eth0 is your local LAN and wlan0 is the wireless:
iptables -P FORWARD DROP # Drop everything except:
iptables -A FORWARD -m state --state RELATED,ESTABLISHED # Accept alr... | IPTABLES rule for separating users |
1,577,654,170,000 |
I've set up a rule to match multicast packets as follows:
add rule filter_4 new_out_4 meta pkttype multicast goto multicast_out_4
filter_4 is IPv4 table, new_out4 is output chain and multicast_out_4 is a chain to handle multicast only traffic.
Here is a more complete picture of the IPv4 table excluding non-relevant p... |
Having reproduced (and completed missing parts for) the setup with a few additional entries such as:
nft insert rule filter_4 new_out_4 counter meta pkttype host counter
indeed the property meta pkttype for this skbuff is host rather than the expected multicast for an outgoing multicast packet. Note that when this ke... | nftables - multicast packets not matched |
1,577,654,170,000 |
I have flowtable offloading working just perfect on my router. Sometimes I want to block some ongoing traffic, being handled via the flowtable. If I add a new blocking rule to the regular routing processing, it has no effect to the active offloaded connections. Therefore after I added some new rule, I would like to fl... |
Offloaded traffic is still associated with a conntrack entry with the property [OFFLOAD] (offloaded entries have a default 30s inactivity timeout and revert to non-offloaded conntrack entries without traffic seen for this time, until they get the chance (traffic) to be offloaded again). To remove the flowtable entry, ... | How to flush the nft flowtable hash of active connections? |
1,577,654,170,000 |
I'm using nftables on a router running NixOS 22.11 (with the latest XanMod kernel patches and acpid as well as irqbalance enabled). The machine has 3 interfaces: enp4s0 which is connected to the internet and two local WiFi access points serving distinct IP LANs, wlp1s0 and wlp5s0.
My nftables configuration is the foll... |
Warning: this is a generic Linux answer. What won't be covered in this answer is specific integration with NixOS and its own method for configuring network or how to call arbitrary commands from its configuration.
Presentation
In OP's first case (two different interfaces), the router is actually routing between the t... | nftables doesn't see KDE Connect packets between two machines on the same interface |
1,577,654,170,000 |
When I run sudo ufw status on a Ubuntu box, I get the following output
sudo ufw status
Status: active
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
30303 ALLOW Anywhere
9000 ALLOW... |
The answer is in the output of netstat. You are listening on address127.0.0.1. You probably need to listen on 0.0.0.0 (all local interfaces/addresses).
Thanks to the other commenters for working it out.
| Why am I getting connection refused with IP address even though it works with localhost and firewall is open? |
1,577,654,170,000 |
While messing around in a qemu guest I discovered something very peculiar. If I set the system firewall to reject all traffic to my gateway (10.0.2.2), the firewall only rejects traffic destined to the gateway directly. Traffic not destined to 10.0.2.2 seemingly continues to get routed and flows through the gateway as... |
This is working and not blocked because a gateway routes packets with source and destination IP addresses that are not the gateway's address. No IPv4 packet (see later about ARP) with address 10.0.2.2 is used to successfully route through the gateway with IP address 10.0.2.2/24.
So when 10.0.2.15 sends a packet to 8.8... | Why does traffic continue to flow through my gateway despite a firewall rule blocking all outbound traffic addressed to it? |
1,626,650,735,000 |
I freshly install openBSD on a VPS. It is my first time. I did nothing but check the firewall setup, say pf. I ran pfctl -sa and it show
all tcp IP0:22 <- IP1:rnd ESTABLISHED:ESTABLISHED
all tcp IP0:22 <- IP2:rnd ESTABLISHED:ESTABLISHED
all tcp IP0:22 <- IP3:rnd FIN_WAIT_2:FIN_WAIT_2
all tcp IP0:22 <- IP4:rnd TIME_WAI... |
The second line doesn't mean that someone is logged in, it merely indicates that someone made a connection to the port. After connecting, the client will then try to authenticate itself, using the established connection.
If you are still suspicious you can test this yourself: log in via SSH on one terminal, open anot... | PF states table give preoccupant results |
1,626,650,735,000 |
Fresh Webmin install on Ubuntu 20.04 on Amazon Lightsail
I added the line to iptables as per their instructions:
sudo iptables -A INPUT -p tcp -m tcp --dport 10000 -j ACCEPT
I have added port 10000/tcp to ufw also.
When I go to the browser https://myip:10000 the browser stays loading for a while then says:
cant op... |
@OKOK Are you on LightSail?
For me it was the Amazon firewall. I had to allow port 10000 through LightSail console under Network. Even though I had allowed it on ufw through terminal Amazon was applying its own firewall.
| Can't access Webmin from browser after installing |
1,626,650,735,000 |
I have host used as gateway with
net.ipv4.conf.all.rp_filter=0
and iptables rpfilter that is used instead
iptables -t raw -A PREROUTING -m rpfilter --invert -j LOG-DROP-RP
My host have 2 interfaces eth1 with IP 10.0.0.1/8 and eth2 with IP 192.168.0.1/16.
If some host with IP 192.168.0.2 on eth1 send packet it's drop... |
Linux uses the weak host model: any IP address assigned to any interface belongs to the host as a whole. When you reach from 10.0.0.2 to 192.168.0.1 there's no forwarding involved because the destination address belongs to the host: the packet gets handled by filter/INPUT, not by filter/FORWARD (which thus won't be ev... | iptables does not block forwarding to another IP of the host itself |
1,626,650,735,000 |
On a random day I was googling iptables rules to harden my desktop, and came across this post[1]. At some point the guide mentions blocking invalid TCP packets using tcp-modules with these rules;
iptables -A INPUT -p tcp -m tcp --tcp-flags ALL FIN,PSH,URG -j DROP
iptables -A INPUT -p tcp -m tcp --tcp-flags SYN,FIN SYN... |
TCP is a stateful protocol, UDP is stateless, so you cannot use ctstate with it.
Either you let traffic for a particular port for UDP or you don't.
Also --udp-flags FIN,SYN,RST,ACK SYN is just pure nonsense.
In short familiarize yourself with TCP/IP and UDP a bit before rushing to set up iptables.
| Why is it that TCP packets can be modified to block invalid packets, but not UDP packets |
1,626,650,735,000 |
I have opened the 3000 port of my CentOS 7 server with the following commands:
firewall-cmd --zone=public --add-port=3000/tcp --permanent
firewall-cmd --reload
But now I want to closing them, how can I do that?
|
firewall-cmd --zone=public --remove-port=3000/tcp --permanent
should do the trick.
man firewall-cmd is always at your disposal.
| how to close a port on CentOS 7 server? |
1,626,650,735,000 |
I've got my server set up with long list of services, and everything is working great... on IPv4. But when I test them against IPv6 nothing is resolving. After disabling nftables everything started working, so I turned it back on and through trial and error, was able to identify the two lines (identified with --> be... |
Turns out that the rules I posted were not the culprit, as I've noted in the question update. The actual issue was related to ICMP traffic and in particular several types related directly to IPv6. My ICMP rules were...
add rule inet filter INPUT ct state new icmp type { echo-request, echo-reply } accept
add rule ine... | nftables preventing services from resolving on IPv6 |
1,626,650,735,000 |
I had question about IPtables.
Let's start with this example of my book:
What rules you would set for a mail server accepting connections for
EMSTP (port 465) and IMAP (port 993) having a network interface eth1
exposed to the Internet and another network interface eth2 exposed to
the corporate network?
I tried... |
First, some reminders:
-p argument is to specificy protocols like TCP, UDP, ICMP ... not higher level protocol like IMAP.
OUTPUT and INPUT chains are for the packets outgoing from the machine and incoming to the machine. If you want to filter packets that are forwarded (when your machine act as a gateway), you must ... | Iptable order of rules with example |
1,626,650,735,000 |
I have few vms (homelab) virtualized with KVM (CentOS7) and connected to my home network. Lately I tried to isolate them by putting them in separate network and I wanted to do so with virtualized pfsense on the same host as other vms.
First I created isolated network in virt-manager for my lab hosts.
Then I created v... |
I've got the answer on the other forum, turns out that all I had to do was disable hardware checksum offload, link to the documentation
| Virtualized firewall on KVM |
1,626,650,735,000 |
I'd like to locally test my web application's behavior under different firewall circumstances.
We have an application that makes requests from the browser to different ports depending upon certain conditions, and I'd like to set up a firewall that allows me to modify firewall rules dynamically so as to see how the a... |
This seems a little counter intuitive to me in how you're approaching it. Typically you'd setup the firewall on the actual server where the web application is residing.
If you're using firewalld this is pretty trivial. You can see the names of all the services it's able to deal with by name using this command:
$ firew... | How to set up a firewall for testing web applications in a virtual machine? [closed] |
1,626,650,735,000 |
I have set up this rule:
-A PREROUTING -i vboxnet0 -p tcp -m tcp --dport 80 -j internet
-A internet -j MARK --set-xmark 0x63/0xffffffff
To capture incoming traffic on port 80 and send it to be marked. It works, but now I'd like to edit it to capture on all ports except 53(DNS), the DHCP service port and some others.
... |
Understanding Your Rules
The first step in understanding how your firewall rules work is, like in most things, to check the man page (man iptables). In the man page you will find:
-m, --match match
Specifies a match to use, that is, an extension module that tests for a specific property. The set of matches make up th... | How to Redirect marked packets on multiple ports to one IP Address |
1,626,650,735,000 |
Iptables is not blocking connections to devices connected to a bridged router. I have inserted the rules at the top of the rules list with: iptables -I INPUT -d 216.58.201.46 -j DROP
Result:
root@OpenWrt:~# iptables -L INPUT -v -n
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out... |
The INPUT table is for packets whose destination is your OpenWRT router itself. Use the FORWARD table for packets going through your router to/from your devices.
iptables -I FORWARD -d 216.58.201.46 -j DROP
| iptables not blocking, bridged router |
1,626,650,735,000 |
I am having difficulties configuring NAT with iptables on my firewall.
My firewall setup is as follow:
it is a layer 2 transparent firewall, between my gateway and my ISP's gateway
I bridged two interfaces as br0. The two interfaces are eno0 on my ISP side and eno1 on my local network side
I set up basically no ipta... |
As suggested by @dirkt, it looks like conntrack does not work well with a bridge. So iptables rules that don't require seem to work on a bridge, but not NAT.
Problem solved as soon as I configured my firewall as a layer 3 firewall.
In case others are interested: I extensively searched the Web if it was possible to use... | Use NAT with iptables and a bridge |
1,626,650,735,000 |
I am not able to get my ufw rules working. As far as I understand, the default behavior is to deny all incoming connections thus the command
ufw allow from 192.168.4.3 to any port http
should enable incoming http connections for the specific ip. However, the requests are blocked by the firewall. I've also tried to ex... |
Check the log /var/log/ufw.log. The default logging level (low) should record any blocked requests. Make sure the source IP (SRC field) matches the IP address you are expecting.
| Unable to allow specific ip addresses in ufw |
1,626,650,735,000 |
I try to connect a NIS server on CentOS 7.3 and a NIS client on raspbian 8.0 together.
My problem is that raspbian does not want to bind the server.
journalctl server the following entry:
raspberrypi nis[708]: Starting NIS services: ypbindbinding to YP server...........................................failed (backgrou... |
Try to use this command
setenforce 0
the restart the ybind service
service ypbind stop
service ypbind start
if it doesnt work then the firewall on the NIS server is blocking all connections from the NIS client. you can stop it using
systemctl disable firewalld
to disable it or
systemctl stop firewalld
to stop... | How to disable all firewall rules and SElinux if runs on CentOS7 |
1,626,650,735,000 |
This tutorial shows how to set up an easy parental control facility, with help of DansGuardian, Privoxy and a few firewall rules. I've tested it and so far, it seems to be working for most part.
There are, however, some things I fail to understand. Namely, in this tutorial we are told to set up, among others, followin... |
I always thought that uids can be either usernames or groups
Those are user names. It's intended that you run Privoxy under a user called prixovy and DansGuardian under a user called dansguardian.
This is even more confusing because getent group shows an entry for dansguardian, but not for privoxy
Do cat /etc/pass... | How can we set firewall rules to allow or deny specific programs? |
1,626,650,735,000 |
I have a working port knocking setup for SSH on Linux using only iptables rules and the “recent” module following this tutorial: https://wiki.archlinux.org/index.php/Port_knocking#Port_knocking_with_iptables_only .
Now my problem is that several networks like my work network block traffic to non-standard ports like 22... |
I would suggest to go knockd route. It's simpler this way. Only instead of using this default config
[openSSH]
sequence = 7000,8000,9000
seq_timeout = 10
tcpflags = syn
command = /usr/sbin/iptables -A INPUT -s %IP% -p tcp --dport 22 -j ACCEPT
[closeSSH]
sequence ... | Allow SSH access after port knocking from any source IP |
1,626,650,735,000 |
at the moment I'm trying to implement the firewall for my linux file server. Everything is working as expected except form the samba server. I have searched through the internet already but non of the solutions works for me. If the firewall is disabled samba works fine. If I add my samba rules I'm unable to access the... |
Erase your rule number 5. It should be:
iptables -A INPUT -i eth0 -s 192.168.178.0/24 -p tcp --dport 445 -m state --state NEW,ESTABLISHED -j ACCEPT
And the related connection(new rule)
iptables -A OUTPUT -o eth0 -d 192.168.178.0/24 -p udp --sport 445 -m state --state ESTABLISHED -j ACCEPT
And, to avoid very long rul... | Firewalling Samba |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.