<commit_before>#! /bin/bash

############################
# Author : o_be_one for mcTrophy
# Creation date : 2016-03-30
# Goal : whitelist your server : block everything and allow only ip you want for in or out. Care it will flush all existing iptables rules !
# HowTo : edit the end of the file and start the script
############################

# Flush existing rules
iptables -F

# Set up default DROP rule for venet0
iptables -P OUTPUT DROP
iptables -P INPUT DROP

# Allow existing connections to continue
iptables -A INPUT -i venet0 -m state --state ESTABLISHED,RELATED -j ACCEPT

# Accept everything from defined remote ip
#iptables -A INPUT -i venet0 -s 172.16.58.3 -j ACCEPT
#iptables -A INPUT -i venet0 -s 172.16.17.32 -j ACCEPT

inip() {
    iptables -A INPUT -i venet0 -s $1 -j ACCEPT
}

# Allow this host to connect defined remote ip
#iptables -A OUTPUT -o venet0 -d 172.16.17.32 -m state --state ESTABLISHED,RELATED -j ACCEPT # example to allow this server to only answer to requests from defined ip
#iptables -A OUTPUT -o venet0 -d 172.16.58.3 -j ACCEPT # allow this server to send requests to defined ip

outip() { # allow this server to send requests to defined ip
    iptables -A OUTPUT -o venet0 -d $1 -j ACCEPT
}

outiprelated() { # allow this server to only answer to requests from defined ips
    iptables -A OUTPUT -o venet0 -d $1 -m state --state ESTABLISHED,RELATED -j ACCEPT
}

######
#
# Define your rules !
#
######

inip 172.16.17.32 # allow this ip to contact the server
outiprelated 172.16.17.32 # allow the server to answer to the ip (only answer, server couldn't contact ip)
inip 172.16.58.3 # allow this ip to contact the server
outip 172.16.58.3 # allow the server to contact the ip<commit_msg>just esthetic change<commit_after>#! /bin/bash

############################
# Author : o_be_one for mcTrophy
# Creation date : 2016-03-30
# Goal : whitelist your server : block everything and allow only ip you want for in or out. Care it will flush all existing iptables rules !
# HowTo : edit the end of the file and start the script
############################

# Flush existing rules
iptables -F

# Set up default DROP rule for venet0
iptables -P OUTPUT DROP
iptables -P INPUT DROP

# Allow existing connections to continue
iptables -A INPUT -i venet0 -m state --state ESTABLISHED,RELATED -j ACCEPT

# Accept everything from defined remote ip
#iptables -A INPUT -i venet0 -s 172.16.58.3 -j ACCEPT
#iptables -A INPUT -i venet0 -s 172.16.17.32 -j ACCEPT

inip() {
    iptables -A INPUT -i venet0 -s $1 -j ACCEPT
}

# Allow this host to connect defined remote ip
#iptables -A OUTPUT -o venet0 -d 172.16.17.32 -m state --state ESTABLISHED,RELATED -j ACCEPT # example to allow this server to only answer to requests from defined ip
#iptables -A OUTPUT -o venet0 -d 172.16.58.3 -j ACCEPT # allow this server to send requests to defined ip

outip() { # allow this server to send requests to defined ip
    iptables -A OUTPUT -o venet0 -d $1 -j ACCEPT
}

outiprelated() { # allow this server to only answer to requests from defined ips
    iptables -A OUTPUT -o venet0 -d $1 -m state --state ESTABLISHED,RELATED -j ACCEPT
}

######
# Define your rules !
######

inip 172.16.17.32 # allow this ip to contact the server
outiprelated 172.16.17.32 # allow the server to answer to the ip (only answer, server couldn't contact ip)
inip 172.16.58.3 # allow this ip to contact the server
outip 172.16.58.3 # allow the server to contact the ip
{'fraction_non_alphanumeric': 0.11390575310783463, 'fraction_numerical': 0.050881757733448975, 'mean_word_length': 3.464516129032258, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 16, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '295906', 'n_tokens_mistral': 1248, 'n_tokens_neox': 1129, 'n_words': 513}