#!/bin/bash -eu

<% unless p("cf_networking.disable") %>
CERTS_DIR=/var/vcap/jobs/vxlan-policy-agent/config/certs

chmod 600 "${CERTS_DIR}"/*

# Completely cleanup IPTables Filter and NAT tables
iptables-restore <( echo '
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT
')
<% end %>
