<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Posts on Surendrajat</title><link>/posts/</link><description>Recent content in Posts on Surendrajat</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Tue, 23 Mar 2021 01:04:35 +0530</lastBuildDate><atom:link href="/posts/index.xml" rel="self" type="application/rss+xml"/><item><title>Hugo blog Hosting on GitLab Pages</title><link>/posts/2021/hugo-gitlab/</link><pubDate>Tue, 23 Mar 2021 01:04:35 +0530</pubDate><guid>/posts/2021/hugo-gitlab/</guid><description>So you have a Hugo blog and you&amp;rsquo;re looking for easy hosting? GitHub and GitLab both provide a free static site hosting feature called Pages. Although both work similarly, I&amp;rsquo;ve chosen GitLab Pages for several reasons and I think it&amp;rsquo;s the better choice (at the moment).
Why GitLab? While GitHub Pages (and GitHub in general) is a more popular way to go, it&amp;rsquo;s not that good. GitLab Pages on the other hand provides more features and uses a relatively simple CI script.</description><content type="html"><![CDATA[<p>So you have a <a href="https://gohugo.io">Hugo</a> blog and you&rsquo;re looking for easy hosting? <a href="https://github.com">GitHub</a> and <a href="https://gitlab.com">GitLab</a> both provide a free static site hosting feature called <strong>Pages</strong>. Although both work similarly, I&rsquo;ve chosen GitLab Pages for several reasons and I think it&rsquo;s the better choice (at the moment).</p>
<h3 id="why-gitlab">Why GitLab?</h3>
<p>While GitHub Pages (and GitHub in general) is a more popular way to go, it&rsquo;s not that good. GitLab Pages on the other hand provides more features and uses a relatively simple CI script.</p>
<p>First, GitHub serves your blog from <code>gh-pages</code> branch so you need to write CI script to commit your Hugo output <code>public</code> dir to your repository&rsquo;s <code>gh-pages</code> branch for it to work. GitLab however serves your blog from CI artifact directly which means you write CI script just to build the Pages and that&rsquo;s all.</p>
<p>Second, The thing I like more about GitLab Pages is its <strong>Pages Settings</strong>. Unlike GitHub, you don&rsquo;t need
<strong>CNAME</strong> file committed in your Hugo site to specify domain/sub-domain. While there&rsquo;re GitHub Actions that don&rsquo;t require a CNAME file, you don&rsquo;t get much control over your domain and SSL certificate settings. GitLab gives you all that with a simple interface under <strong>Repository Settings &gt; Pages</strong>. GitLab also allows you to specify more than one domain/subdomains.</p>
<p>Last, although your blog source is already kind of public when you publish the blog still there are reasons when you
want to keep the blog source private. For any reason, if you want that, GitLab gives you the option to keep your blog source repo private and still be able to serve pages (free of cost).</p>
<h3 id="how">How?</h3>
<ol>
<li>
<p>Create a GitLab repo and push your blog source to it.</p>
</li>
<li>
<p>Click <strong>Settings &gt; Visibility, project features, permissions</strong> and enable <strong>Pages</strong> for everyone.</p>
</li>
<li>
<p>Create a <code>.gitlab-ci.yml</code> file in your root dir of your repo and paste this in it:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-yml" data-lang="yml"><span class="line"><span class="cl"><span class="nt">image</span><span class="p">:</span><span class="w"> </span><span class="l">registry.gitlab.com/pages/hugo/hugo_extended:latest</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">variables</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">GIT_SUBMODULE_STRATEGY</span><span class="p">:</span><span class="w"> </span><span class="l">recursive</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">pages</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">script</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span>- <span class="l">hugo</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">artifacts</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span><span class="nt">paths</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span>- <span class="l">public</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">only</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span>- <span class="l">master</span><span class="w"> </span><span class="c">#default branch of your repo</span><span class="w">
</span></span></span></code></pre></div></li>
<li>
<p>Now if you don&rsquo;t have a domain then you can rename the repo to <code>your-gitlab-username.gitlab.io</code> and your blog should be
available on <code>https://your-gitlab-username.gitlab.io</code>.
But if you have a domain and you want to serve your blog on it then do the following:</p>
<ul>
<li>Click on <strong>Settings &gt; Pages &gt; New Domain</strong> on your repo and enter your domain/sub-domain in there and select <strong>Create New Domain</strong>. You&rsquo;ll see text-boxes in front of <strong>DNS</strong>(CNAME) &amp; <strong>Verification status</strong>(TXT). These are 2 DNS records you need to add to your domain&rsquo;s DNS settings(most probably on your domain registrar&rsquo;s site). Copy both the values somewhere and click <strong>Save Changes</strong>.</li>
<li>Open your domain&rsquo;s DNS settings and add those above 2 DNS records along with one <code>A</code> record pointing to <code>35.185.44.232</code> and that&rsquo;s it. For more info about adding your domain, check the <a href="https://docs.gitlab.com/ee/user/project/pages/custom_domains_ssl_tls_certification/">official guide</a>.</li>
</ul>
<p>For this blog(domain: <a href="https://surendrajat.xyz">surendrajat.xyz</a>) I&rsquo;ve added the following DNS records:</p>
<pre><code> | Key                                | Type | Value                       |
 | ---------------------------------- | ---- | --------------------------- |
 | *                                  | A    | 35.185.44.232               |
 | _gitlab-pages-verification-code... | TXT  | [Verification status value] |
</code></pre>
<p>For another site(sub-domain: <a href="https://apklab.surendrajat.xyz">apklab.surendrajat.xyz</a>) I&rsquo;ve added the following DNS records:</p>
<pre><code> | Key                           | Type  | Value                            |
 | ----------------------------- | ----- | -------------------------------- |
 | *                             | A     | 35.185.44.232                    |
 | apklab.surendrajat.xyz        | CNAME | apklab.gitlab.io [DNS txt value] |
 | _gitlab-pages-verification... | TXT   | [Verification status value]      |
</code></pre>
</li>
</ol>
<p>And that&rsquo;s it. There you have it. Your Hugo blog.</p>
]]></content></item><item><title>Unblocking TeamViewer on Linux</title><link>/posts/2019/unblock-teamviewer-linux/</link><pubDate>Wed, 13 Mar 2019 01:01:05 +0530</pubDate><guid>/posts/2019/unblock-teamviewer-linux/</guid><description>*Educational purpose only TeamViewer is one of the most popular remote desktop (control) application available out there. It&amp;rsquo;s also cross-platform and offers a &amp;lsquo;free for personal use&amp;rsquo; license. So I use it to help out friends &amp;amp; family with their issues sometimes.
Now it works fine until you start seeing a random popup with &amp;lsquo;Commercial use detected&amp;rsquo; before each connection. At this point, TeamViewer becomes pretty much useless as each session will be disconnected after 5 minutes and so on&amp;hellip;</description><content type="html"><![CDATA[<h6 id="educational-purpose-only">*Educational purpose only</h6>
<p><strong>TeamViewer</strong> is one of the most popular remote desktop (control) application available out there. It&rsquo;s also cross-platform and offers a <em>&lsquo;free for personal use&rsquo;</em> license. So I use it to help out friends &amp; family with their issues sometimes.</p>
<p>Now it works fine until you start seeing a random popup with <em>&lsquo;Commercial use detected&rsquo;</em> before each connection. At this point, TeamViewer becomes pretty much useless as each session will be disconnected after 5 minutes and so on&hellip;</p>
<p><em>&ldquo;Okay, I get it, but what&rsquo;s the solution?&rdquo;</em> - well. If you have a lot of patience and are lucky enough then go fill <a href="https://www.teamviewer.com/en/support/commercial-use-suspected/">this official support form </a> and your TeamViewer ID will be unblocked within a few weeks. I tried this way but unfortunately by the time they unblocked it, I had done some tinkering and lost that TeamViewer ID to a new one so no luck.</p>
<p><em>&ldquo;Yeah Neh. I don&rsquo;t think I can wait that long. You got something faster?&rdquo;</em> - hmmm. Using Linux? Yes, then I got it&hellip; follow along. If not then I&rsquo;m sure the machine detection works in a similar way on other OSs too so you can get an idea from here.</p>
<p><em>&ldquo;I tried a fresh reinstall, but still blocked&rdquo;</em> - They label your machine as evil. You gotta change its ID.</p>
<h3 id="what-is-machine-detection-and-how-does-it-work">What is machine detection and how does it work?</h3>
<p>To uniquely identify your machine in the crowd and eliminating the need of a new TeamViewer ID each time you run/reinstall it, some of your machine&rsquo;s unique IDs and parameter hashes are stored on the TeamViewer server and each time you go online those hashes are sent to the server again to retrieve TeamViewer ID.</p>
<p>Below is an example of such an exchange obtained from TeamViewer menu <em>Extras &gt; Open log file&hellip; &gt; <code>TeamViewer14_Logfile.log</code></em></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-apache" data-lang="apache"><span class="line"><span class="cl"><span class="nb">Activating</span> Router carrier
</span></span><span class="line"><span class="cl"><span class="err">KeepAliveSessionOutgoing::ConnectSuccessHandler():</span> <span class="nb">KeepAliveConnect</span> to router16.teamviewer.com successful
</span></span><span class="line"><span class="cl"><span class="err">KeepAliveSessionOutgoing::KeepAliveChannelInitialized():</span> <span class="nb">KeepAliveConnection</span> to router16.teamviewer.com initialized
</span></span><span class="line"><span class="cl"><span class="err">KeepAliveSession::KeepAliveChannelInitialized():</span> <span class="err">KeepAlive-</span><span class="nb">Connection</span> initialized with ID <span class="m">0</span> (IP: <span class="m">0.0.0.0</span>), SendQueue <span class="m">0</span> (0 Bytes), SendIndex <span class="m">0</span>, AckIndex <span class="m">0</span>, RemoteSessionID <span class="m">50</span>
</span></span><span class="line"><span class="cl"><span class="err">KeepAliveSession::SendCompleteQueue():</span> <span class="err">SendQueue:</span> <span class="err">0</span> <span class="err">(0</span> <span class="err">Bytes),</span> <span class="nb">RemoteSession</span> <span class="m">50</span> (ClientID <span class="m">0</span>), Time: <span class="m">0</span> ms
</span></span><span class="line"><span class="cl"><span class="err">IdentifyRequest:</span> <span class="nb">ID</span> = <span class="m">0</span>, IC = -1801590255, IsTemporaryID = <span class="m">0</span>, InitiativeGUID = <span class="m">1</span>b59cb26-6e24-4b9d-8259-3602f206b401, CanStoreGUID = <span class="m">1</span>, MIDHistory = {-1801590255_3b5111c17_0a331900000001eb|l1feb69aabc5947c1867a812f32bb784f:fc3fdb21a48f:59d0c1db2fdc11111f0a38de39e472b|alinux021feb69aabc5947c1867a812f32bb784f:fc3fdb21a48f:59d0c1db2fdc11111f0a38de39e472b}, MIDv = <span class="m">0</span>, MaxSupportedMIDv = <span class="m">2</span>, RebootHash = {60830716-f6ae-3d38-bc5e-e99570d16f76}, MIDFlags = <span class="m">16</span>, MIDForceUpdateFlags = <span class="m">0</span>, AttractionGUID = <span class="m">00000000</span>-0000-0000-0000-000000000000
</span></span><span class="line"><span class="cl"><span class="err">TVRouterClock:</span> <span class="nb">received</span> router time: <span class="m">20190312</span>T025722.427851
</span></span><span class="line"><span class="cl"><span class="nb">TVRouterClock</span> Schedule next request in <span class="m">43200</span> seconds
</span></span><span class="line"><span class="cl"><span class="err">Login::Identify::ManageLogin():</span> <span class="err">ID:</span> <span class="err">1066611234</span> <span class="nb">IC</span> <span class="m">1495071111</span> MIDv1
</span></span><span class="line"><span class="cl"><span class="err">CKeepAliveClientClient::OnKeepAliveSucceeded():</span> <span class="nb">Protocol</span> <span class="m">4</span> proxy  xxx.xxx.xxx.xxx:8080, <span class="k">user</span>= 
</span></span><span class="line"><span class="cl"><span class="err">TeamViewerIDTracker::UpdateMachineID:</span> <span class="nb">New</span> machineID = <span class="m">1066611234</span>
</span></span><span class="line"><span class="cl"><span class="err">LicenseTracker::UpdateMachineLicense()</span> <span class="nb">local</span> license differs from master license
</span></span><span class="line"><span class="cl"><span class="err">SyncManagersFunction::Start:</span> <span class="nb">current</span> managerlist size: <span class="m">0</span>
</span></span><span class="line"><span class="cl"><span class="nb">Client</span> logged in and online
</span></span></code></pre></div><p>As you might have figured the actual request to the TeamViewer server is <strong><code>IdentifyRequest</code></strong> :</p>
<pre tabindex="0"><code>IdentifyRequest: ID = 0, IC = -1801590255, IsTemporaryID = 0, InitiativeGUID = 1b59cb26-6e24-4b9d-8259-3602f206b401, CanStoreGUID = 1, MIDHistory = {-1801590255_3b5111c17_0a331900000001eb|l1feb69aabc5947c1867a812f32bb784f:fc3fdb21a48f:59d0c1db2fdc11111f0a38de39e472b|alinux021feb69aabc5947c1867a812f32bb784f:fc3fdb21a48f:59d0c1db2fdc11111f0a38de39e472b}, MIDv = 0, MaxSupportedMIDv = 2, RebootHash = {60830716-f6ae-3d38-bc5e-e99570d16f76}, MIDFlags = 16, MIDForceUpdateFlags = 0, AttractionGUID = 00000000-0000-0000-0000-000000000000
</code></pre><p>Looks like mess? <em>&ldquo;Yes&rdquo;</em>. Alright. Let&rsquo;s break down the important part.</p>
<ul>
<li><code>ID</code>: <strong>TeamViewer ID</strong> (initially 0 at first run)</li>
<li><code>IC</code>: Some secondary ID</li>
<li><code>MIDHistory</code>: <strong>Unique Machine ID</strong>
<ul>
<li><code>1feb69aabc5947c1867a812f32bb784f</code>: <strong><code>/etc/machine-id</code></strong> or <strong><code>/var/lib/dbus/machine-id</code></strong></li>
<li><code>fc3fdb21a48f</code>: Current active <strong>MAC Address</strong></li>
<li><code>59d0c1db2fdc11111f0a38de39e472b</code>: <strong><code>/ (Root FS) partition UUID</code></strong></li>
</ul>
</li>
</ul>
<p>and the responce is, of course, <strong><code>Login</code></strong>:</p>
<pre tabindex="0"><code>Login::Identify::ManageLogin(): ID: 1066611234 IC 1495071111 MIDv1
</code></pre><p>which contains correct values for <code>ID</code> &amp; <code>IC</code> returned by the TeamViewer server.</p>
<p><em>&ldquo;Ah. I see how it works. How do I hack it then?&rdquo;</em></p>
<h3 id="how-to-change-machine-identity">How to change machine identity?</h3>
<p>Simple.</p>
<ul>
<li>Step 0: Cleanup</li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># completely remove the teamviewer app</span>
</span></span><span class="line"><span class="cl">sudo apt purge teamviewer
</span></span><span class="line"><span class="cl"><span class="c1"># remove all the residuals of it</span>
</span></span><span class="line"><span class="cl">rm -r ~/.config/teamviewer/
</span></span><span class="line"><span class="cl">rm -r ~/.local/share/teamviewer/
</span></span><span class="line"><span class="cl">sudo rm -r /root/.local/share/teamviewer14/
</span></span><span class="line"><span class="cl">sudo rm -r /etc/teamviewer/
</span></span><span class="line"><span class="cl">sudo rm -r /opt/teamviewer/
</span></span><span class="line"><span class="cl">sudo rm -r /var/log/teamviewer14/
</span></span></code></pre></div><ul>
<li>Step 1: Change Machine ID</li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># remove current machine-id</span>
</span></span><span class="line"><span class="cl">sudo rm /etc/machine-id
</span></span><span class="line"><span class="cl">sudo rm /var/lib/dbus/machine-id
</span></span><span class="line"><span class="cl"><span class="c1"># generate new machine-id</span>
</span></span><span class="line"><span class="cl">sudo systemd-machine-id-setup
</span></span><span class="line"><span class="cl"><span class="c1"># and copy(if don&#39;t fancy system reboot)</span>
</span></span><span class="line"><span class="cl">sudo cp /etc/machine-id /var/lib/dbus/
</span></span></code></pre></div><ul>
<li>Step 2: Change MAC address</li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># figure out the device id whose MAC address is  in the logfile </span>
</span></span><span class="line"><span class="cl"><span class="c1"># Menu&gt;Extras&gt;Open log files...&gt;TeamViewer14_logfile.log</span>
</span></span><span class="line"><span class="cl"><span class="c1"># let&#39;s say it&#39;s ethernet device with id elp7s0</span>
</span></span><span class="line"><span class="cl">sudo macchanger -r elp7s0
</span></span></code></pre></div><ul>
<li>Step 3: Profit!!! Just reinstall the TeamViewer and enjoy.</li>
</ul>
<h3 id="final-thoughts">Final thoughts</h3>
<p>Thankfully it works without changing <strong><code>/ (Root FS) partition UUID</code></strong> which can&rsquo;t be changed for a mounted partition and could be a headache. Changing only the <code>MAC address</code> will get you a new ID but you will still be blocked unless you reset <code>machine-id</code>. For Mac, it should be very similar but for Windows, the <code>machine-id</code> part will be totally different and the way <code>MAC address</code>is updated is also different, but you get the idea.</p>
]]></content></item></channel></rss>