Merge ~ekacnetubuntu/ufw:feature_add_logging_backend into ufw:master
- Git
- lp:~ekacnetubuntu/ufw
- feature_add_logging_backend
- Merge into master
| Status: | Merged |
|---|---|
| Merged at revision: | 3405c0f0412ebe38c458818fb68b40908ecddd50 |
| Proposed branch: | ~ekacnetubuntu/ufw:feature_add_logging_backend |
| Merge into: | ufw:master |
| Diff against target: |
2157 lines (+1972/-34) 10 files modified
ChangeLog (+2/-0) setup.py (+3/-1) src/backend.py (+33/-0) src/backend_iptables.py (+133/-33) src/kernel_log_backend.py (+27/-0) src/log_backend.py (+42/-0) src/netfilter_log_backend.py (+27/-0) tests/good/logging_backend/orig (+1/-0) tests/good/logging_backend/result (+1649/-0) tests/good/logging_backend/runtest.sh (+55/-0) |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Jamie Strandboge | Approve | ||
|
Review via email:
|
|||
Commit message
Add support for different logging backends
Description of the change
It allows to have different logging backend for all UFW related logging.
The default one is LOG (kernel_log) which is the one that UFW was using prior to this change. It also support NFLOG (netfilter_log).
The choice of logging backend is made through the `/etc/default/ufw` configuration file and will be effective at the next reload/restart of the UFW service.
The change has been built into packages for both Ubuntu Jammy and Debian bullseye and deployed to a handful of servers and VMs without any issue: after upgrade existing rules were preserved and logging ones were rewrote from LOG backend to NFLOG backend.
Tested also going back and forth a few time without any disruption in the rulesets.
| Matthieu Patou (ekacnetubuntu) wrote : | # |
| Jamie Strandboge (jdstrand) wrote : | # |
Sorry, I missed the initial report, I apologize. I've not time to look at it extensively yet, but should have some time to take a look in the next few weeks. Thanks for merge request!
| Jamie Strandboge (jdstrand) wrote : | # |
I've reviewed the diff and will commit it against latest changes. After committing, I'll update the configuration file and man page.
Note, the additional logging part doesn't work because of a too restrictive regex. I'm going to fix it, commit it, then pull out the additional logging parts since I want to think about that more (but since they'll be in git history, can easily pull it back out.
Thanks for the patch!
| Jamie Strandboge (jdstrand) wrote (last edit ): | # |
I should also mention, I'm going to drop the '_log' from the specifier (eg, LOGGING_
Preview Diff
| 1 | diff --git a/ChangeLog b/ChangeLog |
| 2 | index 937c40a..07d33b5 100644 |
| 3 | --- a/ChangeLog |
| 4 | +++ b/ChangeLog |
| 5 | @@ -29,6 +29,8 @@ ufw (0.37) UNRELEASED; urgency=medium |
| 6 | - unconditionally reload user rules with 'delete' (LP: #1933117) |
| 7 | * src/ufw-init-functions: set default policy after loading rules. Thanks to |
| 8 | Mauricio Faria de Oliveira. (LP: #1946804) |
| 9 | + * allow logging backend to be configured and additional logging options to |
| 10 | + be specified |
| 11 | |
| 12 | -- Jamie Strandboge <jdstrand@ubuntu.com> Wed, 13 Oct 2021 11:44:00 -0500 |
| 13 | |
| 14 | diff --git a/setup.py b/setup.py |
| 15 | index 3915b23..afc7104 100644 |
| 16 | --- a/setup.py |
| 17 | +++ b/setup.py |
| 18 | @@ -295,7 +295,9 @@ setup (name='ufw', |
| 19 | license='GPL-3', |
| 20 | cmdclass={'install': Install}, |
| 21 | package_dir={'ufw': 'staging'}, |
| 22 | - py_modules=['ufw.backend', 'ufw.backend_iptables', 'ufw.common', 'ufw.frontend', 'ufw.util', 'ufw.applications', 'ufw.parser'] |
| 23 | + py_modules=['ufw.backend', 'ufw.backend_iptables', 'ufw.common', 'ufw.frontend', 'ufw.util', |
| 24 | + 'ufw.applications', 'ufw.parser', 'ufw.kernel_log_backend', |
| 25 | + 'ufw.netfilter_log_backend', 'ufw.log_backend'] |
| 26 | ) |
| 27 | |
| 28 | shutil.rmtree('staging') |
| 29 | diff --git a/src/backend.py b/src/backend.py |
| 30 | index 1d2554e..a2285b2 100644 |
| 31 | --- a/src/backend.py |
| 32 | +++ b/src/backend.py |
| 33 | @@ -22,6 +22,8 @@ import re |
| 34 | import stat |
| 35 | import sys |
| 36 | import ufw.util |
| 37 | +import ufw.kernel_log_backend |
| 38 | +import ufw.netfilter_log_backend |
| 39 | from ufw.util import error, warn, debug, _findpath |
| 40 | from ufw.common import UFWError, UFWRule |
| 41 | import ufw.applications |
| 42 | @@ -61,6 +63,7 @@ class UFWBackend: |
| 43 | self._do_checks() |
| 44 | self._get_defaults() |
| 45 | self._read_rules() |
| 46 | + self.log_backend = self.get_logging_backend() |
| 47 | |
| 48 | self.profiles = ufw.applications.get_profiles(self.files['apps']) |
| 49 | |
| 50 | @@ -124,6 +127,36 @@ class UFWBackend: |
| 51 | else: |
| 52 | self.caps['limit']['6'] = False |
| 53 | |
| 54 | + def get_logging_backend(self): |
| 55 | + """Return an instance of the logging backend |
| 56 | + given how it was configured in the config""" |
| 57 | + logging_backend = self.defaults.get("logging_backend", "kernel_log") |
| 58 | + if logging_backend == "kernel_log": |
| 59 | + return ufw.kernel_log_backend.UFWLogBackendKernel( |
| 60 | + self.defaults.get("additional_logging_options") |
| 61 | + ) |
| 62 | + elif logging_backend == "netfilter_log": |
| 63 | + return ufw.netfilter_log_backend.UFWLogBackendNetfilter( |
| 64 | + self.defaults.get("additional_logging_options") |
| 65 | + ) |
| 66 | + else: |
| 67 | + raise UFWError("Unknown %s logging backend" % logging_backend) |
| 68 | + |
| 69 | + def get_all_logging_backends(self): |
| 70 | + """Return an instance of all the logging backends""" |
| 71 | + ret = [] |
| 72 | + ret.append( |
| 73 | + ufw.kernel_log_backend.UFWLogBackendKernel( |
| 74 | + self.defaults.get("additional_logging_options") |
| 75 | + ) |
| 76 | + ) |
| 77 | + ret.append( |
| 78 | + ufw.netfilter_log_backend.UFWLogBackendNetfilter( |
| 79 | + self.defaults.get("additional_logging_options") |
| 80 | + ) |
| 81 | + ) |
| 82 | + return ret |
| 83 | + |
| 84 | def is_enabled(self): |
| 85 | '''Is firewall configured as enabled''' |
| 86 | if 'enabled' in self.defaults and \ |
| 87 | diff --git a/src/backend_iptables.py b/src/backend_iptables.py |
| 88 | index 11b61f1..fc73b49 100644 |
| 89 | --- a/src/backend_iptables.py |
| 90 | +++ b/src/backend_iptables.py |
| 91 | @@ -79,11 +79,31 @@ class UFWBackendIptables(ufw.backend.UFWBackend): |
| 92 | |
| 93 | # The default log rate limiting rule ('ufw[6]-user-limit chain should |
| 94 | # be prepended before use) |
| 95 | - self.ufw_user_limit_log = ['-m', 'limit', \ |
| 96 | - '--limit', '3/minute', '-j', 'LOG', \ |
| 97 | - '--log-prefix'] |
| 98 | + self.ufw_user_limit_log = [ |
| 99 | + "-m", |
| 100 | + "limit", |
| 101 | + "--limit", |
| 102 | + "3/minute", |
| 103 | + "-j", |
| 104 | + self.log_backend.get_log_target(), |
| 105 | + ] |
| 106 | + self.ufw_user_limit_log.extend(self.log_backend.get_logging_options()) |
| 107 | self.ufw_user_limit_log_text = "[UFW LIMIT BLOCK]" |
| 108 | |
| 109 | + all_log_backends = self.get_all_logging_backends() |
| 110 | + self.ufw_user_limit_other_log = [] |
| 111 | + for backend in all_log_backends: |
| 112 | + limit_log = [ |
| 113 | + "-m", |
| 114 | + "limit", |
| 115 | + "--limit", |
| 116 | + "3/minute", |
| 117 | + "-j", |
| 118 | + backend.get_log_target(), |
| 119 | + ] |
| 120 | + limit_log.extend(backend.get_logging_options()) |
| 121 | + self.ufw_user_limit_other_log.append(limit_log) |
| 122 | + |
| 123 | def get_default_application_policy(self): |
| 124 | '''Get current policy''' |
| 125 | rstr = _("New profiles:") |
| 126 | @@ -639,8 +659,12 @@ class UFWBackendIptables(ufw.backend.UFWBackend): |
| 127 | else: |
| 128 | policy = "BLOCK" |
| 129 | |
| 130 | - lstr = '%s -j LOG --log-prefix "[UFW %s] "' % (limit_args, \ |
| 131 | - policy) |
| 132 | + lstr = '%s -j %s %s "[UFW %s] "' % ( |
| 133 | + limit_args, |
| 134 | + self.log_backend.get_log_target(), |
| 135 | + " ".join(self.log_backend.get_logging_options()), |
| 136 | + policy, |
| 137 | + ) |
| 138 | if not pat_logall.search(s): |
| 139 | lstr = '-m conntrack --ctstate NEW ' + lstr |
| 140 | snippets[i] = pat_log.sub(r'\1-j \2\4', s) |
| 141 | @@ -678,13 +702,17 @@ class UFWBackendIptables(ufw.backend.UFWBackend): |
| 142 | str_snippets = self._get_rules_from_formatted(frule, prefix, suffix) |
| 143 | |
| 144 | # split the string such that the log prefix can contain spaces |
| 145 | - pat = re.compile(r'(.*) --log-prefix (".* ")(.*)') |
| 146 | + pat = re.compile( |
| 147 | + r'(.*) {} (".* ")(.*)'.format( |
| 148 | + " ".join(self.log_backend.get_logging_options()) |
| 149 | + ) |
| 150 | + ) |
| 151 | for i, s in enumerate(str_snippets): |
| 152 | snippets.append(pat.sub(r'\1', s).split()) |
| 153 | if pat.match(s): |
| 154 | - snippets[i].append("--log-prefix") |
| 155 | - snippets[i].append(pat.sub(r'\2', s).replace('"', '')) |
| 156 | - snippets[i] += pat.sub(r'\3', s).split() |
| 157 | + snippets[i].extend(self.log_backend.get_logging_options()) |
| 158 | + snippets[i].append(pat.sub(r"\2", s).replace('"', "")) |
| 159 | + snippets[i] += pat.sub(r"\3", s).split() |
| 160 | |
| 161 | return snippets |
| 162 | |
| 163 | @@ -1285,13 +1313,21 @@ class UFWBackendIptables(ufw.backend.UFWBackend): |
| 164 | |
| 165 | # Rate limiting is runtime supported |
| 166 | # Always delete these and re-add them so that we don't have extras |
| 167 | - for chain in ['ufw-user-limit', 'ufw6-user-limit']: |
| 168 | - if (self.caps['limit']['4'] and chain == 'ufw-user-limit') or \ |
| 169 | - (self.caps['limit']['6'] and chain == 'ufw6-user-limit'): |
| 170 | - self._chain_cmd(chain, ['-D', chain] + \ |
| 171 | - self.ufw_user_limit_log + \ |
| 172 | - [self.ufw_user_limit_log_text + " "], \ |
| 173 | - fail_ok=True) |
| 174 | + # Try to delete logging rules from all logging backends. If you change |
| 175 | + # the backend on the first start/reload you will have a lingering |
| 176 | + # rule from the previous backend otherwise |
| 177 | + for chain in ["ufw-user-limit", "ufw6-user-limit"]: |
| 178 | + if (self.caps["limit"]["4"] and chain == "ufw-user-limit") or ( |
| 179 | + self.caps["limit"]["6"] and chain == "ufw6-user-limit" |
| 180 | + ): |
| 181 | + for limit_log_rule in self.ufw_user_limit_other_log: |
| 182 | + self._chain_cmd( |
| 183 | + chain, |
| 184 | + ["-D", chain] |
| 185 | + + limit_log_rule |
| 186 | + + [self.ufw_user_limit_log_text + " "], |
| 187 | + fail_ok=True, |
| 188 | + ) |
| 189 | if self.defaults["loglevel"] != "off": |
| 190 | self._chain_cmd(chain, ['-I', chain] + \ |
| 191 | self.ufw_user_limit_log + \ |
| 192 | @@ -1302,6 +1338,7 @@ class UFWBackendIptables(ufw.backend.UFWBackend): |
| 193 | '''Get rules for specified logging level''' |
| 194 | rules_t = [] |
| 195 | |
| 196 | + log_options = self.log_backend.get_logging_options() |
| 197 | if level not in list(self.loglevels.keys()): |
| 198 | err_msg = _("Invalid log level '%s'") % (level) |
| 199 | raise UFWError(err_msg) |
| 200 | @@ -1333,14 +1370,38 @@ class UFWBackendIptables(ufw.backend.UFWBackend): |
| 201 | if self._get_default_policy(t) == "reject" or \ |
| 202 | self._get_default_policy(t) == "deny": |
| 203 | prefix = "[UFW BLOCK] " |
| 204 | - rules_t.append([c, ['-A', c, '-j', 'LOG', \ |
| 205 | - '--log-prefix', prefix] + |
| 206 | - largs, '']) |
| 207 | + rules_t.append( |
| 208 | + [ |
| 209 | + c, |
| 210 | + [ |
| 211 | + "-A", |
| 212 | + c, |
| 213 | + "-j", |
| 214 | + self.log_backend.get_log_target(), |
| 215 | + *log_options, |
| 216 | + prefix, |
| 217 | + ] |
| 218 | + + largs, |
| 219 | + "", |
| 220 | + ] |
| 221 | + ) |
| 222 | elif self.loglevels[level] >= self.loglevels["medium"]: |
| 223 | prefix = "[UFW ALLOW] " |
| 224 | - rules_t.append([c, ['-A', c, '-j', 'LOG', \ |
| 225 | - '--log-prefix', prefix] + \ |
| 226 | - largs, '']) |
| 227 | + rules_t.append( |
| 228 | + [ |
| 229 | + c, |
| 230 | + [ |
| 231 | + "-A", |
| 232 | + c, |
| 233 | + "-j", |
| 234 | + self.log_backend.get_log_target(), |
| 235 | + *log_options, |
| 236 | + prefix, |
| 237 | + ] |
| 238 | + + largs, |
| 239 | + "", |
| 240 | + ] |
| 241 | + ) |
| 242 | |
| 243 | # Setup the miscellaneous logging chains |
| 244 | largs = [] |
| 245 | @@ -1359,14 +1420,40 @@ class UFWBackendIptables(ufw.backend.UFWBackend): |
| 246 | '--ctstate', 'INVALID', \ |
| 247 | '-j', 'RETURN'] + largs, '']) |
| 248 | else: |
| 249 | - rules_t.append([c, ['-A', c, '-m', 'conntrack', \ |
| 250 | - '--ctstate', 'INVALID', \ |
| 251 | - '-j', 'LOG', \ |
| 252 | - '--log-prefix', \ |
| 253 | - "[UFW AUDIT INVALID] "] + \ |
| 254 | - largs, '']) |
| 255 | - rules_t.append([c, ['-A', c, '-j', 'LOG', \ |
| 256 | - '--log-prefix', prefix] + largs, '']) |
| 257 | + rules_t.append( |
| 258 | + [ |
| 259 | + c, |
| 260 | + [ |
| 261 | + "-A", |
| 262 | + c, |
| 263 | + "-m", |
| 264 | + "conntrack", |
| 265 | + "--ctstate", |
| 266 | + "INVALID", |
| 267 | + "-j", |
| 268 | + self.log_backend.get_log_target(), |
| 269 | + *log_options, |
| 270 | + "[UFW AUDIT INVALID] ", |
| 271 | + ] |
| 272 | + + largs, |
| 273 | + "", |
| 274 | + ] |
| 275 | + ) |
| 276 | + rules_t.append( |
| 277 | + [ |
| 278 | + c, |
| 279 | + [ |
| 280 | + "-A", |
| 281 | + c, |
| 282 | + "-j", |
| 283 | + self.log_backend.get_log_target(), |
| 284 | + *log_options, |
| 285 | + prefix, |
| 286 | + ] |
| 287 | + + largs, |
| 288 | + "", |
| 289 | + ] |
| 290 | + ) |
| 291 | |
| 292 | # Setup the audit logging chains |
| 293 | if self.loglevels[level] >= self.loglevels["medium"]: |
| 294 | @@ -1382,9 +1469,22 @@ class UFWBackendIptables(ufw.backend.UFWBackend): |
| 295 | largs = ['-m', 'conntrack', '--ctstate', 'NEW'] + limit_args |
| 296 | |
| 297 | prefix = "[UFW AUDIT] " |
| 298 | - for c in self.chains['before']: |
| 299 | - rules_t.append([c, ['-I', c, '-j', 'LOG', \ |
| 300 | - '--log-prefix', prefix] + largs, '']) |
| 301 | + for c in self.chains["before"]: |
| 302 | + rules_t.append( |
| 303 | + [ |
| 304 | + c, |
| 305 | + [ |
| 306 | + "-I", |
| 307 | + c, |
| 308 | + "-j", |
| 309 | + self.log_backend.get_log_target(), |
| 310 | + *log_options, |
| 311 | + prefix, |
| 312 | + ] |
| 313 | + + largs, |
| 314 | + "", |
| 315 | + ] |
| 316 | + ) |
| 317 | |
| 318 | return rules_t |
| 319 | |
| 320 | diff --git a/src/kernel_log_backend.py b/src/kernel_log_backend.py |
| 321 | new file mode 100644 |
| 322 | index 0000000..4fc9c7a |
| 323 | --- /dev/null |
| 324 | +++ b/src/kernel_log_backend.py |
| 325 | @@ -0,0 +1,27 @@ |
| 326 | +"""kernel_log_backend.py: backend for kernel (LOG) based logging in ufw""" |
| 327 | +# |
| 328 | +# This program is free software: you can redistribute it and/or modify |
| 329 | +# it under the terms of the GNU General Public License version 3, |
| 330 | +# as published by the Free Software Foundation. |
| 331 | +# |
| 332 | +# This program is distributed in the hope that it will be useful, |
| 333 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 334 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 335 | +# GNU General Public License for more details. |
| 336 | +# |
| 337 | +# You should have received a copy of the GNU General Public License |
| 338 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 339 | +# |
| 340 | +import ufw.log_backend |
| 341 | + |
| 342 | + |
| 343 | +class UFWLogBackendKernel(ufw.log_backend.UFWLogBackend): |
| 344 | + """Instance class for UFWLogBackend""" |
| 345 | + |
| 346 | + own_logging_options = "--log-prefix" |
| 347 | + |
| 348 | + def __init__(self, additional_logging_options=None): |
| 349 | + ufw.log_backend.UFWLogBackend.__init__(self, additional_logging_options) |
| 350 | + |
| 351 | + def get_log_target(self): |
| 352 | + return "LOG" |
| 353 | diff --git a/src/log_backend.py b/src/log_backend.py |
| 354 | new file mode 100644 |
| 355 | index 0000000..f72a7ad |
| 356 | --- /dev/null |
| 357 | +++ b/src/log_backend.py |
| 358 | @@ -0,0 +1,42 @@ |
| 359 | +"""log_backend.py: interface for ufw logging backend""" |
| 360 | +# |
| 361 | +# This program is free software: you can redistribute it and/or modify |
| 362 | +# it under the terms of the GNU General Public License version 3, |
| 363 | +# as published by the Free Software Foundation. |
| 364 | +# |
| 365 | +# This program is distributed in the hope that it will be useful, |
| 366 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 367 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 368 | +# GNU General Public License for more details. |
| 369 | +# |
| 370 | +# You should have received a copy of the GNU General Public License |
| 371 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 372 | +# |
| 373 | + |
| 374 | +from ufw.common import UFWError |
| 375 | + |
| 376 | + |
| 377 | +class UFWLogBackend: |
| 378 | + """Interface for logging backend""" |
| 379 | + |
| 380 | + own_logging_options = "" |
| 381 | + |
| 382 | + def __init__(self, additional_logging_options=None): |
| 383 | + if additional_logging_options is None: |
| 384 | + self.additional_options = [] |
| 385 | + else: |
| 386 | + self.additional_options = filter( |
| 387 | + lambda x: x != self.own_logggin_options, |
| 388 | + additional_logging_options.split(","), |
| 389 | + ) |
| 390 | + |
| 391 | + def get_log_target(self): |
| 392 | + """Return what is the logging target for the backend""" |
| 393 | + raise UFWError("UFWLogBackend:get_log_target: need to override") |
| 394 | + |
| 395 | + def get_logging_options(self): |
| 396 | + """Return the logging options for this logging backend""" |
| 397 | + ret = [] |
| 398 | + ret.extend(self.additional_options) |
| 399 | + ret.append(self.own_logging_options) |
| 400 | + return ret |
| 401 | diff --git a/src/netfilter_log_backend.py b/src/netfilter_log_backend.py |
| 402 | new file mode 100644 |
| 403 | index 0000000..d6deb8c |
| 404 | --- /dev/null |
| 405 | +++ b/src/netfilter_log_backend.py |
| 406 | @@ -0,0 +1,27 @@ |
| 407 | +"""netfilter_log_backend.py: backend for netfilter (NFLOG) based logging in ufw""" |
| 408 | +# |
| 409 | +# This program is free software: you can redistribute it and/or modify |
| 410 | +# it under the terms of the GNU General Public License version 3, |
| 411 | +# as published by the Free Software Foundation. |
| 412 | +# |
| 413 | +# This program is distributed in the hope that it will be useful, |
| 414 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 415 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 416 | +# GNU General Public License for more details. |
| 417 | +# |
| 418 | +# You should have received a copy of the GNU General Public License |
| 419 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 420 | +# |
| 421 | +import ufw.log_backend |
| 422 | + |
| 423 | + |
| 424 | +class UFWLogBackendNetfilter(ufw.log_backend.UFWLogBackend): |
| 425 | + """Instance class for UFWLogBackend""" |
| 426 | + |
| 427 | + own_logging_options = "--nflog-prefix" |
| 428 | + |
| 429 | + def __init__(self, additional_logging_options=None): |
| 430 | + ufw.log_backend.UFWLogBackend.__init__(self, additional_logging_options) |
| 431 | + |
| 432 | + def get_log_target(self): |
| 433 | + return "NFLOG" |
| 434 | diff --git a/tests/good/logging_backend/orig b/tests/good/logging_backend/orig |
| 435 | new file mode 120000 |
| 436 | index 0000000..bdb60f0 |
| 437 | --- /dev/null |
| 438 | +++ b/tests/good/logging_backend/orig |
| 439 | @@ -0,0 +1 @@ |
| 440 | +../../defaults |
| 441 | \ No newline at end of file |
| 442 | diff --git a/tests/good/logging_backend/result b/tests/good/logging_backend/result |
| 443 | new file mode 100644 |
| 444 | index 0000000..154849e |
| 445 | --- /dev/null |
| 446 | +++ b/tests/good/logging_backend/result |
| 447 | @@ -0,0 +1,1649 @@ |
| 448 | +TESTING NFLOG RULES |
| 449 | +0: allow log 23 |
| 450 | + |
| 451 | + |
| 452 | +1: allow log smtp |
| 453 | + |
| 454 | + |
| 455 | +2: allow log tftp |
| 456 | + |
| 457 | + |
| 458 | +3: allow log daytime |
| 459 | + |
| 460 | + |
| 461 | +4: allow log Samba |
| 462 | + |
| 463 | + |
| 464 | +5: allow log Apache |
| 465 | + |
| 466 | + |
| 467 | +6: allow log from 192.168.0.1 port smtp to 10.0.0.1 port smtp |
| 468 | + |
| 469 | + |
| 470 | +7: allow log from 192.168.0.1 app Samba to 10.0.0.1 app Samba |
| 471 | + |
| 472 | + |
| 473 | +contents of user*.rules: |
| 474 | +*filter |
| 475 | +:ufw-user-input - [0:0] |
| 476 | +:ufw-user-output - [0:0] |
| 477 | +:ufw-user-forward - [0:0] |
| 478 | +:ufw-before-logging-input - [0:0] |
| 479 | +:ufw-before-logging-output - [0:0] |
| 480 | +:ufw-before-logging-forward - [0:0] |
| 481 | +:ufw-user-logging-input - [0:0] |
| 482 | +:ufw-user-logging-output - [0:0] |
| 483 | +:ufw-user-logging-forward - [0:0] |
| 484 | +:ufw-after-logging-input - [0:0] |
| 485 | +:ufw-after-logging-output - [0:0] |
| 486 | +:ufw-after-logging-forward - [0:0] |
| 487 | +:ufw-logging-deny - [0:0] |
| 488 | +:ufw-logging-allow - [0:0] |
| 489 | +:ufw-user-limit - [0:0] |
| 490 | +:ufw-user-limit-accept - [0:0] |
| 491 | +### RULES ### |
| 492 | + |
| 493 | +### tuple ### allow_log any 23 0.0.0.0/0 any 0.0.0.0/0 in |
| 494 | +-A ufw-user-logging-input -p tcp --dport 23 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 495 | +-A ufw-user-logging-input -p tcp --dport 23 -j RETURN |
| 496 | +-A ufw-user-input -p tcp --dport 23 -j ufw-user-logging-input |
| 497 | +-A ufw-user-input -p tcp --dport 23 -j ACCEPT |
| 498 | +-A ufw-user-logging-input -p udp --dport 23 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 499 | +-A ufw-user-logging-input -p udp --dport 23 -j RETURN |
| 500 | +-A ufw-user-input -p udp --dport 23 -j ufw-user-logging-input |
| 501 | +-A ufw-user-input -p udp --dport 23 -j ACCEPT |
| 502 | + |
| 503 | +### tuple ### allow_log tcp 25 0.0.0.0/0 any 0.0.0.0/0 in |
| 504 | +-A ufw-user-logging-input -p tcp --dport 25 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 505 | +-A ufw-user-logging-input -p tcp --dport 25 -j RETURN |
| 506 | +-A ufw-user-input -p tcp --dport 25 -j ufw-user-logging-input |
| 507 | +-A ufw-user-input -p tcp --dport 25 -j ACCEPT |
| 508 | + |
| 509 | +### tuple ### allow_log udp 69 0.0.0.0/0 any 0.0.0.0/0 in |
| 510 | +-A ufw-user-logging-input -p udp --dport 69 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 511 | +-A ufw-user-logging-input -p udp --dport 69 -j RETURN |
| 512 | +-A ufw-user-input -p udp --dport 69 -j ufw-user-logging-input |
| 513 | +-A ufw-user-input -p udp --dport 69 -j ACCEPT |
| 514 | + |
| 515 | +### tuple ### allow_log any 13 0.0.0.0/0 any 0.0.0.0/0 in |
| 516 | +-A ufw-user-logging-input -p tcp --dport 13 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 517 | +-A ufw-user-logging-input -p tcp --dport 13 -j RETURN |
| 518 | +-A ufw-user-input -p tcp --dport 13 -j ufw-user-logging-input |
| 519 | +-A ufw-user-input -p tcp --dport 13 -j ACCEPT |
| 520 | +-A ufw-user-logging-input -p udp --dport 13 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 521 | +-A ufw-user-logging-input -p udp --dport 13 -j RETURN |
| 522 | +-A ufw-user-input -p udp --dport 13 -j ufw-user-logging-input |
| 523 | +-A ufw-user-input -p udp --dport 13 -j ACCEPT |
| 524 | + |
| 525 | +### tuple ### allow_log udp 137,138 0.0.0.0/0 any 0.0.0.0/0 Samba - in |
| 526 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 527 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -j RETURN |
| 528 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -j ufw-user-logging-input |
| 529 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -j ACCEPT -m comment --comment 'dapp_Samba' |
| 530 | + |
| 531 | +### tuple ### allow_log tcp 139,445 0.0.0.0/0 any 0.0.0.0/0 Samba - in |
| 532 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 533 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -j RETURN |
| 534 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -j ufw-user-logging-input |
| 535 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -j ACCEPT -m comment --comment 'dapp_Samba' |
| 536 | + |
| 537 | +### tuple ### allow_log tcp 80 0.0.0.0/0 any 0.0.0.0/0 Apache - in |
| 538 | +-A ufw-user-logging-input -p tcp --dport 80 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 539 | +-A ufw-user-logging-input -p tcp --dport 80 -j RETURN |
| 540 | +-A ufw-user-input -p tcp --dport 80 -j ufw-user-logging-input |
| 541 | +-A ufw-user-input -p tcp --dport 80 -j ACCEPT -m comment --comment 'dapp_Apache' |
| 542 | + |
| 543 | +### tuple ### allow_log tcp 25 10.0.0.1 25 192.168.0.1 in |
| 544 | +-A ufw-user-logging-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 545 | +-A ufw-user-logging-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j RETURN |
| 546 | +-A ufw-user-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j ufw-user-logging-input |
| 547 | +-A ufw-user-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j ACCEPT |
| 548 | + |
| 549 | +### tuple ### allow_log udp 137,138 10.0.0.1 137,138 192.168.0.1 Samba Samba in |
| 550 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 551 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j RETURN |
| 552 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j ufw-user-logging-input |
| 553 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j ACCEPT -m comment --comment 'dapp_Samba,sapp_Samba' |
| 554 | + |
| 555 | +### tuple ### allow_log tcp 139,445 10.0.0.1 139,445 192.168.0.1 Samba Samba in |
| 556 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 557 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j RETURN |
| 558 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j ufw-user-logging-input |
| 559 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j ACCEPT -m comment --comment 'dapp_Samba,sapp_Samba' |
| 560 | + |
| 561 | +### END RULES ### |
| 562 | + |
| 563 | +### LOGGING ### |
| 564 | +-A ufw-after-logging-input -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 565 | +-A ufw-after-logging-forward -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 566 | +-I ufw-logging-deny -m conntrack --ctstate INVALID -j RETURN -m limit --limit 3/min --limit-burst 10 |
| 567 | +-A ufw-logging-deny -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 568 | +-A ufw-logging-allow -j NFLOG --nflog-prefix "[UFW ALLOW] " -m limit --limit 3/min --limit-burst 10 |
| 569 | +### END LOGGING ### |
| 570 | + |
| 571 | +### RATE LIMITING ### |
| 572 | +-A ufw-user-limit -m limit --limit 3/minute -j NFLOG --nflog-prefix "[UFW LIMIT BLOCK] " |
| 573 | +-A ufw-user-limit -j REJECT |
| 574 | +-A ufw-user-limit-accept -j ACCEPT |
| 575 | +### END RATE LIMITING ### |
| 576 | +COMMIT |
| 577 | +*filter |
| 578 | +:ufw6-user-input - [0:0] |
| 579 | +:ufw6-user-output - [0:0] |
| 580 | +:ufw6-user-forward - [0:0] |
| 581 | +### RULES ### |
| 582 | +COMMIT |
| 583 | +8: delete allow log 23 |
| 584 | + |
| 585 | + |
| 586 | +9: delete allow log smtp |
| 587 | + |
| 588 | + |
| 589 | +10: delete allow log tftp |
| 590 | + |
| 591 | + |
| 592 | +11: delete allow log daytime |
| 593 | + |
| 594 | + |
| 595 | +12: delete allow log Samba |
| 596 | + |
| 597 | + |
| 598 | +13: delete allow log Apache |
| 599 | + |
| 600 | + |
| 601 | +14: delete allow log from 192.168.0.1 port smtp to 10.0.0.1 port smtp |
| 602 | + |
| 603 | + |
| 604 | +15: delete allow log from 192.168.0.1 app Samba to 10.0.0.1 app Samba |
| 605 | + |
| 606 | + |
| 607 | +contents of user*.rules: |
| 608 | +*filter |
| 609 | +:ufw-user-input - [0:0] |
| 610 | +:ufw-user-output - [0:0] |
| 611 | +:ufw-user-forward - [0:0] |
| 612 | +:ufw-before-logging-input - [0:0] |
| 613 | +:ufw-before-logging-output - [0:0] |
| 614 | +:ufw-before-logging-forward - [0:0] |
| 615 | +:ufw-user-logging-input - [0:0] |
| 616 | +:ufw-user-logging-output - [0:0] |
| 617 | +:ufw-user-logging-forward - [0:0] |
| 618 | +:ufw-after-logging-input - [0:0] |
| 619 | +:ufw-after-logging-output - [0:0] |
| 620 | +:ufw-after-logging-forward - [0:0] |
| 621 | +:ufw-logging-deny - [0:0] |
| 622 | +:ufw-logging-allow - [0:0] |
| 623 | +:ufw-user-limit - [0:0] |
| 624 | +:ufw-user-limit-accept - [0:0] |
| 625 | +### RULES ### |
| 626 | + |
| 627 | +### END RULES ### |
| 628 | + |
| 629 | +### LOGGING ### |
| 630 | +-A ufw-after-logging-input -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 631 | +-A ufw-after-logging-forward -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 632 | +-I ufw-logging-deny -m conntrack --ctstate INVALID -j RETURN -m limit --limit 3/min --limit-burst 10 |
| 633 | +-A ufw-logging-deny -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 634 | +-A ufw-logging-allow -j NFLOG --nflog-prefix "[UFW ALLOW] " -m limit --limit 3/min --limit-burst 10 |
| 635 | +### END LOGGING ### |
| 636 | + |
| 637 | +### RATE LIMITING ### |
| 638 | +-A ufw-user-limit -m limit --limit 3/minute -j NFLOG --nflog-prefix "[UFW LIMIT BLOCK] " |
| 639 | +-A ufw-user-limit -j REJECT |
| 640 | +-A ufw-user-limit-accept -j ACCEPT |
| 641 | +### END RATE LIMITING ### |
| 642 | +COMMIT |
| 643 | +*filter |
| 644 | +:ufw6-user-input - [0:0] |
| 645 | +:ufw6-user-output - [0:0] |
| 646 | +:ufw6-user-forward - [0:0] |
| 647 | +### RULES ### |
| 648 | +COMMIT |
| 649 | +16: allow log-all 23 |
| 650 | + |
| 651 | + |
| 652 | +17: allow log-all smtp |
| 653 | + |
| 654 | + |
| 655 | +18: allow log-all tftp |
| 656 | + |
| 657 | + |
| 658 | +19: allow log-all daytime |
| 659 | + |
| 660 | + |
| 661 | +20: allow log-all Samba |
| 662 | + |
| 663 | + |
| 664 | +21: allow log-all Apache |
| 665 | + |
| 666 | + |
| 667 | +22: allow log-all from 192.168.0.1 port smtp to 10.0.0.1 port smtp |
| 668 | + |
| 669 | + |
| 670 | +23: allow log-all from 192.168.0.1 app Samba to 10.0.0.1 app Samba |
| 671 | + |
| 672 | + |
| 673 | +contents of user*.rules: |
| 674 | +*filter |
| 675 | +:ufw-user-input - [0:0] |
| 676 | +:ufw-user-output - [0:0] |
| 677 | +:ufw-user-forward - [0:0] |
| 678 | +:ufw-before-logging-input - [0:0] |
| 679 | +:ufw-before-logging-output - [0:0] |
| 680 | +:ufw-before-logging-forward - [0:0] |
| 681 | +:ufw-user-logging-input - [0:0] |
| 682 | +:ufw-user-logging-output - [0:0] |
| 683 | +:ufw-user-logging-forward - [0:0] |
| 684 | +:ufw-after-logging-input - [0:0] |
| 685 | +:ufw-after-logging-output - [0:0] |
| 686 | +:ufw-after-logging-forward - [0:0] |
| 687 | +:ufw-logging-deny - [0:0] |
| 688 | +:ufw-logging-allow - [0:0] |
| 689 | +:ufw-user-limit - [0:0] |
| 690 | +:ufw-user-limit-accept - [0:0] |
| 691 | +### RULES ### |
| 692 | + |
| 693 | +### tuple ### allow_log-all any 23 0.0.0.0/0 any 0.0.0.0/0 in |
| 694 | +-A ufw-user-logging-input -p tcp --dport 23 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 695 | +-A ufw-user-logging-input -p tcp --dport 23 -j RETURN |
| 696 | +-A ufw-user-input -p tcp --dport 23 -j ufw-user-logging-input |
| 697 | +-A ufw-user-input -p tcp --dport 23 -j ACCEPT |
| 698 | +-A ufw-user-logging-input -p udp --dport 23 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 699 | +-A ufw-user-logging-input -p udp --dport 23 -j RETURN |
| 700 | +-A ufw-user-input -p udp --dport 23 -j ufw-user-logging-input |
| 701 | +-A ufw-user-input -p udp --dport 23 -j ACCEPT |
| 702 | + |
| 703 | +### tuple ### allow_log-all tcp 25 0.0.0.0/0 any 0.0.0.0/0 in |
| 704 | +-A ufw-user-logging-input -p tcp --dport 25 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 705 | +-A ufw-user-logging-input -p tcp --dport 25 -j RETURN |
| 706 | +-A ufw-user-input -p tcp --dport 25 -j ufw-user-logging-input |
| 707 | +-A ufw-user-input -p tcp --dport 25 -j ACCEPT |
| 708 | + |
| 709 | +### tuple ### allow_log-all udp 69 0.0.0.0/0 any 0.0.0.0/0 in |
| 710 | +-A ufw-user-logging-input -p udp --dport 69 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 711 | +-A ufw-user-logging-input -p udp --dport 69 -j RETURN |
| 712 | +-A ufw-user-input -p udp --dport 69 -j ufw-user-logging-input |
| 713 | +-A ufw-user-input -p udp --dport 69 -j ACCEPT |
| 714 | + |
| 715 | +### tuple ### allow_log-all any 13 0.0.0.0/0 any 0.0.0.0/0 in |
| 716 | +-A ufw-user-logging-input -p tcp --dport 13 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 717 | +-A ufw-user-logging-input -p tcp --dport 13 -j RETURN |
| 718 | +-A ufw-user-input -p tcp --dport 13 -j ufw-user-logging-input |
| 719 | +-A ufw-user-input -p tcp --dport 13 -j ACCEPT |
| 720 | +-A ufw-user-logging-input -p udp --dport 13 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 721 | +-A ufw-user-logging-input -p udp --dport 13 -j RETURN |
| 722 | +-A ufw-user-input -p udp --dport 13 -j ufw-user-logging-input |
| 723 | +-A ufw-user-input -p udp --dport 13 -j ACCEPT |
| 724 | + |
| 725 | +### tuple ### allow_log-all udp 137,138 0.0.0.0/0 any 0.0.0.0/0 Samba - in |
| 726 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 727 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -j RETURN |
| 728 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -j ufw-user-logging-input |
| 729 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -j ACCEPT -m comment --comment 'dapp_Samba' |
| 730 | + |
| 731 | +### tuple ### allow_log-all tcp 139,445 0.0.0.0/0 any 0.0.0.0/0 Samba - in |
| 732 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 733 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -j RETURN |
| 734 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -j ufw-user-logging-input |
| 735 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -j ACCEPT -m comment --comment 'dapp_Samba' |
| 736 | + |
| 737 | +### tuple ### allow_log-all tcp 80 0.0.0.0/0 any 0.0.0.0/0 Apache - in |
| 738 | +-A ufw-user-logging-input -p tcp --dport 80 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 739 | +-A ufw-user-logging-input -p tcp --dport 80 -j RETURN |
| 740 | +-A ufw-user-input -p tcp --dport 80 -j ufw-user-logging-input |
| 741 | +-A ufw-user-input -p tcp --dport 80 -j ACCEPT -m comment --comment 'dapp_Apache' |
| 742 | + |
| 743 | +### tuple ### allow_log-all tcp 25 10.0.0.1 25 192.168.0.1 in |
| 744 | +-A ufw-user-logging-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 745 | +-A ufw-user-logging-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j RETURN |
| 746 | +-A ufw-user-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j ufw-user-logging-input |
| 747 | +-A ufw-user-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j ACCEPT |
| 748 | + |
| 749 | +### tuple ### allow_log-all udp 137,138 10.0.0.1 137,138 192.168.0.1 Samba Samba in |
| 750 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 751 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j RETURN |
| 752 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j ufw-user-logging-input |
| 753 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j ACCEPT -m comment --comment 'dapp_Samba,sapp_Samba' |
| 754 | + |
| 755 | +### tuple ### allow_log-all tcp 139,445 10.0.0.1 139,445 192.168.0.1 Samba Samba in |
| 756 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW ALLOW] " |
| 757 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j RETURN |
| 758 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j ufw-user-logging-input |
| 759 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j ACCEPT -m comment --comment 'dapp_Samba,sapp_Samba' |
| 760 | + |
| 761 | +### END RULES ### |
| 762 | + |
| 763 | +### LOGGING ### |
| 764 | +-A ufw-after-logging-input -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 765 | +-A ufw-after-logging-forward -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 766 | +-I ufw-logging-deny -m conntrack --ctstate INVALID -j RETURN -m limit --limit 3/min --limit-burst 10 |
| 767 | +-A ufw-logging-deny -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 768 | +-A ufw-logging-allow -j NFLOG --nflog-prefix "[UFW ALLOW] " -m limit --limit 3/min --limit-burst 10 |
| 769 | +### END LOGGING ### |
| 770 | + |
| 771 | +### RATE LIMITING ### |
| 772 | +-A ufw-user-limit -m limit --limit 3/minute -j NFLOG --nflog-prefix "[UFW LIMIT BLOCK] " |
| 773 | +-A ufw-user-limit -j REJECT |
| 774 | +-A ufw-user-limit-accept -j ACCEPT |
| 775 | +### END RATE LIMITING ### |
| 776 | +COMMIT |
| 777 | +*filter |
| 778 | +:ufw6-user-input - [0:0] |
| 779 | +:ufw6-user-output - [0:0] |
| 780 | +:ufw6-user-forward - [0:0] |
| 781 | +### RULES ### |
| 782 | +COMMIT |
| 783 | +24: delete allow log-all 23 |
| 784 | + |
| 785 | + |
| 786 | +25: delete allow log-all smtp |
| 787 | + |
| 788 | + |
| 789 | +26: delete allow log-all tftp |
| 790 | + |
| 791 | + |
| 792 | +27: delete allow log-all daytime |
| 793 | + |
| 794 | + |
| 795 | +28: delete allow log-all Samba |
| 796 | + |
| 797 | + |
| 798 | +29: delete allow log-all Apache |
| 799 | + |
| 800 | + |
| 801 | +30: delete allow log-all from 192.168.0.1 port smtp to 10.0.0.1 port smtp |
| 802 | + |
| 803 | + |
| 804 | +31: delete allow log-all from 192.168.0.1 app Samba to 10.0.0.1 app Samba |
| 805 | + |
| 806 | + |
| 807 | +contents of user*.rules: |
| 808 | +*filter |
| 809 | +:ufw-user-input - [0:0] |
| 810 | +:ufw-user-output - [0:0] |
| 811 | +:ufw-user-forward - [0:0] |
| 812 | +:ufw-before-logging-input - [0:0] |
| 813 | +:ufw-before-logging-output - [0:0] |
| 814 | +:ufw-before-logging-forward - [0:0] |
| 815 | +:ufw-user-logging-input - [0:0] |
| 816 | +:ufw-user-logging-output - [0:0] |
| 817 | +:ufw-user-logging-forward - [0:0] |
| 818 | +:ufw-after-logging-input - [0:0] |
| 819 | +:ufw-after-logging-output - [0:0] |
| 820 | +:ufw-after-logging-forward - [0:0] |
| 821 | +:ufw-logging-deny - [0:0] |
| 822 | +:ufw-logging-allow - [0:0] |
| 823 | +:ufw-user-limit - [0:0] |
| 824 | +:ufw-user-limit-accept - [0:0] |
| 825 | +### RULES ### |
| 826 | + |
| 827 | +### END RULES ### |
| 828 | + |
| 829 | +### LOGGING ### |
| 830 | +-A ufw-after-logging-input -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 831 | +-A ufw-after-logging-forward -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 832 | +-I ufw-logging-deny -m conntrack --ctstate INVALID -j RETURN -m limit --limit 3/min --limit-burst 10 |
| 833 | +-A ufw-logging-deny -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 834 | +-A ufw-logging-allow -j NFLOG --nflog-prefix "[UFW ALLOW] " -m limit --limit 3/min --limit-burst 10 |
| 835 | +### END LOGGING ### |
| 836 | + |
| 837 | +### RATE LIMITING ### |
| 838 | +-A ufw-user-limit -m limit --limit 3/minute -j NFLOG --nflog-prefix "[UFW LIMIT BLOCK] " |
| 839 | +-A ufw-user-limit -j REJECT |
| 840 | +-A ufw-user-limit-accept -j ACCEPT |
| 841 | +### END RATE LIMITING ### |
| 842 | +COMMIT |
| 843 | +*filter |
| 844 | +:ufw6-user-input - [0:0] |
| 845 | +:ufw6-user-output - [0:0] |
| 846 | +:ufw6-user-forward - [0:0] |
| 847 | +### RULES ### |
| 848 | +COMMIT |
| 849 | +32: deny log 23 |
| 850 | + |
| 851 | + |
| 852 | +33: deny log smtp |
| 853 | + |
| 854 | + |
| 855 | +34: deny log tftp |
| 856 | + |
| 857 | + |
| 858 | +35: deny log daytime |
| 859 | + |
| 860 | + |
| 861 | +36: deny log Samba |
| 862 | + |
| 863 | + |
| 864 | +37: deny log Apache |
| 865 | + |
| 866 | + |
| 867 | +38: deny log from 192.168.0.1 port smtp to 10.0.0.1 port smtp |
| 868 | + |
| 869 | + |
| 870 | +39: deny log from 192.168.0.1 app Samba to 10.0.0.1 app Samba |
| 871 | + |
| 872 | + |
| 873 | +contents of user*.rules: |
| 874 | +*filter |
| 875 | +:ufw-user-input - [0:0] |
| 876 | +:ufw-user-output - [0:0] |
| 877 | +:ufw-user-forward - [0:0] |
| 878 | +:ufw-before-logging-input - [0:0] |
| 879 | +:ufw-before-logging-output - [0:0] |
| 880 | +:ufw-before-logging-forward - [0:0] |
| 881 | +:ufw-user-logging-input - [0:0] |
| 882 | +:ufw-user-logging-output - [0:0] |
| 883 | +:ufw-user-logging-forward - [0:0] |
| 884 | +:ufw-after-logging-input - [0:0] |
| 885 | +:ufw-after-logging-output - [0:0] |
| 886 | +:ufw-after-logging-forward - [0:0] |
| 887 | +:ufw-logging-deny - [0:0] |
| 888 | +:ufw-logging-allow - [0:0] |
| 889 | +:ufw-user-limit - [0:0] |
| 890 | +:ufw-user-limit-accept - [0:0] |
| 891 | +### RULES ### |
| 892 | + |
| 893 | +### tuple ### deny_log any 23 0.0.0.0/0 any 0.0.0.0/0 in |
| 894 | +-A ufw-user-logging-input -p tcp --dport 23 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 895 | +-A ufw-user-logging-input -p tcp --dport 23 -j RETURN |
| 896 | +-A ufw-user-input -p tcp --dport 23 -j ufw-user-logging-input |
| 897 | +-A ufw-user-input -p tcp --dport 23 -j DROP |
| 898 | +-A ufw-user-logging-input -p udp --dport 23 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 899 | +-A ufw-user-logging-input -p udp --dport 23 -j RETURN |
| 900 | +-A ufw-user-input -p udp --dport 23 -j ufw-user-logging-input |
| 901 | +-A ufw-user-input -p udp --dport 23 -j DROP |
| 902 | + |
| 903 | +### tuple ### deny_log tcp 25 0.0.0.0/0 any 0.0.0.0/0 in |
| 904 | +-A ufw-user-logging-input -p tcp --dport 25 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 905 | +-A ufw-user-logging-input -p tcp --dport 25 -j RETURN |
| 906 | +-A ufw-user-input -p tcp --dport 25 -j ufw-user-logging-input |
| 907 | +-A ufw-user-input -p tcp --dport 25 -j DROP |
| 908 | + |
| 909 | +### tuple ### deny_log udp 69 0.0.0.0/0 any 0.0.0.0/0 in |
| 910 | +-A ufw-user-logging-input -p udp --dport 69 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 911 | +-A ufw-user-logging-input -p udp --dport 69 -j RETURN |
| 912 | +-A ufw-user-input -p udp --dport 69 -j ufw-user-logging-input |
| 913 | +-A ufw-user-input -p udp --dport 69 -j DROP |
| 914 | + |
| 915 | +### tuple ### deny_log any 13 0.0.0.0/0 any 0.0.0.0/0 in |
| 916 | +-A ufw-user-logging-input -p tcp --dport 13 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 917 | +-A ufw-user-logging-input -p tcp --dport 13 -j RETURN |
| 918 | +-A ufw-user-input -p tcp --dport 13 -j ufw-user-logging-input |
| 919 | +-A ufw-user-input -p tcp --dport 13 -j DROP |
| 920 | +-A ufw-user-logging-input -p udp --dport 13 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 921 | +-A ufw-user-logging-input -p udp --dport 13 -j RETURN |
| 922 | +-A ufw-user-input -p udp --dport 13 -j ufw-user-logging-input |
| 923 | +-A ufw-user-input -p udp --dport 13 -j DROP |
| 924 | + |
| 925 | +### tuple ### deny_log udp 137,138 0.0.0.0/0 any 0.0.0.0/0 Samba - in |
| 926 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 927 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -j RETURN |
| 928 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -j ufw-user-logging-input |
| 929 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -j DROP -m comment --comment 'dapp_Samba' |
| 930 | + |
| 931 | +### tuple ### deny_log tcp 139,445 0.0.0.0/0 any 0.0.0.0/0 Samba - in |
| 932 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 933 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -j RETURN |
| 934 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -j ufw-user-logging-input |
| 935 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -j DROP -m comment --comment 'dapp_Samba' |
| 936 | + |
| 937 | +### tuple ### deny_log tcp 80 0.0.0.0/0 any 0.0.0.0/0 Apache - in |
| 938 | +-A ufw-user-logging-input -p tcp --dport 80 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 939 | +-A ufw-user-logging-input -p tcp --dport 80 -j RETURN |
| 940 | +-A ufw-user-input -p tcp --dport 80 -j ufw-user-logging-input |
| 941 | +-A ufw-user-input -p tcp --dport 80 -j DROP -m comment --comment 'dapp_Apache' |
| 942 | + |
| 943 | +### tuple ### deny_log tcp 25 10.0.0.1 25 192.168.0.1 in |
| 944 | +-A ufw-user-logging-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 945 | +-A ufw-user-logging-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j RETURN |
| 946 | +-A ufw-user-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j ufw-user-logging-input |
| 947 | +-A ufw-user-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j DROP |
| 948 | + |
| 949 | +### tuple ### deny_log udp 137,138 10.0.0.1 137,138 192.168.0.1 Samba Samba in |
| 950 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 951 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j RETURN |
| 952 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j ufw-user-logging-input |
| 953 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j DROP -m comment --comment 'dapp_Samba,sapp_Samba' |
| 954 | + |
| 955 | +### tuple ### deny_log tcp 139,445 10.0.0.1 139,445 192.168.0.1 Samba Samba in |
| 956 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 957 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j RETURN |
| 958 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j ufw-user-logging-input |
| 959 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j DROP -m comment --comment 'dapp_Samba,sapp_Samba' |
| 960 | + |
| 961 | +### END RULES ### |
| 962 | + |
| 963 | +### LOGGING ### |
| 964 | +-A ufw-after-logging-input -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 965 | +-A ufw-after-logging-forward -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 966 | +-I ufw-logging-deny -m conntrack --ctstate INVALID -j RETURN -m limit --limit 3/min --limit-burst 10 |
| 967 | +-A ufw-logging-deny -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 968 | +-A ufw-logging-allow -j NFLOG --nflog-prefix "[UFW ALLOW] " -m limit --limit 3/min --limit-burst 10 |
| 969 | +### END LOGGING ### |
| 970 | + |
| 971 | +### RATE LIMITING ### |
| 972 | +-A ufw-user-limit -m limit --limit 3/minute -j NFLOG --nflog-prefix "[UFW LIMIT BLOCK] " |
| 973 | +-A ufw-user-limit -j REJECT |
| 974 | +-A ufw-user-limit-accept -j ACCEPT |
| 975 | +### END RATE LIMITING ### |
| 976 | +COMMIT |
| 977 | +*filter |
| 978 | +:ufw6-user-input - [0:0] |
| 979 | +:ufw6-user-output - [0:0] |
| 980 | +:ufw6-user-forward - [0:0] |
| 981 | +### RULES ### |
| 982 | +COMMIT |
| 983 | +40: delete deny log 23 |
| 984 | + |
| 985 | + |
| 986 | +41: delete deny log smtp |
| 987 | + |
| 988 | + |
| 989 | +42: delete deny log tftp |
| 990 | + |
| 991 | + |
| 992 | +43: delete deny log daytime |
| 993 | + |
| 994 | + |
| 995 | +44: delete deny log Samba |
| 996 | + |
| 997 | + |
| 998 | +45: delete deny log Apache |
| 999 | + |
| 1000 | + |
| 1001 | +46: delete deny log from 192.168.0.1 port smtp to 10.0.0.1 port smtp |
| 1002 | + |
| 1003 | + |
| 1004 | +47: delete deny log from 192.168.0.1 app Samba to 10.0.0.1 app Samba |
| 1005 | + |
| 1006 | + |
| 1007 | +contents of user*.rules: |
| 1008 | +*filter |
| 1009 | +:ufw-user-input - [0:0] |
| 1010 | +:ufw-user-output - [0:0] |
| 1011 | +:ufw-user-forward - [0:0] |
| 1012 | +:ufw-before-logging-input - [0:0] |
| 1013 | +:ufw-before-logging-output - [0:0] |
| 1014 | +:ufw-before-logging-forward - [0:0] |
| 1015 | +:ufw-user-logging-input - [0:0] |
| 1016 | +:ufw-user-logging-output - [0:0] |
| 1017 | +:ufw-user-logging-forward - [0:0] |
| 1018 | +:ufw-after-logging-input - [0:0] |
| 1019 | +:ufw-after-logging-output - [0:0] |
| 1020 | +:ufw-after-logging-forward - [0:0] |
| 1021 | +:ufw-logging-deny - [0:0] |
| 1022 | +:ufw-logging-allow - [0:0] |
| 1023 | +:ufw-user-limit - [0:0] |
| 1024 | +:ufw-user-limit-accept - [0:0] |
| 1025 | +### RULES ### |
| 1026 | + |
| 1027 | +### END RULES ### |
| 1028 | + |
| 1029 | +### LOGGING ### |
| 1030 | +-A ufw-after-logging-input -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1031 | +-A ufw-after-logging-forward -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1032 | +-I ufw-logging-deny -m conntrack --ctstate INVALID -j RETURN -m limit --limit 3/min --limit-burst 10 |
| 1033 | +-A ufw-logging-deny -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1034 | +-A ufw-logging-allow -j NFLOG --nflog-prefix "[UFW ALLOW] " -m limit --limit 3/min --limit-burst 10 |
| 1035 | +### END LOGGING ### |
| 1036 | + |
| 1037 | +### RATE LIMITING ### |
| 1038 | +-A ufw-user-limit -m limit --limit 3/minute -j NFLOG --nflog-prefix "[UFW LIMIT BLOCK] " |
| 1039 | +-A ufw-user-limit -j REJECT |
| 1040 | +-A ufw-user-limit-accept -j ACCEPT |
| 1041 | +### END RATE LIMITING ### |
| 1042 | +COMMIT |
| 1043 | +*filter |
| 1044 | +:ufw6-user-input - [0:0] |
| 1045 | +:ufw6-user-output - [0:0] |
| 1046 | +:ufw6-user-forward - [0:0] |
| 1047 | +### RULES ### |
| 1048 | +COMMIT |
| 1049 | +48: deny log-all 23 |
| 1050 | + |
| 1051 | + |
| 1052 | +49: deny log-all smtp |
| 1053 | + |
| 1054 | + |
| 1055 | +50: deny log-all tftp |
| 1056 | + |
| 1057 | + |
| 1058 | +51: deny log-all daytime |
| 1059 | + |
| 1060 | + |
| 1061 | +52: deny log-all Samba |
| 1062 | + |
| 1063 | + |
| 1064 | +53: deny log-all Apache |
| 1065 | + |
| 1066 | + |
| 1067 | +54: deny log-all from 192.168.0.1 port smtp to 10.0.0.1 port smtp |
| 1068 | + |
| 1069 | + |
| 1070 | +55: deny log-all from 192.168.0.1 app Samba to 10.0.0.1 app Samba |
| 1071 | + |
| 1072 | + |
| 1073 | +contents of user*.rules: |
| 1074 | +*filter |
| 1075 | +:ufw-user-input - [0:0] |
| 1076 | +:ufw-user-output - [0:0] |
| 1077 | +:ufw-user-forward - [0:0] |
| 1078 | +:ufw-before-logging-input - [0:0] |
| 1079 | +:ufw-before-logging-output - [0:0] |
| 1080 | +:ufw-before-logging-forward - [0:0] |
| 1081 | +:ufw-user-logging-input - [0:0] |
| 1082 | +:ufw-user-logging-output - [0:0] |
| 1083 | +:ufw-user-logging-forward - [0:0] |
| 1084 | +:ufw-after-logging-input - [0:0] |
| 1085 | +:ufw-after-logging-output - [0:0] |
| 1086 | +:ufw-after-logging-forward - [0:0] |
| 1087 | +:ufw-logging-deny - [0:0] |
| 1088 | +:ufw-logging-allow - [0:0] |
| 1089 | +:ufw-user-limit - [0:0] |
| 1090 | +:ufw-user-limit-accept - [0:0] |
| 1091 | +### RULES ### |
| 1092 | + |
| 1093 | +### tuple ### deny_log-all any 23 0.0.0.0/0 any 0.0.0.0/0 in |
| 1094 | +-A ufw-user-logging-input -p tcp --dport 23 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1095 | +-A ufw-user-logging-input -p tcp --dport 23 -j RETURN |
| 1096 | +-A ufw-user-input -p tcp --dport 23 -j ufw-user-logging-input |
| 1097 | +-A ufw-user-input -p tcp --dport 23 -j DROP |
| 1098 | +-A ufw-user-logging-input -p udp --dport 23 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1099 | +-A ufw-user-logging-input -p udp --dport 23 -j RETURN |
| 1100 | +-A ufw-user-input -p udp --dport 23 -j ufw-user-logging-input |
| 1101 | +-A ufw-user-input -p udp --dport 23 -j DROP |
| 1102 | + |
| 1103 | +### tuple ### deny_log-all tcp 25 0.0.0.0/0 any 0.0.0.0/0 in |
| 1104 | +-A ufw-user-logging-input -p tcp --dport 25 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1105 | +-A ufw-user-logging-input -p tcp --dport 25 -j RETURN |
| 1106 | +-A ufw-user-input -p tcp --dport 25 -j ufw-user-logging-input |
| 1107 | +-A ufw-user-input -p tcp --dport 25 -j DROP |
| 1108 | + |
| 1109 | +### tuple ### deny_log-all udp 69 0.0.0.0/0 any 0.0.0.0/0 in |
| 1110 | +-A ufw-user-logging-input -p udp --dport 69 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1111 | +-A ufw-user-logging-input -p udp --dport 69 -j RETURN |
| 1112 | +-A ufw-user-input -p udp --dport 69 -j ufw-user-logging-input |
| 1113 | +-A ufw-user-input -p udp --dport 69 -j DROP |
| 1114 | + |
| 1115 | +### tuple ### deny_log-all any 13 0.0.0.0/0 any 0.0.0.0/0 in |
| 1116 | +-A ufw-user-logging-input -p tcp --dport 13 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1117 | +-A ufw-user-logging-input -p tcp --dport 13 -j RETURN |
| 1118 | +-A ufw-user-input -p tcp --dport 13 -j ufw-user-logging-input |
| 1119 | +-A ufw-user-input -p tcp --dport 13 -j DROP |
| 1120 | +-A ufw-user-logging-input -p udp --dport 13 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1121 | +-A ufw-user-logging-input -p udp --dport 13 -j RETURN |
| 1122 | +-A ufw-user-input -p udp --dport 13 -j ufw-user-logging-input |
| 1123 | +-A ufw-user-input -p udp --dport 13 -j DROP |
| 1124 | + |
| 1125 | +### tuple ### deny_log-all udp 137,138 0.0.0.0/0 any 0.0.0.0/0 Samba - in |
| 1126 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1127 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -j RETURN |
| 1128 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -j ufw-user-logging-input |
| 1129 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -j DROP -m comment --comment 'dapp_Samba' |
| 1130 | + |
| 1131 | +### tuple ### deny_log-all tcp 139,445 0.0.0.0/0 any 0.0.0.0/0 Samba - in |
| 1132 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1133 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -j RETURN |
| 1134 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -j ufw-user-logging-input |
| 1135 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -j DROP -m comment --comment 'dapp_Samba' |
| 1136 | + |
| 1137 | +### tuple ### deny_log-all tcp 80 0.0.0.0/0 any 0.0.0.0/0 Apache - in |
| 1138 | +-A ufw-user-logging-input -p tcp --dport 80 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1139 | +-A ufw-user-logging-input -p tcp --dport 80 -j RETURN |
| 1140 | +-A ufw-user-input -p tcp --dport 80 -j ufw-user-logging-input |
| 1141 | +-A ufw-user-input -p tcp --dport 80 -j DROP -m comment --comment 'dapp_Apache' |
| 1142 | + |
| 1143 | +### tuple ### deny_log-all tcp 25 10.0.0.1 25 192.168.0.1 in |
| 1144 | +-A ufw-user-logging-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1145 | +-A ufw-user-logging-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j RETURN |
| 1146 | +-A ufw-user-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j ufw-user-logging-input |
| 1147 | +-A ufw-user-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j DROP |
| 1148 | + |
| 1149 | +### tuple ### deny_log-all udp 137,138 10.0.0.1 137,138 192.168.0.1 Samba Samba in |
| 1150 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1151 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j RETURN |
| 1152 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j ufw-user-logging-input |
| 1153 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j DROP -m comment --comment 'dapp_Samba,sapp_Samba' |
| 1154 | + |
| 1155 | +### tuple ### deny_log-all tcp 139,445 10.0.0.1 139,445 192.168.0.1 Samba Samba in |
| 1156 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1157 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j RETURN |
| 1158 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j ufw-user-logging-input |
| 1159 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j DROP -m comment --comment 'dapp_Samba,sapp_Samba' |
| 1160 | + |
| 1161 | +### END RULES ### |
| 1162 | + |
| 1163 | +### LOGGING ### |
| 1164 | +-A ufw-after-logging-input -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1165 | +-A ufw-after-logging-forward -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1166 | +-I ufw-logging-deny -m conntrack --ctstate INVALID -j RETURN -m limit --limit 3/min --limit-burst 10 |
| 1167 | +-A ufw-logging-deny -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1168 | +-A ufw-logging-allow -j NFLOG --nflog-prefix "[UFW ALLOW] " -m limit --limit 3/min --limit-burst 10 |
| 1169 | +### END LOGGING ### |
| 1170 | + |
| 1171 | +### RATE LIMITING ### |
| 1172 | +-A ufw-user-limit -m limit --limit 3/minute -j NFLOG --nflog-prefix "[UFW LIMIT BLOCK] " |
| 1173 | +-A ufw-user-limit -j REJECT |
| 1174 | +-A ufw-user-limit-accept -j ACCEPT |
| 1175 | +### END RATE LIMITING ### |
| 1176 | +COMMIT |
| 1177 | +*filter |
| 1178 | +:ufw6-user-input - [0:0] |
| 1179 | +:ufw6-user-output - [0:0] |
| 1180 | +:ufw6-user-forward - [0:0] |
| 1181 | +### RULES ### |
| 1182 | +COMMIT |
| 1183 | +56: delete deny log-all 23 |
| 1184 | + |
| 1185 | + |
| 1186 | +57: delete deny log-all smtp |
| 1187 | + |
| 1188 | + |
| 1189 | +58: delete deny log-all tftp |
| 1190 | + |
| 1191 | + |
| 1192 | +59: delete deny log-all daytime |
| 1193 | + |
| 1194 | + |
| 1195 | +60: delete deny log-all Samba |
| 1196 | + |
| 1197 | + |
| 1198 | +61: delete deny log-all Apache |
| 1199 | + |
| 1200 | + |
| 1201 | +62: delete deny log-all from 192.168.0.1 port smtp to 10.0.0.1 port smtp |
| 1202 | + |
| 1203 | + |
| 1204 | +63: delete deny log-all from 192.168.0.1 app Samba to 10.0.0.1 app Samba |
| 1205 | + |
| 1206 | + |
| 1207 | +contents of user*.rules: |
| 1208 | +*filter |
| 1209 | +:ufw-user-input - [0:0] |
| 1210 | +:ufw-user-output - [0:0] |
| 1211 | +:ufw-user-forward - [0:0] |
| 1212 | +:ufw-before-logging-input - [0:0] |
| 1213 | +:ufw-before-logging-output - [0:0] |
| 1214 | +:ufw-before-logging-forward - [0:0] |
| 1215 | +:ufw-user-logging-input - [0:0] |
| 1216 | +:ufw-user-logging-output - [0:0] |
| 1217 | +:ufw-user-logging-forward - [0:0] |
| 1218 | +:ufw-after-logging-input - [0:0] |
| 1219 | +:ufw-after-logging-output - [0:0] |
| 1220 | +:ufw-after-logging-forward - [0:0] |
| 1221 | +:ufw-logging-deny - [0:0] |
| 1222 | +:ufw-logging-allow - [0:0] |
| 1223 | +:ufw-user-limit - [0:0] |
| 1224 | +:ufw-user-limit-accept - [0:0] |
| 1225 | +### RULES ### |
| 1226 | + |
| 1227 | +### END RULES ### |
| 1228 | + |
| 1229 | +### LOGGING ### |
| 1230 | +-A ufw-after-logging-input -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1231 | +-A ufw-after-logging-forward -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1232 | +-I ufw-logging-deny -m conntrack --ctstate INVALID -j RETURN -m limit --limit 3/min --limit-burst 10 |
| 1233 | +-A ufw-logging-deny -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1234 | +-A ufw-logging-allow -j NFLOG --nflog-prefix "[UFW ALLOW] " -m limit --limit 3/min --limit-burst 10 |
| 1235 | +### END LOGGING ### |
| 1236 | + |
| 1237 | +### RATE LIMITING ### |
| 1238 | +-A ufw-user-limit -m limit --limit 3/minute -j NFLOG --nflog-prefix "[UFW LIMIT BLOCK] " |
| 1239 | +-A ufw-user-limit -j REJECT |
| 1240 | +-A ufw-user-limit-accept -j ACCEPT |
| 1241 | +### END RATE LIMITING ### |
| 1242 | +COMMIT |
| 1243 | +*filter |
| 1244 | +:ufw6-user-input - [0:0] |
| 1245 | +:ufw6-user-output - [0:0] |
| 1246 | +:ufw6-user-forward - [0:0] |
| 1247 | +### RULES ### |
| 1248 | +COMMIT |
| 1249 | +64: limit log 23 |
| 1250 | + |
| 1251 | + |
| 1252 | +65: limit log smtp |
| 1253 | + |
| 1254 | + |
| 1255 | +66: limit log tftp |
| 1256 | + |
| 1257 | + |
| 1258 | +67: limit log daytime |
| 1259 | + |
| 1260 | + |
| 1261 | +68: limit log Samba |
| 1262 | + |
| 1263 | + |
| 1264 | +69: limit log Apache |
| 1265 | + |
| 1266 | + |
| 1267 | +70: limit log from 192.168.0.1 port smtp to 10.0.0.1 port smtp |
| 1268 | + |
| 1269 | + |
| 1270 | +71: limit log from 192.168.0.1 app Samba to 10.0.0.1 app Samba |
| 1271 | + |
| 1272 | + |
| 1273 | +contents of user*.rules: |
| 1274 | +*filter |
| 1275 | +:ufw-user-input - [0:0] |
| 1276 | +:ufw-user-output - [0:0] |
| 1277 | +:ufw-user-forward - [0:0] |
| 1278 | +:ufw-before-logging-input - [0:0] |
| 1279 | +:ufw-before-logging-output - [0:0] |
| 1280 | +:ufw-before-logging-forward - [0:0] |
| 1281 | +:ufw-user-logging-input - [0:0] |
| 1282 | +:ufw-user-logging-output - [0:0] |
| 1283 | +:ufw-user-logging-forward - [0:0] |
| 1284 | +:ufw-after-logging-input - [0:0] |
| 1285 | +:ufw-after-logging-output - [0:0] |
| 1286 | +:ufw-after-logging-forward - [0:0] |
| 1287 | +:ufw-logging-deny - [0:0] |
| 1288 | +:ufw-logging-allow - [0:0] |
| 1289 | +:ufw-user-limit - [0:0] |
| 1290 | +:ufw-user-limit-accept - [0:0] |
| 1291 | +### RULES ### |
| 1292 | + |
| 1293 | +### tuple ### limit_log any 23 0.0.0.0/0 any 0.0.0.0/0 in |
| 1294 | +-A ufw-user-logging-input -p tcp --dport 23 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1295 | +-A ufw-user-logging-input -p tcp --dport 23 -j RETURN |
| 1296 | +-A ufw-user-input -p tcp --dport 23 -j ufw-user-logging-input |
| 1297 | +-A ufw-user-input -p tcp --dport 23 -m conntrack --ctstate NEW -m recent --set |
| 1298 | +-A ufw-user-input -p tcp --dport 23 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit |
| 1299 | +-A ufw-user-input -p tcp --dport 23 -j ufw-user-limit-accept |
| 1300 | +-A ufw-user-logging-input -p udp --dport 23 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1301 | +-A ufw-user-logging-input -p udp --dport 23 -j RETURN |
| 1302 | +-A ufw-user-input -p udp --dport 23 -j ufw-user-logging-input |
| 1303 | +-A ufw-user-input -p udp --dport 23 -m conntrack --ctstate NEW -m recent --set |
| 1304 | +-A ufw-user-input -p udp --dport 23 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit |
| 1305 | +-A ufw-user-input -p udp --dport 23 -j ufw-user-limit-accept |
| 1306 | + |
| 1307 | +### tuple ### limit_log tcp 25 0.0.0.0/0 any 0.0.0.0/0 in |
| 1308 | +-A ufw-user-logging-input -p tcp --dport 25 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1309 | +-A ufw-user-logging-input -p tcp --dport 25 -j RETURN |
| 1310 | +-A ufw-user-input -p tcp --dport 25 -j ufw-user-logging-input |
| 1311 | +-A ufw-user-input -p tcp --dport 25 -m conntrack --ctstate NEW -m recent --set |
| 1312 | +-A ufw-user-input -p tcp --dport 25 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit |
| 1313 | +-A ufw-user-input -p tcp --dport 25 -j ufw-user-limit-accept |
| 1314 | + |
| 1315 | +### tuple ### limit_log udp 69 0.0.0.0/0 any 0.0.0.0/0 in |
| 1316 | +-A ufw-user-logging-input -p udp --dport 69 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1317 | +-A ufw-user-logging-input -p udp --dport 69 -j RETURN |
| 1318 | +-A ufw-user-input -p udp --dport 69 -j ufw-user-logging-input |
| 1319 | +-A ufw-user-input -p udp --dport 69 -m conntrack --ctstate NEW -m recent --set |
| 1320 | +-A ufw-user-input -p udp --dport 69 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit |
| 1321 | +-A ufw-user-input -p udp --dport 69 -j ufw-user-limit-accept |
| 1322 | + |
| 1323 | +### tuple ### limit_log any 13 0.0.0.0/0 any 0.0.0.0/0 in |
| 1324 | +-A ufw-user-logging-input -p tcp --dport 13 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1325 | +-A ufw-user-logging-input -p tcp --dport 13 -j RETURN |
| 1326 | +-A ufw-user-input -p tcp --dport 13 -j ufw-user-logging-input |
| 1327 | +-A ufw-user-input -p tcp --dport 13 -m conntrack --ctstate NEW -m recent --set |
| 1328 | +-A ufw-user-input -p tcp --dport 13 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit |
| 1329 | +-A ufw-user-input -p tcp --dport 13 -j ufw-user-limit-accept |
| 1330 | +-A ufw-user-logging-input -p udp --dport 13 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1331 | +-A ufw-user-logging-input -p udp --dport 13 -j RETURN |
| 1332 | +-A ufw-user-input -p udp --dport 13 -j ufw-user-logging-input |
| 1333 | +-A ufw-user-input -p udp --dport 13 -m conntrack --ctstate NEW -m recent --set |
| 1334 | +-A ufw-user-input -p udp --dport 13 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit |
| 1335 | +-A ufw-user-input -p udp --dport 13 -j ufw-user-limit-accept |
| 1336 | + |
| 1337 | +### tuple ### limit_log udp 137,138 0.0.0.0/0 any 0.0.0.0/0 Samba - in |
| 1338 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1339 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -j RETURN |
| 1340 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -j ufw-user-logging-input |
| 1341 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m conntrack --ctstate NEW -m recent --set -m comment --comment 'dapp_Samba' |
| 1342 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit -m comment --comment 'dapp_Samba' |
| 1343 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -j ufw-user-limit-accept -m comment --comment 'dapp_Samba' |
| 1344 | + |
| 1345 | +### tuple ### limit_log tcp 139,445 0.0.0.0/0 any 0.0.0.0/0 Samba - in |
| 1346 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1347 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -j RETURN |
| 1348 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -j ufw-user-logging-input |
| 1349 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m conntrack --ctstate NEW -m recent --set -m comment --comment 'dapp_Samba' |
| 1350 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit -m comment --comment 'dapp_Samba' |
| 1351 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -j ufw-user-limit-accept -m comment --comment 'dapp_Samba' |
| 1352 | + |
| 1353 | +### tuple ### limit_log tcp 80 0.0.0.0/0 any 0.0.0.0/0 Apache - in |
| 1354 | +-A ufw-user-logging-input -p tcp --dport 80 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1355 | +-A ufw-user-logging-input -p tcp --dport 80 -j RETURN |
| 1356 | +-A ufw-user-input -p tcp --dport 80 -j ufw-user-logging-input |
| 1357 | +-A ufw-user-input -p tcp --dport 80 -m conntrack --ctstate NEW -m recent --set -m comment --comment 'dapp_Apache' |
| 1358 | +-A ufw-user-input -p tcp --dport 80 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit -m comment --comment 'dapp_Apache' |
| 1359 | +-A ufw-user-input -p tcp --dport 80 -j ufw-user-limit-accept -m comment --comment 'dapp_Apache' |
| 1360 | + |
| 1361 | +### tuple ### limit_log tcp 25 10.0.0.1 25 192.168.0.1 in |
| 1362 | +-A ufw-user-logging-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1363 | +-A ufw-user-logging-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j RETURN |
| 1364 | +-A ufw-user-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j ufw-user-logging-input |
| 1365 | +-A ufw-user-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -m conntrack --ctstate NEW -m recent --set |
| 1366 | +-A ufw-user-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit |
| 1367 | +-A ufw-user-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j ufw-user-limit-accept |
| 1368 | + |
| 1369 | +### tuple ### limit_log udp 137,138 10.0.0.1 137,138 192.168.0.1 Samba Samba in |
| 1370 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1371 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j RETURN |
| 1372 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j ufw-user-logging-input |
| 1373 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -m conntrack --ctstate NEW -m recent --set -m comment --comment 'dapp_Samba,sapp_Samba' |
| 1374 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit -m comment --comment 'dapp_Samba,sapp_Samba' |
| 1375 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j ufw-user-limit-accept -m comment --comment 'dapp_Samba,sapp_Samba' |
| 1376 | + |
| 1377 | +### tuple ### limit_log tcp 139,445 10.0.0.1 139,445 192.168.0.1 Samba Samba in |
| 1378 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1379 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j RETURN |
| 1380 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j ufw-user-logging-input |
| 1381 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -m conntrack --ctstate NEW -m recent --set -m comment --comment 'dapp_Samba,sapp_Samba' |
| 1382 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit -m comment --comment 'dapp_Samba,sapp_Samba' |
| 1383 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j ufw-user-limit-accept -m comment --comment 'dapp_Samba,sapp_Samba' |
| 1384 | + |
| 1385 | +### END RULES ### |
| 1386 | + |
| 1387 | +### LOGGING ### |
| 1388 | +-A ufw-after-logging-input -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1389 | +-A ufw-after-logging-forward -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1390 | +-I ufw-logging-deny -m conntrack --ctstate INVALID -j RETURN -m limit --limit 3/min --limit-burst 10 |
| 1391 | +-A ufw-logging-deny -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1392 | +-A ufw-logging-allow -j NFLOG --nflog-prefix "[UFW ALLOW] " -m limit --limit 3/min --limit-burst 10 |
| 1393 | +### END LOGGING ### |
| 1394 | + |
| 1395 | +### RATE LIMITING ### |
| 1396 | +-A ufw-user-limit -m limit --limit 3/minute -j NFLOG --nflog-prefix "[UFW LIMIT BLOCK] " |
| 1397 | +-A ufw-user-limit -j REJECT |
| 1398 | +-A ufw-user-limit-accept -j ACCEPT |
| 1399 | +### END RATE LIMITING ### |
| 1400 | +COMMIT |
| 1401 | +*filter |
| 1402 | +:ufw6-user-input - [0:0] |
| 1403 | +:ufw6-user-output - [0:0] |
| 1404 | +:ufw6-user-forward - [0:0] |
| 1405 | +### RULES ### |
| 1406 | +COMMIT |
| 1407 | +72: delete limit log 23 |
| 1408 | + |
| 1409 | + |
| 1410 | +73: delete limit log smtp |
| 1411 | + |
| 1412 | + |
| 1413 | +74: delete limit log tftp |
| 1414 | + |
| 1415 | + |
| 1416 | +75: delete limit log daytime |
| 1417 | + |
| 1418 | + |
| 1419 | +76: delete limit log Samba |
| 1420 | + |
| 1421 | + |
| 1422 | +77: delete limit log Apache |
| 1423 | + |
| 1424 | + |
| 1425 | +78: delete limit log from 192.168.0.1 port smtp to 10.0.0.1 port smtp |
| 1426 | + |
| 1427 | + |
| 1428 | +79: delete limit log from 192.168.0.1 app Samba to 10.0.0.1 app Samba |
| 1429 | + |
| 1430 | + |
| 1431 | +contents of user*.rules: |
| 1432 | +*filter |
| 1433 | +:ufw-user-input - [0:0] |
| 1434 | +:ufw-user-output - [0:0] |
| 1435 | +:ufw-user-forward - [0:0] |
| 1436 | +:ufw-before-logging-input - [0:0] |
| 1437 | +:ufw-before-logging-output - [0:0] |
| 1438 | +:ufw-before-logging-forward - [0:0] |
| 1439 | +:ufw-user-logging-input - [0:0] |
| 1440 | +:ufw-user-logging-output - [0:0] |
| 1441 | +:ufw-user-logging-forward - [0:0] |
| 1442 | +:ufw-after-logging-input - [0:0] |
| 1443 | +:ufw-after-logging-output - [0:0] |
| 1444 | +:ufw-after-logging-forward - [0:0] |
| 1445 | +:ufw-logging-deny - [0:0] |
| 1446 | +:ufw-logging-allow - [0:0] |
| 1447 | +:ufw-user-limit - [0:0] |
| 1448 | +:ufw-user-limit-accept - [0:0] |
| 1449 | +### RULES ### |
| 1450 | + |
| 1451 | +### END RULES ### |
| 1452 | + |
| 1453 | +### LOGGING ### |
| 1454 | +-A ufw-after-logging-input -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1455 | +-A ufw-after-logging-forward -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1456 | +-I ufw-logging-deny -m conntrack --ctstate INVALID -j RETURN -m limit --limit 3/min --limit-burst 10 |
| 1457 | +-A ufw-logging-deny -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1458 | +-A ufw-logging-allow -j NFLOG --nflog-prefix "[UFW ALLOW] " -m limit --limit 3/min --limit-burst 10 |
| 1459 | +### END LOGGING ### |
| 1460 | + |
| 1461 | +### RATE LIMITING ### |
| 1462 | +-A ufw-user-limit -m limit --limit 3/minute -j NFLOG --nflog-prefix "[UFW LIMIT BLOCK] " |
| 1463 | +-A ufw-user-limit -j REJECT |
| 1464 | +-A ufw-user-limit-accept -j ACCEPT |
| 1465 | +### END RATE LIMITING ### |
| 1466 | +COMMIT |
| 1467 | +*filter |
| 1468 | +:ufw6-user-input - [0:0] |
| 1469 | +:ufw6-user-output - [0:0] |
| 1470 | +:ufw6-user-forward - [0:0] |
| 1471 | +### RULES ### |
| 1472 | +COMMIT |
| 1473 | +80: limit log-all 23 |
| 1474 | + |
| 1475 | + |
| 1476 | +81: limit log-all smtp |
| 1477 | + |
| 1478 | + |
| 1479 | +82: limit log-all tftp |
| 1480 | + |
| 1481 | + |
| 1482 | +83: limit log-all daytime |
| 1483 | + |
| 1484 | + |
| 1485 | +84: limit log-all Samba |
| 1486 | + |
| 1487 | + |
| 1488 | +85: limit log-all Apache |
| 1489 | + |
| 1490 | + |
| 1491 | +86: limit log-all from 192.168.0.1 port smtp to 10.0.0.1 port smtp |
| 1492 | + |
| 1493 | + |
| 1494 | +87: limit log-all from 192.168.0.1 app Samba to 10.0.0.1 app Samba |
| 1495 | + |
| 1496 | + |
| 1497 | +contents of user*.rules: |
| 1498 | +*filter |
| 1499 | +:ufw-user-input - [0:0] |
| 1500 | +:ufw-user-output - [0:0] |
| 1501 | +:ufw-user-forward - [0:0] |
| 1502 | +:ufw-before-logging-input - [0:0] |
| 1503 | +:ufw-before-logging-output - [0:0] |
| 1504 | +:ufw-before-logging-forward - [0:0] |
| 1505 | +:ufw-user-logging-input - [0:0] |
| 1506 | +:ufw-user-logging-output - [0:0] |
| 1507 | +:ufw-user-logging-forward - [0:0] |
| 1508 | +:ufw-after-logging-input - [0:0] |
| 1509 | +:ufw-after-logging-output - [0:0] |
| 1510 | +:ufw-after-logging-forward - [0:0] |
| 1511 | +:ufw-logging-deny - [0:0] |
| 1512 | +:ufw-logging-allow - [0:0] |
| 1513 | +:ufw-user-limit - [0:0] |
| 1514 | +:ufw-user-limit-accept - [0:0] |
| 1515 | +### RULES ### |
| 1516 | + |
| 1517 | +### tuple ### limit_log-all any 23 0.0.0.0/0 any 0.0.0.0/0 in |
| 1518 | +-A ufw-user-logging-input -p tcp --dport 23 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1519 | +-A ufw-user-logging-input -p tcp --dport 23 -j RETURN |
| 1520 | +-A ufw-user-input -p tcp --dport 23 -j ufw-user-logging-input |
| 1521 | +-A ufw-user-input -p tcp --dport 23 -m conntrack --ctstate NEW -m recent --set |
| 1522 | +-A ufw-user-input -p tcp --dport 23 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit |
| 1523 | +-A ufw-user-input -p tcp --dport 23 -j ufw-user-limit-accept |
| 1524 | +-A ufw-user-logging-input -p udp --dport 23 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1525 | +-A ufw-user-logging-input -p udp --dport 23 -j RETURN |
| 1526 | +-A ufw-user-input -p udp --dport 23 -j ufw-user-logging-input |
| 1527 | +-A ufw-user-input -p udp --dport 23 -m conntrack --ctstate NEW -m recent --set |
| 1528 | +-A ufw-user-input -p udp --dport 23 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit |
| 1529 | +-A ufw-user-input -p udp --dport 23 -j ufw-user-limit-accept |
| 1530 | + |
| 1531 | +### tuple ### limit_log-all tcp 25 0.0.0.0/0 any 0.0.0.0/0 in |
| 1532 | +-A ufw-user-logging-input -p tcp --dport 25 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1533 | +-A ufw-user-logging-input -p tcp --dport 25 -j RETURN |
| 1534 | +-A ufw-user-input -p tcp --dport 25 -j ufw-user-logging-input |
| 1535 | +-A ufw-user-input -p tcp --dport 25 -m conntrack --ctstate NEW -m recent --set |
| 1536 | +-A ufw-user-input -p tcp --dport 25 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit |
| 1537 | +-A ufw-user-input -p tcp --dport 25 -j ufw-user-limit-accept |
| 1538 | + |
| 1539 | +### tuple ### limit_log-all udp 69 0.0.0.0/0 any 0.0.0.0/0 in |
| 1540 | +-A ufw-user-logging-input -p udp --dport 69 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1541 | +-A ufw-user-logging-input -p udp --dport 69 -j RETURN |
| 1542 | +-A ufw-user-input -p udp --dport 69 -j ufw-user-logging-input |
| 1543 | +-A ufw-user-input -p udp --dport 69 -m conntrack --ctstate NEW -m recent --set |
| 1544 | +-A ufw-user-input -p udp --dport 69 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit |
| 1545 | +-A ufw-user-input -p udp --dport 69 -j ufw-user-limit-accept |
| 1546 | + |
| 1547 | +### tuple ### limit_log-all any 13 0.0.0.0/0 any 0.0.0.0/0 in |
| 1548 | +-A ufw-user-logging-input -p tcp --dport 13 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1549 | +-A ufw-user-logging-input -p tcp --dport 13 -j RETURN |
| 1550 | +-A ufw-user-input -p tcp --dport 13 -j ufw-user-logging-input |
| 1551 | +-A ufw-user-input -p tcp --dport 13 -m conntrack --ctstate NEW -m recent --set |
| 1552 | +-A ufw-user-input -p tcp --dport 13 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit |
| 1553 | +-A ufw-user-input -p tcp --dport 13 -j ufw-user-limit-accept |
| 1554 | +-A ufw-user-logging-input -p udp --dport 13 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1555 | +-A ufw-user-logging-input -p udp --dport 13 -j RETURN |
| 1556 | +-A ufw-user-input -p udp --dport 13 -j ufw-user-logging-input |
| 1557 | +-A ufw-user-input -p udp --dport 13 -m conntrack --ctstate NEW -m recent --set |
| 1558 | +-A ufw-user-input -p udp --dport 13 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit |
| 1559 | +-A ufw-user-input -p udp --dport 13 -j ufw-user-limit-accept |
| 1560 | + |
| 1561 | +### tuple ### limit_log-all udp 137,138 0.0.0.0/0 any 0.0.0.0/0 Samba - in |
| 1562 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1563 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -j RETURN |
| 1564 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -j ufw-user-logging-input |
| 1565 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m conntrack --ctstate NEW -m recent --set -m comment --comment 'dapp_Samba' |
| 1566 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit -m comment --comment 'dapp_Samba' |
| 1567 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -j ufw-user-limit-accept -m comment --comment 'dapp_Samba' |
| 1568 | + |
| 1569 | +### tuple ### limit_log-all tcp 139,445 0.0.0.0/0 any 0.0.0.0/0 Samba - in |
| 1570 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1571 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -j RETURN |
| 1572 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -j ufw-user-logging-input |
| 1573 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m conntrack --ctstate NEW -m recent --set -m comment --comment 'dapp_Samba' |
| 1574 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit -m comment --comment 'dapp_Samba' |
| 1575 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -j ufw-user-limit-accept -m comment --comment 'dapp_Samba' |
| 1576 | + |
| 1577 | +### tuple ### limit_log-all tcp 80 0.0.0.0/0 any 0.0.0.0/0 Apache - in |
| 1578 | +-A ufw-user-logging-input -p tcp --dport 80 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1579 | +-A ufw-user-logging-input -p tcp --dport 80 -j RETURN |
| 1580 | +-A ufw-user-input -p tcp --dport 80 -j ufw-user-logging-input |
| 1581 | +-A ufw-user-input -p tcp --dport 80 -m conntrack --ctstate NEW -m recent --set -m comment --comment 'dapp_Apache' |
| 1582 | +-A ufw-user-input -p tcp --dport 80 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit -m comment --comment 'dapp_Apache' |
| 1583 | +-A ufw-user-input -p tcp --dport 80 -j ufw-user-limit-accept -m comment --comment 'dapp_Apache' |
| 1584 | + |
| 1585 | +### tuple ### limit_log-all tcp 25 10.0.0.1 25 192.168.0.1 in |
| 1586 | +-A ufw-user-logging-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1587 | +-A ufw-user-logging-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j RETURN |
| 1588 | +-A ufw-user-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j ufw-user-logging-input |
| 1589 | +-A ufw-user-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -m conntrack --ctstate NEW -m recent --set |
| 1590 | +-A ufw-user-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit |
| 1591 | +-A ufw-user-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j ufw-user-limit-accept |
| 1592 | + |
| 1593 | +### tuple ### limit_log-all udp 137,138 10.0.0.1 137,138 192.168.0.1 Samba Samba in |
| 1594 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1595 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j RETURN |
| 1596 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j ufw-user-logging-input |
| 1597 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -m conntrack --ctstate NEW -m recent --set -m comment --comment 'dapp_Samba,sapp_Samba' |
| 1598 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit -m comment --comment 'dapp_Samba,sapp_Samba' |
| 1599 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j ufw-user-limit-accept -m comment --comment 'dapp_Samba,sapp_Samba' |
| 1600 | + |
| 1601 | +### tuple ### limit_log-all tcp 139,445 10.0.0.1 139,445 192.168.0.1 Samba Samba in |
| 1602 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW LIMIT] " |
| 1603 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j RETURN |
| 1604 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j ufw-user-logging-input |
| 1605 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -m conntrack --ctstate NEW -m recent --set -m comment --comment 'dapp_Samba,sapp_Samba' |
| 1606 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j ufw-user-limit -m comment --comment 'dapp_Samba,sapp_Samba' |
| 1607 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j ufw-user-limit-accept -m comment --comment 'dapp_Samba,sapp_Samba' |
| 1608 | + |
| 1609 | +### END RULES ### |
| 1610 | + |
| 1611 | +### LOGGING ### |
| 1612 | +-A ufw-after-logging-input -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1613 | +-A ufw-after-logging-forward -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1614 | +-I ufw-logging-deny -m conntrack --ctstate INVALID -j RETURN -m limit --limit 3/min --limit-burst 10 |
| 1615 | +-A ufw-logging-deny -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1616 | +-A ufw-logging-allow -j NFLOG --nflog-prefix "[UFW ALLOW] " -m limit --limit 3/min --limit-burst 10 |
| 1617 | +### END LOGGING ### |
| 1618 | + |
| 1619 | +### RATE LIMITING ### |
| 1620 | +-A ufw-user-limit -m limit --limit 3/minute -j NFLOG --nflog-prefix "[UFW LIMIT BLOCK] " |
| 1621 | +-A ufw-user-limit -j REJECT |
| 1622 | +-A ufw-user-limit-accept -j ACCEPT |
| 1623 | +### END RATE LIMITING ### |
| 1624 | +COMMIT |
| 1625 | +*filter |
| 1626 | +:ufw6-user-input - [0:0] |
| 1627 | +:ufw6-user-output - [0:0] |
| 1628 | +:ufw6-user-forward - [0:0] |
| 1629 | +### RULES ### |
| 1630 | +COMMIT |
| 1631 | +88: delete limit log-all 23 |
| 1632 | + |
| 1633 | + |
| 1634 | +89: delete limit log-all smtp |
| 1635 | + |
| 1636 | + |
| 1637 | +90: delete limit log-all tftp |
| 1638 | + |
| 1639 | + |
| 1640 | +91: delete limit log-all daytime |
| 1641 | + |
| 1642 | + |
| 1643 | +92: delete limit log-all Samba |
| 1644 | + |
| 1645 | + |
| 1646 | +93: delete limit log-all Apache |
| 1647 | + |
| 1648 | + |
| 1649 | +94: delete limit log-all from 192.168.0.1 port smtp to 10.0.0.1 port smtp |
| 1650 | + |
| 1651 | + |
| 1652 | +95: delete limit log-all from 192.168.0.1 app Samba to 10.0.0.1 app Samba |
| 1653 | + |
| 1654 | + |
| 1655 | +contents of user*.rules: |
| 1656 | +*filter |
| 1657 | +:ufw-user-input - [0:0] |
| 1658 | +:ufw-user-output - [0:0] |
| 1659 | +:ufw-user-forward - [0:0] |
| 1660 | +:ufw-before-logging-input - [0:0] |
| 1661 | +:ufw-before-logging-output - [0:0] |
| 1662 | +:ufw-before-logging-forward - [0:0] |
| 1663 | +:ufw-user-logging-input - [0:0] |
| 1664 | +:ufw-user-logging-output - [0:0] |
| 1665 | +:ufw-user-logging-forward - [0:0] |
| 1666 | +:ufw-after-logging-input - [0:0] |
| 1667 | +:ufw-after-logging-output - [0:0] |
| 1668 | +:ufw-after-logging-forward - [0:0] |
| 1669 | +:ufw-logging-deny - [0:0] |
| 1670 | +:ufw-logging-allow - [0:0] |
| 1671 | +:ufw-user-limit - [0:0] |
| 1672 | +:ufw-user-limit-accept - [0:0] |
| 1673 | +### RULES ### |
| 1674 | + |
| 1675 | +### END RULES ### |
| 1676 | + |
| 1677 | +### LOGGING ### |
| 1678 | +-A ufw-after-logging-input -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1679 | +-A ufw-after-logging-forward -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1680 | +-I ufw-logging-deny -m conntrack --ctstate INVALID -j RETURN -m limit --limit 3/min --limit-burst 10 |
| 1681 | +-A ufw-logging-deny -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1682 | +-A ufw-logging-allow -j NFLOG --nflog-prefix "[UFW ALLOW] " -m limit --limit 3/min --limit-burst 10 |
| 1683 | +### END LOGGING ### |
| 1684 | + |
| 1685 | +### RATE LIMITING ### |
| 1686 | +-A ufw-user-limit -m limit --limit 3/minute -j NFLOG --nflog-prefix "[UFW LIMIT BLOCK] " |
| 1687 | +-A ufw-user-limit -j REJECT |
| 1688 | +-A ufw-user-limit-accept -j ACCEPT |
| 1689 | +### END RATE LIMITING ### |
| 1690 | +COMMIT |
| 1691 | +*filter |
| 1692 | +:ufw6-user-input - [0:0] |
| 1693 | +:ufw6-user-output - [0:0] |
| 1694 | +:ufw6-user-forward - [0:0] |
| 1695 | +### RULES ### |
| 1696 | +COMMIT |
| 1697 | +96: reject log 23 |
| 1698 | + |
| 1699 | + |
| 1700 | +97: reject log smtp |
| 1701 | + |
| 1702 | + |
| 1703 | +98: reject log tftp |
| 1704 | + |
| 1705 | + |
| 1706 | +99: reject log daytime |
| 1707 | + |
| 1708 | + |
| 1709 | +100: reject log Samba |
| 1710 | + |
| 1711 | + |
| 1712 | +101: reject log Apache |
| 1713 | + |
| 1714 | + |
| 1715 | +102: reject log from 192.168.0.1 port smtp to 10.0.0.1 port smtp |
| 1716 | + |
| 1717 | + |
| 1718 | +103: reject log from 192.168.0.1 app Samba to 10.0.0.1 app Samba |
| 1719 | + |
| 1720 | + |
| 1721 | +contents of user*.rules: |
| 1722 | +*filter |
| 1723 | +:ufw-user-input - [0:0] |
| 1724 | +:ufw-user-output - [0:0] |
| 1725 | +:ufw-user-forward - [0:0] |
| 1726 | +:ufw-before-logging-input - [0:0] |
| 1727 | +:ufw-before-logging-output - [0:0] |
| 1728 | +:ufw-before-logging-forward - [0:0] |
| 1729 | +:ufw-user-logging-input - [0:0] |
| 1730 | +:ufw-user-logging-output - [0:0] |
| 1731 | +:ufw-user-logging-forward - [0:0] |
| 1732 | +:ufw-after-logging-input - [0:0] |
| 1733 | +:ufw-after-logging-output - [0:0] |
| 1734 | +:ufw-after-logging-forward - [0:0] |
| 1735 | +:ufw-logging-deny - [0:0] |
| 1736 | +:ufw-logging-allow - [0:0] |
| 1737 | +:ufw-user-limit - [0:0] |
| 1738 | +:ufw-user-limit-accept - [0:0] |
| 1739 | +### RULES ### |
| 1740 | + |
| 1741 | +### tuple ### reject_log any 23 0.0.0.0/0 any 0.0.0.0/0 in |
| 1742 | +-A ufw-user-logging-input -p tcp --dport 23 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1743 | +-A ufw-user-logging-input -p tcp --dport 23 -j RETURN |
| 1744 | +-A ufw-user-input -p tcp --dport 23 -j ufw-user-logging-input |
| 1745 | +-A ufw-user-input -p tcp --dport 23 -j REJECT --reject-with tcp-reset |
| 1746 | +-A ufw-user-logging-input -p udp --dport 23 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1747 | +-A ufw-user-logging-input -p udp --dport 23 -j RETURN |
| 1748 | +-A ufw-user-input -p udp --dport 23 -j ufw-user-logging-input |
| 1749 | +-A ufw-user-input -p udp --dport 23 -j REJECT |
| 1750 | + |
| 1751 | +### tuple ### reject_log tcp 25 0.0.0.0/0 any 0.0.0.0/0 in |
| 1752 | +-A ufw-user-logging-input -p tcp --dport 25 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1753 | +-A ufw-user-logging-input -p tcp --dport 25 -j RETURN |
| 1754 | +-A ufw-user-input -p tcp --dport 25 -j ufw-user-logging-input |
| 1755 | +-A ufw-user-input -p tcp --dport 25 -j REJECT --reject-with tcp-reset |
| 1756 | + |
| 1757 | +### tuple ### reject_log udp 69 0.0.0.0/0 any 0.0.0.0/0 in |
| 1758 | +-A ufw-user-logging-input -p udp --dport 69 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1759 | +-A ufw-user-logging-input -p udp --dport 69 -j RETURN |
| 1760 | +-A ufw-user-input -p udp --dport 69 -j ufw-user-logging-input |
| 1761 | +-A ufw-user-input -p udp --dport 69 -j REJECT |
| 1762 | + |
| 1763 | +### tuple ### reject_log any 13 0.0.0.0/0 any 0.0.0.0/0 in |
| 1764 | +-A ufw-user-logging-input -p tcp --dport 13 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1765 | +-A ufw-user-logging-input -p tcp --dport 13 -j RETURN |
| 1766 | +-A ufw-user-input -p tcp --dport 13 -j ufw-user-logging-input |
| 1767 | +-A ufw-user-input -p tcp --dport 13 -j REJECT --reject-with tcp-reset |
| 1768 | +-A ufw-user-logging-input -p udp --dport 13 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1769 | +-A ufw-user-logging-input -p udp --dport 13 -j RETURN |
| 1770 | +-A ufw-user-input -p udp --dport 13 -j ufw-user-logging-input |
| 1771 | +-A ufw-user-input -p udp --dport 13 -j REJECT |
| 1772 | + |
| 1773 | +### tuple ### reject_log udp 137,138 0.0.0.0/0 any 0.0.0.0/0 Samba - in |
| 1774 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1775 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -j RETURN |
| 1776 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -j ufw-user-logging-input |
| 1777 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -j REJECT -m comment --comment 'dapp_Samba' |
| 1778 | + |
| 1779 | +### tuple ### reject_log tcp 139,445 0.0.0.0/0 any 0.0.0.0/0 Samba - in |
| 1780 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1781 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -j RETURN |
| 1782 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -j ufw-user-logging-input |
| 1783 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -j REJECT --reject-with tcp-reset -m comment --comment 'dapp_Samba' |
| 1784 | + |
| 1785 | +### tuple ### reject_log tcp 80 0.0.0.0/0 any 0.0.0.0/0 Apache - in |
| 1786 | +-A ufw-user-logging-input -p tcp --dport 80 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1787 | +-A ufw-user-logging-input -p tcp --dport 80 -j RETURN |
| 1788 | +-A ufw-user-input -p tcp --dport 80 -j ufw-user-logging-input |
| 1789 | +-A ufw-user-input -p tcp --dport 80 -j REJECT --reject-with tcp-reset -m comment --comment 'dapp_Apache' |
| 1790 | + |
| 1791 | +### tuple ### reject_log tcp 25 10.0.0.1 25 192.168.0.1 in |
| 1792 | +-A ufw-user-logging-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1793 | +-A ufw-user-logging-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j RETURN |
| 1794 | +-A ufw-user-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j ufw-user-logging-input |
| 1795 | +-A ufw-user-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j REJECT --reject-with tcp-reset |
| 1796 | + |
| 1797 | +### tuple ### reject_log udp 137,138 10.0.0.1 137,138 192.168.0.1 Samba Samba in |
| 1798 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1799 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j RETURN |
| 1800 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j ufw-user-logging-input |
| 1801 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j REJECT -m comment --comment 'dapp_Samba,sapp_Samba' |
| 1802 | + |
| 1803 | +### tuple ### reject_log tcp 139,445 10.0.0.1 139,445 192.168.0.1 Samba Samba in |
| 1804 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1805 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j RETURN |
| 1806 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j ufw-user-logging-input |
| 1807 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j REJECT --reject-with tcp-reset -m comment --comment 'dapp_Samba,sapp_Samba' |
| 1808 | + |
| 1809 | +### END RULES ### |
| 1810 | + |
| 1811 | +### LOGGING ### |
| 1812 | +-A ufw-after-logging-input -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1813 | +-A ufw-after-logging-forward -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1814 | +-I ufw-logging-deny -m conntrack --ctstate INVALID -j RETURN -m limit --limit 3/min --limit-burst 10 |
| 1815 | +-A ufw-logging-deny -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1816 | +-A ufw-logging-allow -j NFLOG --nflog-prefix "[UFW ALLOW] " -m limit --limit 3/min --limit-burst 10 |
| 1817 | +### END LOGGING ### |
| 1818 | + |
| 1819 | +### RATE LIMITING ### |
| 1820 | +-A ufw-user-limit -m limit --limit 3/minute -j NFLOG --nflog-prefix "[UFW LIMIT BLOCK] " |
| 1821 | +-A ufw-user-limit -j REJECT |
| 1822 | +-A ufw-user-limit-accept -j ACCEPT |
| 1823 | +### END RATE LIMITING ### |
| 1824 | +COMMIT |
| 1825 | +*filter |
| 1826 | +:ufw6-user-input - [0:0] |
| 1827 | +:ufw6-user-output - [0:0] |
| 1828 | +:ufw6-user-forward - [0:0] |
| 1829 | +### RULES ### |
| 1830 | +COMMIT |
| 1831 | +104: delete reject log 23 |
| 1832 | + |
| 1833 | + |
| 1834 | +105: delete reject log smtp |
| 1835 | + |
| 1836 | + |
| 1837 | +106: delete reject log tftp |
| 1838 | + |
| 1839 | + |
| 1840 | +107: delete reject log daytime |
| 1841 | + |
| 1842 | + |
| 1843 | +108: delete reject log Samba |
| 1844 | + |
| 1845 | + |
| 1846 | +109: delete reject log Apache |
| 1847 | + |
| 1848 | + |
| 1849 | +110: delete reject log from 192.168.0.1 port smtp to 10.0.0.1 port smtp |
| 1850 | + |
| 1851 | + |
| 1852 | +111: delete reject log from 192.168.0.1 app Samba to 10.0.0.1 app Samba |
| 1853 | + |
| 1854 | + |
| 1855 | +contents of user*.rules: |
| 1856 | +*filter |
| 1857 | +:ufw-user-input - [0:0] |
| 1858 | +:ufw-user-output - [0:0] |
| 1859 | +:ufw-user-forward - [0:0] |
| 1860 | +:ufw-before-logging-input - [0:0] |
| 1861 | +:ufw-before-logging-output - [0:0] |
| 1862 | +:ufw-before-logging-forward - [0:0] |
| 1863 | +:ufw-user-logging-input - [0:0] |
| 1864 | +:ufw-user-logging-output - [0:0] |
| 1865 | +:ufw-user-logging-forward - [0:0] |
| 1866 | +:ufw-after-logging-input - [0:0] |
| 1867 | +:ufw-after-logging-output - [0:0] |
| 1868 | +:ufw-after-logging-forward - [0:0] |
| 1869 | +:ufw-logging-deny - [0:0] |
| 1870 | +:ufw-logging-allow - [0:0] |
| 1871 | +:ufw-user-limit - [0:0] |
| 1872 | +:ufw-user-limit-accept - [0:0] |
| 1873 | +### RULES ### |
| 1874 | + |
| 1875 | +### END RULES ### |
| 1876 | + |
| 1877 | +### LOGGING ### |
| 1878 | +-A ufw-after-logging-input -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1879 | +-A ufw-after-logging-forward -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1880 | +-I ufw-logging-deny -m conntrack --ctstate INVALID -j RETURN -m limit --limit 3/min --limit-burst 10 |
| 1881 | +-A ufw-logging-deny -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 1882 | +-A ufw-logging-allow -j NFLOG --nflog-prefix "[UFW ALLOW] " -m limit --limit 3/min --limit-burst 10 |
| 1883 | +### END LOGGING ### |
| 1884 | + |
| 1885 | +### RATE LIMITING ### |
| 1886 | +-A ufw-user-limit -m limit --limit 3/minute -j NFLOG --nflog-prefix "[UFW LIMIT BLOCK] " |
| 1887 | +-A ufw-user-limit -j REJECT |
| 1888 | +-A ufw-user-limit-accept -j ACCEPT |
| 1889 | +### END RATE LIMITING ### |
| 1890 | +COMMIT |
| 1891 | +*filter |
| 1892 | +:ufw6-user-input - [0:0] |
| 1893 | +:ufw6-user-output - [0:0] |
| 1894 | +:ufw6-user-forward - [0:0] |
| 1895 | +### RULES ### |
| 1896 | +COMMIT |
| 1897 | +112: reject log-all 23 |
| 1898 | + |
| 1899 | + |
| 1900 | +113: reject log-all smtp |
| 1901 | + |
| 1902 | + |
| 1903 | +114: reject log-all tftp |
| 1904 | + |
| 1905 | + |
| 1906 | +115: reject log-all daytime |
| 1907 | + |
| 1908 | + |
| 1909 | +116: reject log-all Samba |
| 1910 | + |
| 1911 | + |
| 1912 | +117: reject log-all Apache |
| 1913 | + |
| 1914 | + |
| 1915 | +118: reject log-all from 192.168.0.1 port smtp to 10.0.0.1 port smtp |
| 1916 | + |
| 1917 | + |
| 1918 | +119: reject log-all from 192.168.0.1 app Samba to 10.0.0.1 app Samba |
| 1919 | + |
| 1920 | + |
| 1921 | +contents of user*.rules: |
| 1922 | +*filter |
| 1923 | +:ufw-user-input - [0:0] |
| 1924 | +:ufw-user-output - [0:0] |
| 1925 | +:ufw-user-forward - [0:0] |
| 1926 | +:ufw-before-logging-input - [0:0] |
| 1927 | +:ufw-before-logging-output - [0:0] |
| 1928 | +:ufw-before-logging-forward - [0:0] |
| 1929 | +:ufw-user-logging-input - [0:0] |
| 1930 | +:ufw-user-logging-output - [0:0] |
| 1931 | +:ufw-user-logging-forward - [0:0] |
| 1932 | +:ufw-after-logging-input - [0:0] |
| 1933 | +:ufw-after-logging-output - [0:0] |
| 1934 | +:ufw-after-logging-forward - [0:0] |
| 1935 | +:ufw-logging-deny - [0:0] |
| 1936 | +:ufw-logging-allow - [0:0] |
| 1937 | +:ufw-user-limit - [0:0] |
| 1938 | +:ufw-user-limit-accept - [0:0] |
| 1939 | +### RULES ### |
| 1940 | + |
| 1941 | +### tuple ### reject_log-all any 23 0.0.0.0/0 any 0.0.0.0/0 in |
| 1942 | +-A ufw-user-logging-input -p tcp --dport 23 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1943 | +-A ufw-user-logging-input -p tcp --dport 23 -j RETURN |
| 1944 | +-A ufw-user-input -p tcp --dport 23 -j ufw-user-logging-input |
| 1945 | +-A ufw-user-input -p tcp --dport 23 -j REJECT --reject-with tcp-reset |
| 1946 | +-A ufw-user-logging-input -p udp --dport 23 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1947 | +-A ufw-user-logging-input -p udp --dport 23 -j RETURN |
| 1948 | +-A ufw-user-input -p udp --dport 23 -j ufw-user-logging-input |
| 1949 | +-A ufw-user-input -p udp --dport 23 -j REJECT |
| 1950 | + |
| 1951 | +### tuple ### reject_log-all tcp 25 0.0.0.0/0 any 0.0.0.0/0 in |
| 1952 | +-A ufw-user-logging-input -p tcp --dport 25 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1953 | +-A ufw-user-logging-input -p tcp --dport 25 -j RETURN |
| 1954 | +-A ufw-user-input -p tcp --dport 25 -j ufw-user-logging-input |
| 1955 | +-A ufw-user-input -p tcp --dport 25 -j REJECT --reject-with tcp-reset |
| 1956 | + |
| 1957 | +### tuple ### reject_log-all udp 69 0.0.0.0/0 any 0.0.0.0/0 in |
| 1958 | +-A ufw-user-logging-input -p udp --dport 69 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1959 | +-A ufw-user-logging-input -p udp --dport 69 -j RETURN |
| 1960 | +-A ufw-user-input -p udp --dport 69 -j ufw-user-logging-input |
| 1961 | +-A ufw-user-input -p udp --dport 69 -j REJECT |
| 1962 | + |
| 1963 | +### tuple ### reject_log-all any 13 0.0.0.0/0 any 0.0.0.0/0 in |
| 1964 | +-A ufw-user-logging-input -p tcp --dport 13 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1965 | +-A ufw-user-logging-input -p tcp --dport 13 -j RETURN |
| 1966 | +-A ufw-user-input -p tcp --dport 13 -j ufw-user-logging-input |
| 1967 | +-A ufw-user-input -p tcp --dport 13 -j REJECT --reject-with tcp-reset |
| 1968 | +-A ufw-user-logging-input -p udp --dport 13 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1969 | +-A ufw-user-logging-input -p udp --dport 13 -j RETURN |
| 1970 | +-A ufw-user-input -p udp --dport 13 -j ufw-user-logging-input |
| 1971 | +-A ufw-user-input -p udp --dport 13 -j REJECT |
| 1972 | + |
| 1973 | +### tuple ### reject_log-all udp 137,138 0.0.0.0/0 any 0.0.0.0/0 Samba - in |
| 1974 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1975 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -j RETURN |
| 1976 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -j ufw-user-logging-input |
| 1977 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -j REJECT -m comment --comment 'dapp_Samba' |
| 1978 | + |
| 1979 | +### tuple ### reject_log-all tcp 139,445 0.0.0.0/0 any 0.0.0.0/0 Samba - in |
| 1980 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1981 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -j RETURN |
| 1982 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -j ufw-user-logging-input |
| 1983 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -j REJECT --reject-with tcp-reset -m comment --comment 'dapp_Samba' |
| 1984 | + |
| 1985 | +### tuple ### reject_log-all tcp 80 0.0.0.0/0 any 0.0.0.0/0 Apache - in |
| 1986 | +-A ufw-user-logging-input -p tcp --dport 80 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1987 | +-A ufw-user-logging-input -p tcp --dport 80 -j RETURN |
| 1988 | +-A ufw-user-input -p tcp --dport 80 -j ufw-user-logging-input |
| 1989 | +-A ufw-user-input -p tcp --dport 80 -j REJECT --reject-with tcp-reset -m comment --comment 'dapp_Apache' |
| 1990 | + |
| 1991 | +### tuple ### reject_log-all tcp 25 10.0.0.1 25 192.168.0.1 in |
| 1992 | +-A ufw-user-logging-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1993 | +-A ufw-user-logging-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j RETURN |
| 1994 | +-A ufw-user-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j ufw-user-logging-input |
| 1995 | +-A ufw-user-input -p tcp -d 10.0.0.1 --dport 25 -s 192.168.0.1 --sport 25 -j REJECT --reject-with tcp-reset |
| 1996 | + |
| 1997 | +### tuple ### reject_log-all udp 137,138 10.0.0.1 137,138 192.168.0.1 Samba Samba in |
| 1998 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 1999 | +-A ufw-user-logging-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j RETURN |
| 2000 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j ufw-user-logging-input |
| 2001 | +-A ufw-user-input -p udp -m multiport --dports 137,138 -m multiport --sports 137,138 -d 10.0.0.1 -s 192.168.0.1 -j REJECT -m comment --comment 'dapp_Samba,sapp_Samba' |
| 2002 | + |
| 2003 | +### tuple ### reject_log-all tcp 139,445 10.0.0.1 139,445 192.168.0.1 Samba Samba in |
| 2004 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -m limit --limit 3/min --limit-burst 10 -j NFLOG --nflog-prefix "[UFW BLOCK] " |
| 2005 | +-A ufw-user-logging-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j RETURN |
| 2006 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j ufw-user-logging-input |
| 2007 | +-A ufw-user-input -p tcp -m multiport --dports 139,445 -m multiport --sports 139,445 -d 10.0.0.1 -s 192.168.0.1 -j REJECT --reject-with tcp-reset -m comment --comment 'dapp_Samba,sapp_Samba' |
| 2008 | + |
| 2009 | +### END RULES ### |
| 2010 | + |
| 2011 | +### LOGGING ### |
| 2012 | +-A ufw-after-logging-input -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 2013 | +-A ufw-after-logging-forward -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 2014 | +-I ufw-logging-deny -m conntrack --ctstate INVALID -j RETURN -m limit --limit 3/min --limit-burst 10 |
| 2015 | +-A ufw-logging-deny -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 2016 | +-A ufw-logging-allow -j NFLOG --nflog-prefix "[UFW ALLOW] " -m limit --limit 3/min --limit-burst 10 |
| 2017 | +### END LOGGING ### |
| 2018 | + |
| 2019 | +### RATE LIMITING ### |
| 2020 | +-A ufw-user-limit -m limit --limit 3/minute -j NFLOG --nflog-prefix "[UFW LIMIT BLOCK] " |
| 2021 | +-A ufw-user-limit -j REJECT |
| 2022 | +-A ufw-user-limit-accept -j ACCEPT |
| 2023 | +### END RATE LIMITING ### |
| 2024 | +COMMIT |
| 2025 | +*filter |
| 2026 | +:ufw6-user-input - [0:0] |
| 2027 | +:ufw6-user-output - [0:0] |
| 2028 | +:ufw6-user-forward - [0:0] |
| 2029 | +### RULES ### |
| 2030 | +COMMIT |
| 2031 | +120: delete reject log-all 23 |
| 2032 | + |
| 2033 | + |
| 2034 | +121: delete reject log-all smtp |
| 2035 | + |
| 2036 | + |
| 2037 | +122: delete reject log-all tftp |
| 2038 | + |
| 2039 | + |
| 2040 | +123: delete reject log-all daytime |
| 2041 | + |
| 2042 | + |
| 2043 | +124: delete reject log-all Samba |
| 2044 | + |
| 2045 | + |
| 2046 | +125: delete reject log-all Apache |
| 2047 | + |
| 2048 | + |
| 2049 | +126: delete reject log-all from 192.168.0.1 port smtp to 10.0.0.1 port smtp |
| 2050 | + |
| 2051 | + |
| 2052 | +127: delete reject log-all from 192.168.0.1 app Samba to 10.0.0.1 app Samba |
| 2053 | + |
| 2054 | + |
| 2055 | +contents of user*.rules: |
| 2056 | +*filter |
| 2057 | +:ufw-user-input - [0:0] |
| 2058 | +:ufw-user-output - [0:0] |
| 2059 | +:ufw-user-forward - [0:0] |
| 2060 | +:ufw-before-logging-input - [0:0] |
| 2061 | +:ufw-before-logging-output - [0:0] |
| 2062 | +:ufw-before-logging-forward - [0:0] |
| 2063 | +:ufw-user-logging-input - [0:0] |
| 2064 | +:ufw-user-logging-output - [0:0] |
| 2065 | +:ufw-user-logging-forward - [0:0] |
| 2066 | +:ufw-after-logging-input - [0:0] |
| 2067 | +:ufw-after-logging-output - [0:0] |
| 2068 | +:ufw-after-logging-forward - [0:0] |
| 2069 | +:ufw-logging-deny - [0:0] |
| 2070 | +:ufw-logging-allow - [0:0] |
| 2071 | +:ufw-user-limit - [0:0] |
| 2072 | +:ufw-user-limit-accept - [0:0] |
| 2073 | +### RULES ### |
| 2074 | + |
| 2075 | +### END RULES ### |
| 2076 | + |
| 2077 | +### LOGGING ### |
| 2078 | +-A ufw-after-logging-input -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 2079 | +-A ufw-after-logging-forward -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 2080 | +-I ufw-logging-deny -m conntrack --ctstate INVALID -j RETURN -m limit --limit 3/min --limit-burst 10 |
| 2081 | +-A ufw-logging-deny -j NFLOG --nflog-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10 |
| 2082 | +-A ufw-logging-allow -j NFLOG --nflog-prefix "[UFW ALLOW] " -m limit --limit 3/min --limit-burst 10 |
| 2083 | +### END LOGGING ### |
| 2084 | + |
| 2085 | +### RATE LIMITING ### |
| 2086 | +-A ufw-user-limit -m limit --limit 3/minute -j NFLOG --nflog-prefix "[UFW LIMIT BLOCK] " |
| 2087 | +-A ufw-user-limit -j REJECT |
| 2088 | +-A ufw-user-limit-accept -j ACCEPT |
| 2089 | +### END RATE LIMITING ### |
| 2090 | +COMMIT |
| 2091 | +*filter |
| 2092 | +:ufw6-user-input - [0:0] |
| 2093 | +:ufw6-user-output - [0:0] |
| 2094 | +:ufw6-user-forward - [0:0] |
| 2095 | +### RULES ### |
| 2096 | +COMMIT |
| 2097 | diff --git a/tests/good/logging_backend/runtest.sh b/tests/good/logging_backend/runtest.sh |
| 2098 | new file mode 100755 |
| 2099 | index 0000000..b409bc6 |
| 2100 | --- /dev/null |
| 2101 | +++ b/tests/good/logging_backend/runtest.sh |
| 2102 | @@ -0,0 +1,55 @@ |
| 2103 | +#!/bin/bash |
| 2104 | + |
| 2105 | +# Copyright 2009 Canonical Ltd. |
| 2106 | +# |
| 2107 | +# This program is free software: you can redistribute it and/or modify |
| 2108 | +# it under the terms of the GNU General Public License version 3, |
| 2109 | +# as published by the Free Software Foundation. |
| 2110 | +# |
| 2111 | +# This program is distributed in the hope that it will be useful, |
| 2112 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 2113 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 2114 | +# GNU General Public License for more details. |
| 2115 | +# |
| 2116 | +# You should have received a copy of the GNU General Public License |
| 2117 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 2118 | + |
| 2119 | +#set -x |
| 2120 | + |
| 2121 | +source "$TESTPATH/../testlib.sh" |
| 2122 | +sed -i '/LOGGING_BACKEND/d' $TESTPATH/etc/default/ufw |
| 2123 | +echo "LOGGING_BACKEND=netfilter_log" >>$TESTPATH/etc/default/ufw |
| 2124 | + |
| 2125 | +echo "TESTING NFLOG RULES" >> $TESTTMP/result |
| 2126 | +for i in allow deny limit reject ; do |
| 2127 | + for j in log log-all ; do |
| 2128 | + do_cmd "0" null $i $j 23 |
| 2129 | + do_cmd "0" null $i $j smtp |
| 2130 | + do_cmd "0" null $i $j tftp |
| 2131 | + do_cmd "0" null $i $j daytime |
| 2132 | + do_cmd "0" null $i $j Samba |
| 2133 | + do_cmd "0" null $i $j Apache |
| 2134 | + do_cmd "0" null $i $j from 192.168.0.1 port smtp to 10.0.0.1 port smtp |
| 2135 | + do_cmd "0" null $i $j from 192.168.0.1 app Samba to 10.0.0.1 app Samba |
| 2136 | + |
| 2137 | + echo "contents of user*.rules:" >> $TESTTMP/result |
| 2138 | + cat $TESTCONFIG/user.rules >> $TESTTMP/result |
| 2139 | + cat $TESTCONFIG/user6.rules >> $TESTTMP/result |
| 2140 | + |
| 2141 | + # now delete the rules |
| 2142 | + do_cmd "0" null delete $i $j 23 |
| 2143 | + do_cmd "0" null delete $i $j smtp |
| 2144 | + do_cmd "0" null delete $i $j tftp |
| 2145 | + do_cmd "0" null delete $i $j daytime |
| 2146 | + do_cmd "0" null delete $i $j Samba |
| 2147 | + do_cmd "0" null delete $i $j Apache |
| 2148 | + do_cmd "0" null delete $i $j from 192.168.0.1 port smtp to 10.0.0.1 port smtp |
| 2149 | + do_cmd "0" null delete $i $j from 192.168.0.1 app Samba to 10.0.0.1 app Samba |
| 2150 | + |
| 2151 | + echo "contents of user*.rules:" >> $TESTTMP/result |
| 2152 | + cat $TESTCONFIG/user.rules >> $TESTTMP/result |
| 2153 | + cat $TESTCONFIG/user6.rules >> $TESTTMP/result |
| 2154 | + done |
| 2155 | +done |
| 2156 | + |
| 2157 | +exit 0 |
Hey Jamie
Anything blocking on this diff ?
I'll update it but it should be pretty the same for the latest version. I have been using it for a while and it works great.