Posts

Showing posts from 2024

Enable UEFI in your VMWare machine

Image
VMWare Workstation 8, 9, and 10 support booting to a UEFI environment. Create a new virtual machine Open the .VMX file of your virtual machine in Notepad (or similar) and add the following line to it: firmware="efi" Save the .VMX file.         In addition, order to be able to select network boot, it is advisable to add a boot delay to the startup of the virtual machine. This can be done by adding the line "bios.bootdelay = 5000" (time is in milliseconds)

Provisions a Ubuntu 20.04 VM in QEMU on Mac OSX using Cloud-Init

#!/usr/bin/env bash #Install brew and qemu + cloud init metadata dependencies /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh )" brew install qemu brew install cdrtools rm -rf /tmp/ubuntuqemuboot #download Ubuntu 20.04 Cloud Image and resize to 30 Gigs mkdir -p /tmp/ubuntuqemuboot/images cd /tmp/ubuntuqemuboot/images curl https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img --output focal-server-cloudimg-amd64.img qemu-img resize focal-server-cloudimg-amd64.img 30G #create the cloud-init NoCloud metadata disk file mkdir -p /tmp/ubuntuqemuboot/cloudinitmetadata cd /tmp/ubuntuqemuboot/cloudinitmetadata ssh-keygen -b 2048 -t rsa -f id_rsa_ubuntu2004boot -P "" chmod 0600 /tmp/ubuntuqemuboot/cloudinitmetadata/id_rsa_ubuntu2004boot PUBLIC_KEY=$(cat id_rsa_ubuntu2004boot.pub) cat <<EOF >/tmp/ubuntuqemuboot/cloudinitmetadata/meta-data instance-id: circle-the-wagons-local716 local-hostname: ci...

How to import a pfx using certutil without prompt?

Open the powershell as administrator certutil -f -user -p PASSWORD -importpfx c:\cert.pfx NoRoot

K8s registry mirror

https://github.com/spegel-org/spegel

error jailing process inside rootfs: pivot_root .: permission denied: unknown

Error:  Starting keycloak_postgres_1 ... error ERROR: for keycloak_postgres_1  Cannot start service postgres: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error jailing process inside rootfs: pivot_root .: permission denied: unknown ERROR: for postgres  Cannot start service postgres: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error jailing process inside rootfs: pivot_root .: permission denied: unknown ERROR: Encountered errors while bringing up the project. Solution # ln -s /etc/apparmor.d/runc /etc/apparmor.d/disable/ # apparmor_parser -R  /etc/apparmor.d/runc Rebooting the instance might also achieve the same.

Remote kubectl x509: certificate is valid for 127.0.0.1

E0829 10:19:51.734979   13883 memcache.go:265] couldn't get current server API group list: Get "https://x.x.x.x:6443/api? Unable to connect to the server: tls: failed to verify certificate: x509: certificate is valid for 10.43.0.1, 127.0.0.1, 172.31.4.10, ::1, not 13.126.42.175 Solution: edit /etc/systemd/system/k3s.service ExecStart=/usr/local/bin/k3s \    server \       '–advertise-address=106.xx.xx.xx' \       '-tls-san=106.xx.xx.xx' \  ## this is important and kubectl -n kube-system delete secrets/k3s-serving mv /var/lib/rancher/k3s/server/tls/dynamic-cert.json /tmp/dynamic-cert.json systemctl restart k3s

DevSecOps github

https://github.com/sottlmarek/DevSecOps  

PG::Error: ERROR: new encoding (UTF8) is incompatible

First, we need to drop template1. Templates can't be dropped, so we first modify it so t's an ordinary database: UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1'; Now we can drop it: DROP DATABASE template1; Now its time to create database from template0, with a new default encoding: CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE'; Now modify template1 so it's actually a template: UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1'; Now switch to template1 and VACUUM FREEZE the template: \c template1 VACUUM FREEZE; Problem should be resolved.

Download the secure file to local machine or view its content in Azure DevOps with build administrator privilege

Create a pipeline and execute. trigger: - main pool:   vmImage: ubuntu-latest steps: - task: DownloadSecureFile@1   displayName: 'Download secure file'   inputs:     secureFile: <securefilename> - task: PublishBuildArtifacts@1   displayName: 'Publish Artifact: drop'   inputs:     PathtoPublish: '$(DOWNLOADSECUREFILE.SECUREFILEPATH)'

.gitlab-ci.yaml use image with a specific user

In yaml Instead of image : xyz you can do image:  name: xyz  docker:    user: root

ProxMox LxC container open vpn Cannot open TUN/TAP dev /dev/net/tun: No such file or directory (errno=2)

Adding the following to /etc/pve/lxc/xxx.conf solves the problem: lxc.cgroup.devices.allow: c 10:200 rwm lxc.mount.entry: /dev/net dev/net none bind,create=dir

VPN Support with WSL2

update to WSL offers experimental features which resolve the issue for me. I'm using WSL2 on Windows 11 with Global protect. Add the following flags  C:\Users\_username_\.wslconfig  file: [experimental] networkingMode=mirrored dnsTunneling=true Or in wsl specific distro vim /etc/wsl.conf [experimental] networkingMode=mirrored dnsTunneling=true

Let's Encrypt/ACME client and library written in Go

go-acme/lego: Let's Encrypt/ACME client and library written in Go (github.com)

How to change default port for GitLab

As suggested on https://github.com/gitlabhq/gitlabhq/issues/6581  you can configure port on below file. Change port to 81 (You can choose your own) at port: near by production:$base >> gitlab: for file /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml Change your host address if you like to use different from your ip address or localhost Change server port to 81 in file "/opt/gitlab/embedded/conf/nginx.conf" Restart gitlab using command "sudo gitlab-ctl restart". After applying all above changes still my nginx was running on port 80 only and not sure why also reconfiguring gitlab reset may all change on gitlab.yml files. Finally, file "/etc/gitlab/gitlab.rb" make this work for me.  Open "/etc/gitlab/gitlab.rb" to text editor where currently I have external_url 'http://myipaddress/' as text. I just change to  external_url 'http://gitlab.com.local:81/' then reconfigure using comm...

Secure & Modern All-in-One Mail Server (IMAP, JMAP, SMTP)

Secure & Modern All-in-One Mail Server (IMAP, JMAP, SMTP) https://github.com/stalwartlabs/mail-server

Preserve bash history in multiple terminal windows

Add the following to your  ~/.bashrc : # Avoid duplicates HISTCONTROL=ignoredups:erasedups # When the shell exits, append to the history file instead of overwriting it shopt -s histappend # After each command, append to the history file and reread it PROMPT_COMMAND= " ${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'} history -a; history -c; history -r"

Open source Zapier alternative

https://automatisch.io/?ref=openalternative

Docker "ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network"

Docker may be at its maximum of created networks. The command  docker network prune  can be used to remove all networks not used by at least one container. docker network ls Remove unused docker network

Maven Lifecycle

https://www.scaler.com/topics/maven-lifecycle/

wsl 777 permission bold green color remove

  export LS_COLORS= " $LS_COLORS :ow=1;34:tw=1;34:" source ~/.bashrc

Make your wsl 2 Current Distro Run Systemd

By this installation, systemd is enabled in your WSL 2 distro. Download and run the latest installer script. curl -L -O "https://raw.githubusercontent.com/nullpo-head/wsl-distrod/main/install.sh" chmod +x install.sh sudo ./install.sh install This script installs distrod, but doesn't enable it yet. Enable distrod in your distro You have two options. If you want to automatically start your distro on Windows startup, enable distrod by the following command /opt/distrod/bin/distrod enable --start-on-windows-boot Otherwise, /opt/distrod/bin/distrod enable You can run enable with --start-on-windows-boot again if you want to enable autostart later. Restart your distro Close your WSL's terminal. Open a new Command Prompt window, and run the following command. wsl --terminate Distrod After re-opening a new WSL window, your shell runs in a systemd session

Installing Docker in WSL2

While we  could  use Docker Desktop, we can also run the docker daemon (aka Docker Engine) directly within our WSL2 environment. It's faster, and takes up less system resources using this method. Bonus : This method also works for Windows on ARM users, which at the time of this writing, Docker Desktop is x86-64 only. Enable systemd sudo tee /etc/wsl.conf << EOF [boot] systemd=true EOF exit Restart Shutdown WSL wsl --shutdown Prepare the subnets before you begin Set a predictable IP address for the docker bridge network interface and additional docker subnets. This can save you a lot of grief down the road when docker will inevitably conflict with another subnet on your network. I am going to use 192.168.1.1 as the bridge IP, and allocate the remaining 254 IP addresses (192.168.1.*) for additional IPs in this subnet. https://www.ipaddressguide.com/cidr  is a great utility for converting subnets into the CIDR notation. For example: 192.168.1.1 - 192.168.1.255 = 192....