-
Notifications
You must be signed in to change notification settings - Fork 310
Provisioning Bitcoin Network Crawler
Addy Yeow edited this page Oct 15, 2021
·
61 revisions
Hetzner PX61-NVMe Dedicated Server 64GB Debian 9 64-bit (Falkenstein, DE)
ssh root@[IP_ADDRESS]
[PASSWORD]
passwd
[PASSWORD]
vi /etc/hostname
[HOSTNAME]
vi /etc/hosts
127.0.0.1 localhost
[IP_ADDRESS] [HOSTNAME]
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
[IPV6_ADDRESS] [HOSTNAME]
dpkg-reconfigure locales
en_US.UTF-8 UTF-8
en_US.UTF-8
vi /etc/environment
LC_CTYPE=en_US.UTF-8
dpkg-reconfigure tzdata
None of the above
UTC
apt-get update; apt-get upgrade
apt-get -y install apt-transport-https build-essential dirmngr htop python-dev python-virtualenv sudo tcl tcpdump unzip
adduser [USERNAME]
[PASSWORD]
adduser [USERNAME] sudo
mkdir -p /home/[USERNAME]/.ssh; chmod 700 /home/[USERNAME]/.ssh
vi /home/[USERNAME]/.ssh/authorized_keys
[PUBLICKEY]
chmod 600 /home/[USERNAME]/.ssh/authorized_keys; chown -R [USERNAME]:[USERNAME] /home/[USERNAME]/.ssh
export REDIS_SOCKET=/tmp/redis.sock
export REDIS_PASSWORD=[PASSWORD]
Port [PORT]
LoginGraceTime 60
PermitRootLogin no
AllowUsers [USERNAME]
PasswordAuthentication no
net.ipv4.conf.default.rp_filter=1
net.ipv4.conf.all.rp_filter=1
net.ipv4.tcp_syncookies=1
net.ipv4.conf.all.accept_redirects=0
net.ipv6.conf.all.accept_redirects=0
net.ipv4.conf.all.send_redirects=0
net.ipv4.conf.all.accept_source_route=0
net.ipv6.conf.all.accept_source_route=0
net.ipv4.conf.all.log_martians=1
net.core.rmem_default=33554432
net.core.wmem_default=33554432
net.core.rmem_max=33554432
net.core.wmem_max=33554432
net.core.optmem_max=33554432
net.ipv4.tcp_rmem=10240 87380 33554432
net.ipv4.tcp_wmem=10240 87380 33554432
net.ipv4.ip_local_port_range=2000 65500
net.core.netdev_max_backlog=100000
net.ipv4.tcp_max_syn_backlog=80000
net.ipv4.tcp_max_tw_buckets=2000000
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_fin_timeout=5
net.ipv4.tcp_slow_start_after_idle=0
net.core.somaxconn=60000
fs.file-max=1000000
vm.swappiness=10
vm.min_free_kbytes=1048576
vm.overcommit_memory=1
* soft nofile 1000000
* hard nofile 1000000
vi /etc/systemd/system/disable-transparent-huge-pages.service
[Unit]
Description=disable-transparent-huge-pages
[Service]
Type=oneshot
ExecStart=/bin/sh -c "echo "never" | tee /sys/kernel/mm/transparent_hugepage/enabled"
ExecStart=/bin/sh -c "echo "never" | tee /sys/kernel/mm/transparent_hugepage/defrag"
[Install]
WantedBy=multi-user.target
systemctl enable disable-transparent-huge-pages.service
systemctl start disable-transparent-huge-pages.service
vi /etc/systemd/system/set-txqueuelen.service
[Unit]
Description=set-txqueuelen
[Service]
Type=oneshot
ExecStart=/sbin/ifconfig [INTERFACE] txqueuelen 5000
[Install]
WantedBy=multi-user.target
systemctl enable set-txqueuelen.service
systemctl start set-txqueuelen.service
reboot
ssh -p [PORT] -i [PRIVATEKEY] [USERNAME]@[IP_ADDRESS]
cd; wget http://download.redis.io/releases/redis-5.0.3.tar.gz
tar xzf redis-5.0.3.tar.gz; cd redis-5.0.3; make; make test
sudo make install
cd utils; sudo bash install_server.sh
sudo vi /etc/init.d/redis_0
***************************************************************************
#!/bin/sh
EXEC=/usr/local/bin/redis-server
CLIEXEC=/usr/local/bin/redis-cli
PIDFILE=/var/run/redis_0.pid
CONF="/etc/redis/0.conf"
REDISSOCKET="/tmp/redis.sock"
REDISPASSWORD="[PASSWORD]"
###############
# SysV Init Information
# chkconfig: - 58 74
# description: redis_0 is the redis daemon.
### BEGIN INIT INFO
# Provides: redis_0
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Should-Start: $syslog $named
# Should-Stop: $syslog $named
# Short-Description: start and stop redis_0
# Description: Redis daemon
### END INIT INFO
case "$1" in
start)
if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is already running or crashed"
else
echo "Starting Redis server..."
$EXEC $CONF
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
else
PID=$(cat $PIDFILE)
echo "Stopping ..."
$CLIEXEC -s $REDISSOCKET -a $REDISPASSWORD shutdown
while [ -x /proc/${PID} ]
do
echo "Waiting for Redis to shutdown ..."
sleep 1
done
echo "Redis stopped"
fi
;;
status)
PID=$(cat $PIDFILE)
if [ ! -x /proc/${PID} ]
then
echo 'Redis is not running'
else
echo "Redis is running ($PID)"
fi
;;
restart)
$0 stop
$0 start
;;
*)
echo "Please use start, stop, restart or status as first argument"
;;
esac
***************************************************************************
sudo update-rc.d redis_0 defaults
sudo vi /etc/redis/0.conf
unixsocket /tmp/redis.sock
unixsocketperm 777
#save 900 1
#save 300 10
#save 60 10000
requirepass [PASSWORD]
maxclients 50000
maxmemory 34326183936
maxmemory-policy volatile-lru
notify-keyspace-events K$z
activerehashing no
client-output-buffer-limit normal 512mb 256mb 300
client-output-buffer-limit replica 512mb 256mb 300
client-output-buffer-limit pubsub 512mb 256mb 300
sudo reboot
ssh -p [PORT] -i [PRIVATEKEY] [USERNAME]@[IP_ADDRESS]
cd; wget --no-check-certificate https://github.com/ayeowch/bitnodes/archive/master.zip
unzip master.zip
virtualenv ~/.virtualenvs/bitnodes
source ~/.virtualenvs/bitnodes/bin/activate
cd bitnodes-master
pip install -r requirements.txt
vi geoip/.maxmind_license_key
[MAXMIND_LICENSE_KEY]
bash geoip/update.sh
cp conf/crawl.conf.default conf/crawl.conf
cp conf/export.conf.default conf/export.conf
cp conf/pcap.conf.default conf/pcap.conf
cp conf/ping.conf.default conf/ping.conf
cp conf/resolve.conf.default conf/resolve.conf
cp conf/seeder.conf.default conf/seeder.conf
bash start.sh
cd data/pcap/f9beb4d9
sudo rm *.pcap; sudo tcpdump -i [INTERFACE] -w %s.[INTERFACE.pcap -v -n -G 2 -B 65536 -Z [USERNAME] 'tcp and not src host [IP_ADDRESS] and not src host [IPV6_ADDRESS]' > [INTERFACE] 2>&1 &
sudo tcpdump -i lo -w %s.lo.pcap -v -n -G 2 -B 65536 -Z [USERNAME] 'tcp and port 9050' > lo 2>&1 &