<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>svnscha - kibana</title>
    <subtitle>automating annoying tasks, sharing tips, and embracing less frustration</subtitle>
    <link rel="self" type="application/atom+xml" href="https://svnscha.de/tags/kibana/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://svnscha.de"/>
    <generator uri="https://astro.build/">Astro</generator>
    <updated>2024-04-24T00:00:00+00:00</updated>
    <id>https://svnscha.de/tags/kibana/atom.xml</id>
    <entry xml:lang="en">
        <title>Simplify Elasticsearch and Kibana Installation</title>
        <published>2024-04-24T00:00:00+00:00</published>
        <updated>2024-04-24T00:00:00+00:00</updated>
        <author>
          <name>Sven Scharmentke</name>
        </author>
        <link rel="alternate" type="text/html" href="https://svnscha.de/posts/simplify-elasticsearch-kibana/"/>
        <id>https://svnscha.de/posts/simplify-elasticsearch-kibana/</id>
        <summary type="html">Let me walk you through how I created a bash script that sets up Elasticsearch and Kibana on a single-node cluster with minimal fuss.</summary>
        <content type="html" xml:base="https://svnscha.de/posts/simplify-elasticsearch-kibana/">&lt;h2 id=&quot;why-you-ask&quot;&gt;Why, You Ask?&lt;/h2&gt;
&lt;p&gt;Setting up Elasticsearch and Kibana involves the same steps each time: update the system, configure repositories, install packages, and apply the initial configuration. I wrote a script to automate that work and make the setup reusable.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;It's time-consuming and frustrating. I'm tired of it.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id=&quot;automating-the-setup&quot;&gt;Automating the Setup&lt;/h2&gt;
&lt;p&gt;This Bash script installs Elasticsearch and Kibana as a single-node cluster. I use it when I need a small, repeatable setup without adding another configuration tool.&lt;/p&gt;
&lt;h2 id=&quot;why-choose-a-bash-script&quot;&gt;Why Choose a Bash Script?&lt;/h2&gt;
&lt;p&gt;I chose Bash instead of Ansible because the script also works well with cloud-init and inside Docker environments. It has no extra tooling requirements and is easy to copy to a new machine.&lt;/p&gt;
&lt;h2 id=&quot;building-the-script-a-step-by-step-guide&quot;&gt;Building the Script: A Step-by-Step Guide&lt;/h2&gt;
&lt;p&gt;Let's walk through the crafting of the script that automates setting up Elasticsearch and Kibana. Here's how I pieced it together, one step at a time:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Checking for Superuser Privileges
The script needs administrative access, so it starts by checking for root privileges.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#C586C0&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt; [ &lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt;&quot;$(&lt;/span&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; -u&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt;)&quot;&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt; != &lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt;&quot;0&quot;&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt; ]; &lt;/span&gt;&lt;span style=&quot;color:#C586C0&quot;&gt;then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;   echo&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; &quot;This script must be run as root&quot;&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt; 1&amp;gt;&amp;amp;2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;   exit&lt;/span&gt;&lt;span style=&quot;color:#B5CEA8&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#C586C0&quot;&gt;fi&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;Updating the System and Installing Essential Packages
Updating the system first helps avoid installation problems caused by outdated packages.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;apt&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; update&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;apt&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; install&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; -y&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; apt-transport-https&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; gnupg&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; curl&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; jq&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;
&lt;p&gt;Adding the Elasticsearch Repository
Getting this right is like picking the perfect ingredients for a master chef recipe - it ensures the rest of the meal turns out just right.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Installing Elasticsearch and Kibana
Next, the script installs Elasticsearch and Kibana.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Configuring and Starting Services
The plot thickens! Setting up the services and getting them running is like reaching the climax of our story - where all elements come together to unveil the full potential of our setup.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Rather than churn out another cookie-cutter guide on setting up Elasticsearch and Kibana, you can view the complete script &lt;a href=&quot;https://gist.github.com/svnscha/676291c9e1cdbfa261202b3897afba37&quot;&gt;here&lt;/a&gt;. However, I do want to emphasize the initial configuration process involving enrollment tokens and security settings. I've automated these aspects because, let's face it, I've read too many guides that suggest just turning off security for the sake of simplicity. That's not my style - I'd rather keep things secure automatically. It's not rocket science, but it sure is critical. Why simplify by compromising security when you can automate it effectively, right?&lt;/p&gt;
&lt;p&gt;This approach ensures you get the functionality you need without the hassle of manual setup or the risks of disabled security.&lt;/p&gt;
&lt;h2 id=&quot;perfecting-the-automation-securing-and-finalizing-the-setup&quot;&gt;Perfecting the Automation: Securing and Finalizing the Setup&lt;/h2&gt;
&lt;p&gt;The final part configures security and leaves both services ready to use.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Broadcasting the Good News
First things first, let's make sure any user logging into the system knows what's been accomplished:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; -e&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; &quot;=== init-vm.sh: Initial ===&quot;&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt; &amp;gt;&amp;gt; &lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt;/etc/motd&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; -e&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; &quot;[&amp;gt; Elasticsearch 'elastic' password: &lt;/span&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;$ELASTIC_PASSWORD&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt; &amp;gt;&amp;gt; &lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt;/etc/motd&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; -e&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; &quot;[&amp;gt; Test instance with 'curl -k -X GET https://elastic:&lt;/span&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;$ELASTIC_PASSWORD&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt;@localhost:9200'&quot;&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt; &amp;gt;&amp;gt; &lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt;/etc/motd&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; -e&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; &quot;=== init-vm.sh: Get started ===&quot;&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt; &amp;gt;&amp;gt; &lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt;/etc/motd&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; -e&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; &quot;[&amp;gt; Reset 'elastic' password with '/usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic'.&quot;&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt; &amp;gt;&amp;gt; &lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt;/etc/motd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here, we're updating the message of the day (MOTD) file to ensure anyone who logs in is immediately informed about how to interact with Elasticsearch and what steps to take next. It's like leaving a note on the fridge - impossible to ignore and incredibly helpful.&lt;/p&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;Decoding the Secrets
Automation isn't just about doing things without human intervention; it's also about doing them securely and wisely:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6A9955&quot;&gt;# Because who likes doing setup manually, right?&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;decoded_token&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;=$(&lt;/span&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt; $KIBANA_ENROLLMENT_TOKEN&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt; | &lt;/span&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;base64&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; --decode&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;address&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;=$(&lt;/span&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt; $decoded_token&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt; | &lt;/span&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;jq&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; -r&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; '.adr[0]'&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;fingerprint&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;=$(&lt;/span&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt; $decoded_token&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt; | &lt;/span&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;jq&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; -r&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; '.fgr'&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;api_key&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;=$(&lt;/span&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt; $decoded_token&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt; | &lt;/span&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;jq&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; -r&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; '.key'&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Decoding the enrollment token reveals the essential elements needed to securely configure Kibana: the address, fingerprint, and API key.&lt;/p&gt;
&lt;p&gt;Harnessing Version and Build Information
Knowing exactly which version and build of Kibana you're working with is required for the API, so let's get that:&lt;/p&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;ver&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;=$(&lt;/span&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;jq&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; -r&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; '.version'&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; /usr/share/kibana/package.json&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;build&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;=$(&lt;/span&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;jq&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; -r&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; '.build.number'&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; /usr/share/kibana/package.json&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;Re-encoding and Verification
Secrecy is paramount, and so is verification. Here's how we handle both:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;encoded_api_key&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;=$(&lt;/span&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; -n&lt;/span&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt; $api_key&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt; | &lt;/span&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;base64&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;output&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;=$(&lt;/span&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; /usr/share/kibana/bin/kibana-verification-code&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;verification_code&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;=$(&lt;/span&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt; $output&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt; | &lt;/span&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;awk&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; -F&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt;&quot;: &quot;&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; '{print $2}'&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt; | &lt;/span&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;sed&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; 's/ //g'&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The API key needs to be re-encoded to maintain security, and we also extract a verification code necessary for the next step - enrolling Kibana.&lt;/p&gt;
&lt;h2 id=&quot;the-final-act-enrolling-kibana&quot;&gt;The Final Act: Enrolling Kibana&lt;/h2&gt;
&lt;p&gt;And now, the final piece of our automation puzzle:&lt;/p&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;curl&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; -k&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; -v&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; -X&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; POST&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; &quot;http://localhost:5601/internal/interactive_setup/enroll&quot;&lt;/span&gt;&lt;span style=&quot;color:#D7BA7D&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#569CD6&quot;&gt;     -H&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; &quot;Accept: */*&quot;&lt;/span&gt;&lt;span style=&quot;color:#D7BA7D&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#569CD6&quot;&gt;     -H&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; &quot;Content-Type: application/json&quot;&lt;/span&gt;&lt;span style=&quot;color:#D7BA7D&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#569CD6&quot;&gt;     -H&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; &quot;Host: localhost:5601&quot;&lt;/span&gt;&lt;span style=&quot;color:#D7BA7D&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#569CD6&quot;&gt;     -H&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; &quot;Origin: http://localhost:5601&quot;&lt;/span&gt;&lt;span style=&quot;color:#D7BA7D&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#569CD6&quot;&gt;     -H&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; &quot;Referer: http://localhost:5601/&quot;&lt;/span&gt;&lt;span style=&quot;color:#D7BA7D&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#569CD6&quot;&gt;     -H&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; &quot;kbn-build-number: &lt;/span&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;$build&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#D7BA7D&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#569CD6&quot;&gt;     -H&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; &quot;kbn-version: &lt;/span&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;$ver&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#D7BA7D&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#569CD6&quot;&gt;     -H&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; &quot;x-elastic-internal-origin: Kibana&quot;&lt;/span&gt;&lt;span style=&quot;color:#D7BA7D&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#569CD6&quot;&gt;     -H&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; &quot;x-kbn-context: %7B%22type%22%3A%22application%22%2C%22name%22%3A%22interactiveSetup%22%2C%22url%22%3A%22%2F%22%7D&quot;&lt;/span&gt;&lt;span style=&quot;color:#D7BA7D&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#569CD6&quot;&gt;     -d&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; '{&quot;hosts&quot;:[&quot;https://'&lt;/span&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;$address&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt;'&quot;],&quot;apiKey&quot;:&quot;'&lt;/span&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;$encoded_api_key&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt;'&quot;,&quot;caFingerprint&quot;:&quot;'&lt;/span&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;$fingerprint&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt;'&quot;,&quot;code&quot;:&quot;'&lt;/span&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;$verification_code&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt;'&quot;}'&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This curl command not only sends all the needed parameters to Kibana for configuration but also uses the verification code to ensure that the setup is both authorized and secure. It's akin to dotting the i's and crossing the t's in our setup script.&lt;/p&gt;
&lt;h3 id=&quot;summary&quot;&gt;Summary&lt;/h3&gt;
&lt;p&gt;The script turns a fresh system into a secured, working Elasticsearch and Kibana installation. Feel free to adapt it to your own environment.&lt;/p&gt;
&lt;p&gt;Check out the complete script here:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://gist.github.com/svnscha/676291c9e1cdbfa261202b3897afba37&quot;&gt;init-elastic-search-kibana-vm.sh&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Happy automating, and here's to many insightful data explorations!&lt;/p&gt;
&lt;p&gt;P.S.: This script is tailored for automating development environments. Remember, a single-node cluster isn’t suited for production use, and storing passwords in the message of the day (MOTD) file? That’s a no-go for serious deployments. 😏&lt;/p&gt;
</content>
    </entry>
</feed>
