IT notes

ssh rsa public key encryption

Encrypt a file using ssh public keys. Create ssh public key in PEM format: ssh-keygen -f id_rsa.pub -e -m PKCS8 > id_rsa.pem.pub Use openssl to encrypt/decrypt Encrypt: openssl rsautl -encrypt -pubin -inkey ~/.ssh/id_rsa.pem.pub -ssl -in test.txt -out test.txt.enc Decrypt: openssl rsautl -decrypt -inkey ~/.ssh/id_rsa -in test.txt.enc -out test.txt.enc.txt

reset qnap virtual switch

To reset the QNAP Virtualization Station, rename the file: /share/CE_CACHEDEV1_DATA/.qpkg/.QKVM to /share/CE_CACHEDEV1_DATA/.qpkg/.QKVM-backup From the App center remove/install the Virtualization Station.

E437 terminal capability cm required

When trying to open vi/vim the following message could appear: "E437: terminal capability "cm" required" To fix it type: $ export TERM=xterm

aws uptime

AWS >= 657 days OS: FreeBSD 8.2 AWS: us-east-1 Type: t1.micro

debian parted

Resize AWS Debian Jessie Probably instance will have 8GB, to extend the disk, for example to 40GB do this: Install parted: $ apt-get install parted Run: $ /sbin/parted ---pretend-input-tty /dev/xvda resizepart 1 yes 100% Resize2fs: $ resize2fs /dev/xvda1 Run lsblk: [email protected]:~# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 40G 0 disk `-xvda1 202:1 0 40G 0 part /

CI & CD

Release pipeline CI & CD

Raspberry Pi 1 Model B

Raspberry Pi 1 Model B, FreeBSD + wifi cat /var/run/dmesg.boot: KDB: debugger backends: ddb KDB: current backend: ddb Copyright (c) 1992-2016 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 10.3-RELEASE #0 r297264: Fri Mar 25 08:01:14 UTC 2016 [email protected]:/usr/obj/arm.armv6/usr/src/sys/RPI-B arm FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512 VT: init without driver.

uptime 1000 days

uptime >= 1000 days OS: FreeBSD + ZFS + Jails Server: Dell PowerEdge 2900 2xE5420 24GB RAM Colocation: https://iweb.com/

aws ec2 associate address

If doing more than 100 requests implying the AWS CLI associate-address sub-command, subsequent calls will cost $0.10 each, so If doing to much scale in/out or have a monitoring/automated tool that frecuenly make API calls using this sub-command, the bill is not going to be cheap: Scale in (remove instances) Scale out (add instances) Long story short, The associate-address sub-command, is an idempotent operation, if you call “aws ec2 associate-address” with the same combination of instance and EIP as the one currently in place, it won’t return an error; instead, it will return and count as successful, regardless of whether an actual allocation was done or not.

letsencrypt + cloudfare using DNS

It’s not necessary to disable CloudFlare to use Let’s Encrypt, Installation: On mac os X: $ git clone https://github.com/lukas2511/letsencrypt.sh $ cd letsencrypt.sh $ mkdir hooks $ git clone https://github.com/kappataumu/letsencrypt-cloudflare-hook hooks/cloudflare $ pip install -r hooks/cloudflare/requirements-python-2.txt Configuration Your account’s CloudFlare email and API key are expected to be in the environment: $ export CF_EMAIL="[email protected]" $ export CF_KEY="Global API Key" $ export CF_DNS_SERVERS='8.8.8.8 8.8.4.4' Usage $ ./letsencrypt.sh -c -d imap.ejemplo.org -t dns-01 -k "hooks/cloudflare/hook.py" # # !!