Category Archives: Logs, Tips, and Scripts

Membuat file PKCS#12/PFX

Karena kerja sebagai security analyst, udah jadi agenda tahunan saya untuk update SSL certificate seluruh aplikasi kantor. Certificate yang didapat dari penyedia sebenernya bisa ke semua format yang ada, kecuali PKCS#12/PFX karena mereka ngga punya file key nya. Sebagai pengingat juga untuk saya di tahun depan, ini dia cara convert file certs menjadi PKCS#12/PFX:

openssl pkcs12 -export -out domain.com.pfx -inkey domain.com.privateKey.key -in domain.com.crt -certfile Intermediate-CA.crt -certfile TrustedRoot.crt

Sedangkan untuk verifikasi bahwa csr, key, dan crt yang kita punya itu match, commands nya begini:

openssl pkey -in domain.com.key -pubout -outform pem | sha256sum
openssl x509 -in domain.com.crt -pubkey -noout -outform pem | sha256sum
openssl req -in domain.com.csr -pubkey -noout -outform pem | sha256sum

ESXi windows.iso error not found

Bagi kamu yang sudah upgrade ESXi dan tiba-tiba gak bisa upgrade atau install VMware Tools untuk VM guest, dengan pesan error The required vmware tools ISO image does not exist or is inaccessible. Vix 21001. coba lakukan ini untuk memperbaiki symbolic link productLocker;

mv /usr/lib/vmware/isoimages /usr/lib/vmware/isoimages.tmp

rm /productLocker 

ln -s /vmfs/volumes/datastore2/Tools /productLocker

mv /usr/lib/vmware/isoimages.tmp /usr/lib/vmware/isoimages

Solusi ini sebenernya merujuk pada KB 2129825, tapi setelah saya coba KB tersebut malah ada beberapa command yang gak bisa. YMMV, bisa dicoba dengan 4 lines command saya di atas.

Putting MySQL database file on external drive

Currently hosting websites on a Raspberry Pi 4, with all web data already on external SSD drive. But then why not put the database files also on the SSD? Since there’s no point to have fast SSD if DB query still capped by crappy SD card read/write speed.

I’d create a custom file /etc/mysql/mariadb.conf.d/99-local.cnf with your changes in it. That would override the original file without having to change it or worrying about it getting overwritten during a software upgrade.

# This is /etc/mysql/mariadb.conf.d/99-local.cnf
[mysqld]
datadir = /ssd/mysql

The external SSD drive must be mounted before the mariadb server starts, otherwise it will fail. You can verify the changes by using mysql command SHOW VARIABLES LIKE '%datadir%';

root@buggy-sunshine:~# mysql -uroot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 247
Server version: 10.5.10-MariaDB-0ubuntu0.21.04.1 Ubuntu 21.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> SHOW VARIABLES LIKE '%datadir%';
+---------------+-------------+
| Variable_name | Value       |
+---------------+-------------+
| datadir       | /ssd/mysql/ |
+---------------+-------------+
1 row in set (0.004 sec)

MariaDB [(none)]>