Skip to content

Instantly share code, notes, and snippets.

View gilangvperdana's full-sized avatar
🎓
Still Learning

Gilang Virga Perdana gilangvperdana

🎓
Still Learning
View GitHub Profile
@gilangvperdana
gilangvperdana / README.md
Last active July 26, 2024 10:25
Kubernetes with KubeSpray on BareMetal Ubuntu Server 20.04 LTS

Kubernetes with KubeSpray on BareMetal Ubuntu Server 20.04 LTS

Provisioning Kubernetes Cluster BareMetal with KubeSpray

Environment

2x Ubuntu Server 20.04LTS
@gilangvperdana
gilangvperdana / PFwithSSH.md
Last active July 12, 2024 06:36
Port Forwarding on Ubuntu

Local Forwarding

If you want to locally access a cloud application that has the address 192.168.100.2:82 and can only be reached by your VM, you can use the technique below. That way you can access your local localhost:80.

ssh -L LocalPortAccess:AppsIPAddresses:AppsPortAddresses user@VPSPublicIP -pXXXX
ssh -L 80:127.0.0.1:30001 student@lab4.btech.id -p10013

Remote Forwarding

If you want to access your local application with the application address 127.0.0.1:30001 then you can access it on your VPS on port 80 you can use the technique below:

@gilangvperdana
gilangvperdana / README.md
Last active July 11, 2024 11:28
Integrate Logging with Promtail & Loki

General

Hello world, in this topic actually I'm making a logging visualization in grafana for GeoIP purposes. As we know, GeoIP cannot use Prometheus, we have to use metrics in the form of raw logs, which is called logging. Because I don't have a lot of resources for running the ELK Stack, in the end I just ran logging with Promtail + Loki. Follow this technical for installation and integration of Promtail & Loki.

I will continue from this article to visualize it with Promtail + Loki.

Change nginx.conf

	log_format json_analytics escape=json '{'
						'"msec": "$msec", ' # request unixtime in seconds with a milliseconds resolution
						'"connection": "$connection", ' # connection serial number
@gilangvperdana
gilangvperdana / README.md
Last active July 9, 2024 16:00
Pritunl behind Nginx Reverse Proxy

Install Pritunl

sudo apt-get update
sudo apt-get -y upgrade

echo "deb http://repo.pritunl.com/stable/apt focal main" | sudo tee /etc/apt/sources.list.d/pritunl.list
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
sudo apt update
@gilangvperdana
gilangvperdana / README.md
Last active July 8, 2024 06:03
Authenticate our Reverse Proxy

General

  • This note, just wanna to share about OAUTH2PROXY for authenticate all our endpoints behind Nginx.

Prepare OAUTH2PROXY

wget https://github.com/oauth2-proxy/oauth2-proxy/releases/download/v7.4.0/oauth2-proxy-v7.4.0.linux-amd64.tar.gz
tar -xzvf oauth2-proxy-v7.4.0.linux-amd64.tar.gz
cd oauth2-proxy-v7.4.0.linux-amd64
@gilangvperdana
gilangvperdana / README.md
Last active July 7, 2024 05:25
Install GeoIP for Nginx

General

  • If you want to see your client website region, you can install GeoIP module on Nginx
  • The project I've worked on, using (Filebeat, Logstash, Elasticsearch) after GeoIP is installed then visualized using Kibana or Grafana : image

Installation

sudo apt update
sudo apt install libnginx-mod-http-geoip
@gilangvperdana
gilangvperdana / README.md
Created July 5, 2024 11:23
Fix OpenSSH Denied with Pubkey on Windows Server

General

Have you ever wanted to change SSH authentication on your Windows server with a public key and it failed after setting it? let's follow this step

Create authorized_keys

cd C:\Users\Administrator\.ssh
ssh-keygen
type id_rsa.pub > authorized_keys
@gilangvperdana
gilangvperdana / README.md
Last active July 2, 2024 12:59
Remote Mikrotik from OpenVPN Client with Pritunl VPN Server

Mikrotik OpenVPN Client

If you want to make your Mikrotik to be OpenVPN Client you can follow this guide.

Goals

  • Can remote mikrotik from Pritunl VPN Server Endpoint

Environment

  • Mikrotik
  • Pritunl Server
@gilangvperdana
gilangvperdana / README.md
Last active June 28, 2024 10:12 — forked from thomasn/ssh-mtu-errors.md
Fix ssh error : SSH2_MSG_KEX_ECDH_REPLY

General

I once had a problem with an instance running on Openstack, namely that it could not ssh to other nodes, but other nodes could ssh to the said node. It turns out that this is because the MTU is different at the instance or at the server host level, please check the MTU again on each interface related to openstack's neutron external.

From some machines (with latest openssh) ssh to muddy fails -

  • ssh -vvv -p $MUDDYPORT $MUDDYIP
  • hangs at expecting SSH2_MSG_KEX_ECDH_REPLY

Quick Check

ping node2 -c 8000
@gilangvperdana
gilangvperdana / README.md
Last active June 23, 2024 19:15
Monitor our Server with Blackbox Exporter

Briefing

If you want to monitor your server with existing monitoring mainstream stack (Prometheus, Grafana) you can use Blackbox Exporter to monitor it.

Installation

wget https://github.com/prometheus/blackbox_exporter/releases/download/v0.19.0/blackbox_exporter-0.19.0.linux-amd64.tar.gz
tar -xvf blackbox_exporter-0.19.0.linux-amd64.tar.gz
mv blackbox_exporter-0.19.0.linux-amd64/blackbox_exporter /usr/local/bin/
cd blackbox_exporter-0.19.0.linux-amd64/
sudo useradd -rs /bin/false blackbox_exporter