mysql ssl connection

The standard way to connect to MySQL is: mysql -h hostname -u user -p Here’s how to connect to MySQL with SSL encryption. mysql -h hostname -u user -p \ --ssl-ca=server-ca.pem \ --ssl-cert=client-cert.pem \ --ssl-key=client-key.pem Generate the SSL keys from the MySQL server. Download it to the client.

April 27, 2020 · 1 min · ulysses

mysql restore

Here’s how to restore a MySQL database from mysqldump. mysql -u user -p mysql> drop database databasename; mysql> quit; Bye mysql -u user -p databasename Drop database first, then import the SQL file.

April 26, 2020 · 1 min · ulysses

upgrade to ubuntu 20.04 lts

Now that Ubuntu 20.04 LTS (Long Term Support) is out, here’s a quick guide to upgrade to Ubuntu 20.04 LTS. You can ONLY upgrade from either Ubuntu 18.04 LTS or 19.10. If you have older versions of Ubuntu, it may not work. I suggest you back up your VM before running the upgrade, so you can quicky recover if something goes awry. This upgrade process will require sudo access. # login as root sudo -i # check your current version lsb_release -a # update packages apt update -y apt upgrade -y # reboot server reboot # remove old kernels apt --purge autoremove # install update manager core apt install update-manager-core # finally, perform the upgrade do-release-upgrade -d # reboot the server reboot # after reboot confirm lsb_release -a

April 26, 2020 · 1 min · ulysses

pfx to pem

Here’s how to convert SSL certificate from PFX to PEM format. #!/bin/bash echo "This script converts SSL certificates from PFX to PEM." read -p 'Enter PFX Certificate Name : ' cert_pfx read -p 'Enter the Import Passphrase : ' import_passphrase openssl pkcs12 -in $cert_pfx -nocerts -out cert-key.pem -passin pass:$import_passphrase -passout pass:$import_passphrase openssl pkcs12 -in $cert_pfx -clcerts -nokeys -out cert-body.pem -passin pass:$import_passphrase -passout pass:$import_passphrase openssl pkcs12 -in $cert_pfx -nodes -nokeys -out cert-chain.pem -passin pass:$import_passphrase -passout pass:$import_passphrase sleep 3 openssl rsa -in key.pem -out cert-private.key -passin pass:$import_passphrase -passout pass:$import_passphrase This was covered in an earlier post, but this script prompts you for the passphrase. ...

April 22, 2020 · 1 min · ulysses

waf cloudformation template

Here’s the CloudFormation template for creating a WAF. Here are some options that you’ll be asked during creation. Activate SQL Injection Protection ( yes | no ) Activate Cross-site Scripting Protection ( yes | no ) Activate HTTP Flood Protection ( WAF rate | Lambda log parser | Athena log parser | no ) Activate Scanner & Probe Protection ( Lambda log parser | Athena log parser | no ) Activate Reputation List Protection ( yes | no ) Activate Bad Bot Protection ( yes | no ) Endpoint Type (CloudFront or ALB) Application Access Log Bucket Name ( Leave blank if no S3 bucket) The template creates 2 CloudFormation stacks.

April 21, 2020 · 1 min · ulysses

aws waf ip set

Here’s how to get the WAF rule. aws waf-regional get-rule \ --rule-id xxxxxxxxxxxxxxxxxxxxxxxxxxx Here’s how to get the AWS WAF IP set. aws waf-regional get-ip-set \ --ip-set-id xxxxxxxxxxxxxxxxxxx \ --region us-east-1 \ --profile your-profile Here’s how to get the latest token. aws waf-regional get-change-token Result is similar to this. { "ChangeToken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" } Create a JSON file called “change.json” to be used for updating the IP set. We will insert and delete an IP set. ...

April 17, 2020 · 1 min · ulysses

gcp instances by service account

Here’s how to get a list of GCP instances using a specific service account. gcloud compute instances list \ --filter="serviceAccounts.email=service-account@domain.com" \ --project project-id To display all instances and their service accounts in JSON format. gcloud compute instances list \ --format="json(name,serviceAccounts[].email)" \ --project your-project-id Display in YAML which is also the Default. gcloud compute instances list \ --format="default(name,serviceAccounts[].email)" \ --project your-project-id

April 14, 2020 · 1 min · ulysses

s3 browser iam assume role

S3 Browser is a free Windows client for accessing AWS S3 buckets. You can access S3 buckets with an interface similar to File Manager. A typical setup requires that you use access and secret keys to connect to the S3 browser. However, if the server is in the cloud, it’s better that use a machine profile with an assume role. The assume role gets temporary credentials until they expire. They are automatically rotated by AWS behind the scenes for you. This is much safer process than storing key credentials in the cloud. The good news is, S3 Browser support IAM assume roles. Here’s the setup instructions to get your S3 Browser configured using IAM assume role. Here’s IAM role explained.

April 12, 2020 · 1 min · ulysses

video conferencing

Due to the Covid-19 lockdown, here are several video conferencing options. Microsoft Skype – been around for a long time. Microsoft Teams – Microsoft wants everyone to switch to Teams. Google Meet – Uses the webRTC protocol. Video calls up to 10 people. Discord – Popular with gamers. Video chat capable up to 9 people. Zoom – Got really hot, then took a dive due to zoombombing. Chime – Amazon Web Services video chat. Webex – Cisco’s video conferencing. This is not an extensive list, but are the popular options. ...

April 12, 2020 · 1 min · ulysses

aws s3 ls recursive

Here’s how to list S3 files recursively. aws s3 ls s3://mybucket --recursive | awk '{print $4}' By default, the results display date, time, disk size and filename. Use awk to display the filename only.

April 5, 2020 · 1 min · ulysses