date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,298,910,509,000
I have a VPS where I changed the SSH port from the default 22. Unfortunately I forgot to allow the new port through the firewall. I don't have physical access to the server, and my host does not seem to offer any shell access to the VPS through their website. Result: I'm locked out of the server. Is there any way I ca...
If you made the changes by hand and reinvoked sshd resetting might help, but if you changed sshd_config then resetting the server will not help you, the server will come back up and listen on the new, firewalled, port. You will have to access the VPS through a console or any other means your provider provides to rect...
Changed SSH port without allowing it through firewall, locked out now - what to do?
1,298,910,509,000
For a while now (introduced in version 1.3 I believe), iptables' conntrack module can track two virtual states, SNAT and DNAT: SNAT A virtual state, matching if the original source address differs from the reply destination. DNAT A virtual state, matching if the original destination differs from the reply source...
Thanks to @A.B's advice about logging, I could do some more tests and here are the results, as well as answers to my own questions, in the hope this will help other people who, like me, didn't find anything on the web about the states SNAT and DNAT, and/or their ability to replace ESTABLISHED,RELATED for matching. So,...
iptables conntrack module: SNAT (or DNAT) state in place of ESTABLISHED/RELATED?
1,298,910,509,000
How to list all loadable modules in iptables (given after the -m flag)? This post proposes to list loadable modules with ls /lib*/iptables/ I don't have this folder with my version (v1.6.0).
You got everything described in the linked your post. List all available modules: :~# ls /lib/modules/`uname -r`/kernel/net/netfilter/ List all loaded modules (unless you use a specific module in a rule, it won't show up in this list): :~# cat /proc/net/ip_tables_matches comment addrtype mark conntrack conntrack co...
How to list iptables loadable match modules
1,298,910,509,000
As I notice more often with FreeBSD, there are always plenty of ways that lead to some specific goal. After figuring out which firewall I wanted (I choose ipfw) I now am completely insecure about which way to do Network Address Translation (NAT). As I have discovered now, there are two ways to to NAT, I could use the...
ipfw nat is generally preferable, since it runs in kernel-space and consumes less CPU than divert+natd. But natd still can be useful if you need to dynamically add rules for FTP connections (look for -punch_fw option in natd(8)). Handbook page is badly outdated.
FreeBSD kernel nat or natd?
1,298,910,509,000
I am trying to limit number of ssh login attempts per time period. How might I do that? I have something like (in shorewall's rules) #ACTION SOURCE DEST PROTO DEST SOURCE MARK # PORT PORT(S) ... Limit:info:SSHA,3,180 net ...
You can use iptables to limit to 3 attempts per minute: iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --set iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 -j DROP Or use something like fail2ban. It bans by IP address for 15 m...
How to limit number off ssh login attempts per time interval
1,298,910,509,000
I have a machine (A) behind a firewall with no access to the Internet, on this machine I can NFS mount directories on another machine (B) which can access internet, and is accessible from Internet, but I cannot install anything on this machine (B). I want to keep a directory on (A) in sync with my Dropbox (that I us...
You may be able to use Unison to synchronize your files. Unison uses the rsync protocol and can run over ssh. You may need to copy the executable into your directory on the remote system. Using rsync may cause problems as it is difficult to synchronize file deletions. EDIT: To sync a folder on A from system C (wi...
Using rsync + cron to sync a machine behind a firewall with my dropbox
1,298,910,509,000
Which tools should I research into to intercept a plain text packet, edit it and then continue it on it's way. I am using Ubuntu 11.04 and Backtrack 5; my wifi is WPA2-person encrypted. I need to edit an item database of an ipod game :)
You don't want to intercept this in the air. It's very hard to do well. I suggest you change your network around a bit. You'll need a PC with two network interfaces and two routers to pull this off. Here's how I would do it: Internet --> Router --> Ubuntu machine --(network port)--> Wifi router --> iPod Ubuntu needs ...
What tools do I need to intercept and change an incoming packet on a WP2-Personal wifi hub
1,298,910,509,000
What incoming TCP and UDP connections are permitted, by the default firewall policy of Fedora Workstation, and Fedora Server? I am interested in the current version, Fedora 28.
Look at the default zone definitions in /usr/lib/firewalld/zones/, and cross-reference them against /usr/lib/firewalld/services/. FedoraWorkstation.xml Unsolicited incoming network packets are rejected from port 1 to 1024, except for select network services. Incoming packets that are related to outgoing network conne...
Which ports does the default firewall allow on Fedora Workstation and Fedora Server?
1,298,910,509,000
I have a linux host running 3.10 kernel with two bridged interfaces: eth0 & eth1 as brid00 with no IP. Bridge works fine, but now I want to filter some of the traffic going through the bridge, but iptables' rules are not firing. I have enabled net.bridge.bridge-nf-call-iptables (all traffic is IPv4) and net.ipv4.ip_fo...
Considered a bug in kernel 3.10 (maybe only in my architecture, arm64). Works fine in 4.x kernels, tested in few of them. According to kernel diagrams and docs routing is the same between kernels 3.x & 4.x and should work in both, but it doesn't. br_netfilter is a separate module in kernel 4.x, you have to modprobe br...
iptables not filtering bridged traffic
1,425,403,167,000
I am using CentOS 6.5 64 and use xen to create a virtual machine (CentOS) ifconfig [root@CentOS ~]# ifconfig eth0 Link encap:Ethernet HWaddr 08:00:27:54:B3:FA inet6 addr: fe80::a00:27ff:fe54:b3fa/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:10087 erro...
First of all if you are using VirtualBox to host the XEN server please ensure to use Ethernet not Wireless network and set Promiscuous Mode to "Allow All". Secondly just to make everything clean, let's start with clean installation of CentOS with XEN and install the Bridge Network and CentOS VM on it. Assuming you hav...
bridge does not forwarding packets centos
1,425,403,167,000
What is a practical way to manage a whitelist of firewall outgoing connection rules for http://security.debian.org (on a server that blocks all outgoing connections by default)? My understanding is that security.debian.org is a CNAME to several mirror IPs, and it is advisable to use only IP addresses (not hostnames) i...
The real solution would be to check all DNS resolving actions. If you can make the (local) DNS server (which is used by the restricted system) log all activities then you can grep all inquiries for security.debian.org, compare the result to your list of IPs and update the firewall in case the IP is new. That's probabl...
ufw firewall rules for security.debian.org
1,425,403,167,000
I need to add a rule (allow any to any port 22) to my firewall, so that I can ssh remotely into my machine. I have had a look in the SCO OSR600 Documentation and I cannot find anything in there. Update I have managed to enable ipfstat: #ipfstat enable And now my firewall is active, I just need to add rules now. But w...
Probably the rule, should be: pass in quick proto tcp from any to any port = 22 keep state pass out quick proto tcp from any to any port = 22 keep state in /etc/ipf.conf
How to Add rules to IP Filter (Firewall in SCO)
1,425,403,167,000
When executing wget https://docs.conda.io/projects/conda/en/4.6.0/_downloads/52a95608c49671267e40c689e0bc00ca/conda-cheatsheet.pdf I have this error: --2020-06-03 20:55:06-- https://docs.conda.io/projects/conda/en/4.6.0/_downloads/52a95608c49671267e40c689e0bc00ca/conda-cheatsheet.pdf Resolving docs.conda.io (docs.co...
meta: not really an answer but too much for comments UPDATE1 I have tried the following steps: [using certs exported by browser that are actually from Bluecoat, not really from conda] 1) sudo cp conda.crt /usr/share/ca-certificates/mozilla/ 2) sudo vi /etc/ca-certificates.conf and append mozilla/conda.crt at t...
Unable to locally verify the issuer's authority even after using certificate
1,425,403,167,000
I cannot get my Mac (10.10.3) machine to connect to my Oracle Linux 7 (CentOS/RH 7) server with its firewall up. (I am trying to configure for NFSv3 only; I don't need v4) I have verified that NFS is working by issuing this command on the Mac (firewall OFF on OL 7 server) showmount -e myserver.home And I get this b...
I have solved this issue and wanted to post the answer here in case anyone else had the same difficulties as the documentation on Oracle's Website is incomplete. We need to open a port for the mountd service. To do this, issue the following commands: firewall-cmd --permanent --zone=<zone> --add-service mountd Make ...
NFS Port Blocking Firewall Issue
1,425,403,167,000
Trying to disable the network access for the user: [root@notebook ~]# iptables -I OUTPUT -m owner --uid-owner tempuser -j DROP [root@notebook ~]# ip6tables -I OUTPUT -m owner --uid-owner tempuser -j DROP Could not open socket to kernel: Address family not supported by protocol [root@notebook ~]# [root@notebook ~]# i...
Try this, iptables -A OUTPUT -o ethX -m owner --uid-owner {USERNAME} -j DROP Where, --uid-owner { USERNAME } : Matches if the packet was created by a process with the given effective USERNAME. -A : Append rule to given table/chain -I : Insert rule to head of table/chain For example, my oracle user id is 1000 so I wil...
How to disable network access for a user?
1,425,403,167,000
I am configuring a REDIS server and I want to allow connections only from a set of specific IP addresses. This is a Debian 10 server, and the recommended framework to use is nft, which I haven't used in the past. The default ruleset is this: #!/usr/sbin/nft -f flush ruleset table inet filter { chain input { ...
In case someone else stumbles upon the same issue, my main problem was that I was using rules in the incorrect order. I was adding a drop rule before the accept rule, and this seems to work the other way around. This is a sample rule for dropping all IP addresses except 2: ip saddr 1.1.1.1 tcp dport 6379 accept ip sad...
nftables allow redis only from specific IP addresses
1,425,403,167,000
Problem: I have two web applications which were created by using JAVA and PYTHON respectively. The JAVA application runs using Tomcat server on the port number 8000. The PYTHON application uses web.py and runs on the port number 8080. The Python (API) performs a back-end job and Java (UI) acts a front-end guy. In my...
The standard solution for this is to use a front-end server which dispatches the requests to the appropriate “real” server, typically based on the host name. This is called a reverse proxy. Nginx is very often used for that. Start with the tutorial. Here's how the configuration (/etc/nginx/nginx.conf) of a reverse pro...
Two web servers running in one linux machine?
1,425,403,167,000
Linux box a is connected to a home DSL line with dynamic DNS registration, hosting a tmux session to which multiple clients connect in read-only mode over SSH. All users connect using the same credentials: user b. Example: ssh [email protected] tmux attach -t screencast It all works fine but I have had a user do "nau...
I don't completely understand your requirements: which machine are the users to be jailed on? Can they do anything that doesn't involve the network? Nonetheless I think I can tell you what the necessary building blocks are. To restrict a user to specific network connections, see How to restrict internet access for a p...
How to "jail" a user account's network capabilities on Linux?
1,425,403,167,000
At the moment I'm using a Python script to generate iptables rules. Each set of changes gets committed to a git repository before deployment so there's a trace of who changed what and why. What tools/processes do other people use to manage changes to their firewall rules? Is there a guide on best practice for firewall...
You could use a higher-level software that generates iptables rules, like shorewall. It has a command 'shorewall check' that checks the consistency and errors in your rules.
Firewall change control
1,425,403,167,000
I posted a question on ServerFault about a specialized Firewall setup, but as an avid software developer I am also considering rolling my own. I am only interested in using a high-level language, preferably Java or Node.JS. Is there some system for Linux or Illumos that will take all network packets, and provide them ...
On Linux-based platforms there is a netlink socket that you can open from your Java program and determine whether or not to accept the packet. This socket can be included in the network stack with an iptables rule. Here of course you can also limit the types of packets to be passed to your usermode filter. Here's what...
Build my own firewall, in Java or other high-level language?
1,425,403,167,000
Does iptables -I INPUT -j ACCEPT open all ports?
This will accept all traffic that is inbound and destined for this computer; all ports, all protocols, all users, all states. Remember that port isn't the only thing you have to think about when writing a firewall on a Linux System. Any traffic that is outbound or destined for another computer may have different rules...
What does this iptables command do?
1,425,403,167,000
I am using Linux at home and want to be able to configure firewall. I would like to understand what I am doing not just copy paste some rules from internet :).
If you want to really understand what you are doing, you've got your work cut out for you as iptables is massively complex: frozentux iptables tutorial. This is a highly recommended tutorial (it's free). If you're willing to break a few bucks: http://www.amazon.com/Linux-Firewalls-3rd-Steve-Suehring/dp/0672327716
Recommend a reading for learning Linux firewalls configuration for beginner? [closed]
1,425,403,167,000
I was trying to setup the firewall settings, and probably did something wrong. I don't have internet now unless I stop iptables service I tried flushing,and accepting everything sudo iptables -F sudo iptables -P OUTPUT ACCEPT sudo iptables -P INPUT ACCEPT But I still cannot access internet. if I stop the service, sud...
The iptables command per default only shows entries of the filter table. But there are also other tables: There are probably some entries in the nat table. Add -t nat to your commands to look at them.
No internet even with iptables ACCEPT all
1,425,403,167,000
My company PC is behind the firewall, I want to connect to my remote server. The port is open however I can not connect to it, does anyone know the root cause? From my company PC connect to my remote server: # telnet my-server 2221 Trying x.x.x.x... Connected to my-server. Escape character is '^]'. ^C^C^C # nc -vzw5 ...
debug1: Connection established. [...] debug1: identity file /root/.ssh/id_ecdsa-cert type -1 ^C When a client connects to an SSH server, the first data exchange is that the server and client send their version strings to each other. The OpenSSH client normally logs this immediately after the list of identity files, f...
Port is open but I can't ssh to it
1,425,403,167,000
My SMTP server is being probed. It looks like a brute force attach on SASL, where they're going through a password dictionary. Having seen thousands of these lines in the log files Sep 18 14:09:52 xxx postfix/smtpd[7412]: connect from ca255.calcit.fastwebserver.de[146.0.42.124] Sep 18 14:09:55 xxx postfix/smtpd[7412]:...
Postfix doesn't evaluate the smtpd_client_restrictions until the RCPT TO (or ETRN) command is sent. http://www.postfix.org/SMTPD_ACCESS_README.html#timing Current Postfix versions postpone the evaluation of client, helo and sender restriction lists until the RCPT TO or ETRN command. This behavior is controlled by the...
Why doesn't Postfix reject a specific client's connection attempts?
1,425,403,167,000
Is there an infographic somewhere that describes the logical flow of iptables? Specifically, I'm looking for something that diagrams which point in the process ip_conntrack applies.
This netfilter diagram (svg) seems to fit.
iptables infographic
1,425,403,167,000
I run nginx on my local machine to dispatch to various internal applications that I use quite a lot. nginx makes it easy for me to give the applications easy local aliases. The problem is that the applications serve up very sensitive information, and so I would like to not have nginx listening on any of my public inte...
So, it turns out that while nginx will listen to all interfaces, enabling nginx does not actually open up the port on the firewall. In my original test, I opened the firewall port, then accessed the service from a remote machine. This was my control test to verify that the service was truly accessible. Then I closed t...
How can I enable nginx on nixos for localhost only?
1,425,403,167,000
I'm using an iptables firewall on my local Linux server. The log tells me that there is a continuous multicast on the network by my router (Fritz box). Is this a normal behaviour. Should I allow this traffic? [633912.348130] IPTables Packet Dropped: IN=enp3s0 OUT= MAC=01:00:5e:00:00:01:xx:xx:xx:xx:xx:xx:xx:xx SRC=192....
This is IGMP traffic, which unless you know why you'd want it, can be safely ignored. The 224.0.0.1 multicast subnet is defined as being for all hosts on the network segment. (See Notable IPv4 multicast addresses (Wikipedia).) Protocol 2 (See List of IP protocol numbers (Wikipedia)) is IGMP, the Internet Group Managem...
Continuous multicast traffic from my router
1,425,403,167,000
I made default policy of my machine- iptables -A INPUT -j REJECT #DROP ALL PACKETS TO INPUT CHANNEL INPUT channel has been blocked. Now I want to allow only some specific services like I should be able to access the internet. So what rule should I add? Port 80 is for HTTP so I tried allowing that port by iptables -A ...
iptables rules are sequential, meaning the first rule they hit that matches gets executed. rules like ACCEPT, DROP, and REJECT are terminal, meaning the packet will not proceed further into the chain.-A means append. So what you've done is match everything and REJECT it # everything stops here accept tcp port 80 # we...
iptables rule to allow access to internet
1,425,403,167,000
I used to use a linux software that monitors logs like http, ssh, etc and if it detects that someone is trying to use brute force, it blocks that ip by adding a rule to iptables. I forgot what that software is called. It's opensource and free.
fail2ban does that, although I don't think it's the only such tool. (Amazed mentioned DenyHosts, although it seems to be SSH specific.)
Linux App that monitors log and add rules to iptables
1,425,403,167,000
I have an old Dell Dimension with two ethernet cards, and I need to turn it into a firewall. I've tried FireStarter and IPCop, but I don't think I'm setting them up right. Here's the setup that I'm trying to accomplish: I need to have one ethernet card plugged directly into the modem, and the other ethernet card plug...
for sheer ease of use, I can recommend Smoothwall. I used it many years ago, and it was great then. Just install it following the prompts, and you're done. Of course, you can tweak it and fiddle with it if you want to, but you probably won't need to unless you have unusual requirements. It's very good. :)
Turning an old computer into a network firewall
1,425,403,167,000
I am running an Apache web server on a desktop machine running Trisquel 8 (based on Ubuntu). I would like to make the server accessible to other machines/devices on my local network, but I can't figure out how. When I try to connect from another device, using the local IP address of the Apache server, I get error mess...
When I try to connect from another device, using the local IP address of the Apache server Please post the output of ip addr (or ifconfig) command run as root on the server Please indicate which exact local IP address you tried to connect from other devices at that time. Please indicate the LAN IP address of each o...
Unable to access Apache webserver from local home network
1,425,403,167,000
I want to use ULOG and send firewall logs to ulogd2 iptables -A INPUT -i eth0 -j ULOG gives me following error: iptables: No chain/target/match by that name I have these LOG-related options enabled in my kernel: CONFIG_NETFILTER_NETLINK_LOG=y CONFIG_NF_LOG_COMMON=y CONFIG_NETFILTER_XT_TARGET_LOG=y CONFIG_NETFILTER...
ULOG has been deprecated, and if you don't have module ipt_ULOG you should move on to the newer NFLOG target. ulogd handles both of these, even though it is still called "ulog". Check out man iptables-extensions.
iptables: No chain/target/match ULOG
1,425,403,167,000
I am building a router with a RPi (Raspbian). It has 3 network interfaces: eth0: Connected to the Internet (IP/Gateway from DHCP) wlan0, wlan1: local WLAN interfaces (each serving its own SSID as AP) Moreover a have a VPN connection tun0 to a remote network, which is connected to the internet itself. Now I want: al...
You need to create a second routing table and use policy based routing. Applied to your case you need to: Setup the first default route using the main routing table. This table will be used for the traffic generated locally and for the traffic from wlan1 : ip route add default via <gateway_reachable_by_eth0> table ma...
Configure two Routers on one Device
1,425,403,167,000
I'm running FreeBSD 10.3 p4 and observed some strange behavior When restarting the machine pf starts due to /etc/rc.conf entry # JAILS cloned_interfaces="${cloned_interfaces} lo1" gateway_enable="YES" ipv6_gateway_enable="YES" # OPENVPN -> jails cloned_interfaces="${cloned_interfaces} tun0" # FIREWALL pf_enable="YES...
The problem here is that /etc/rc.d/pf runs before /usr/local/etc/rc.d/ezjail, so the kernel hasn't configured the jailed network by the time it tries to load the firewall rules. You might be tempted to alter the pf script to start after ezjail, but that's not a good idea - you want your firewall to start early in the ...
Freebsd: pf firewall doesn't work on restart
1,425,403,167,000
I've got a raspberry pi set up to send me periodic emails. As it's connected to the internet 24/7, I need IPTables set up properly. I want to allow incoming SSH and allow emails to send out on port 587 via SMTP. I've came up with this IPTables script, is it correct? If not, can you tell me why. Thanks. sudo iptables -...
A iptables rule like this works fine *filter :INPUT DROP [0:0] :FORWARD DROP [0:0] :OUTPUT ACCEPT [1:156] -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 587 -j ACC...
How can I allow SSH and SMTP only using IPTables?
1,425,403,167,000
so... we know that we can test that if a port is open on the firewall with: telnet SERVERIP PORT ..but afaik there are services that can't be tested with telnet, because ex.: telnet doesn't know that protocol that the service is using, and telnet will report that the port is closed, but in reality the service is up&...
On the first question, maybe the service does not wait for interactive input. There could be other explanations, too. On the second, nmap can be used to test the firewall. There are many options. Scan the first 1,000 ports (default): nmap -v -A -PN hostname.domainname.com Or perhaps a specific range: nmap -v -A -p 1...
What to use for firewall testing (port opened or not)
1,314,836,079,000
I recently enabled IP Forwarding on a production web server that also acts as a VPN server. What, if any, security issues did I just set myself up for? And are there any iptables rules I should set up to limit forwarding to my VPN tunnel?
You will only have security issues if your server gets compromised. Anyone/thing that gets into your server will have access to machines on your network, as if it was the server (your machines probably trust your server). You should definitely have some iptables rules! Basically you want iptables to block everything f...
Security with Kernel IP Forwarding Enabled
1,314,836,079,000
When using the iptables recent module, I can see the module settings here: $ ls -1 /sys/module/xt_recent/parameters/ and list setting for particular parameter: $ cat /sys/module/xt_recent/parameters/ip_list_tot 100 I also know I can change the defaults when loading the module. My question is, what happens when the l...
After reading (very fast) the source code, I would say that the older entry is removed: if (t->entries >= ip_list_tot) { e = list_entry(t->lru_list.next, struct recent_entry, lru_list); recent_entry_remove(t, e); } To increase this value, you can set the parameter while loading the module manually: ~$...
settings for iptables "recent" module
1,314,836,079,000
I have 2 Servers and the network looks like this: Server_A (Ubuntu) -> Firewall/Router -> Internet Server_A can connect to any server on the internet. Server_B (Ubuntu) which is directly connected to the internet. No restrictions in port forwarding or any Firewalls on Server_B I can't connect to Server_A from the in...
If you can run a ssh server on Server_A, the you can ssh from Server_A to Server_B and have a port on Server_B forwarded back to Server_A's ssh server. Server_A$ ssh -R 12345:localhost:22 Server_B Password: Server_B$ And then on Server_B you can now ssh to Server_A by using localhost on port 12345: Server_B$ ssh -p ...
How to connect to a SSH server behind a firewall using another server?
1,314,836,079,000
I have two desktops and a laptop running Arch Linux. I have not setup any iptable rules on any of the machines, and I am curious if I should. One desktop is only used in my home network and is "protected" by a cheap cable modem/router/firewall that is essentially unconfigured and unmaintained (I changed the default pa...
Whether or not to use iptables is ultimately up to you. You have to look at what it's capable of and what you want it do to. At a very high level, iptables can do 3 things very well: Filter inbound network traffic Filter outbound network traffic Log traffic Typically, configuring iptables is unnecessary on systems...
Does IP tables need to be configured or is a stand alone firewall sufficient?
1,314,836,079,000
I need to ensure on my server that maximum new ssh connections per minute are not more then 5. sudo /sbin/iptables -A INPUT -p tcp --syn --dport 22 -m connlimit --connlimit-above 5 -j REJECT Above IPtables rule work for me, but it will not allow new connections after one minute. Any pointers how to achieve this?
Add --reject-with tcp-reset so that the rejected connections get closed gracefully otherwise you're going to have a bunch of SYN_WAITs sitting around. sudo /sbin/iptables -A INPUT -p tcp --syn --dport 22 -m connlimit --connlimit-above 5 -j REJECT --reject-with tcp-reset
IPtables : Limit number of new ssh connections per minute
1,314,836,079,000
GoogleBot is hitting my server hard - and even though I have set the CrawlRate in Webmaster Tools it is still hiking up the load on my server and slowing down Apache for the rest of the normal web traffic. Is it possible to limit / rate-limit connections per second / minute using UFW based on a user agent string? If n...
You cannot do this with ufw directly, but you need to add the right iptables rules to /etc/ufw/before.rules. I suggest you to learn iptables. As a (not optimized) starting point something like -A ufw-before-input -p tcp --syn -dport 80 -m recent --name LIMIT_BOTS --update --seconds 60 --hitcount 4 --rcheck -j DROP -A...
Can I limit connections per second for certain UserAgents using UFW?
1,314,836,079,000
I have a box running a fresh install of Fedora 15. I've installed TigerVNC server on it and client on my Windows machine. I've added -A INPUT -m state --state NET -m tcp -p tcp --dport 5900 -j ACCEPT to /etc/sysconfig/iptables then, added to /etc/sysconfig/vncservers: VNCSERVER="1:UNAME" VNCSERVERARGS[1]="-ge...
The "1:user" tells the vnc server that the username user is map to display 1, so the port number to access this user via vnc is 5901. Note: "By default, VNC uses ports numbered 5900 plus the display number. In this example, the display is 1, so the port number is 5901.
Problems setting up TigerVNC and firewall
1,314,836,079,000
A few months ago, I migrated the firewall of a debian laptop from iptables to nftables, using debian's recommended procedure, and all seems to have been fine. Now, months later, I'm scrutinizing the rule-set created by that migration procedure, trying to learn the nftables syntax, and see what seem to be several count...
No, the explanation is much simpler: the counter statement has optional arguments packets and bytes which display the number of packets and bytes counted by the counter when a packet reached the rule where it was. Without filter before the counter, any packet (including on loopback) will thus increase the values so it...
firewall: nftable counter rules
1,314,836,079,000
I have two CentOS 7 boxes, called Turbo and Demo. I started a daemon/service on the first one, Turbo, and wish to call the service from the second one, Demo. I started the service to monitor port 8081. Another daemon uses port 8080, so I thought to use the next port, 8081. Neither box has the firewall daemon, Firewall...
This is the problem -- your netstat output shows the service listening on localhost instead of an externally-accessible IP: 127.0.0.1:8081 Edit the service to listen on an (or 'any') IP and restart it.
Connection refused on port 8081 using curl
1,314,836,079,000
Say there are several iptables scripts (run at boot time), all of which run something like iptables -A ... to add rules. I'm thinking this could be improved, turning all those shell scripts into text files generated by iptables-save. But I must be doing something wrong, trying to read all those rulesets. The script ru...
The --noflush option for iptables-restore doesn't work for user-defined chains, such as TESTCHAIN, only builtin chains. Your best bet is to consolidate all of the TESTCHAIN rules into a single file and import that ruleset using iptables-restore. You could find all the rules with something along the lines of: egrep -...
How to combine iptables rulesets
1,314,836,079,000
I am currently testing netfilter / nftables / nft. As a starting point, I have made a ruleset that drops nearly everything in and out, and have written the rules so that every dropped packet is logged. As always, and as it probably has to be, I don't understand the very first thing the machine tries to do and that I n...
This is a bug in Netfilter's ARP logs. There was a bug report about this problem. It was discovered that ARP didn't log using the correct data (it used data from link layer header instead of ARP's network layer). A patch was committed to fix this a few days later and appeared in kernel 5.19: netfilter: nf_log: incor...
What are ARP hardware type 37, opcode 21 and protocol type 0x90bd?
1,314,836,079,000
Current system: Distro: Ubuntu 20.04 kernel: 5.4.0-124-generic nft: nftables v0.9.3 (Topsy) I am new and learning nftables, Here is my nft ruleset currently: $sudo nft list ruleset ...
The wiki says what you tried is not yet implemented: You have to obtain the handle to delete a rule. The example is: $ sudo nft -a list table inet filter table inet filter { ... chain output { type filter hook output priority 0; ip daddr 192.168.1.1 counter packets 1 bytes 84 # hand...
How do I delete a specific element in a chain in nftables?
1,314,836,079,000
In Linux, you can do NAT port redirection with a command like this: iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8000 What is the equivalent with BSD's PF?
You can do it like this with Packet Filter : pass in on em0 proto tcp from any to any port 80 rdr-to 192.168.1.20 port 8000 Change em0 with your network interface, and change the IP address to suit your needs. Read more : http://www.openbsd.org/faq/pf/rdr.html#filter
How do you do NAT port redirection with PF?
1,314,836,079,000
I'm trying to properly setup the firewall on my gateway (OpenBSD 4.7) using pf to allow amule (on 10.0.0.104) to operate properly as discussed here: Now I know pf has changed a bit from OpenBSD 4.7 to 4.9 with some of the rules being rewritten and I believe the '->' symbol is no longer used with port forwarding. So my...
You want the first set. Regarding the OpenBSD documentation you can consult the man page for the most accurate info, if you don't have them installed you can get them from OpenBSDs site: http://www.openbsd.org/cgi-bin/man.cgi?query=pf.conf&apropos=0&sektion=0&manpath=OpenBSD+4.7&arch=amd64&format=html They keep all v...
Setting up the firewall for amule on OpenBSD 4.7 gateway
1,314,836,079,000
I would like to limit number of connection to some ports. for example: I would like to allow just 2 connection for ports between 2300 to 2500 on my server. But I don't know how can I do that using iptables. Is there need additional software? Any suggestion?
You can do this with nftables, using kernel >= 4.18 (tested here with kernel 5.3) and nftables >= 0.9.1 for its connlimit's count feature (and the dynamic flag used here). It's more flexible than iptables's connlimit because you can choose, when creating the meter set, the selector(s) and masks on which the limit will...
How to Limit Number of connection to specific port in linux?
1,314,836,079,000
I am seeing journal entries such as the following, which appear at regular 4-second intervals: Jan 22 19:31:00 tara kernel: OUT-global:IN= OUT=enp3s0f2 SRC=fe80:0000:0000:0000:56e4:c37c:30cc:668f DST=ff02:0000:0000:0000:0000:0000:0000:0002 LEN=48 TC=0 HOPLIMIT=255 FLOWLBL=158870 PROTO=ICMPv6 TYPE=133 CODE=0 Jan 22 19:...
As mentioned in FireHOL IPv6 Setup, add the following to the top of your firehol.conf: ipv6 interface any v6interop proto icmpv6 client ipv6neigh accept server ipv6neigh accept client ipv6mld accept client ipv6router accept policy return
Prevent dropping of IPv6 Router Solicitation (Type 133) packets
1,314,836,079,000
I just got a new dedicated server with CentOS and I'm trying to debug some network problems. In doing so, I found over one thousand iptables entries. Is this the default on a CentOS system? Is there some firewall package that might be guilty of doing that?
Is this the default on a CentOS system? No. The default one is below. Is there some firewall package that might be guilty of doing that? Probably. You don't say what the entries are but if they're banning CIDR blocks I'd guess your server has a firewall like APF or CSF that can subscribe to blacklist like Spam...
1000 iptables entries on CentOS?
1,474,297,842,000
I've installed a server (WSO2 ESB) in my laptop. When I run it, going to the browser and typing the console address https://10.13.6.75:9443/carbon, it works normally, but if I try it on another machine on the network, it gives timeout. Some observations: ping works telnet respond on ssh port (22) but not in 23, 8080...
Fedora 19 uses the firewall firewalld.service. You can see if it's running from a terminal using this command: $ systemctl status firewalld.service firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled) Active: active (running) since Sat 2014-...
Fedora 19: can't disable the firewall
1,474,297,842,000
I have an excellent book called "Linux Firewalls: Attack Detection and Response" by Michael Rash. I have a few questions before I begin. I want to make an enterprise grade iptables Firewall and was wondering if I will need to do my own kernel compilation like it says in the book or nowadays is it ok to just download...
As for firewalls, I would be worried where they are placed, your Internet speeds, and how much rules you need on them. They can pretty much dictate the kind of hardware you will need. Be aware for more performance/higher speeds, you may need better NIC cards. In the past, I used top tier Intel Pro cards. About router/...
IPtables installation question
1,474,297,842,000
I am curious if using negative vs. positive matching impacts the performance of the netfilter stack. e.g. is iptables -I INPUT -p tcp -s 192.168.0.0/16 -j DROP equivalent to iptables -I INPUT -p tcp !-s 192.168.0.0/16 -j ACCEPT in terms of performance? I have been told that negative matching might yield far worse per...
My first instinct is that in your example the cost and complexity of your rules is identical and which is better is as much personal preference as anything else. The inversion generally is not more complex as a matching rule in netfilter. The general consensus seems to be that the number and ordering of rules is much ...
Does negative vs positive matching impact firewall performance?
1,474,297,842,000
I am trying to setup a Transparent Firewall using ArchLinux. My setup looks like this: (ISP, IP: 10.90.10.254) \ \ \ (eth0-> ip: 10.90.10.1 gateway: 10.90.10.254) +-----------+ | | | PC | |(as server)| +-----------+ \ (eth1-> ip: 10.90.10.100) \ ...
To accomplish that, you need to put eth0 and eth1 into bridge mode on the PC and give 1 ip to the bridge interface (not on the individual eths) Here are the basics about bridging on linux, to get started http://www.tldp.org/HOWTO/BRIDGE-STP-HOWTO/index.html Depending on your distro there might be a faster/better way t...
How to setup transparent firewall using ArchLinux
1,474,297,842,000
I am curious if most Linux distros make it possible to intercept incoming network traffic as soon as it enters the system and filter its content based on some rules before any other client can use it or at least before it gets to a specified client. E.g., let's say I wanted to have a filter that intercepts all HTTP tr...
You need to Content-filtering not Packet-filtering . Packet filtering : Working on Port, IP, layers , redirecting , icmp, udp, and other necessary protocol. Content Filtering: Suppose you have a packet and it have a payload such as sex term.you need to drop it. Content filtering softwares: Dansguardian , SquidGuard, H...
Packet analyzer to intercept and filter incoming traffic before any client app
1,474,297,842,000
I have an OpenBSD 5.2 box what's running a webserver on port 80 and an SSHD server on port 2222. How can I configure OpenBSD's pf to only allow connections from given countries to port 80 and 2222?
Short answer: The Internet Doesn't Work That Way Longer answer: IP address blocks are not neatly demarcated per country. As far as IPv4 is concerned, the parent organization IANA allocated (past tense -- they're out of blocks) address blocks to the various NICs, which operate in very wide regions as you can see here. ...
How to configure OpenBSD pf to only allow inbound from given countries?
1,474,297,842,000
I have an Ubuntu 11.04 server in a remote location on another continent, so I have no physical access to it. I only interact with it by ssh (and scp), and intend to only ever interact with it that way. For security purposes, I want to ensure that absolutely all ports on the server are closed, except for ssh. My unders...
First write a little script to flush the iptables rules: #!/bin/bash echo "Stopping firewall and allowing everyone..." iptables -F iptables -X iptables -t nat -F iptables -t nat -X iptables -t mangle -F iptables -t mangle -X iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT (You probably d...
How do I shut down ports remotely without shutting myself out?
1,474,297,842,000
I am seeing some log enties that look like hacking attempts Type 1 Dec 26 03:09:01 ... CRON[9271]: pam_unix(cron:session): session closed for user root Dec 26 03:17:01 ... CRON[9308]: pam_unix(cron:session): session opened for user root by (uid=0) Type 2 Dec 26 03:27:11 ... sshd[9364]: pam_unix(sshd:auth): authentica...
As already mentioned, the first type does not come from any SSH related stuff, its an activity log of your cron deamon and this is not harmful, but usual. The second one might be login attempts from a hacker, and these should be followed. denyhosts might help you, but disabling the possibility for root logins is also ...
Making sense of auth log
1,474,297,842,000
The ip6tables command accepts icmp and icmpv6 protocols: $ sudo ip6tables -A INPUT -p icmp -j ACCEPT $ sudo ip6tables -A INPUT -p ipv6-icmp -j ACCEPT However, when I test with the ping6 command: $ ping6 fe80::a00:1234:1234:1234%eth1 I never hit the icmp rule: Chain INPUT (policy ACCEPT 133 packets, 13501 bytes) ...
The protocol is just a number: $ grep icmp /etc/protocols icmp 1 ICMP # internet control message protocol ipv6-icmp 58 IPv6-ICMP # ICMP for IPv6 These numbers share the same "namespace": Internet Procol, some protocols are common, eg: UDP (17), TCP (6), SCTP (132), but others are not, especially whe...
How do we access the "icmp" protocol in ip6tables?
1,474,297,842,000
I need to script some Iptables rule changes involving NAT rules (-t nat) on Ubuntu 16 servers. It seems like the common way to drop a rule using -D [rule here] does not work with the -t identifier... I really do not want to complicate the scripting by having to identify which rule in my chain I'm looking for and get i...
Given any rule with -I (insert) or -A (append), you can repeat the rule definition with -D to delete it. For your particular example, this will delete the first matching rule in the OUTPUT chain for the nat table iptables -t nat -D OUTPUT -p tcp -o lo --dport 3306 -j DNAT --to-destination RMT_IP:3306
iptables - Drop NAT rules based on rule/name, NOT rule number
1,474,297,842,000
I have two machines A and B which are in different subnets, both behind separate firewalls. Machine A can see B, but B cannot see A. I have a user account (non-root) on both machines, I can SSH B from A, and I would like to be able to SSH A from B instead, but that cannot be done directly. I have used tunnelling to ...
The short answer is yes you can, the how is: machine-A$ ssh -R 127.0.0.1:2222:127.0.0.1:22 [ip__or_name_of_B] Then on B you can ssh to A with: machine-B$ ssh -p2222 127.0.0.1 This says the following: On A create a tunnel on the remote side (-R), such that any traffic that goes to localhost (127.0.0.1) on port 222...
"Reverse" an SSH connection from destination to target [duplicate]
1,474,297,842,000
I've got netatalk running as an AFP server so I can make Time Machine backups on my LAN. It works perfectly as long as iptables accepts all incoming traffic on the LAN, but I'm trying to tighten up security on the server, so I set the default iptables input policy to REJECT, and now I need to open up the ports needed...
I opened these ports, and Time Machine backups are now working: afpovertcp mdns svrloc at-rtmp at-nbp at-echo at-zis 1900 To generate the iptables rules I added the following to ferm.conf: # netatalk daemon ports for AFP Time Machine server @def $PORT_TIME_MACHINE = (afpovertcp mdns svrloc at-rtmp at-nbp at-echo at-z...
What ports need to be open for netatalk to work as a Time Machine server on my LAN?
1,474,297,842,000
I've been reading about states in iptables. This page says A connection is considered RELATED when it is related to another already ESTABLISHED connection. What this means, is that for a connection to be considered as RELATED, we must first have a connection that is considered ESTABLISHED. The ESTABLISHED connection ...
No. the http REDIRECT indicates the client that the searched page is now at an other address (maybe in the same host, maybe not). iptables RELATED indicates related connections (usually in parallel, or as reply), and not a new initiated connection.
Is an HTTP redirect considered as a RELATED connection by iptables?
1,474,297,842,000
I have Debian 7, and I want to block all websites in my computer, unless my email, using IPTABLES or others firewall. How can I block all website, include http and https too. How can I do this?
iptables -I OUTPUT -p tcp -m tcp --dport 443 -j REJECT --reject-with icmp-port-unreachable iptables -I OUTPUT -p tcp -m tcp --dport 80 -j REJECT --reject-with icmp-port-unreachable iptables -I OUTPUT -p tcp -m tcp -d youremailsiteIP/32 --dport 80 -j ACCEPT iptables -I OUTPUT -p tcp -m tcp -d youremailsiteIP/32 --dport...
iptables to block all websites
1,474,297,842,000
Is there a GUI to track any socket connection sent to this computer and which program that initiates it? Also if possible track any incoming connection sent to this computer and which program that handles it (as a realtime popup indicator if possible) ? For example: "/bin/x owned by user x tries to connect to x.x.x.x:...
There is old school console tool: nethogs - Net top tool grouping bandwidth per process e.g. run in this manner: # nethogs eth0 NetHogs version 0.8.0 PID USER PROGRAM DEV SENT RECEIVED 11173 user rtorrent eth0 111.001 4.358 KB/sec 13159 user rtorrent ...
Linux GUI to track connections made from/to this computer
1,474,297,842,000
I have a range of ip addresses (10.13.13.10-19) that I want to redirect all outgoing http traffic to an internal webserver. So if someone in that range tried to access any site, the html from my webserver would be returned instead. However, I only want to affect that ip range. What iptables rules do I need on my ro...
You can use the iprange module to match a range of addresses. You want to DNAT the packets to your webserver. iptables --table nat --append PREROUTING --match iprange --src-range 10.13.13.10-10.13.13.19 --protocol tcp --dport 80 --jump DNAT --to-destination 1.2.3.4
Redirect http using iptables for an ip range
1,474,297,842,000
I would like to configure squid in such way, so that only specific (public) ip (reverse proxy), could connect to the server, but I don't know how... can someone tell me how to do this?
In Squid this is done by specifying the public IP address in http_port, and using loopback address for the web server and Apache may be configured like in httpd.conf to listen on the loopback address: Port 80 BindAddress 127.0.0.1
squid (reverse proxy) configuration
1,474,297,842,000
I'm trying to implement a way to prevent network scans from my notebook. One of the things I want is to allow arp request to specific hosts, like my gateway. I added some rules using arptables and they seem to work (at first) arptables -A OUTPUT -d 192.168.1.30 -j DROP arptables -A INPUT -s 192.168.1.30 -j DROP This...
I'll complete OP's setup: address 192.168.1.38/24 on eth0 and a gateway (not really needed) 192.168.1.1. If the setup uses Wifi rather than actual Ethernet, the first method (bridge) won't be available without additional efforts (probably easy if Access Point, very difficult to impossible if not AP). nmap uses a pac...
arptables not working with nmap
1,474,297,842,000
I have the following in nftables.conf: table inet nat { set blocked { type ipv4_addr } chain postrouting { type nat hook postrouting priority 100; policy accept; ip daddr @blocked counter drop; oifname "ppp0" masquerade; ...
The nat hook (as all other hooks) is provided by Netfilter to nftables. The NAT hook is special: only the first packet of a connection is traversing this hook. All other packets of a connection already tracked by conntrack aren't traversing any NAT hook anymore but are then directly handled by conntrack to continue pe...
nftables Named Set Update Delay
1,474,297,842,000
$ systemctl status ufw ● ufw.service - Uncomplicated firewall Loaded: loaded (/lib/systemd/system/ufw.service; enabled; vendor preset: enabled) Active: active (exited) since Sun 2021-10-03 15:43:42 +03; 1h 30min ago Docs: man:ufw(8) Main PID: 28326 (code=exited, status=0/SUCCESS) Tasks: 0 (limit: 4467...
From original post: What does status "active (exited)" mean for a systemd service? State active (exited) means that systemd has successfully run the commands but that it does not know there is a daemon to monitor. If you're using ufw, you can check if you're firewall is active with sudo ufw status ufw is a tool for...
Is my firewall configured OK?
1,474,297,842,000
I'm trying to connect to a FTP server behind a firewall that allows incoming connections in the range 6100-6200 only. I have successfully connected to this server using curl like this: curl --ftp-port :6100-6200 --list-only ftp.server But I'd like to reproduce the behaviour of this curl command with other clients tha...
When you use FTP in passive mode, the server tells the client which (server-side) data port to use. The well-known FTP protocol includes no way for the client to express requests on which port range to use at the server end. There could be some extensions that could change that, but those are not necessarily widely su...
Setting which ports to use for passive FTP connection with Linux's ftp client
1,474,297,842,000
I'm try to open port using firewall-cmd but I get error ModuleNotFoundError: No module named 'six'. I'm try to reinstall six using easy_install, pip, pip3 and pip3.6 but it not work. os: centos 8 python: 3.6.8 pip 20.1.1
first of all this issue happen due to python setuptools issue , by mistake or intentionally you upgrade it , and then after upgrade i think you reinstall six module by you or one of the libraries , what happen it will not install it correctly after upgrade in the correct path all you need is to run this command , it w...
firewall-cmd (ModuleNotFoundError: No module named 'six')
1,474,297,842,000
I am trying to build a simple stateful firewall with nftables following the Arch Linux nftables guide. I posted this question on the Arch Linux forum and never received an answer. After completing the guide and rebooting my machine, systemd failed to load the nftables.service. To troubleshoot the error I ran: systemct...
This was a syntax limitation of nftables 0.7 (or a few other versions): it didn't consider ICMP and ICMPv6 directly usable in the dual IPv4/IPv6 table inet without stating explicitly which IP protocol first: So the rule: icmp type echo-request ct state new accept to work both on IPv4 and IPv6 has to be written twice ...
Nftables configuration error: conflicting protocols specified: inet-service v. icmp
1,474,297,842,000
I am using a box running Arch as my router and firewall (with shorewall). Recently, I tried to add another network onto the system, which failed horribly. After putting everything back where it was before this, and confirming that everything is exactly the same, I am having some issues with routing from my internal ne...
I've done something like that on an Arch server. The server had enp4s8 as the "external" network, and wlp1s0 as the "internal" network. enp4s8 had a statically-defined IP address of 10.0.0.3, and a default route to 10.0.0.1, the DSL modem. /usr/bin/ip link set dev wlp1s0 up /usr/bin/ip addr add 172.16.0.1/24 dev wlp...
Add route from internal network to external network
1,474,297,842,000
I need to add some firewall rules in our QA environment using iptables. I have to do the changes remotely . Some of the changes also include disabling SSH for few Networks . What are best practices I can follow so that if SSH service is somehow get blocked , how can I restore my access back without rebooting the host...
That's what iptables-apply is for. From the man page: iptables-apply will try to apply a new rulesfile (as output by iptables-save, read by iptables-restore) or run a command to configure iptables and then prompt the user whether the changes are okay. If the new iptables rules cut the existing c...
Best practises: Applying iptables firewall rules for SSH
1,474,297,842,000
I've installed Postgresql 9.4 on Ubuntu Trusty from the PGDG ppa. I've created a database and set it listen-addresses to '*'. I've made an entry in the pg_hba.conf file. I can connect locally with no trouble. Here is the entry from my pg_hba.conf: host all tarka 192.168.0.0/24 md5 The problem is that the por...
Just noticed in your question you have 'listen-addresses' with a hyphen - the documentation has an underscore ('listen_addresses')
ufw won't allow connections to port 5432
1,474,297,842,000
I'm trying to mark traffic, How shall I write following code in terms of IPtables? /ip firewall mangle> add chain=prerouting src-address=10.1.1.1/32 action=mark-connection \ new-connection-mark=server_con /ip firewall mangle> add chain=forward connection-mark=server_con action=mark-packet \ new-packet-mark=server ...
You can translate MikroTik firewall rules to Linux iptables rules pretty easily. The only real difference is that iptables marking isn't quite as pretty, it likes 32 bit flags instead of nice long names, but "1" suffices most of the time. According to the iptables man pages: add chain=prerouting : -t mangle -A PRERO...
How to Mark Traffic using IPtables?
1,474,297,842,000
I want to block intruders via psad, but HTTP and HTTPS should not be blocked. For example, if someone is scanning my dedicated server via nmap, psad should block him for 2 hours, but he should still see the contents from my domain. I set AUTO_BLOCK_TIMEOUT to a value of 7200, so everyone scanning me is completely bloc...
Using SCAN_TIMEOUT I would assume that if psad detects scanning attacks from some nefarious IP address that it wholesale blocks it for the duration of time set in AUTO_BLOCK_TIMEOUT. If you just want to block scanning attacks then from the manual I would say you might want to use this timeout instead: SCAN_TIMEOUT ...
psad: do not block access to HTTP
1,474,297,842,000
I was wondering about the semantics of ipset(8). Is it possible to add a rule matching a set to iptables and then manipulate the set, or can I only create a set and swap it for an older set in order to apply it to an iptables rule matching the name? I.e. can I add/remove to/from an IP set ad hoc, or can I exchange who...
You can add and remove IPs to your already defined sets on the fly. This is one of the ideas behind IPsets: if this wasn't possible, the whole set extension of iptables wouldn't make much sense. The primary goal of ipset was to enable you to define (also dynamically) classes of matches (e.g. for dynamically blacklist...
Do I have to swap IP sets, or can I add/remove on the fly?
1,474,297,842,000
I have a small web server running on port 80, and I'd like to allow only Google Translate to have access to it. First I tried running dig translate.google.com and dig translate.googleusercontent.com to get the IP address for it, which returned addresses ranging from 74.125.234.74 to 74.125.234.110. Then I opened the m...
You can't do this effectively. You aren't going to be able to count on any particular block of IPs for any known length of time. Now, there are a couple of ways of solving your problem. cut&paste what you need to translate into Google Translate. You can use cat file | xclip -i to do this for even a fairly long file i...
Allow incoming connections from Google Translate only
1,474,297,842,000
I have a home server (with slackware 13) with a eth0 for the local network and a eth1 for the internet (cable modem with dynamic ip). While I do want to learn more about iptables I am still on the proccess and I need some rules done and can't until a learn to do it as I dont wish my server to get compromised at this s...
So, basically your Linux box acts as a firewall? First, enable IP forwarding. echo 1 > /proc/sys/net/ipv4/ip_forward echo 1 > /proc/sys/net/ipv4/conf/all/forwarding Then, add some forwarding rules: iptables -A FORWARD -i eth0 -j ACCEPT iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT Secure the FOR...
iptables rule for local network with free internet blocking unrequested connection from internet to server?
1,474,297,842,000
I am building a custom embedded Linux platform based on the NXP i.MX8 with Yocto. I want to use UFW to setup the firewall. When I boot the system and try to use UFW it returns an error Couldn't determine iptables version. I have the iptables and nftables packages installed. I have tried to manually change the itpabl...
You could use strace -f -s 1000 -e trace=file ufw status to figure out which files path are used, you could discover something wrong.
UFW Couldn't determine iptables version
1,614,612,997,000
I'm just getting started with tinkering with Linux / IPTABLES and following this great tutorial here to successfully setup a RaspBerry Pi device (running RaspBerryPi OS / Debian) as a VPN Gateway. Any device on the same network can manually configure their network settings and set their routing to the IP address of th...
Correcting a common misconception: iptables doesn't route. It just controls if routed flows are allowed to proceed or not, but doesn't change their direction (unless using things like NAT which can change the routing fate, still done by the routing stack). That's why the most important thing in the question should be ...
iptables / route for returning incoming traffic back out of originating interface (eth0)
1,614,612,997,000
In setting up dynamic blacklists for nftables, per A.B.'s excellent answer, I'm encountering an error when duplicating the blacklist for both ipv4 and ipv6. I perform the following command-line operation (debian nftables) (EDIT: The original question was for a prior version, 0.9.0; during the back-and-forth comment pr...
try this one table inet filter { set blackhole_4 { type ipv4_addr flags timeout } set blackhole_6 { type ipv6_addr flags timeout } set greed_4 { type ipv4_addr flags dynamic size 128000 } set greed_6 { type ipv6_addr flags dynamic size 128000 } chain input { ...
nftables dynamic blacklisting both IPv4 and IPv6
1,614,612,997,000
This is my /etc/sysconfig/nftables.conf #!/usr/sbin/nft -f flush ruleset table ip filter { chain input { type filter hook input priority filter; policy accept; ct state established,related counter packets 264 bytes 17996 accept ct state invalid drop tcp dport 22 ip saddr 192.168.0.0...
That's the compatibility table and chains created by the newer version of the ebtables command, used to manipulate bridges, but using the nftables kernel API in ebtables compatibility mode. Something ran an ebtables command somewhere, even if just to verify there's no ebtables rule present, or maybe to auto-load som...
nftables changes on reboot
1,614,612,997,000
I enable ufw and I tried to block all the traffic from one server, but I can't. It only blocks ssh, all the other ports are open. I test it with telnet. I want to allow all ports for some IPs, and block all ports if the IP is not there. I have these rules: sudo ufw status verbose Status: active Logging: on (low) D...
Because docker use also other Chains you have to block from DOCKER chain.
ufw & iptables don't block incoming connection
1,614,612,997,000
We run a FreePBX server on our LAN and softphones can register using the local SIP server IP. I need these softphones to be able to register over the internet too so we have configured the firewall and created a dns entry for sip.ourdomain.com. When the softphones are configured to use sip.ourdomain.com then can regi...
What you may need is defining in your infra-structure a split view DNS or multiview DNS architecture. Thus in your internal network, your internal DNS server will resolve sip.ourdomain.com to 192.168.1.8 and externally to the current public IP address. Another alternative is enforcing a public IP address for the SIP ...
Unable to register SIP via WiFi
1,614,612,997,000
I've installed a database on Ubuntu that I'll connect to it from my other server remotely on port 27017. This server I want to use only as a storage for my other server. I requested the host support to block all the connections except from one specified IP. He did, but I still could connect from home. He reasoned that...
You only need to block which the database uses. The more interesting question might be how that is done. iptables -F INPUT # deletes all rules iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT : maybe allow other services here iptables -A INPUT -s $allowed_source_address -p tcp --dport 27017 -j AC...
Reject all connections except from a specific IP
1,614,612,997,000
I am running a cloud service on my Raspberry Pi 3 and want to access it also from outside. Unfortunately, my ISP does not allow me to forward ports (this is another story) therefore I sometimes also need to access it over IPv6. To limit the access on IPv4 I have setup the following rules # /etc/iptables/rules.v4 # Gen...
Ok, it seems that adding the following two rules helped. -A INPUT -p udp -m udp --dport 546 -m state --state NEW,ESTABLISHED -j ACCEPT -A INPUT -p ipv6-icmp -j ACCEPT Here the complete rules.v6 # Generated by ip6tables-save v1.4.21 on Wed May 17 10:14:19 2017 *filter :INPUT DROP [0:0] :FORWARD ACCEPT [0:0] :OUTPUT AC...
How to convert iptables rules to ip6tables rules?
1,614,612,997,000
I use iptables-persistent to set firewall rules. This is my standard configuration: *filter :INPUT DROP [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -p tcp --dport 2123 -m mac --mac-source XX:XX:XX:XX:XX:XX -j ACCEPT COMMIT Problem is I can't download packages from debian servers...
The problem you've got is that you're not allowing any incoming packets. So if you try and reach out to an external server then you can't receive the replies! This, typically, can be handled with an "established" rule -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT The idea, here, is that incoming packets th...
iptables-persistent blocking any outbound connections
1,614,612,997,000
on my linux machine I see the following: iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination but from /...
The rules in /etc/sysconfig/iptables are loaded when the iptables service is started. Since your firewall chains appear empty, there's probably nothing in there. Do not that there could rules set like the nat and raw tables. If you change the rules directly in /etc/sysconfig/iptables, you need to restart the iptables...
linux + iptables + /etc/sysconfig/iptables
1,614,612,997,000
Say that i want to only allow username/password logins on my private network, but restrict all external sources on to key/cert login. I would do something like this: RSAAuthentication yes PubkeyAuthentication yes PasswordAuthentication no Match Address 10.0.0.* PasswordAuthentication yes But is there a way that ...
IP Spoofing, is a technique where the attacker uses a forged IP source address with the purpose of concealing the identity of the sender or impersonating another computing system. However, this kind of attack will be nearly "impossible" from the internet because RFC1918 defines the following blocks that will be used o...
Are there any loopholes in IP restricting sshd?
1,614,612,997,000
I'm not really sure what's going on here. I have the following: A fresh install of Ubuntu 12.04 LTS. Jira 6.1.2 installed as per instructions from Atlassian. Confluence 3.5.13 installed as per instructions from Atlassian. What's happening is that as long as I maintain an active SSH session with the server I can acc...
Do you have an encrypted home directory and JIRA or Confluence depend on files anywhere under your home directory? If so, when you log out, that directory is encrypted and only available again when it's unencrypted after you log back in.
Ubuntu blocks access to services when not logged in
1,614,612,997,000
I am not sure this is a Linux question directly ... I use Arch Linux which uses package signing. This requires me to download a set of pgp keys with the pacman-key program. This works off the presumably more general gpg program. If I can get gpg to work, I am guessing I can get pacman-key working. The error I am getti...
Indeed, there are keyservers that listen on port 80. One such keyserver is hkp://keyserver.ubuntu.com:80. Indeed, pacman-key uses gpg under the hood. You might have tried specifying a keyserver by passing the --keyserver argument to pacman-key. This didn't work for me. You might have tried specifying a keyserver by ...
PGP keyserver and proxy firewall issues
1,614,612,997,000
I have my ssh port changed to XXX. Then I did ufw limit XXX/tcp However, when I try to login, after 5/6 failed attempts I get thrown back to prompt, but I can try again. Is that supposed to be the way it works?
If I understand your description correctly, you're typing ssh myserver.example.com and making a few failed attempts, and getting your local prompt back. That is still one TCP connection, so it counts for one against ufw limit (the firewall doesn't know anything about authentication attempts, it works at a lower level)...
UFW Limit does not appear to work
1,614,612,997,000
I'm running OpenSUSE 11.4. The problem is that I can set easily what to log, but not where to log to. And currently the same logs are written to /var/log/firewall and /var/log/messages. I still want messages to be written into the first one, but not the second one — it is redundant and it is polluting regular system l...
Gilles, no wonder you were puzzled (I wasn't, I just didn't understand the syntax ;-) ), it was a bug: https://bugzilla.novell.com/show_bug.cgi?id=676041 Luckily fixed already.
How to stop firewall from writing logs to /var/log/messages?