{"action":"created","comment":{"url":"https://api.github.com/repos/arno-iptables-firewall/aif/pulls/comments/129580602","pull_request_review_id":52368799,"id":129580602,"diff_hunk":"@@ -0,0 +1,292 @@\n+# ------------------------------------------------------------------------------\n+#           -= Arno's iptables firewall - Parasitic Network plugin =-\n+#\n+PLUGIN_NAME=\"Parasitic Network plugin\"\n+PLUGIN_VERSION=\"1.00 BETA\"\n+PLUGIN_CONF_FILE=\"parasitic-net.conf\"\n+#\n+# Last changed          : July 25, 2017\n+# Requirements          : AIF 2.0.1+\n+# Comments              : This plugin allows \"clients\" on the same subnet to use this\n+#                       : device as a gateway upstream. This network of \"clients\" is\n+#                       : SNAT'ed to this device's external interface(s).\n+#                       : \n+#                       : This Parasitic Network is useful for situations when the\n+#                       : upstream firewall is not under your control and you desire\n+#                       : added security for specific devices in your subnet.\n+#                       : Set the gateway address of Parasitic Network clients to an\n+#                       : external IPv4 address of this device.\n+#\n+# Author                : (C) Copyright 2017 by Arno van Amersfoort & Lonnie Abelbeck\n+# Email                 : arnova AT rocky DOT eld DOT leidenuniv DOT nl\n+#                         (note: you must remove all spaces and substitute the @ and the .\n+#                         at the proper locations!)\n+# ------------------------------------------------------------------------------\n+# This program is free software; you can redistribute it and/or\n+# modify it under the terms of the GNU General Public License\n+# version 2 as published by the Free Software Foundation.\n+#\n+# This program is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with this program; if not, write to the Free Software\n+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\n+# ------------------------------------------------------------------------------\n+\n+parasitic_net_first_ipv4()\n+{\n+  ip -o addr show dev \"$1\" 2>/dev/null \\\n+    | awk '$3 == \"inet\" { split($4, field, \"/\"); print field[1]; nextfile; }'\n+}\n+\n+parasitic_net_all_ipv4()\n+{\n+  ip -o addr show dev \"$1\" 2>/dev/null \\\n+    | awk '$3 == \"inet\" { split($4, field, \"/\"); print field[1]; }'\n+}\n+\n+# Plugin start function\n+plugin_start()\n+{\n+  local x host net eif gateway_if gateway_ip snat_if snat_ip snat_ifs_ips IFS\n+\n+  ip4tables -t nat -N PARASITIC_NET_SNAT 2>/dev/null\n+  ip4tables -t nat -F PARASITIC_NET_SNAT\n+\n+  ip4tables -N PARASITIC_NET_ACL 2>/dev/null\n+  ip4tables -F PARASITIC_NET_ACL\n+\n+  ip4tables -N PARASITIC_NET_FORWARD 2>/dev/null\n+  ip4tables -F PARASITIC_NET_FORWARD\n+\n+  snat_ifs_ips=\"\"\n+  IFS=' ,'\n+  for eif in $(wildcard_ifs $EXT_IF); do\n+    snat_if=\"$eif\"\n+    snat_ip=\"$(parasitic_net_first_ipv4 $eif)\"\n+    if [ -n \"$snat_if\" -a -n \"$snat_ip\" ]; then\n+      snat_ifs_ips=\"$snat_ifs_ips${snat_ifs_ips:+ }$snat_if~$snat_ip\"\n+    fi\n+  done\n+","path":"share/arno-iptables-firewall/plugins/20parasitic-net.plugin","position":74,"original_position":74,"commit_id":"5b24f882476806bb103502fa7f357d7836a636f5","original_commit_id":"18540eb339388d3e94fb274361aedd5419853ee3","user":{"login":"abelbeck","id":3116543,"avatar_url":"https://avatars1.githubusercontent.com/u/3116543?v=4","gravatar_id":"","url":"https://api.github.com/users/abelbeck","html_url":"https://github.com/abelbeck","followers_url":"https://api.github.com/users/abelbeck/followers","following_url":"https://api.github.com/users/abelbeck/following{/other_user}","gists_url":"https://api.github.com/users/abelbeck/gists{/gist_id}","starred_url":"https://api.github.com/users/abelbeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abelbeck/subscriptions","organizations_url":"https://api.github.com/users/abelbeck/orgs","repos_url":"https://api.github.com/users/abelbeck/repos","events_url":"https://api.github.com/users/abelbeck/events{/privacy}","received_events_url":"https://api.github.com/users/abelbeck/received_events","type":"User","site_admin":false},"body":"Changed with: 5b24f88 ","created_at":"2017-07-26T14:04:25Z","updated_at":"2017-07-26T14:04:25Z","html_url":"https://github.com/arno-iptables-firewall/aif/pull/40#discussion_r129580602","pull_request_url":"https://api.github.com/repos/arno-iptables-firewall/aif/pulls/40","_links":{"self":{"href":"https://api.github.com/repos/arno-iptables-firewall/aif/pulls/comments/129580602"},"html":{"href":"https://github.com/arno-iptables-firewall/aif/pull/40#discussion_r129580602"},"pull_request":{"href":"https://api.github.com/repos/arno-iptables-firewall/aif/pulls/40"}}},"pull_request":{"url":"https://api.github.com/repos/arno-iptables-firewall/aif/pulls/40","id":131437923,"html_url":"https://github.com/arno-iptables-firewall/aif/pull/40","diff_url":"https://github.com/arno-iptables-firewall/aif/pull/40.diff","patch_url":"https://github.com/arno-iptables-firewall/aif/pull/40.patch","issue_url":"https://api.github.com/repos/arno-iptables-firewall/aif/issues/40","number":40,"state":"open","locked":false,"title":"added: new Parasitic Network plugin","user":{"login":"abelbeck","id":3116543,"avatar_url":"https://avatars1.githubusercontent.com/u/3116543?v=4","gravatar_id":"","url":"https://api.github.com/users/abelbeck","html_url":"https://github.com/abelbeck","followers_url":"https://api.github.com/users/abelbeck/followers","following_url":"https://api.github.com/users/abelbeck/following{/other_user}","gists_url":"https://api.github.com/users/abelbeck/gists{/gist_id}","starred_url":"https://api.github.com/users/abelbeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abelbeck/subscriptions","organizations_url":"https://api.github.com/users/abelbeck/orgs","repos_url":"https://api.github.com/users/abelbeck/repos","events_url":"https://api.github.com/users/abelbeck/events{/privacy}","received_events_url":"https://api.github.com/users/abelbeck/received_events","type":"User","site_admin":false},"body":"An alternative to @arnova PR #39 \r\n\r\n```\r\nThis plugin allows \"clients\" on the same subnet to use this\r\ndevice as a gateway upstream. This network of \"clients\" is\r\nSNAT'ed to this device's first external interface.\r\n\r\nThis Parasitic Network is useful for situations when the\r\nupstream firewall is not under your control and you desire\r\nadded security for specific devices in your subnet.\r\nSet the gateway address of Parasitic Network clients to the\r\nIPv4 address of this device.\r\n```\r\n\r\nI have performed some basic testing, and appears to work as expected.\r\n\r\nLimiting to a EXT_IF-only configuration does not seem necessary.  It is common for OpenVPN to add a INT_IF internal network, so requiring EXT_IF-only would be too limiting.\r\n","created_at":"2017-07-19T22:59:41Z","updated_at":"2017-07-26T14:04:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b576f3504cdb3e9c01a874cb679bb333818fc6b2","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/arno-iptables-firewall/aif/pulls/40/commits","review_comments_url":"https://api.github.com/repos/arno-iptables-firewall/aif/pulls/40/comments","review_comment_url":"https://api.github.com/repos/arno-iptables-firewall/aif/pulls/comments{/number}","comments_url":"https://api.github.com/repos/arno-iptables-firewall/aif/issues/40/comments","statuses_url":"https://api.github.com/repos/arno-iptables-firewall/aif/statuses/5b24f882476806bb103502fa7f357d7836a636f5","head":{"label":"abelbeck:parasitic_net","ref":"parasitic_net","sha":"5b24f882476806bb103502fa7f357d7836a636f5","user":{"login":"abelbeck","id":3116543,"avatar_url":"https://avatars1.githubusercontent.com/u/3116543?v=4","gravatar_id":"","url":"https://api.github.com/users/abelbeck","html_url":"https://github.com/abelbeck","followers_url":"https://api.github.com/users/abelbeck/followers","following_url":"https://api.github.com/users/abelbeck/following{/other_user}","gists_url":"https://api.github.com/users/abelbeck/gists{/gist_id}","starred_url":"https://api.github.com/users/abelbeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abelbeck/subscriptions","organizations_url":"https://api.github.com/users/abelbeck/orgs","repos_url":"https://api.github.com/users/abelbeck/repos","events_url":"https://api.github.com/users/abelbeck/events{/privacy}","received_events_url":"https://api.github.com/users/abelbeck/received_events","type":"User","site_admin":false},"repo":{"id":94206481,"name":"aif","full_name":"abelbeck/aif","owner":{"login":"abelbeck","id":3116543,"avatar_url":"https://avatars1.githubusercontent.com/u/3116543?v=4","gravatar_id":"","url":"https://api.github.com/users/abelbeck","html_url":"https://github.com/abelbeck","followers_url":"https://api.github.com/users/abelbeck/followers","following_url":"https://api.github.com/users/abelbeck/following{/other_user}","gists_url":"https://api.github.com/users/abelbeck/gists{/gist_id}","starred_url":"https://api.github.com/users/abelbeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abelbeck/subscriptions","organizations_url":"https://api.github.com/users/abelbeck/orgs","repos_url":"https://api.github.com/users/abelbeck/repos","events_url":"https://api.github.com/users/abelbeck/events{/privacy}","received_events_url":"https://api.github.com/users/abelbeck/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abelbeck/aif","description":null,"fork":true,"url":"https://api.github.com/repos/abelbeck/aif","forks_url":"https://api.github.com/repos/abelbeck/aif/forks","keys_url":"https://api.github.com/repos/abelbeck/aif/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abelbeck/aif/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abelbeck/aif/teams","hooks_url":"https://api.github.com/repos/abelbeck/aif/hooks","issue_events_url":"https://api.github.com/repos/abelbeck/aif/issues/events{/number}","events_url":"https://api.github.com/repos/abelbeck/aif/events","assignees_url":"https://api.github.com/repos/abelbeck/aif/assignees{/user}","branches_url":"https://api.github.com/repos/abelbeck/aif/branches{/branch}","tags_url":"https://api.github.com/repos/abelbeck/aif/tags","blobs_url":"https://api.github.com/repos/abelbeck/aif/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abelbeck/aif/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abelbeck/aif/git/refs{/sha}","trees_url":"https://api.github.com/repos/abelbeck/aif/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abelbeck/aif/statuses/{sha}","languages_url":"https://api.github.com/repos/abelbeck/aif/languages","stargazers_url":"https://api.github.com/repos/abelbeck/aif/stargazers","contributors_url":"https://api.github.com/repos/abelbeck/aif/contributors","subscribers_url":"https://api.github.com/repos/abelbeck/aif/subscribers","subscription_url":"https://api.github.com/repos/abelbeck/aif/subscription","commits_url":"https://api.github.com/repos/abelbeck/aif/commits{/sha}","git_commits_url":"https://api.github.com/repos/abelbeck/aif/git/commits{/sha}","comments_url":"https://api.github.com/repos/abelbeck/aif/comments{/number}","issue_comment_url":"https://api.github.com/repos/abelbeck/aif/issues/comments{/number}","contents_url":"https://api.github.com/repos/abelbeck/aif/contents/{+path}","compare_url":"https://api.github.com/repos/abelbeck/aif/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abelbeck/aif/merges","archive_url":"https://api.github.com/repos/abelbeck/aif/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abelbeck/aif/downloads","issues_url":"https://api.github.com/repos/abelbeck/aif/issues{/number}","pulls_url":"https://api.github.com/repos/abelbeck/aif/pulls{/number}","milestones_url":"https://api.github.com/repos/abelbeck/aif/milestones{/number}","notifications_url":"https://api.github.com/repos/abelbeck/aif/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abelbeck/aif/labels{/name}","releases_url":"https://api.github.com/repos/abelbeck/aif/releases{/id}","deployments_url":"https://api.github.com/repos/abelbeck/aif/deployments","created_at":"2017-06-13T11:39:06Z","updated_at":"2017-06-13T11:39:07Z","pushed_at":"2017-07-26T14:03:06Z","git_url":"git://github.com/abelbeck/aif.git","ssh_url":"git@github.com:abelbeck/aif.git","clone_url":"https://github.com/abelbeck/aif.git","svn_url":"https://github.com/abelbeck/aif","homepage":null,"size":1443,"stargazers_count":0,"watchers_count":0,"language":"Shell","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"arno-iptables-firewall:master","ref":"master","sha":"7a2be399f2d227fac0aa207a54732e6b5b164f64","user":{"login":"arno-iptables-firewall","id":3135789,"avatar_url":"https://avatars3.githubusercontent.com/u/3135789?v=4","gravatar_id":"","url":"https://api.github.com/users/arno-iptables-firewall","html_url":"https://github.com/arno-iptables-firewall","followers_url":"https://api.github.com/users/arno-iptables-firewall/followers","following_url":"https://api.github.com/users/arno-iptables-firewall/following{/other_user}","gists_url":"https://api.github.com/users/arno-iptables-firewall/gists{/gist_id}","starred_url":"https://api.github.com/users/arno-iptables-firewall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arno-iptables-firewall/subscriptions","organizations_url":"https://api.github.com/users/arno-iptables-firewall/orgs","repos_url":"https://api.github.com/users/arno-iptables-firewall/repos","events_url":"https://api.github.com/users/arno-iptables-firewall/events{/privacy}","received_events_url":"https://api.github.com/users/arno-iptables-firewall/received_events","type":"Organization","site_admin":false},"repo":{"id":7343406,"name":"aif","full_name":"arno-iptables-firewall/aif","owner":{"login":"arno-iptables-firewall","id":3135789,"avatar_url":"https://avatars3.githubusercontent.com/u/3135789?v=4","gravatar_id":"","url":"https://api.github.com/users/arno-iptables-firewall","html_url":"https://github.com/arno-iptables-firewall","followers_url":"https://api.github.com/users/arno-iptables-firewall/followers","following_url":"https://api.github.com/users/arno-iptables-firewall/following{/other_user}","gists_url":"https://api.github.com/users/arno-iptables-firewall/gists{/gist_id}","starred_url":"https://api.github.com/users/arno-iptables-firewall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arno-iptables-firewall/subscriptions","organizations_url":"https://api.github.com/users/arno-iptables-firewall/orgs","repos_url":"https://api.github.com/users/arno-iptables-firewall/repos","events_url":"https://api.github.com/users/arno-iptables-firewall/events{/privacy}","received_events_url":"https://api.github.com/users/arno-iptables-firewall/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/arno-iptables-firewall/aif","description":null,"fork":false,"url":"https://api.github.com/repos/arno-iptables-firewall/aif","forks_url":"https://api.github.com/repos/arno-iptables-firewall/aif/forks","keys_url":"https://api.github.com/repos/arno-iptables-firewall/aif/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arno-iptables-firewall/aif/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arno-iptables-firewall/aif/teams","hooks_url":"https://api.github.com/repos/arno-iptables-firewall/aif/hooks","issue_events_url":"https://api.github.com/repos/arno-iptables-firewall/aif/issues/events{/number}","events_url":"https://api.github.com/repos/arno-iptables-firewall/aif/events","assignees_url":"https://api.github.com/repos/arno-iptables-firewall/aif/assignees{/user}","branches_url":"https://api.github.com/repos/arno-iptables-firewall/aif/branches{/branch}","tags_url":"https://api.github.com/repos/arno-iptables-firewall/aif/tags","blobs_url":"https://api.github.com/repos/arno-iptables-firewall/aif/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arno-iptables-firewall/aif/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arno-iptables-firewall/aif/git/refs{/sha}","trees_url":"https://api.github.com/repos/arno-iptables-firewall/aif/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arno-iptables-firewall/aif/statuses/{sha}","languages_url":"https://api.github.com/repos/arno-iptables-firewall/aif/languages","stargazers_url":"https://api.github.com/repos/arno-iptables-firewall/aif/stargazers","contributors_url":"https://api.github.com/repos/arno-iptables-firewall/aif/contributors","subscribers_url":"https://api.github.com/repos/arno-iptables-firewall/aif/subscribers","subscription_url":"https://api.github.com/repos/arno-iptables-firewall/aif/subscription","commits_url":"https://api.github.com/repos/arno-iptables-firewall/aif/commits{/sha}","git_commits_url":"https://api.github.com/repos/arno-iptables-firewall/aif/git/commits{/sha}","comments_url":"https://api.github.com/repos/arno-iptables-firewall/aif/comments{/number}","issue_comment_url":"https://api.github.com/repos/arno-iptables-firewall/aif/issues/comments{/number}","contents_url":"https://api.github.com/repos/arno-iptables-firewall/aif/contents/{+path}","compare_url":"https://api.github.com/repos/arno-iptables-firewall/aif/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arno-iptables-firewall/aif/merges","archive_url":"https://api.github.com/repos/arno-iptables-firewall/aif/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arno-iptables-firewall/aif/downloads","issues_url":"https://api.github.com/repos/arno-iptables-firewall/aif/issues{/number}","pulls_url":"https://api.github.com/repos/arno-iptables-firewall/aif/pulls{/number}","milestones_url":"https://api.github.com/repos/arno-iptables-firewall/aif/milestones{/number}","notifications_url":"https://api.github.com/repos/arno-iptables-firewall/aif/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arno-iptables-firewall/aif/labels{/name}","releases_url":"https://api.github.com/repos/arno-iptables-firewall/aif/releases{/id}","deployments_url":"https://api.github.com/repos/arno-iptables-firewall/aif/deployments","created_at":"2012-12-27T17:16:57Z","updated_at":"2017-06-16T13:10:50Z","pushed_at":"2017-07-26T14:03:07Z","git_url":"git://github.com/arno-iptables-firewall/aif.git","ssh_url":"git@github.com:arno-iptables-firewall/aif.git","clone_url":"https://github.com/arno-iptables-firewall/aif.git","svn_url":"https://github.com/arno-iptables-firewall/aif","homepage":null,"size":1433,"stargazers_count":70,"watchers_count":70,"language":"Shell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":8,"forks":17,"open_issues":8,"watchers":70,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/arno-iptables-firewall/aif/pulls/40"},"html":{"href":"https://github.com/arno-iptables-firewall/aif/pull/40"},"issue":{"href":"https://api.github.com/repos/arno-iptables-firewall/aif/issues/40"},"comments":{"href":"https://api.github.com/repos/arno-iptables-firewall/aif/issues/40/comments"},"review_comments":{"href":"https://api.github.com/repos/arno-iptables-firewall/aif/pulls/40/comments"},"review_comment":{"href":"https://api.github.com/repos/arno-iptables-firewall/aif/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/arno-iptables-firewall/aif/pulls/40/commits"},"statuses":{"href":"https://api.github.com/repos/arno-iptables-firewall/aif/statuses/5b24f882476806bb103502fa7f357d7836a636f5"}}}}
{"actor":{"display_login":"abelbeck"}}