/srv/irclogs.ubuntu.com/2020/01/06/#ubuntu-server.txt

=== BenderRodriguez is now known as RobertMuellerDid
=== RobertMuellerDid is now known as BenderRodriguez
=== cpaelzer__ is now known as cpaelzer
SkyriderGreetings all15:05
SkyriderI am in need of some help.. think my firewall, is... kinda? busted. It appears all allow rules in ufw works perfectly fine.. though, the deny/reject doesn't work at all.15:05
SkyriderI used a simple rule to deny my mobile IP to connect to the server, yet I can still load sites just fine.15:06
tewardwe'd need to see your rules you're trying to set up15:07
tewardalso UFW is specifically based on first-match so if your ALLOW rules are before your DROP/REJECT rules it will still allow15:07
SkyriderAnywhere                   DENY        143.179.70.207 - is above the allow rules15:08
tewardand you're *sure* your phone is using that IP actively?  (send your phone to https://ifconfig.co to find out)15:09
tewardif it's NOT when it goes out to the 'net then that's why your rule doesn't work15:09
SkyriderAccording to that site, my mobile is using 143.179.70.20715:10
SkyriderWhich matches with the deny rule.15:10
Skyriderhttps://i.imgur.com/ZCQglP5.png15:11
SkyriderEven when I reload ufw, doesn't make much difference.15:14
teward`ufw status numbered` please - i think you actually do have a rule ordering issue15:16
teward(AND include the headers please)15:16
teward(Because reading that output is pain)15:16
tewardjust want to verify the numerical ordering is right15:16
tewardbecause I just spun a container up with ufw rules, and did an allow rule for SSH but also a REJECT rule for my IP and it puts the SSH Allow above15:17
teward(which is important to note because it will match the 22 ALLOW rule first)15:18
tewardalso make sure your phone isn't using IPv6 if v6 is on your infra15:19
Skyriderhttps://paste.ubuntu.com/p/DhHby6f5F4/15:19
SkyriderNot sure why there are 2x 22'c, I'll erase that later on. But, I do believe the order is correct.15:20
tewardprobably because at one point you specified just port 22 which is any protocol15:21
SkyriderAll reject/denies are above the allowed rules.. so.. I'm, honestly confused.15:21
tewardso am I let me do some poking15:21
tewardwhat's your box's version? 18.04?15:22
tewardjust to make sure i'm testing the right version :p15:22
lordievaderSkyrider: Could you pastebin the output of `sudo iptables-save`?15:23
tewardthat as well15:23
tewardbecause ufw might be doing a weirdness behind the scenes15:24
tewardSkyrider: how're you testing the DENY rule?15:25
tewardout of curiousity15:25
tewardbecause `ping` isn't denied by ufw by default15:25
tewardso you will always get false info from `ping`15:25
teward(just confirmed this in an 18.04 box)15:25
Skyriderya, 18.04 and lemme grab the iptables rules. As testing, using mobile device to check my domains. Should be rejected.15:26
tewardso, accessing it via HTTP and such then15:27
Skyrideryup15:28
tewardahhhhh okay i replicated your issue15:28
tewardI *think* the ALLOW rules get placed in a higher priority in iptables15:28
tewardwhich is stupid15:28
Skyriderhttps://paste.ubuntu.com/p/s8tMkSPzpx/15:29
tewardsomehow15:29
lordievaderI guess it is the ufw-user-input chain15:33
lordievaderLine 9915:33
Skyridernot local?15:34
lordievaderWhich happens before line 60 (reject), due to line 57 calling the ufw-user-input chain.15:34
tewardlordievader: i think there may be other bugs...15:37
tewardperhaps this is because i'm running in a container BUT15:37
tewardwith a REJECT on my IP and an ALLOW on 80 with apache2 installed it still permits me in15:37
SkyriderInteresting fact I just discovered.15:38
SkyriderThe deny/rejection on IP didn't allow my mobile to connect to SSH.15:38
tewardbut did for HTTP?15:38
SkyriderIndeed15:38
tewardi assume *caching* was eliminated as a factor15:38
tewardbecause browsers are evil15:38
teward(my tests are with curl :)15:38
teward(which seem to suggest the HTTP Allow rule takes precedence)15:39
SkyriderOnce I erased my cells IP rule, I was able to connect again.15:39
SkyriderI assumed all reject/deny were systemwide, even for http(s).15:40
tewardthey should be15:41
tewardthis seems like a bug15:41
tewardbut i need to verify somehow15:41
teward(ufw isn't doing logging right even at full levels)15:41
tewardokay i think something's actually odd on your env15:45
tewardbecause I realized I fatfingered a rule on my side15:45
tewardand it's now working15:45
tewardhttps://paste.ubuntu.com/p/H3p6F5PnH6/15:45
tewardand a curl rejects to it15:45
teward(curl doesn't have a cache)15:45
tewardSkyrider: they should be15:46
tewardwhat you aren't doing is verifying if your browser is caching or not15:46
lordievaderIf you want a detailed answer why something went through or not look into the trace functionality of netfilter.15:46
tewardnuke your browser cache15:46
tewardand try again15:46
tewardbecause browsers are NOTORIOUS with caching if you've gone to the page at least once15:46
tewardSkyrider: readd your REJECT rule in the right spot and then erase your browser cache and try again on your phone15:46
tewardchances are it'll reject15:46
tewardand your browser was simply caching content15:46
teward(which is usually the case for browsers)15:47
SkyriderI shall try.. however, would like to add that last week I mentioned that a deny/reject rule I added with ip range kept scanning my sites.15:48
SkyriderWas forced to block the IP range through nginx instead.15:48
tewardhmmm15:48
tewardjust as an FYI15:48
tewardthis is why I don't use ufw15:49
tewardit has some... nuances...15:49
tewardI just control everything via iptables directly :P15:49
tewardufw is nice, but it can be weird and glitchy15:49
SkyriderYa.. I find iptables a bit... complicated.15:49
tewardmost users do unfortunately, hence why they use ufw.15:49
tewardthe problem I find is, ufw does a lot of other 'stuff' with its rules that can be glitchy15:49
tewardand ufw logging is poor :P15:49
jdstrandif there are weird glitchy issues in ufw, please file bugs15:49
tewardjdstrand: you mean like `ufw logging full` not actually logging anything anywhere?  :P15:50
teward(at least, in LXD containers)15:50
SkyriderI re-added the the IP, though no success. Gotta admit, I didn't clean the cache. But I went to forum pages that I never went to before on mobile, even private area's. Wasn't blocked a single time.15:50
jdstrandteward: that isn't ufw's fault. unprivileged containers don't have access to kmsg and that is where the kernel logs15:50
tewardjdstrand: this is a privileged container ;)15:50
tewardand it still can't access15:50
jdstrandagain, that is the kernel, not ufw15:51
SkyriderEven created a new thread on the forums with my mobile :p, you can't cache that.15:51
tewardhmm15:51
tewardlet me spin up a VM15:51
tewardremove the kernel headaches from the equation for testing15:51
weedmicwhy not use iptables, then you can save it to a file and at any time run it to instantly set it the way you want?15:51
tewardand get some niiice auditing to try and replicate this15:51
tewardweedmic: because they find it 'complicated' :P15:51
tewardmost users do15:51
jdstrandlogging is also complicated by journald15:52
jdstrandso depending on the release in the container, there may be some stuff going on with journald15:52
weedmicwell, it's just a language (of sorts) - it's only got like 5 things in it - but I could see that - I find it easier than suse's gui for firewall15:52
SkyriderIf there's something that is similar to ufw (in simplicity), but adds rules as iptables would.. I don't mind.15:52
SkyriderNever had any issues with ufw until a few weeks ago.15:53
* jdstrand also notes that ufw uses iptables-restore syntax under the hood15:53
jdstrand(man ufw-framework)15:53
jdstrandSkyrider: please file bugs if there are issues15:53
tewardwellllllllllll15:53
tewardI was writing a python frontend to `iptables` that does much like what `ufw` does...15:54
tewardbut I got busy/bored/distracted15:54
SkyriderI could report a bug, but need to be sure that this isn't my fault XD15:54
tewardjdstrand: well rsyslogd dumps it to /var/log/ufw.log and that oddly enough works15:54
tewardSkyrider: let me set up a test env with logging, etc. give me a minute then i'll coopt you to do some testing15:54
teward*goes to the Cloud*15:55
Skyrider^_^15:56
jdstrandteward: its gonna depend on what is available in the container, how the container is configured, how logging overall is configured, the kernel, etc. ufw does ship an rsyslog snippet, yes15:56
tewardright15:56
tewardbut this is why i'm going to the Cloud and VMs for a full env15:56
tewardthank you cloud VPS deployment xD15:56
jdstrandbut the imklog15:56
jdstrandmodule from rsyslog might not be able to read the kernel logs15:57
jdstrandso, it can't put it in ufw.log15:57
jdstrandbut again, lots of variables15:57
jdstrandthe container host should still see it though15:58
tewardyep which is why i'm spinning a cloud instance up to test with :p15:59
tewardshould help15:59
SkyriderHopefully with results matching my issue... makes things easier.16:01
tewardjust takes a while to launch xD16:03
SkyriderCloud aint that fast ey16:03
tewardnot as fast as I'd like but I don't use predeployed images :P16:03
tewardI boot the ISOs and deploy my own settings :P16:03
tewardSkyrider: check your PMs I sent you a location to go to16:19
tewardjdstrand: i think we've narrowed it down16:42
tewardbut it's not a ufw bug16:42
tewardit's how their android phone behaves with Internet16:42
teward(everything goes via Google Proxies for some reason)16:42
tewardwhich makes sense if it's using stock Google Chrome on the Android :P16:42
tewardSkyrider: ^16:42
tewardas to why the /16 wasn't blocking I am unsure, because by all intents and purposes it shouold have16:57
tewardcan't rule out proxies at play though16:57
jdstrandteward: oh, interersting. yeah, clouds, their kernels and their logging infra can certainly affect things. good luck tracking it down!17:15
tewardKVM VPS on OpenStack though...17:15
tewardThats full virtualization ;)17:15
setuidNeed some Android Emulator running on top of an instance inside that OpenStack though :D17:18
SkyriderGuess my headless server is busted then17:18
JanCthe "google proxies" = AMP stuff ?17:30
tewardJanC: Not sure, but Skyrider had Google Data Saver on in their Chrome browser17:39
tewardthat was probably a factor17:39
tewardjdstrand: but Skyrider DOES have something wonky up with their environment, even with the rules in the proper places it still allows connections.  Can't rule out caching, but something's up with their system17:52
tewardnot a ufw bug per se, maybe something specific to their config17:52
jdstrandSkyrider: note that connection tracking may be an issue. usually this indicates either other firewall software is installed and is competing with ufw or something is not configured correctly in the kernel. you can run 'sudo /usr/share/ufw/check-requirements' for the latter18:03
Skyriderjdstrand: Command requests to create rules.18:22
Skyriderteward: Does ufw override iptables rules by any chance?18:22
tewardufw *is* iptables rules18:22
tewardit will overwrite any other loaded netfilter rules18:22
teward(which is iptables)18:23
SkyriderThat, I know.. But I noticed ufw lines being used in iptables rule list.18:23
tewardthat's normal18:23
SkyriderMaybe just for naming purposes?18:23
tewardbecause ufw *uses* netfilter/iptables under the hood18:23
tewardit's UFW specifics for how it does its tables/namings/etc18:23
tewardbut it's still ultimately iptables, just a user-friendly frontend to manage the iptables rules18:23
SkyriderMaybe I should try to create an iptables rule denying my own ip address, directly from iptables.18:23
SkyriderRather than ufw.. see if that works.18:23
tewarddisable ufw first, then apply a ruleset similarly.  I can help you write a ruleset as such if you want18:23
tewardufw will overwrite any iptables rules you add18:24
teward(for the record I use iptables exclusively, but i have reasons xD)18:24
SkyriderI assume "iptables -A INPUT -s IP-ADDRESS -j DROP" would work fine. Not sure the order it would add it though.18:24
SkyriderMaybe I should just use iptables, and use aliasses to make it more simpler for me.18:24
teward`iptables -I INPUT 1 -s IPADDRESS -j REJECT --reject-with icmp-host-unreachable` would be more instantaneously identifiable as a truly effective rule18:25
tewardof course with sudo :P18:25
Skyrider^_^18:25
Skyrideroki, ufw disabled.18:25
SkyriderWhat about the order?18:26
SkyriderIs there a command to set the order like ufw? sudo ufw insert x .. etc, etc, etc.18:26
tewardthe rule I provided adds to the top of the list and there's a default ALLOW by default in `iptables`18:26
teward`iptables -I`  - `-I CHAIN INDEX` Insert rule into specified chain at specified index/position18:26
tewardin this case, INPUT is the chain (as expected) and INDEX is 1, meaning top of the chain]18:27
tewardSkyrider: i'd be happy to give you a crash course in `iptables` syntax at some point :P18:28
tewardif it turns out this deny/reject actually WORKS18:29
teward... ops?18:29
tewardooops*18:29
tewardi think they killed themselves... if they did i'll have to help them fix it18:29
* teward reminds himself that ufw can be evil18:29
Skyrider*shrugs*18:36
SkyriderForgot, that it would block me from .. .well, everything18:36
Skyriderlol18:36
SkyriderWas forced to reboot and reset the rules.18:36
SkyriderInteresting fact though that blocking my IP in iptables disconnected me almost instantly from everything.. while if I do the same on ufw, it didn't.18:37
SkyriderSo my guess is.... ufw.. is, busted on my end.18:37
jdstrandteward, Skyrider: actually, ufw will *not* overwrite rules you have unless you specify MANAGE_BUILTINS=yes in /etc/default/ufw, which is not the default18:41
tewardjdstrand: interesting.  so it'll what, append rules?18:42
tdsSkyrider: that depends on where exactly you're adding the drop/reject rules - if they go before a rule using conntrack allowing existing connections, that will terminate all open connections, while after will only make them affect new connections18:42
tewardlast i checked ufw overwrites whatever I put in `iptables` when ufw is disabled18:42
jdstrandteward: no, it works on its own chains that are all prepended with ufw-*18:42
jdstrandteward: this is how it plays well with libvirt, etc which adds their own rules. but something like iptables-persistent or other things that assume they own the firewall can interfere with ufw18:43
SkyriderThe rule I was provided to add in iptables disconnected all my connections.18:43
SkyriderLet me try again, but only adding the web ports instead rather than a global deny.18:44
jdstrandstill, the advice is sound to disable ufw and see if something simple is working18:44
Skyrider"iptables -A INPUT -p tcp --destination-port {PORT-NUMBER-HERE} -j DROP" ?18:45
Skyridererr, no.. lacking ip18:45
tewardSkyrider: `sudo iptables -I INPUT 1 -s IPADDRESS -p tcp --dport 80 -j REJECT --reject-with icmp-host-unreachable`18:45
tewardsame for 443 (though you can replace the index with `2`18:45
tewardand that'll ONLY block traffic matching the source IP address heading to port 80 on TCP18:45
SkyriderThanks :) lemme try18:45
teward(standard HTTP)18:45
tewardmy apologies for fubaring your access, but at least we know THAT worked xD)18:46
SkyriderSimple reboot fixed it XD.. why isn't iptables saved though?18:46
SkyriderWith that, I mean.. saved on reboot ,etc.18:46
jdstrandteward: it depends on how your are disabling ufw. if you disable and do /lib/ufw/ufw-init flush-all or other low level things (or have MANAGE_BUILTINS=yes set), then yes, it will blow stuff away18:46
tewardbecause it's not stored in a file anywhere, ufw when it reenables loads data from stored rules/data and reloads it into netfilter18:47
tewardsimilar to how `iptables-persistent` does the same on boot (but assumes firewall ownership and blasts things apart)18:47
Skyrideroki, I dropped the connection on 80 and 443.. didn't work.18:47
tdsSkyrider: iptables itself doesn't do anything for saving on boot, if you want that you need to install something like the iptables-persistent package18:47
SkyriderWell, it got added.. just didn't block my access on my web stuff.18:47
jdstranddo note that just because ufw doesn't stomp on the rules doesn't mean that rule ordering isn't in play. iptables rules are order-dependent. if the ufw chains are first, then ufw will work, if after, they may not (ie, -A (append) vs -I (insert))18:47
tewardSkyrider: did you use DROP or REJECT?18:48
tewardtest REJECT18:48
tewardinstead of DROP18:48
tewardthis said, DROP should've worked too18:48
tewardSkyrider: is this a VPS?  Is it containerized (LXD, OpenVZ) or full virtual (KVM)?18:48
tewardSkyrider: also, make sure you're actually blocking the right IP (remember the google proxy evil?)18:49
Skyrider    Virtualization: kvm18:49
jdstrandSkyrider: how are you testing the connection? is the traffic going through the interface you expect to be firewalling? did you kill off any connection tracking (eg, sudo conntrack -D ...)18:49
SkyriderNot sure what conntrack is.18:50
jdstrandSkyrider: did you add the rules with -A (append) or -I (insert)?18:50
tewardjdstrand: would that apply even if the first rule were a global matchall?  If they did `-I INPUT 1` like i suggested it'd have put it at first position in INPUT18:50
jdstrandSkyrider: it is also possible there are vps rules that are in front of your added rules18:50
jdstrandI see Skyrider used iptables -A INPUT...18:51
tewardah that might break it18:52
SkyriderCopy/pasted, ya :P18:52
tewardSkyrider: did you use `iptables -A INPUT` or `iptables -I INPUT 1` like i suggested?18:52
SkyriderI copy/pasted your line18:52
SkyriderSo.. with input 1.18:52
jdstrandSkyrider: with INPUT 1, it worked and blocked the connection?18:53
Skyrider-A INPUT -s xxxxxx/32 -p tcp -m tcp --dport 443 -j REJECT --reject-with icmp-host-unreachable - and another line with port 80 according to iptables -S18:53
SkyriderAnd no, it didn't block my web connection.18:53
tewardshow us the `iptables-save` output (Pastebin it please)18:53
Skyridersure18:54
tds`iptables-save -c` ideally :)18:54
teward^ that18:54
Skyrider>_>18:54
teward... ooooooooooops i just broke my own email, stupid firewalls and NAT... *goes to fix*18:55
Skyriderhttps://paste.ubuntu.com/p/49hZ53dx4d/18:55
tewardthe only reason it'd be doing *that* is because your IP(s) accessing the site aren't what we think it is18:56
jdstrandSkyrider: how did you disable ufw?18:56
tewardwhich is what was happening earlier with our tests skyrider18:56
Skyridersudo ufw disable18:56
SkyriderStatus: inactive18:56
jdstrandSkyrider: and you rebooted?18:56
SkyriderReboot kept ufw disabled.18:56
tewardjdstrand: shouldn't the first to input lines (24, 25) have caught regardless if the source IP matching was correct?18:57
teward0:0 suggests that it never triggered/matched on sourceIP18:57
tewardand since those rules are ABOVE the ufw rules, those should be matched regardless of UFW active/inactive18:57
tewardat least per my nf understanding18:57
jdstrandSkyrider: that isn't what a disabled ufw looks like after a reboot18:59
SkyriderDon't look at me XD18:59
jdstrand(if it is disabled, after a reboot, it should have no ufw chains)18:59
jdstrandSkyrider: what release of ubuntu is this?19:00
Skyrider18.0419:00
SkyriderI removed ufw and purged it.19:00
Skyriderufw rules in iptables-save are still there.19:00
SkyriderAt least, the ufw lines.19:00
tewardjdstrand: just ran ufw in the command line in a container19:00
tewardaaaaaaaaaand, the ufw rules are still there when disabled19:00
tewardeven on reboot19:00
jdstrandSkyrider: this is a container?19:00
tewardexcept on reboot*19:00
tewardjdstrand: confirming on a VM currently as well19:01
tewardstandby...19:01
jdstrandteward: ufw disable pre-reboot will leave chains in place, but empty them. on reboot, they won't be added19:01
tewardthat part i confirm19:01
tewardSkyrider: you did `sudo ufw disable` and then restarted the server yes?19:02
jdstrandSkyrider: what is ENABLED set to in /etc/ufw/ufw.conf?19:02
tewardbecause jdstrand *is* right - it won't add those rules if `ufw` was disabled when you rebooted19:02
tdsSkyrider: did you install iptables-persistent or anything similar?19:02
tdsif you did, that may have saved the ufw rules for you19:02
tewardlooks to me more like you just rebooted then did `sudo ufw disable`19:02
jdstrandtds: yes19:02
jdstrandtds: that is often a problem19:02
tds`grep ufw /etc/iptables/rules.v4` would tell you :)19:02
teward(and won't exist if it's not installed or manually created)19:03
* jdstrand is reminded he needs to add iptables-persistent detection to /usr/share/ufw/check-requirements19:03
tewardjdstrand: what's the underlying language for it?19:03
tewardi might be bored enough to try :p19:03
jdstrandpython3 for the ufw command, shell for early boot setup and iptables-restore syntax for rules19:05
SkyriderYa, iptables-persistent is installed.19:05
jdstrandSkyrider: iptables-persistent and ufw do not work well together. choose one or the other19:05
SkyriderI only added it a few hours ago, when I was trying to fix all of this.19:05
tewardremove iptables-persistent and reboot19:06
tewardthen add the `iptables` rule I stated19:06
tewardthis said19:06
SkyriderDo I have to reboot? :P19:06
tewardjdstrand: my previous question stands.19:06
tewardjdstrand: shouldn't the first to input lines (24, 25) have caught regardless if the source IP matching was correct?19:06
tewardbecause of the ordering in INPUT19:06
jdstrandSkyrider: that's fine, but we can only debug what is happening right now19:06
SkyriderOne moment, will disable/enable some services and reboot.19:07
jdstrandteward: yes, they should have19:07
tewardjdstrand: one of the issues we ran into earlier with Skyrider was their device(s) were being routed via Google's Proxies19:07
tewardas a result of datasaver, etc.19:07
tewardwhen we blocekd the IP of their actual address that was in the access logs from the webserver they couldn't get to it19:07
SkyriderThis time however, using my own browser on my main desktop system.19:07
jdstrandteward: so the incoming ip is NAT'd or something? that is going to make a source ip infeasible19:08
SkyriderWait a sec...19:08
tewardjdstrand: there's a few different factors19:08
Skyrideronce I removed persistent, everything started to work19:08
Skyridernvm..19:08
tewardwhen their main computer connected and I blacklisted that in a live system it blocked them19:08
SkyriderJust slow connection XD19:08
tewardbut the tricky part here is that i can't verify what's going on on their main desktop19:08
tewardjdstrand: i also can't rule out Proxy settings at play by ISP or some other VPN or proxy system at play19:09
tewardin which case if they ARE indeed nat'd we'd have some... headaches with that and you're rightw e'd have to ignore source IP as a valid identifier (because NAT breaks it)19:09
tewardcase in point my IP currently, it shows as my home's IP instead of ym work's IP because I'm VPN'd through home, but HTTP Proxies would behave similarly for HTTP/HTTPS connections in some cases19:09
tewardSkyrider: confirm you're still rejected on the test IP I provided earlier as well19:10
jdstrandsudo tcpdump -i <interface name> -s 0 -n -vv port 8019:10
SkyriderNot atm (not on my desktop)_19:10
jdstrandthat will also be helpful on the server ^19:10
jdstrandSkyrider: just for your own debugging. you'll then see the IPs involved19:11
tewardjdstrand: i'd agree with what jdstrand says :P19:11
Skyrider**rebooting**19:11
tewardthen attempt connecting yourself and see the IP(s)19:11
tewardblehrewrherw9re19:11
teward*yawns*19:11
tewardjdstrand: ewwww check-requirements is bash >.<19:14
teward /bin/sh *19:14
jdstrandoh your question was about that. yes, shell19:14
tewardone of my more hated languages19:14
tewardbehind Ruby and Perl19:14
SkyriderOkay, so..19:15
SkyriderReboot done.19:15
teward(Ruby, Perl, pure Dash/sh, C, C++...)19:15
Skyrideriptables only shows 3 lines now.19:15
Skyriderinput, forward and output.19:15
jdstrandheh, well, it works ok for that particular debugging purpose :)19:15
jdstrandSkyrider: ok, so you now have a completely clean slate19:15
tewardjdstrand: oh fun fact: you might need to remove the python 2.* checks in this thing for focal if we're sure we're blasting Py2 away19:16
teward:P19:16
SkyriderI re-added the 80/443 rules.19:17
* jdstrand notes that the ufw rules that were there before were all 'pass through' but it complicated the output. please, trying to reason around ufw and iptables-persistent at the same time is never good19:17
jdstrandteward: yes, ufw itself is all py3, etc, etc. I do need to drop the py2 packaging which I'll do before ff. note that check-requirements looks for any python, it just happened to find py2 on the system19:19
jdstrandSkyrider: and the connection is still not blocked?19:19
SkyriderNot yet.. just reminded server is using cloudflare.. lemme disable that.19:20
Skyridersudo tcpdump -i <interface name> -s 0 -n -vv port 443 - Can I ignore the the machines IP?19:21
SkyriderGetting spammed with it.19:21
SkyriderA lot of them with cksum 0x8d69 (incorrect -> 0x0873), seq 1:194, ack 1, win 229, length 19319:21
SkyriderSpecifically the "incorrect" part.19:22
tewardjdstrand: https://paste.ubuntu.com/p/k5NPprmBv3/ in case you're curious *might* help, since those're the scripts iptables-persistent currently installs - if either of them exists then the package is installed :P19:25
tewardit's a diff btw19:25
teward> server uses cloudflare19:26
tewardwell that explains a lot19:26
tewardCloudFlare is equivalent to Proxies and VPN, it futzes the endpoint Source IPs19:26
SkyriderSide question.. if I allow a port to be used on a specific IP with iptables, does it block the rest?19:26
tewardso you can't use `iptables` or `ufw` to filter on SourceIP if you're behind CloudFlare19:26
tewardWhich explains the problems you're having19:26
tewardSkyrider: if you put the default policy to DROP or add a REJECT rule at the end of the rules as a default, then it will19:27
SkyriderOkay, that makes it different over UFW.19:27
tewardno19:27
tewardbecause iptables defaults is ALLOW19:27
jdstrandteward: re check-requirement, thanks :)19:27
tewardufw's 'default' policy is deny incoming ;)19:27
SkyriderAdding an accept port / ip rule through ufw, auto denies it for other ip's.19:27
tewardjdstrand: yep, it's likely to need minor refinement.19:27
tewardSkyrider: because the default policy is DROP19:27
tewardin Ufw19:27
SkyriderWhich I find, better.. in my opinion19:28
tewardiptables doesn't have that unless you specify it as that, but that's a different discussion19:28
tewardbecause you can *set* iptables to default-Deny19:28
tewardwhich can cause issues if you're not careful19:28
jdstrandSkyrider: you can add 'and host <ip addr>'19:28
SkyriderAh, that makes it better :D19:29
SkyriderAlso... still doesn't block my IP >_>19:29
Skyrider****web wise.19:29
tewardSkyrider: if you're using Cloudflare then it won't19:29
tewardto reiterate WHY:19:29
tewardCloudFlare is equivalent to Proxies and VPN, it futzes the endpoint Source IPs19:29
tewardbecause the traffic goes through CloudFlare's nginx proxy to try and mitigate DDoS and provide minor CDN functionality19:29
SkyriderOh, I know. :)19:29
tewardso... :P19:30
SkyriderSet it to DNS only19:30
tewardand you're sure your computer sees the updated DNS?19:30
SkyriderChrome / Firefox appears to be blocked now.. Internet explorer.. not so much.19:30
teward... ewww IExplorer19:30
teward*shivers*19:30
SkyriderXD19:30
SkyriderUsing it just for testing.19:30
tewardInternet Explorer is evil and relies on Windows' DNS cache19:30
tewardChrome/FFox both do their own queries lol19:30
SkyriderOkay, soo... works now.. so all this time, cloudflare was the issue.19:30
SkyriderReally wish iptables would be smarter to check "behind" the proxy...19:31
jdstrandit can't. the info is gone from the packet19:32
SkyriderFun times.. can't even use cloudflare XD19:33
jdstrandthe T in NAT is Transalation. the host doing the translating rewrites the address before sending the packet on its way19:33
tewardjdstrand: regarding iptables-persistent if that patch looks good I can turn that into an actual quilt patch and upload it.  but i don't want to touch things that're major-critical without second sets of eyes/testing :P19:34
jdstrandSkyrider: but the host doing the translating sees it. perhaps there is something in the cloudfare UI that allows you to block that ip19:34
tewardalso my shell is rusty so :P19:34
tewardjdstrand: CF will pass a header called Ray-ID19:34
tewardand XFF19:35
tewardnginx can check XFF19:35
tewardiptables can't19:35
Skyrideriptables sounds outdated :o19:35
tewardi think you're confusing 'firewall' with 'proxy filtration'19:35
teward'firewall' is good at the packets level19:35
SkyriderAnd yea, using multiple methods online to convert the proxy ip to the users real IP.19:35
tewardNOT at the application level19:35
jdstrandteward: I'm doing uploads for Debian and Ubuntu in the coming weeks. thanks for the offer19:35
SkyriderSet it up in nginx as well.19:35
tewardwhich is what XFF / RayID involves19:35
tewardjdstrand: ack19:35
tewardjdstrand: just, if you use the diff verbatim, please credit me :)19:35
jdstrandteward: of course19:36
teward(it's inspiration though if you have a better way, I just fast-hashed it together)19:36
teward... DAMN YOU EMAIL19:36
teward... seriously hate email sometimes, I broke it bad...19:36
teward*goes to fix his postfix and dovecot mail system*19:36
jdstrandand if I modify it, I'll still reference you 'based on...' or whatever makes sense19:36
SkyriderI do appreciate all you guys help and efforts btw!19:36
tewardjdstrand: ack, thank you very much :)19:37
tewardSkyrider: glad we could help, sorry that it took so long to debug19:37
tewardSkyrider: yeah, if you're using CloudFlare you need to use web server level filtering/blocking for the traffic on those IP(s)19:37
tewardif you're not, you can use `iptables`19:37
tewardit's unfortunately the case of different levels of the TCP/IP stack being at play because of CF19:37
jdstrandor ufw ;)19:37
tewardtrue :P19:38
* teward has a habit of typing `iptables` :P19:38
jdstrandthat is unfortunate, yes19:38
teward`iptables`/`ufw` work at one level of the TCP/IP stack (packet level), your webserver will operate at a more application-level filtration (so XFF header, etc. from Cloudflare so it IDs properly at endpoints for filtration)19:38
tewardthe second of those which is what you have to do when Cloudflare is in the equation19:39
jdstrandI suspect it makes since to use iptables(-persitent), ufw, or something on the server to block most stuff (ie, with rules to allow all 80, 443, etc) and then use cloudfare UI to blacklist certain IPs19:39
jdstrands/since/sense/19:39
tewardyep19:40
tewardthough unless you pay for CF your filtration there is limited19:40
SkyriderI find webmin.. weird.19:42
SkyriderThe ufw chains still exists in its firewall rules.19:42
tewardwebmin is evil don't rely on it19:43
SkyriderAt least rules are working..19:44
SkyriderWhat about nftables ? :P19:48
jdstrandSkyrider: did you 'dpkg --purge iptables-persistent'? maybe there are some lingering files that still fire on reboot19:50
jdstrandSkyrider: (or at the time of the removal, apt-get remove --purge iptables-persistent)19:51
* jdstrand is confused. I thought Skyrider said after reboot it was empty...19:51
SkyriderYa, the iptables -S said it did.. just webmin for some reason cached the old ufw chains.19:52
SkyriderI erased webmin though.19:52
jdstrandoh, I see. I don't know what it was doing19:52
SkyriderWow iptables is sooo limited >_>20:01
tewardfor the record20:03
tewardto properly protect systems20:03
tewardyou need IDS/IPS *and* firewalls20:04
tewardand WAFs20:04
tewardIDS/IPS to protect from signature based threats, firewalls for specific IPs, WAFs for HTTP/HTTPS level application filtering when CF and stuff are in play20:04
tewardit's a lot more complex than just "Use a firewall"20:04
tewardesp. when Cloudflare is involved20:04
SkyriderIndeed, sounds complicated :o20:08
mybalzitchwhats a waf20:09
Skyriderdog? :p20:09
mybalzitchwoof?20:09
tewardWeb Application Firewall20:09
tewardsomething that operates at the HTTP/HTTPS 'application' level20:09
mybalzitchneat20:10
Skyridereg ModSecurity.. seen that around.20:10
SkyriderThough, kinda sucks I have to compile nginx to include MC into nginx.20:14
=== jelly-home is now known as jelly
=== randomthoughts is now known as tops

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!