6/14/19

uWSGI with Python 3.7 in Ubuntu 18

Packages
sudo apt install python3.7 python3.7-dev uwsgi uwsgi-src uuid-dev libcap-dev libpcre3-dev

Build
cd ~
export PYTHON=python3.7
uwsgi --build-plugin "/usr/src/uwsgi/plugins/python python37"

Install
sudo mv python37_plugin.so /usr/lib/uwsgi/plugins/python37_plugin.so
sudo chmod 644 /usr/lib/uwsgi/plugins/python37_plugin.so

10/16/18

SSLError(SSLError(1, u'[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:661)'),))

pip install pyOpenSSL
pip install ndg-httpsclient
pip install pyasn1

or

easy_install pyOpenSSL
easy_install ndg-httpsclient
easy_install pyasn1

9/28/18

Enable and use the RabbitMQ management console

sudo rabbitmq-plugins enable rabbitmq_management
sudo chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/

sudo rabbitmqctl add_user mqadmin password
sudo rabbitmqctl set_user_tags mqadmin administrator
sudo rabbitmqctl set_permissions -p / mqadmin ".*" ".*" ".*"

http://Server-IP:15672/

9/18/18

Docker VPN

Create digitalocean docker droplet

Run:
CID=$(docker run -d --restart=always --privileged -p 1194:1194/udp -p 443:443/tcp umputun/dockvpn)

docker run -t -i -p 8080:8080 --volumes-from $CID umputun/dockvpn serveconfig

Download vpn config: 
https://<server_ip>:8080/

Download vpn client:

MacOS:
https://code.google.com/p/tunnelblick/wiki/DownloadsEntry#Tunnelblick_Stable_Release

Other:
https://openvpn.net/


9/6/18

GeoIP Update Script

#!/bin/sh
cd /usr/share/GeoIP/
sudo rm /usr/share/GeoIP/GeoIP.dat_bak
sudo mv /usr/share/GeoIP/GeoIP.dat /usr/share/GeoIP/GeoIP.dat_bak
sudo wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
sudo gunzip GeoIP.dat.gz

8/26/18

SETTING LOCALE FAILED. PLEASE CHECK THAT YOUR LOCALE SETTINGS

sudo nano /etc/default/locale
add
LANGUAGE=en_US.UTF-8
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
LC_TYPE=en_US.UTF-8

or

export LANGUAGE="en_US.UTF-8"
echo 'LANGUAGE="en_US.UTF-8"' >> /etc/default/locale
echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale

Secure Nginx from Clickjacking with X-FRAME-OPTIONS

X-Frame-Options in HTTP response header can be used to indicate whether or not a browser should be allowed to open a page in frame or iframe.
  • SAMEORIGIN: This setting will allow the page to be displayed in a frame on the same origin as the page itself.
  • DENY: This setting will prevent a page displaying in a frame or iframe.
  • ALLOW-FROM URI: This setting will allow a page to be displayed only on the specified origin.
Add the following parameter in nginx.conf under server section:
add_header X-Frame-Options "SAMEORIGIN";