IT notes

self CA

Create a self signed CA (Certificate Authority) Generate private key: $ openssl genrsa -des3 -out CA.key 4096 To create a private key without password: $ openssl genrsa -out CA.key 4096 Create a root certificate: $ openssl req -x509 -new -nodes -key CA.key -sha256 -out CA.pem -subj "/CN=example.com" -days 365 In one single command create the private key and the certificate: $ openssl req -x509 -newkey rsa:4096 -sha256 -nodes -keyout CA.

Bosh cheatsheet

BOSH is a project that unifies release engineering, deployment, and lifecycle management of small and large-scale cloud software. Check your environment: $ bosh env Set your deployment environment: $ export BOSH_DEPLOYMENT=foo if have multiple deployments in same dir better to use -d <deployment-name> since many commands are bound to this variable. To recreate your environment (virtualbox), remove the line that start with current_manifest from the file state.

ZFS swap

To add more swap on a ZFS system: # zfs create -V 64G -o org.freebsd:swap=on -o checksum=off -o compression=off -o dedup=off -o sync=disabled -o primarycache=none tank/swap2 To add it: # swapon /dev/zvol/tank/swap2 To resize you could first remove it: # swapoff /dev/zvol/tank/swap Then destroy it: # zfs destroy tank/swap

No history

To avoid having command in history just prefix them with an empty space: $⎵ uname If using zsh: $ echo "" > ~/.zsh_history & exec $SHELL -l

macOs sparseimage

To create an install disk using an spare disk: $ hdiutil create -size 6GB -fs JHFS+ -volname "macOS_installmedia" -type SPARSE ~/Desktop/macOS_installmedia Mount it (or double-click in Finder to mount): $ hdiutil mount ~/Desktop/macOS_installmedia.sparseimage Use the createinstallmedia: $ sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/macOS_installmedia --applicationpath /Applications/Install\ macOS\ High\ Sierra.app

NATO phonetic alphabet

Symbol Code word Pronunciation A Alfa Al fah B Bravo Brah Voh C Charlie Char Lee D Delta Dell Tah E Echo Eck Oh F Fox Foks Trot G Golf Golf H Hotel Hoh Tell I India In Dee Ah J Juliett Jew Lee Ett K Kilo Key Loh L Lima Lee Mah M Mike Mike N November No Vem Ber O Oscar Oss Car P Papa Pah Pah Q Quebec Keh Beck R Romeo Row Me Oh S Sierra See Air Ah T Tango Tang Go U Uniform You Nee Form V Victor Vik Tah W Whiskey Wiss Key X X-ray Ecks Ray Y Yankee Yang Key Z Zulu Zoo Loo 0 Zero Zee Row 1 One Wun 2 Two Too 3 Three Tree 4 Four Fow Er 5 Five Fife 6 Six Six 7 Seven Sev En 8 Eight Ait 9 Nine Nine Er

ZFS send receive

To send a zfs dataset being no root, on the origin server: # zfs allow -g wheel send,snapshot,hold tank/foo On the receiver, create the dataset and allow users in group wheel: # zfs create -o mountpoint=/foo tank/foo # zfs allow -g wheel compression,mountpoint,create,mount,receive tank/foo # umount /foo On the origin server create the snapshot to send: # zfs snapshot -r tank/foo On the origin server send the dataset by using:

Enable Paste

To enable paste in chrome, open the console and enter: var allowPaste = function(e){ e.stopImmediatePropagation(); return true; }; document.addEventListener('paste', allowPaste, true);

kld_list

To load kernel modules after local disks are mounted add this to /etc/rc.conf: kld_list="fuse" in this case module fuse will be loaded

hw.(machine|model|ncpu)

To get an overview of the system: # sysctl -a | egrep -i 'hw.machine|hw.model|hw.ncpu' hw.machine: amd64 hw.model: Intel(R) Xeon(R) Silver 4110 CPU @ 2.10GHz hw.ncpu: 16 hw.machine_arch: amd64

moosefs

Create a small distributed file system using 2 servers one acting as a mater/chunkserver and other only as a chunkserver. Install the required packages: pkg install moosefs3-cgi moosefs3-cgiserv moosefs3-chunkserver moosefs3-client For the master just add: pkg install moosefs3-master In all the servers add to your /etc/hosts and entry for the mfsmaster: X.X.X.X mfsmaster Before starting the master, crate the file /var/mfs/metadata.mfs with: MFSM NEW Create a pool to share:

MANIFEST No Such File or Directory

If when trying to install FreeBSD using bsdinstall you get: "Error while fetching file:///usr/freebsd-dist/MANIFEST" - no such file or directory Try to: [email protected]:~ # mkdir -p /usr/freebsd-dist/ [email protected]:~ # touch /usr/freebsd-dist/MANIFEST And then start again

ctrl-backslash

To send a quit signal to the process: ctrl-\ # (backslash) This will send a SIGQUIT

python site packages

To find the python site-packages paths: $ python -m site

DNS TCP

Unbound using DNS over TCP: server: private-domain: "plex.direct" forward-zone: name: "." forward-ssl-upstream: yes forward-addr: [email protected] forward-addr: [email protected] forward-addr: [email protected] forward-addr: [email protected] forward-addr: 2606:4700:4700::[email protected] forward-addr: 2606:4700:4700::[email protected] forward-addr: 2620:fe::[email protected]; forward-addr: 2620:fe::[email protected]; To test do: # unbound-control -c /var/unbound/unbound.conf lookup . It should return something like: The following name servers are used for lookup of . forwarding request: Delegation with 0 names, of which 0 can be examined to query further addresses.

ssh CanonicalDomains

SSH Canonicalization CanonicalDomains example.com example.net example.org # CanonicalizeFallbackLocal no CanonicalizeHostname yes Host *.example.com IdentityFile ~/.ssh/exampleCOM User foo Host *.example.net IdentityFile ~/.ssh/exampleNET User foo Host *.example.org User foo IdentityFile ~/.ssh/exampleORG more info: https://dotfiles.tnetconsulting.net/articles/2016/0109/ssh-canonicalization.html

pfsense

How to connect using serial (usb/com RJ45) port on macOS: $ sudo cu -s 115200 -l /dev/tty.usbserial-DN04FSAL To bail out when you’re done, type ~. as you would with SSH. Boot example: After installing (zfs on root): The toy:

packagecloud

To upload all packages to packagecloud: package_cloud push immortal/immortal/el/7 immortal_0.19.0_*.rpm --skip-errors for .deb 386 needs to be i386

gzip

Gzip all files within a directory: gzip -r ./ or find . -type f ! -name '*.gz' -exec gzip "{}" \;

odroid C2

Disabling blinking blue led: echo none > /sys/class/leds/blue:heartbeat/trigger To make the change permanent add the line to /etc/rc.local