aboutsummaryrefslogtreecommitdiff
path: root/docker/netiquette/test/iptables.mjs
diff options
context:
space:
mode:
authorQuentin <quentin@deuxfleurs.fr>2020-02-09 20:09:20 +0100
committerQuentin <quentin@deuxfleurs.fr>2020-02-09 20:09:20 +0100
commit96c6da392fc3236754c273a299728ad0360b3d51 (patch)
treedb6732c726c731396b482debe329cd5894613d02 /docker/netiquette/test/iptables.mjs
parentba5590ce97953f66702b149fd7840bcb58d4b463 (diff)
downloadinfrastructure-96c6da392fc3236754c273a299728ad0360b3d51.tar.gz
infrastructure-96c6da392fc3236754c273a299728ad0360b3d51.zip
[diplomate] Skeleton for our UPNP configurator
Diffstat (limited to 'docker/netiquette/test/iptables.mjs')
-rw-r--r--docker/netiquette/test/iptables.mjs28
1 files changed, 0 insertions, 28 deletions
diff --git a/docker/netiquette/test/iptables.mjs b/docker/netiquette/test/iptables.mjs
deleted file mode 100644
index 1ae1cb0..0000000
--- a/docker/netiquette/test/iptables.mjs
+++ /dev/null
@@ -1,28 +0,0 @@
-'use strict'
-
-import chai from 'chai'
-import iptables from '../src/injector/iptables.mjs'
-const expect = chai.expect
-
-export default [
- (async () => {
- const effective_actions = []
- const expected_actions = [
- 'iptables -A INPUT -p tcp --dport 56 -j ACCEPT',
- 'iptables -A INPUT -p tcp --dport 53 -j ACCEPT',
- 'iptables -A INPUT -p udp --match multiport --dports 25630:25999 -j ACCEPT',
- 'iptables -D INPUT -p tcp --dport 54 -j ACCEPT'
- ]
-
- const mockLog = () => {}
- const mockReadFile = (file, opt) => '-A INPUT -p tcp --dport 53 -j ACCEPT'
- const mockExecCommand = (cmd, opts) => {
- if (cmd.match(/^iptables -S/g)) return { stdout: '-A INPUT -p tcp --dport 54 -j ACCEPT' }
- else effective_actions.push(cmd)
- return { stdout: '' } }
-
- const fw = await iptables('static', mockReadFile, mockExecCommand, mockLog)
- await fw(['public_port=56/tcp', 'public_port=25630-25999/udp', 'public_port=13', 'traefik.entrypoints=Host:im.deuxfleurs.fr;PathPrefix:/_matrix'])
- expect(effective_actions).to.have.members(expected_actions)
- })
-]