Web-Based Guacamole tool

Guacamole website: https://guacamole.incubator.apache.org/

Create database for Guacamole: (DB name is guacamole_db)

$ mysql -u root -p

mysql> create database guacamole_db;
mysql> grant all privileges on guacamole_db.* to guacamole_user@localhost identified by 'secure password';
mysql> flush  privileges;

Initializing the MySQL database

$ docker run --rm guacamole/guacamole /opt/guacamole/bin/initdb.sh --mysql > initdb.sql

$ mysql -u guacamole_user -p guacamole_db < initdb.sql

Create my-guacd docker container

$ docker run --name my-guacd -d guacamole/guacd

Create my-guacamole docker container

docker run --name my-guacamole \
  --link my-guacd:guacd \
  -d -p 8080:8080 guacamole/guacamole


http://<server ip>:8080/guacamole/


$ docker logs my-guacamole

Behind apache proxy:

<Location /guacamole/>
    Order allow,deny
    Allow from all
    ProxyPass http://HOSTNAME:8080/guacamole/ flushpackets=on
    ProxyPassReverse http://HOSTNAME:8080/guacamole/

<Location /guacamole/websocket-tunnel>
    Order allow,deny
    Allow from all
    ProxyPass ws://HOSTNAME:8080/guacamole/websocket-tunnel
    ProxyPassReverse ws://HOSTNAME:8080/guacamole/websocket-tunnel

SMTP setting for Drupal, Django, and WordPress

Drupal, Django, and WordPress are using localhost as SMTP server by default. But there is a way to use another SMTP server to send email.

Drupal security modules

Base security modules for drupal:

  1. Login security http://drupal.org/project/login_security
  2. Password policy https://www.drupal.org/project/password_policy
  3. Update manager https://www.drupal.org/documentation/modules/update
  4. Captcha https://www.drupal.org/project/captcha
  5. Flood Control https://www.drupal.org/project/flood_control
  6. Secure Pages Hijack Prevention    https://www.drupal.org/project/securepages_prevent_hijack
  7. XFS (cross frame scripting) https://www.drupal.org/project/seckit
  8. Idle Session Timeout https://www.drupal.org/project/autologout
  9. Concurrent Sessions https://www.drupal.org/project/session_limit
  10. ACL https://www.drupal.org/project/acl
  11. Two-factor Authentication (TFA) https://www.drupal.org/project/tfa
  12. Paranoia https://www.drupal.org/project/paranoia
  13. Coder https://www.drupal.org/project/coder
  14. Security Review https://www.drupal.org/project/security_review
  15. SpamSpan filter https://www.drupal.org/project/spamspan

source: http://resources.infosecinstitute.com/15-security-modules-for-drupal-to-make-website-secure/

Change django administration title

There are two ways to change them.

  1. Create //templates/admin/base_site.html file with the following content

    {% extends "admin/base.html" %}
    {% block title %}{{ title }} | Your website title here {% endblock %}
    {% block branding %}
    <h1 id="site-name">
        <a href="{% url 'admin:index' %}">Your website title here</a>
    {% endblock %}

    The original file is https://github.com/django/django/blob/master/django/contrib/admin/templates/admin/base_site.html

  2. Change settings.py and urls.py

    $ vi settings.py
    ADMIN_SITE_HEADER = "My shiny new administration"
    $ vi urls.py
    from django.conf import settings
    admin.site.site_title = settings.ADMIN_SITE_HEADER
    admin.site.site_header = settings.ADMIN_SITE_HEADER

    Source: http://stackoverflow.com/questions/4938491/django-admin-change-header-django-administration-text

Using pyenv on Ubuntu

Installing pyenv

$ sudo apt-get install -y --fix-missing make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils
$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
$ git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
$ . ~/.bash_profile

Installing python

$ pyenv install 3.5.2

Setting python version

$ pyenv versions
$ pyenv global system
$ pyenv global 3.5.2
$ pyenv global
$ pyenv local
$ pyenv local 3.5.2

Using virtualenv

$ pyenv virtualenv 3.5.2 venv
$ pyenv activate venv
$ pyenv deactivate venv

Checking python version

$ python -V

Install nodejs on ubuntu

Installing nodejs

sudo apt install nodejs
sudo apt-get install npm

Installing pm2

sudo npm install pm2@latest -g
cd /usr/bin
sudo ln -s nodejs node

Create user to run nodejs

sudo useradd nodeuser
sudo passwd nodeuser
sudo addgroup nodejs
sudo adduser nodeuser nodejs

Using pm2 to start nodejs app

pm2 start hello.js

Using pm2 to autostart nodejs apps

sudo env PATH=$PATH:/usr/local/bin pm2 startup -u nodeuser
sudo su -c "chmod +x /etc/init.d/pm2-init.sh && update-rc.d pm2-init.sh defaults"
pm2 save

Install java on ubuntu

Installing default jre/jdk

sudo apt update
sudo apt install default-jre
sudo apt install default-jdk

Installing openjre/jdk 7

sudo apt-get install openjdk-7-jre 
sudo apt-get install openjdk-7-jdk

Installing Oracle java

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update

sudo apt-get install oracle-java6-installer

sudo apt-get install oracle-java7-installer

sudo apt-get install oracle-java8-installer

Managing java

sudo update-alternatives --config java
sudo update-alternatives --config javac


sudo vi /etc/environment