write:errno=104 / New, (NONE), Cipher is (NONE)

    So if you’re having some issues with SSL connections, it’s higly likely you’re experiencing them from client version openssl 1.0.2. the fix is below and i can confirm it works on both openssl 1.0.1 and 1.0.2.

    openssl s_client -connect yourdomain.com:5671 -showcerts
    CONNECTED(00000003)
    write:errno=104

    no peer certificate available

    No client certificate CA names sent

    SSL handshake has read 0 bytes and written 305 bytes

    New, (NONE), Cipher is (NONE)
    Secure Renegotiation IS NOT supported
    Compression: NONE
    Expansion: NONE
    No ALPN negotiated
    SSL-Session:
    Protocol : TLSv1.2
    Cipher : 0000
    Session-ID:
    Session-ID-ctx:
    Master-Key:
    Key-Arg : None
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1484575655
    Timeout : 300 (sec)
    Verify return code: 0 (ok)

    openssl s_client \

    -cipher RSA \

    -connect mydomain.com:5671 \

    -servername mydomain.com \

    -cert client/cert.pem \

    -key client/key.pem \

    -CAfile testca/cacert.pem \

    -tls1_2

    Enjoy!

    vBulletin – can’t login to admincp

    So i had the weirdest issue today:

    Last night, i installed vbulletin as i want to get a forum going for our new project: Dive: Frozen in time – a puzzle-driven skydiving game in Virtual Reality, made by our brand new studio: spinningBOX VR Studios and everything was fine. Went to bed and when i try to login – i can login to the website but not to the admincp. I was pretty amazed, however one really easy fix was this:

    change your cookie prefix in core/includes/config.php to rewrite the cookie key.

    $config['Misc']['cookieprefix'] = 'bb';
    to 
    $config['Misc']['cookieprefix'] = 'bb1';
    
    Problem solved.
    Enjoy!

    npm ERR! EPROTO: protocol error, symlink ‘../rimraf/bin.js’

    So i was trying to spin up a docker app in a node.js docker container but i got the error below:

    npm ERR! Linux 4.4.24-boot2docker
    npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “install”
    npm ERR! node v6.9.1
    npm ERR! npm v3.10.8
    npm ERR! path ../rimraf/bin.js
    npm ERR! code EPROTO
    npm ERR! errno -71
    npm ERR! syscall symlink

    npm ERR! EPROTO: protocol error, symlink ‘../rimraf/bin.js’ -> ‘/root/src/node_modules/.bin/rimraf’
    npm ERR!
    npm ERR! If you need help, you may report this error at:
    npm ERR! <https://github.com/npm/npm/issues>

    npm ERR! Please include the following file with any support request:
    npm ERR! /root/src/npm-debug.log

    Quite a cool fix was:

    [email protected]:~/src# npm install –no-bin-links

    Ended up working just fine. Enjoy!

    npm info lifecycle [email protected]~install: [email protected]
    npm info lifecycle [email protected]~postinstall: [email protected]
    npm info lifecycle [email protected]~prepublish: [email protected]
    [email protected] /root/src
    `– [email protected]
    `– [email protected]
    `– [email protected]
    `– [email protected]
    +– [email protected]
    +– [email protected]
    `– [email protected]
    `– [email protected]
    +– [email protected]
    `– [email protected]

    npm info ok
    [email protected]:~/src#

    Git cheat sheet

    Some of the stuff that i use more frequently and i still haven’t learned by heart yet, I will be putting them here, in this beautiful cheat sheet.

    List all tracked files:

    git ls-tree --full-tree -r --name-only HEAD

    Untrack file in git:

    echo "FILE_NAME" >> .gitignore
    git rm --cached FILE_NAME
    git add -u
    git commit -m "removing file from source control"
    git pull origin master
    git push origin master
    
    (replace master with the branch you're on)

    How to install Node.js on Ubuntu/CentOS

    If you want to easy install Node.js on Ubuntu or RHEL – based systems such as CentOS, I’m just gonna point you towards Nodesource. It’s the easiest thing to do since sliced bread.

    However, if you’re into more heavy development and you would like an RVM-like setup, you can try NVM. You will be able to run multiple Node.js versions side by side and more granular control.

    Enjoy!

    Ubuntu 16.04 – Downgrade php from 7.0 to 5.6

    So I got a new Ubuntu box and they are loading PHP 7.0 by default, which kinda breaks some apps right now. Lucky for us, I got an answer from a handy guy on AskUbuntu:

    Remove the installed PHP packages (if you installed them):

    sudo apt purge dpkg -l | grep php| awk '{print $2}' |tr "\n" " "

    Add the PPA
    sudo add-apt-repository ppa:ondrej/php

    Install your PHP Version
    sudo apt-get update
    sudo apt-get install php5.6

    Enjoy!

    AttributeError: ‘module’ object has no attribute ‘DeprecatedIn12’

    If you are playing with certbot on CenOS7 and you encounter the thing below, it’s due to a Python library that should be upgraded:

    AttributeError: ‘module’ object has no attribute ‘DeprecatedIn12’

    pip install cryptography –upgrade

    pip install –upgrade pip

    then again:

    pip install cryptography –upgrade

    After this, you should be able to use certbot without any issues.

    Format / mount ec2 volume

    So you added a new volume to a server and you want to mount it quick.

    • Use lsblk to spot the new added volume:

    [[email protected] ~]# lsblk
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    xvda 202:0 0 8G 0 disk
    ??xvda1 202:1 0 8G 0 part /
    xvdb 202:16 0 8G 0 disk /var/www/html
    xvdf 202:80 0 16G 0 disk /var/lib/mysql
    xvdg 202:96 0 16G 0 disk /home
    xvdh 202:112 0 32G 0 disk

    • Use mkfs to create a filesystem on the partition:

    [[email protected] ~]# mkfs -t ext4 /dev/xvdf
    mke2fs 1.42.9 (28-Dec-2013)
    /dev/xvdf is mounted; will not make a filesystem here!
    [[email protected] ~]# mkfs -t ext4 /dev/xvdh
    mke2fs 1.42.9 (28-Dec-2013)
    Filesystem label=
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    Stride=0 blocks, Stripe width=0 blocks
    2097152 inodes, 8388608 blocks
    419430 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=2155872256
    256 block groups
    32768 blocks per group, 32768 fragments per group
    8192 inodes per group
    Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
    4096000, 7962624

    Allocating group tables: done
    Writing inode tables: done
    Creating journal (32768 blocks): done
    Writing superblocks and filesystem accounting information: done

    • Create a folder and mount the newly created partition:

    [[email protected] ~]# mkdir /misc
    [[email protected] ~]# mount /dev/xvdh /misc
    [[email protected] ~]# df -h |grep misc
    Filesystem Size Used Avail Use% Mounted on
    /dev/xvdh 32G 49M 30G 1% /misc

    • Edit /etc/fstab so the partition is mounted at reboot:

    /dev/xvdh /misc ext4 defaults,nofail 0 2

    Done!

    Amazon EC2 change hostname – OpenSUSE

    I am just getting to know OpenSUSE and it’s been driving me insane with the hostname not being persistent even if you change it via “hostnamectl” or entering the new hostname in “/etc/hostname”.

    In EC2, you have to open up yast and uncheck the “change hostname via DHCP tick box” in the network card settings.

    Self signed SSL – quick and dirty

    If you’re in the market for quickly getting a self signed SSL certificate done:

    openssl genrsa -des3 -passout pass:x -out server.pass.key 2048
    openssl rsa -passin pass:x -in server.pass.key -out server.key
    openssl req -new -key server.key -out server.csr
    openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

    ls -la

    -rw-r–r–. 1 root root 1387 Apr 27 08:49 server.crt
    -rw-r–r–. 1 root root 1098 Apr 27 08:49 server.csr
    -rw-r–r–. 1 root root 1679 Apr 27 08:48 server.key

    Enjoy