Skip to content

Commit

Permalink
Allow group 'users' or /etc/fireall.d/phoneout.groups in default config
Browse files Browse the repository at this point in the history
  • Loading branch information
vaeth committed Sep 12, 2017
1 parent 66987aa commit 453914e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 15 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ install: firewall-scripted.sh
install -m 644 sbin/firewall-scripted.sh '$(DESTDIR)$(DATADIR)/firewall-scripted.sh'
install -m 644 etc/firewall.config '$(DESTDIR)$(LIBDIR)/firewall.config'
install -m 644 etc/firewall.d/README '$(DESTDIR)$(ETCDIR)/firewall.d/README'
install -m 644 etc/firewall.d/phoneout.groups '$(DESTDIR)$(ETCDIR)/firewall.d/phoneout.groups'
[ -z '$(OPENRCDIR)' ] || install -d '$(DESTDIR)$(OPENRCDIR)/init.d'
[ -z '$(OPENRCDIR)' ] || install -d '$(DESTDIR)$(OPENRCDIR)/conf.d'
[ -z '$(OPENRCDIR)' ] || install -m 755 openrc/init.d/firewall '$(DESTDIR)$(OPENRCDIR)/init.d/firewall'
Expand All @@ -54,6 +55,7 @@ uninstall: FORCE
rm -f '$(DESTDIR)/$(LIBDIR)/firewall-scripted.sh'
-rmdir '$(DESTDIR)/$(LIBDIR)'
rm -f '$(DESTDIR)/$(ETCDIR)/firewall.d/README'
rm -f '$(DESTDIR)/$(ETCDIR)/firewall.d/phoneout.groups'
-rmdir '$(DESTDIR)/$(ETCDIR)/firewall.d'
-rmdir '$(DESTDIR)/$(ETCDIR)'
[ -z '$(OPENRCDIR)' ] || rm -f '$(DESTDIR)$(OPENRCDIR)/init.d/firewall'
Expand Down
40 changes: 25 additions & 15 deletions etc/firewall.config
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,31 @@ fi


# Who may phone outside?

Push -c OUTONLYGID \
0 \
$(id -g ddclient 2>/dev/null) \
$(id -g ez-ipupd 2>/dev/null) \
$(id -g pdnsd 2>/dev/null) \
$(id -g privoxy 2>/dev/null) \
$(id -g tor 2>/dev/null) \
$(id -g unbound 2>/dev/null) \
$(id -g tlsdate 2>/dev/null) \
$(id -g wwwoffle 2>/dev/null) \
$(id -g portage 2>/dev/null) \
$(id -g www 2>/dev/null) \
$(id -g mwww 2>/dev/null) \
$(id -g edi 2>/dev/null)
# The root group may always:

Push -c OUTONLYGID 0

# All groups listed in /etc/firewall.d/phoneout.groups may phone outside.
phoneoutgroups=`sed -n -e '/^[^#]/p' -- /etc/firewall.d/phoneout.groups 2>/dev/null` \
|| phoneoutgroups=

# If no group is listed there, we choose "users":
: ${phoneoutgroups:=users}

# In addition, we always allow the following groups if the exist:
phoneoutgroups=$phoneoutgroups' ddclient'
phoneoutgroups=$phoneoutgroups' ez-ipupd'
phoneoutgroups=$phoneoutgroups' pdnsd'
phoneoutgroups=$phoneoutgroups' privoxy'
phoneoutgroups=$phoneoutgroups' tor'
phoneoutgroups=$phoneoutgroups' unbound'
phoneoutgroups=$phoneoutgroups' tlsdate'
phoneoutgroups=$phoneoutgroups' wwwoffle'
phoneoutgroups=$phoneoutgroups' portage'

for i in $phoneoutgroups
do Push OUTONLYGID `id -g "$i" 2>/dev/null`
done

# To LOCALNETSOUT everybody may "phone":

Expand Down
2 changes: 2 additions & 0 deletions etc/firewall.d/phoneout.groups
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# The default firewall.config lets only groups listed here phone outside.
# If no group is specified, the single group "users" is chosen.

0 comments on commit 453914e

Please sign in to comment.