HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DNS\ParametersCreate a new DWORD "MaxCacheTtl" with a DECIMAL setting of 300 (for 300 seconds)
Then restart the DNS service (not required)
Helpful bits and bytes
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DNS\ParametersCreate a new DWORD "MaxCacheTtl" with a DECIMAL setting of 300 (for 300 seconds)
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DNSCache\ParametersCreate a new DWORD "NegativeCacheTime" with a DECIMAL setting of 30 (for 30 seconds)
#!/usr/local/bin/ruby -w
require 'ipaddr'
# /32 CIDR -> /40's (LONG)
(0..255).each { |x| puts IPAddr.new("1234:5678:#{sprintf("%02x",x)}00::0").to_i }
# /32 CIDR -> /48's (LONG)
(0..255).each { |x| puts IPAddr.new("1234:5678:00#{sprintf("%02x",x)}::0").to_i }
<?php
$addr = inet_pton($ip);
$unpack = unpack('H*hex', $addr);
$hex = $unpack['hex'];
$arpa = implode('.', array_reverse(str_split($hex))) . '.ip6.arpa';
?>
<?php
function cidr2mask($cidr) {
return long2ip(-1 << (32 - (int)$cidr));
}
?>
<?php
function mask2cidr($mask){
$long = ip2long($mask);
$base = ip2long('255.255.255.255');
return 32-log(($long ^ $base)+1,2);
}
?>
yum install openssh-clients -y
net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1To disable it on a running system, without reboot:
echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6 echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 1To disable it on a running system, without reboot:
echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
edit policy-options prefix-list block-Manual set a.b.c.d/CIDR up annotate prefix-list block-Manual "Manual Block List" edit policy-options prefix-list block-spamhaus-edrop set a.b.c.d/CIDR [...] set w.x.y.z/CIDR up annotate prefix-list block-spamhaus-edrop "http://www.spamhaus.org/drop/edrop.txt"You'll need to add the nets you want to block to each prefix list (I've created separate lists on purpose) but this should roughly give you:
[edit policy-options]
/* Manual Block List */
prefix-list block-Manual {
set a.b.c.d/CIDR;
}
/* http://www.spamhaus.org/drop/edrop.txt */
prefix-list block-spamhaus-edrop {
a.b.c.d/CIDR;
w.x.y.z/CIDR;
}
I'm also using the drop list from SpamHaus but at 500+ lines felt it was of no use in this article, however simply create another prefix list, annotate it according and fill it with the contents of http://www.spamhaus.org/drop/drop.txtset firewall family inet filter blocked-IP term 1 from prefix-list block-Manual set firewall family inet filter blocked-IP term 1 then discard set firewall family inet filter blocked-IP term 2 from prefix-list block-spamhaus-edrop set firewall family inet filter blocked-IP term 2 then discard set firewall family inet filter blocked-IP term 99 then accept...and this gives you:
filter blocked-IP {
term 1 {
from {
prefix-list {
block-Manual;
}
}
then {
discard;
}
}
term 2 {
from {
prefix-list {
block-spamhaus-edrop;
}
}
then {
discard;
}
}
term 99 {
then accept;
}
}
3) Apply to an interface
family inet {
filter {
input blocked-IP;
output blocked-IP;
}
}
...and thats all there is to it. Just keep adding new prefix lists (if you want to keep them logically separate) and then add them as terms to the filter ensuring term 99 (accepting traffic) is always last.
netstat -an | grep :80 | grep -i syn | wc -l
echo 1 > /proc/sys/net/ipv4/tcp_syncookies echo 2048 > /proc/sys/net/ipv4/tcp_max_syn_backlog echo 3 > /proc/sys/net/ipv4/tcp_synack_retriesTo make these persist across reboots, enter the following into /etc/sysctl.conf
net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_max_syn_backlog = 2048 net.ipv4.tcp_synack_retries = 3It is also recommended you install CSF firewall to help your servers' security. CSF also includes SYN Flood mitigation at the firewall iptables/firewall level.
nmap -p 80 --unprivileged [single IP or spaced CIDR-notated blocks, e.g. 192.168.0.0/24]
nmap -sP --unprivileged [single IP or spaced CIDR-notated blocks, e.g. 192.168.0.0/24]
for /L %a in (1,1,32) do netsh int ip add address "Local Area Connection" 192.168.0.%a 255.255.255.255This will add 192.168.0.1 - 192.168.0.32 to the network adapter named "Local Area Connection"
netsh firewall set portopening TCP 3389 microsoft-rdp
access-list 199 deny tcp any any eq smtp access-list 199 permit ip any anyNow, on any interface that you want to deny outbound port 25 SMTP traffic to:
ip access-group 199 inWrite out the changes and you're done
edit policy-options set policy-statement provider_blackhole edit policy-statement provider_blackhole set term match_666 from protocol static set term match_666 from tag 666 set term match_666 then origin igp set term match_666 then community set provider_blackhole set term match_666 then acceptTo check your work, type show and you should see:
policy-statement provider_blackhole {
term match_666 {
from {
protocol static;
tag 666;
}
then {
origin igp;
community set provider_blackhole;
accept;
}
}
}
Now we have to create that actual community:
edit policy-options set community provider_blackhole members AS###:COM###;...replace AS### with the providers ASN number, and replace COM### with the community tag your provider gave you for the BGP blackhole.
edit protocols bgp group provider set export provider_blackhole...one VERY important thing to note is that export ordering MATTERS. The most specific routes are announced left to right, so always ensure your blackhole export is listed first.
edit routing-options static set route a.b.c.d/cidr discard set route a.b.c.d/cidr tag 666...that's it.
touch /etc/modprobe.d/disable-ipv6 echo "options ipv6 disable=1" >> /etc/modprobe.d/disable-ipv6You'll also want to set "NETWORKING_IPV6" to "NO" in this file:
/etc/sysconfig/network...and then reboot.
lsmod | grep tunIf that yields no results, you have to load it into the kernel:
modprobe tunNext, you'll want to ensure this module is loaded across system reboots so you can do either of the following:
echo 'modprobe tun' >> /etc/rc.local--- OR ---
echo 'modprobe tun' >> /etc/rc.modules...whichever you are accustom to.
vzctl set CT_ID --devices c:10:200:rw --save vzctl set CT_ID --capability net_admin:on --saveLastly, we have to create the device and assign the proper permissions to it:
vzctl stop CT_ID vzctl exec CT_ID mkdir -p /dev/net vzctl exec CT_ID mknod /dev/net/tun c 10 200 vzctl exec CT_ID chmod 600 /dev/net/tun vzctl start CT_IDYour container should now be able to install OpenVPN or other VPN software.