<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Guides on moddedbear.com</title>
    <link>https://moddedbear.com/blog/guides/</link>
    <description>Recent content in Guides on moddedbear.com</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-US</language>
    <managingEditor>modbear@proton.me (JP)</managingEditor>
    <webMaster>modbear@proton.me (JP)</webMaster>
    <copyright>Copyright © 2024, moddedBear.</copyright>
    <lastBuildDate>Thu, 07 Aug 2025 20:05:02 -0600</lastBuildDate>
    <atom:link href="https://moddedbear.com/blog/guides/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Cracking a Family Member&#39;s Password</title>
      <link>https://moddedbear.com/cracking-a-family-members-password/</link>
      <pubDate>Thu, 07 Aug 2025 20:05:02 -0600</pubDate><author>modbear@proton.me (JP)</author>
      <guid>https://moddedbear.com/cracking-a-family-members-password/</guid>
      <description>&lt;p&gt;My wife&amp;rsquo;s grandfather passed away near the start of this year, and while going through his things her family found an iMac that nobody knew the password to. I&amp;rsquo;m sort of the go-to person in the family for problems like this, but it also seemed like a fun challenge so I figured I&amp;rsquo;d take a crack at it.&lt;/p&gt;&#xA;&lt;p&gt;I didn&amp;rsquo;t learn this until later, but this iMac was from 2011 and was running OSX 10.7 Lion. What I could tell pretty quickly though is that this wasn&amp;rsquo;t a recent iMac at all. That was a good sign, because I figured that would make it unlikely that there would be any disk encryption or extra security that would make it difficult to extract the data or crack the password.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>My wife&rsquo;s grandfather passed away near the start of this year, and while going through his things her family found an iMac that nobody knew the password to. I&rsquo;m sort of the go-to person in the family for problems like this, but it also seemed like a fun challenge so I figured I&rsquo;d take a crack at it.</p>
<p>I didn&rsquo;t learn this until later, but this iMac was from 2011 and was running OSX 10.7 Lion. What I could tell pretty quickly though is that this wasn&rsquo;t a recent iMac at all. That was a good sign, because I figured that would make it unlikely that there would be any disk encryption or extra security that would make it difficult to extract the data or crack the password.</p>
<p>I was able to get to a boot menu with a little bit of trial and error. Turns out it only comes up if you hold the option key during boot from fully powered off, not after triggering a restart from the login screen! I plugged in a live Fedora USB and had Linux running soon after.</p>
<p>Now if all we cared about was getting the files off the internal drive, I could have stopped here. The Gnome file browser had no trouble browsing the drive, but I wanted to see if we could do one better by getting into OSX. This grandfather was really into photography, and there would be something neat about seeing the computer running as he had kept it, tools and all.</p>
<p>A quick search showed that this version of OSX stores user password hashes in plist files located at <code>/var/db/dslocal/nodes/Default/users/{username}.plist</code>. From Linux I was able to send a copy of this file over to my main computer to work on it.</p>
<p>I found a pretty simple <a href="https://gist.github.com/teddziuba/3ff08bdda120d1f7822f3baf52e606c2">Python script online</a> for extracting password hashes on OSX 10.15 Catalina. Lion uses the simpler SALTED-SHA512 format instead of the PBKDF2-SHA512 that was introduced in 10.8 Mountain Lion. After a few small changes I was able to come up with a <a href="https://gist.github.com/moddedBear/ee67bd9a8d6f77a7158875ca36b0b2d6">modified script that would work for 10.7 Lion</a>.</p>
<p>With the hash extracted, I installed hashcat to start cracking. The command I used is:</p>





<pre tabindex="0"><code>hashcat -m 1722 -a 0 hash.txt rockyou.txt</code></pre><ul>
<li>The <code>m</code> flag specifies the hash type, which you can find in the <a href="https://hashcat.net/wiki/doku.php?id=example_hashes">hashcat documentation</a>.</li>
<li>The <code>a</code> flag specifies an attack mode. <code>0</code> corresponds to a straight dictionary attack, which is what I wanted since I suspected the password would be something simple.</li>
<li>I used the popular rockyou wordlist for the same reason. If it failed, I could always try again with a custom wordlist.</li>
</ul>
<p>After about two seconds (yes the password was <em>that</em> simple) I had the password! Embarrassingly, it was something we easily could have and should have guessed. But we didn&rsquo;t, so my effort was for something at least.</p>
<p>When we logged in, all of Grandpa&rsquo;s windows reopened as he had last had them which was a neat sight. We had a great time going through all the old photos the rest of the night.</p>
<p>— JP</p>
]]></content:encoded>
    </item>
    <item>
      <title>Fixing the Broken Texture Streaming in Control</title>
      <link>https://moddedbear.com/fixing-the-broken-texture-streaming-in-control/</link>
      <pubDate>Mon, 30 Jun 2025 20:33:09 -0600</pubDate><author>modbear@proton.me (JP)</author>
      <guid>https://moddedbear.com/fixing-the-broken-texture-streaming-in-control/</guid>
      <description>&lt;p&gt;I picked up Control for cheap on the Steam summer sale, but one thing that was getting in the way of my enjoyment of it was the game&amp;rsquo;s extremely broken texture streaming. A quick glance at the game&amp;rsquo;s subreddit page or Steam discussions shows it&amp;rsquo;s a really common problem, and it took me long enough to piece together a solution between several different sources that I figured I&amp;rsquo;d write down some notes to help the next person who&amp;rsquo;s considering refunding the game because of it. Not to mention it seems like I&amp;rsquo;m seeing deleted threads and comments all the time on Reddit these days, so who knows how long solutions posted there are going to stick around.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I picked up Control for cheap on the Steam summer sale, but one thing that was getting in the way of my enjoyment of it was the game&rsquo;s extremely broken texture streaming. A quick glance at the game&rsquo;s subreddit page or Steam discussions shows it&rsquo;s a really common problem, and it took me long enough to piece together a solution between several different sources that I figured I&rsquo;d write down some notes to help the next person who&rsquo;s considering refunding the game because of it. Not to mention it seems like I&rsquo;m seeing deleted threads and comments all the time on Reddit these days, so who knows how long solutions posted there are going to stick around.</p>
<p>Control&rsquo;s issue is that after only a couple minutes the game stops loading high quality versions of textures for things like characters and important world details, reducing everything to about PS2 level quality.</p>
<p>It seems to be a problem with the game engine itself. Knocking the graphics settings down works temporarily but the blurry textures come back after only a few minutes. I&rsquo;m running on an RX 6700 XT, a 12 GB card, so I&rsquo;m pretty certain I&rsquo;m not hitting a VRAM limit. Even if I was, I&rsquo;d expect lowering the settings to be a permanent fix.</p>

<h2 id="what-worked-for-me"> <a href="#what-worked-for-me">
    What worked for me
</a> </h2>

<p>I downloaded and installed these two mods from Nexus Mods. Installation is simple, you just extract the zip contents to Control&rsquo;s root directory.</p>
<ul>
<li><a href="https://www.nexusmods.com/control/mods/11">Loose Files Loader</a></li>
<li><a href="https://www.nexusmods.com/control/mods/14">Tweakables</a></li>
</ul>
<p>Next, paste this XML into <code>Control\data\globaldb\tweakables.xml</code>.</p>





<pre tabindex="0"><code>&lt;tweakables&gt;
	&lt;tweakable type=&#34;float1&#34; name=&#34;Texture Streaming:Max texture load time per update (ms)&#34; value=&#34;100.000000&#34;/&gt;
	&lt;tweakable type=&#34;float1&#34; name=&#34;Texture Streaming:Max texture request time per update (ms)&#34; value=&#34;10.000000&#34;/&gt;
	&lt;tweakable type=&#34;int&#34; name=&#34;Texture Streaming:Update Slices&#34; value=&#34;1&#34;/&gt;
	&lt;tweakable type=&#34;float1&#34; name=&#34;Texture Streaming:Distance scale&#34; value=&#34;0.250000&#34;/&gt;
	&lt;tweakable type=&#34;float1&#34; name=&#34;Texture Streaming:Mip target bias&#34; value=&#34;0.500000&#34;/&gt;
	&lt;tweakable type=&#34;int&#34; name=&#34;Texture Streaming:Min Pool Size MB&#34; value=&#34;2048&#34;/&gt;
	&lt;tweakable type=&#34;int&#34; name=&#34;Texture Streaming:Target texture pool size MB&#34; value=&#34;4096&#34;/&gt;
	&lt;tweakable type=&#34;int&#34; name=&#34;Texture Streaming:Max Dropped Mips (Characters)&#34; value=&#34;0&#34;/&gt;
	&lt;tweakable type=&#34;int&#34; name=&#34;Texture Streaming:Max Dropped Mips (Player)&#34; value=&#34;0&#34;/&gt;
	&lt;tweakable type=&#34;bool&#34; name=&#34;LOD: Use ObjectScaleOverride&#34; value=&#34;1&#34;/&gt;
	&lt;tweakable type=&#34;float1&#34; name=&#34;LOD: ObjectScaleOverride&#34; value=&#34;3.000000&#34;/&gt;
	&lt;tweakable type=&#34;float1&#34; name=&#34;Hierarchy LOD:Distance scale&#34; value=&#34;3.000000&#34;/&gt;
&lt;/tweakables&gt;</code></pre><p>No, I haven&rsquo;t got a clue what these settings are doing. I found them in a Reddit comment that I can&rsquo;t for the life of me track down again, and you see now why I&rsquo;m writing this post.</p>
<p>That should be all you need to do to apply the fix. If you&rsquo;ve made it to the point in the game where you&rsquo;ve cleansed your first control point (roughly 30-45 minutes in), a good quick way to test the fix is to go to the control point and switch between the different outfits. The new outfit textures should load in pretty quickly every time you switch. After applying the fix myself, I played for over an hour and never saw a blurry texture.</p>

<h2 id="what-didnt-work-for-me"> <a href="#what-didnt-work-for-me">
    What didn&rsquo;t work for me
</a> </h2>

<p>I&rsquo;m including these here because they may still be options to explore if you want to avoid modding the game for some reason.</p>
<p>It&rsquo;s worth noting that my system has an Intel i5-13600K and an AMD Radeon RX 6700 XT.</p>

<h3 id="switching-to-dx11-mode"> <a href="#switching-to-dx11-mode">
    Switching to DX11 mode
</a> </h3>

<p>Control, at least on my system, defaults to using DX12. If you add <code>-showlauncher</code> to the game&rsquo;s launch options, you&rsquo;ll be shown a menu that allows you to run in DX11 mode when you start the game.</p>
<p>Some people report that switching to DX11 mode solves the blurry texture issue. I tried it for myself and DX11 mode ran significantly worse than DX12 on my system. There was lots of noticeable micro-stuttering and the game just felt a lot worse to play because of it, but your mileage may vary.</p>

<h3 id="disabling-resizeable-bar"> <a href="#disabling-resizeable-bar">
    Disabling resizeable BAR
</a> </h3>

<p>This is another option that people report some success with. You&rsquo;ll have to look up the specific steps of how to do this depending on your GPU. On AMD, you need to change a couple of options in the BIOS to disable resizeable BAR.</p>
<p>I don&rsquo;t know about you, but I wasn&rsquo;t about to go changing BIOS settings to workaround an issue for one specific game so I didn&rsquo;t even bother with this. Still, it might be something to try if you&rsquo;ve exhausted other options and are bent on getting it to work.</p>

<h2 id="a-dumb-closing-thought"> <a href="#a-dumb-closing-thought">
    A dumb closing thought
</a> </h2>

<p>Why is gaming like this? This isn&rsquo;t even close to my worst example. There&rsquo;s one (not very old!) game whose executable I had to manually patch just to get launching on newer CPUs.</p>
<p>— JP</p>
]]></content:encoded>
    </item>
    <item>
      <title>How to Post to a Hugo Blog on Android</title>
      <link>https://moddedbear.com/how-to-post-to-a-hugo-blog-on-android/</link>
      <pubDate>Mon, 27 Jan 2025 16:18:47 -0700</pubDate><author>modbear@proton.me (JP)</author>
      <guid>https://moddedbear.com/how-to-post-to-a-hugo-blog-on-android/</guid>
      <description>&lt;p&gt;A few months back I went looking into whether it was possible to post to my Hugo blog here using only my Android phone.&lt;/p&gt;&#xA;&lt;p&gt;It turns out that it is! It may even be slightly more straightforward than you&amp;rsquo;d guess, but I still ran into enough snags during the setup that I figured it&amp;rsquo;d be useful to document.&lt;/p&gt;&#xA;&#xA;&lt;h2 id=&#34;what-youll-need&#34;&gt; &lt;a href=&#34;#what-youll-need&#34;&gt;&#xA;    What you&amp;rsquo;ll need&#xA;&lt;/a&gt; &lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://termux.dev/en/&#34;&gt;Termux&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/gsantner/markor&#34;&gt;Markor&lt;/a&gt; (or any other text editor that will let you easily edit markdown files)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2 id=&#34;setup-termux&#34;&gt; &lt;a href=&#34;#setup-termux&#34;&gt;&#xA;    Setup Termux&#xA;&lt;/a&gt; &lt;/h2&gt;&#xA;&#xA;&lt;p&gt;If you haven&amp;rsquo;t used Termux before, one of the first things you&amp;rsquo;ll want to do is run &lt;code&gt;termux-setup-storage&lt;/code&gt;. This will grant Termux access to your phone&amp;rsquo;s storage, which we&amp;rsquo;ll need later in order to clone our site somewhere where our text editor will be able to get to it.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>A few months back I went looking into whether it was possible to post to my Hugo blog here using only my Android phone.</p>
<p>It turns out that it is! It may even be slightly more straightforward than you&rsquo;d guess, but I still ran into enough snags during the setup that I figured it&rsquo;d be useful to document.</p>

<h2 id="what-youll-need"> <a href="#what-youll-need">
    What you&rsquo;ll need
</a> </h2>

<ul>
<li><a href="https://termux.dev/en/">Termux</a></li>
<li><a href="https://github.com/gsantner/markor">Markor</a> (or any other text editor that will let you easily edit markdown files)</li>
</ul>

<h2 id="setup-termux"> <a href="#setup-termux">
    Setup Termux
</a> </h2>

<p>If you haven&rsquo;t used Termux before, one of the first things you&rsquo;ll want to do is run <code>termux-setup-storage</code>. This will grant Termux access to your phone&rsquo;s storage, which we&rsquo;ll need later in order to clone our site somewhere where our text editor will be able to get to it.</p>
<p>You&rsquo;ll also need to install git with <code>pkg install git</code> and Hugo with <code>pkg install hugo</code>.</p>

<h2 id="setup-git"> <a href="#setup-git">
    Setup git
</a> </h2>

<p>There&rsquo;s one option that you&rsquo;ll need to add to your git config in Termux, otherwise you&rsquo;ll probably run into errors later on about an &ldquo;unsafe repository&rdquo;. From what I can tell, this has something to do with how Android or Termux is handling file ownership, though much more than that I don&rsquo;t know.</p>
<p>You can get around this error by running <code>git config --global --add safe.directory '*'</code>. If you want to read up on why this safe directory check is in place, you can check <a href="https://git-scm.com/docs/git-config/2.35.2#Documentation/git-config.txt-safedirectory">the git documentation</a> and <a href="https://github.com/git/git/commit/8959555cee7ec045958f9b6dd62e541affb7e7d9">this commit</a> for more information. As long as you trust the files on your phone&rsquo;s storage (I can&rsquo;t think of a good reason why you wouldn&rsquo;t), you should be safe adding this config option to bypass the safety check.</p>

<h2 id="clone-your-site"> <a href="#clone-your-site">
    Clone your site
</a> </h2>

<p>This step will obviously vary slightly depending on where you host your site&rsquo;s repository. In my case, the git repository for my site is hosted on GitHub, and my preferred way of accessing it is through GitHub&rsquo;s command line tool. Fortunately this is easy to install in Termux with <code>pkg install gh</code>. Once it&rsquo;s installed, you should be able to authenticate normally with <code>gh auth login</code>.</p>
<p>Termux normally starts in its own internal directory which other apps can&rsquo;t access, so you&rsquo;ll need to navigate to somewhere in Android&rsquo;s &ldquo;external&rdquo; storage where Markor or your chosen text editor will be able to make edits. On my Google Pixel, this is located at <code>/storage/emulated/0/</code>. Termux will only be able to access this if you&rsquo;ve run the <code>termux-setup-storage</code> command from earlier.</p>
<p>You can clone your site anywhere under that directory that makes sense to you. For me, that was in the Documents directory.</p>

<h2 id="get-ready-to-write"> <a href="#get-ready-to-write">
    Get ready to write
</a> </h2>

<p>If you&rsquo;re used to creating a new post with the <code>hugo new</code> command, you might notice that it fails with an error about being unable to obtain a build lock. This is because some commands cause Hugo to try to obtain an OS-level write lock on the <code>.hugo_build.lock</code> file, which here it&rsquo;s unable to do either because of Android or Termux. My workaround is to create the new file manually and copy the frontmatter metadata from an existing post.</p>
<p>The <code>hugo server</code> and <code>hugo build</code> commands will also fail for the same reason, but these allow the build lock to be skipped by adding the <code>--noBuildLock</code> flag.</p>
<p>There&rsquo;s <a href="https://discourse.gohugo.io/t/what-is-the-hugo-build-lock-file/35417">a decent explanation of why this build lock exists on the Hugo support forum</a> if you&rsquo;d like to learn more about it. As long as you&rsquo;re not running multiple instances of Hugo at the same time, I don&rsquo;t believe you&rsquo;ll run into issues disabling it.</p>

<h2 id="write-and-publish"> <a href="#write-and-publish">
    Write and publish
</a> </h2>

<p>Everything past this point should work as you&rsquo;d expect it to. Just edit your post in Markor or whichever text editor you&rsquo;ve chosen and publish it when you&rsquo;re ready. You can even preview your site with <code>hugo build</code> (you may need the <code>--noBuildLock</code> flag mentioned earlier) and it works just as you&rsquo;d expect it to.</p>
<p>My site gets built and deployed by Vercel automatically when I push to the main branch, so to publish all I have to do is create a new commit and push it. If your publishing process involves building locally then copying the files somewhere, I assume that would also work as expected since common tools like <code>scp</code> are available in Termux.</p>

<h2 id="final-thoughts"> <a href="#final-thoughts">
    Final thoughts
</a> </h2>

<p>Everything here is based on my experience with my Google Pixel running Android 15. The process should be identical or at least extremely similar on other Android phones. If you try this and find that it isn&rsquo;t, feel free to reach out to me with the details and I&rsquo;ll try to get them added!</p>
<p>— JP</p>
]]></content:encoded>
    </item>
    <item>
      <title>How to Get Into Self Hosting</title>
      <link>https://moddedbear.com/how-to-get-into-self-hosting/</link>
      <pubDate>Sun, 20 Mar 2022 00:00:00 +0000</pubDate><author>modbear@proton.me (JP)</author>
      <guid>https://moddedbear.com/how-to-get-into-self-hosting/</guid>
      <description>&lt;p&gt;(In response to &lt;a href=&#34;gemini://jdj.golf/gemlog/what-do-you-self-host.gmi&#34;&gt;gemini://jdj.golf/gemlog/what-do-you-self-host.gmi&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;There&amp;rsquo;s been quite a few posts going around from people sharing their self hosting setups. Here&amp;rsquo;s my setup, but since I&amp;rsquo;m still somewhat new to self hosting I&amp;rsquo;ll also add a few of my recommendations for those interested in joining in on the fun.&lt;/p&gt;&#xA;&#xA;&lt;h2 id=&#34;purely-self-hosted-services&#34;&gt; &lt;a href=&#34;#purely-self-hosted-services&#34;&gt;&#xA;    Purely Self Hosted Services&#xA;&lt;/a&gt; &lt;/h2&gt;&#xA;&#xA;&lt;p&gt;These are services I run from home on a Dell Optiplex (office PC) that was a lucky $5 find at a thrift store. With a Core 2 Duo, 8 GBs RAM, and my own 1 TB HDD, it&amp;rsquo;s plenty beefy and surely draws too much power for what I use it for.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>(In response to <a href="gemini://jdj.golf/gemlog/what-do-you-self-host.gmi">gemini://jdj.golf/gemlog/what-do-you-self-host.gmi</a>)</p>
<p>There&rsquo;s been quite a few posts going around from people sharing their self hosting setups. Here&rsquo;s my setup, but since I&rsquo;m still somewhat new to self hosting I&rsquo;ll also add a few of my recommendations for those interested in joining in on the fun.</p>

<h2 id="purely-self-hosted-services"> <a href="#purely-self-hosted-services">
    Purely Self Hosted Services
</a> </h2>

<p>These are services I run from home on a Dell Optiplex (office PC) that was a lucky $5 find at a thrift store. With a Core 2 Duo, 8 GBs RAM, and my own 1 TB HDD, it&rsquo;s plenty beefy and surely draws too much power for what I use it for.</p>

<h3 id="nextcloud"> <a href="#nextcloud">
    Nextcloud
</a> </h3>

<p>Nextcloud is a self hostable cloud storage solution, but it&rsquo;s also a lot more than that. Sort of how Google has Drive, but also Photos, Calendar, Meet, etc. I use Nextcloud for backups, file sharing, and video calls with family.</p>

<h3 id="jellyfin"> <a href="#jellyfin">
    Jellyfin
</a> </h3>

<p>A simple but feature-rich media server. If you&rsquo;ve heard of Plex, it&rsquo;s the same thing but much faster and without all the nonsense.</p>

<h2 id="vps-services"> <a href="#vps-services">
    VPS Services
</a> </h2>

<p>These are services I run through a couple of rented VPSs. I&rsquo;ve been using DigitalOcean for a couple of years and have been pretty happy with them. A VPS can offer a lot of the advantages of self hosting while also offloading some of the responsibility. If reliability is high-priority then a VPS can be a great option.</p>

<h3 id="gemini-capsule"> <a href="#gemini-capsule">
    Gemini capsule
</a> </h3>

<p>I use the static Agate gemini server &ndash; my top recommendation for anyone wanting to set up their own home on gemini.</p>

<h3 id="rocketcaster"> <a href="#rocketcaster">
    RocketCaster
</a> </h3>

<p>RocketCaster is a simple gemini service I wrote that brings podcastindex.org&rsquo;s searchable podcast database to gemini.</p>
<p>See:
<a href="gemini://rocketcaster.xyz">gemini://rocketcaster.xyz</a></p>

<h3 id="snikket"> <a href="#snikket">
    Snikket
</a> </h3>

<p>An easy to setup server for the XMPP chat protocol. I&rsquo;m the only user on it right now but it&rsquo;s served me well in talking to folks on other servers.</p>

<h2 id="where-to-get-started"> <a href="#where-to-get-started">
    Where to Get Started?
</a> </h2>

<p>If you want to start playing around with self hosting, I would strongly recommend Nextcloud. It&rsquo;s surprisingly easy to set up and maintain on Ubuntu with Snap. For as much crap as Snap gets in the desktop space it makes a lot of sense in cases like this. It&rsquo;ll even take care of auto-updating for you by default &ndash; something that&rsquo;s seriously helpful in the context of self hosting.</p>
<p>Nextcloud like I said is extremely versatile thanks to a wide range of installable extensions called apps. The one that I use the most is Talk which adds chat and video conferencing features. There are apps for almost anything you can think of like news readers, maps, calendars, contacts, forms, notes, mail, and more. There are few things you can self host that will give you as much utility as Nextcloud.</p>
<p>Gemini servers would also be a great place to start self hosting since they&rsquo;re public, low-stakes, and can be comfortably run on the tiniest of computers.</p>
<p>Above all, just find something that you&rsquo;ll find useful. The fun in self hosting for me is not building something or maintaining it but getting good use out of it. It&rsquo;s the feeling of technological independence.</p>
<p><a href="https://github.com/awesome-selfhosted/awesome-selfhosted">See this list on GitHub for ideas of services to self host</a></p>
]]></content:encoded>
    </item>
    <item>
      <title>Control TP Link Kasa Smart Devices With Tasker</title>
      <link>https://moddedbear.com/control-tp-link-kasa-smart-devices-with-tasker/</link>
      <pubDate>Mon, 06 Dec 2021 00:00:00 +0000</pubDate><author>modbear@proton.me (JP)</author>
      <guid>https://moddedbear.com/control-tp-link-kasa-smart-devices-with-tasker/</guid>
      <description>&lt;p&gt;I was recently gifted a few Kasa smart plugs, and after a little bit of research I found out it&amp;rsquo;s possible to use their API to control the plugs using Tasker, a popular Android automation app. The resources I was able to find were just a little out of date, so I&amp;rsquo;m deciding to write my own notes on the process here.&lt;/p&gt;&#xA;&lt;p&gt;At the bottom of this post I&amp;rsquo;ll link to the XML files for the tasks I created in case anybody wants to import them.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I was recently gifted a few Kasa smart plugs, and after a little bit of research I found out it&rsquo;s possible to use their API to control the plugs using Tasker, a popular Android automation app. The resources I was able to find were just a little out of date, so I&rsquo;m deciding to write my own notes on the process here.</p>
<p>At the bottom of this post I&rsquo;ll link to the XML files for the tasks I created in case anybody wants to import them.</p>

<h2 id="create-a-login-task"> <a href="#create-a-login-task">
    Create a login task
</a> </h2>

<p>Before anything else, you need to create a task that logs in to the Kasa API and gets a token. This token should be saved as a global variable so other tasks can make use of it.</p>
<p>You&rsquo;ll need to create a few global variables:</p>
<ul>
<li><code>%TPLUSER</code> - the email address used for your Kasa account</li>
<li><code>%TPLPASS</code> - the password for your Kasa account</li>
<li><code>%TPLTERM</code> - a version 4 UUID, you can generate one to use with an online tool or with the uuidgen command in Linux</li>
<li><code>%TPLTOKEN</code> - where the login token will be stored</li>
</ul>
<p>With that done, you can start creating the login task.</p>
<p>Start with a Variable Set action. Name the variable <code>%payload</code> and set it to the following:</p>





<pre tabindex="0"><code>{ &#34;method&#34; :&#34;login&#34;,
&#34;params&#34; : {
  &#34;appType&#34; :&#34;Kasa_Android&#34;,
  &#34;cloudPassword&#34; :&#34;%TPLPASS&#34;,
  &#34;cloudUserName&#34; :&#34;%TPLUSER&#34;,
  &#34;terminalUUID&#34; :&#34;%TPLTERM&#34; } }</code></pre><p>Next, create an HTTP Request action. Set the method to POST, the URL to <code>https://wap.tplinkcloud.com</code>, and the body to &ldquo;%payload&rdquo;.</p>
<p>Create a JavaScriptlet action next and give it the following code. This will extract the login token from the response and save it as a local variable.</p>





<pre tabindex="0"><code>var mtoken = JSON.parse(http_data).result.token;</code></pre><p>The last thing to do is to use another Variable Set action to set the global <code>%TPLTOKEN</code> variable to <code>%mtoken</code>.</p>
<p>I don&rsquo;t know how often this token expires, but you may want to create a profile that runs the login task on some sort of regular interval just in case.</p>

<h2 id="find-your-device-ids"> <a href="#find-your-device-ids">
    Find your device IDs
</a> </h2>

<p>To control a device you first need to know its ID. You can get a list of all of your devices by sending a POST request to <code>https://wap.tplinkcloud.com?token={your-token-here}</code> with the following data:</p>





<pre tabindex="0"><code>{ &#34;method&#34;: &#34;getDeviceList&#34; }</code></pre><p>Here is an example curl command that&rsquo;ll do the trick. You may want to pipe it to jq to make the response more readable.</p>





<pre tabindex="0"><code>curl -X POST -H &#34;Content-type: application/json&#34; -d &#39;{ &#34;method&#34;: &#34;getDeviceList&#34; }&#39; &#39;https://wap.tplinkcloud.com?token={your-token-here}&#39;</code></pre><p>Find whichever devices you want to control in Tasker in the response and make note of their device IDs. Save each device ID as a Tasker variable and call it something descriptive like <code>%TPLLAMPID</code>.</p>

<h2 id="create-a-device-control-task"> <a href="#create-a-device-control-task">
    Create a device control task
</a> </h2>

<p>Create a new task and add a Variable Set action. Call the variable <code>%payload</code> and set it to the following:</p>





<pre tabindex="0"><code>{&#34;method&#34;:&#34;passthrough&#34;, &#34;params&#34;: {&#34;deviceId&#34;: &#34;%TPLDEVICEID&#34;, &#34;requestData&#34;: &#34;{\&#34;system\&#34;:{\&#34;set_relay_state\&#34;:{\&#34;state\&#34;:0}}}&#34; }}</code></pre><p>Be sure to change <code>%TPLDEVICEID</code> to whatever you called the variable that contains your device ID. Also be sure to set the state to either 0 for off or 1 for on.</p>
<p>Next create an HTTP Request action and set its method to POST and its URL to <code>https://wap.tplinkcloud.com?token=%TPLTOKEN</code>. Set its body to <code>%payload</code>.</p>
<p>That should be it! If you run the task, you should see your device turn off or on depending on what you set the state in the payload to. If you need to debug, you can create a popup action with the text <code>%http_data</code> to see the response from the API.</p>

<h2 id="resources-used"> <a href="#resources-used">
    Resources Used
</a> </h2>

<ul>
<li><a href="https://www.reddit.com/r/tasker/comments/czt93u/integrate_kasa_app_with_tasker/">https://www.reddit.com/r/tasker/comments/czt93u/integrate_kasa_app_with_tasker/</a></li>
<li><a href="https://itnerd.space/2017/06/19/how-to-authenticate-to-tp-link-cloud-api-with-tasker/">https://itnerd.space/2017/06/19/how-to-authenticate-to-tp-link-cloud-api-with-tasker/</a></li>
<li><a href="https://itnerd.space/2017/01/22/how-to-control-your-tp-link-hs100-smartplug-from-internet/">https://itnerd.space/2017/01/22/how-to-control-your-tp-link-hs100-smartplug-from-internet/</a></li>
</ul>
]]></content:encoded>
    </item>
    <item>
      <title>Using Wireguard to Self-Host Around a Carrier-Grade NAT</title>
      <link>https://moddedbear.com/using-wireguard-to-self-host-around-a-carrier-grade-nat/</link>
      <pubDate>Tue, 21 Sep 2021 00:00:00 +0000</pubDate><author>modbear@proton.me (JP)</author>
      <guid>https://moddedbear.com/using-wireguard-to-self-host-around-a-carrier-grade-nat/</guid>
      <description>&lt;p&gt;Here&amp;rsquo;s another log that&amp;rsquo;s half notes for myself and half information for anyone who needs it.&lt;/p&gt;&#xA;&#xA;&lt;h2 id=&#34;explanation&#34;&gt; &lt;a href=&#34;#explanation&#34;&gt;&#xA;    Explanation&#xA;&lt;/a&gt; &lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I first took a look at Nextcloud a few months ago and decided it was a little much for what I needed. But needs change and since early last month I&amp;rsquo;ve been self-hosting my own Nextcloud instance on an old office computer.&lt;/p&gt;&#xA;&lt;p&gt;Making my Nextcloud available from outside my network was less than straightforward due to the situation with my apartment internet. Basically, there&amp;rsquo;s another device between my router and the internet doing network address translation. This makes it either impossible or at least a big hassle for me to get my own public IP.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Here&rsquo;s another log that&rsquo;s half notes for myself and half information for anyone who needs it.</p>

<h2 id="explanation"> <a href="#explanation">
    Explanation
</a> </h2>

<p>I first took a look at Nextcloud a few months ago and decided it was a little much for what I needed. But needs change and since early last month I&rsquo;ve been self-hosting my own Nextcloud instance on an old office computer.</p>
<p>Making my Nextcloud available from outside my network was less than straightforward due to the situation with my apartment internet. Basically, there&rsquo;s another device between my router and the internet doing network address translation. This makes it either impossible or at least a big hassle for me to get my own public IP.</p>
<p>The way I chose to work around this was by setting up a VPS with a provider I&rsquo;ve used before (DigitalOcean), configuring a Wireguard VPN server on it, and connecting to it from my machine hosting Nextcloud. My Wireguard server is configured to route all incoming web traffic to my Nextcloud server and my Nextcloud server is configured to route all outgoing traffic through my Wireguard server. The end result is that I&rsquo;m now able to talk to my VPS and it&rsquo;s as if I&rsquo;m talking to my Nextcloud server.</p>

<h2 id="getting-started"> <a href="#getting-started">
    Getting Started
</a> </h2>

<p>There are a few guides on how to do this out there already, but there&rsquo;s a few things I didn&rsquo;t like about each one I looked at. I borrowed from a few different ones to come up with my current config which I&rsquo;ve written about here.</p>
<p>The instructions below were written with Ubuntu in mind but they should be pretty general and work on most other Linux flavors. A lot of what&rsquo;s in this guide will also need sudo privileges.</p>
<p>First thing you&rsquo;ll want to do is of course get a VPS started. DigitalOcean and Linode are both popular providers that offer fairly cheap basic plans, though for this purpose you might be able to find an even cheaper option elsewhere. From now on I&rsquo;m going to be referring to the VPS as the server and the machine you&rsquo;re self-hosting from as the client.</p>
<p>Next you&rsquo;ll want to install Wireguard, which most likely should be in your OS&rsquo;s package repositories. Go ahead and do this on both the server and the client.</p>

<h2 id="generate-keys"> <a href="#generate-keys">
    Generate Keys
</a> </h2>

<p>Navigate to /etc/wireguard (or any other directory you would like to save your keys in) and run the following commands on both the server and the client to generate your public and private keys.</p>





<pre tabindex="0"><code>wg genkey | tee privatekey | wg pubkey &gt; publickey</code></pre>
<h2 id="server-configuration"> <a href="#server-configuration">
    Server Configuration
</a> </h2>

<p>Here&rsquo;s my server config which I&rsquo;ve saved as /etc/wireguard/wg0.conf.</p>





<pre tabindex="0"><code>[Interface]
PrivateKey = &lt;server&#39;s private key&gt;
Address = 10.10.92.2/32
ListenPort = &lt;port you want to listen on&gt;

PreUp = iptables -t nat -A PREROUTING -d &lt;server&#39;s public ip&gt; -p tcp --dport 80 -j DNAT --to-destination 10.10.92.1
PreUp = iptables -t nat -A PREROUTING -d &lt;server&#39;s public ip&gt; -p tcp --dport 443 -j DNAT --to-destination 10.10.92.1
PreUp = iptables -t nat -A POSTROUTING -o &lt;your network interface, ex. eth0&gt; -j MASQUERADE
PostDown = iptables -t nat -D PREROUTING -d &lt;server&#39;s public ip&gt; -p tcp --dport 80 -j DNAT --to-destination 10.10.92.1
PostDown = iptables -t nat -D PREROUTING -d &lt;server&#39;s public ip&gt; -p tcp --dport 443 -j DNAT --to-destination 10.10.92.1
PostDown = iptables -t nat -D POSTROUTING -o &lt;your network interface, ex. eth0&gt; -j MASQUERADE

[Peer]
PublicKey = &lt;client&#39;s public key&gt;
AllowedIPs = 10.10.92.1/32</code></pre><p>Notice the PreUp and PostDown rules. These modify iptable rules when the wireguard connection goes up or down in order to forward incoming traffic to the client. Some guides I&rsquo;ve seen online have these rules set up to forward ALL incoming traffic to the client, but I would strongly discourage that. Instead, you can use the rules that I have in this config to forward only the ports you intend to use. I have rules for ports 80 and 443 for http and https. You can modify these rules, remove them, or add more for your needs.</p>
<p>Next you&rsquo;ll need to enable IP forwarding with the following command. You may also need to edit /etc/sysctl.conf to make the setting persistent.</p>





<pre tabindex="0"><code>sysctl net.ipv4.ip_forward=1</code></pre>
<h2 id="client-configuration"> <a href="#client-configuration">
    Client Configuration
</a> </h2>

<p>The config file for the client is a bit simpler than the server. Save it as /etc/wireguard/wg0.conf.</p>





<pre tabindex="0"><code>[Interface]
PrivateKey = &lt;client&#39;s private key&gt;
Address = 10.10.92.1/32

[Peer]
PublicKey = &lt;server&#39;s public key&gt;
Endpoint = &lt;server&#39;s ip address&gt;:&lt;ListenPort from server config&gt;
AllowedIPs = 0.0.0.0/0
PersistentKeepAlive = 25  # necessary to keep the connection alive</code></pre><p>You&rsquo;ll need to add two iptable rules. Run the following commands and also add them to /etc/rc.local to make them permanent across reboots.</p>





<pre tabindex="0"><code>iptables -A FORWARD -i wg0 -j ACCEPT
iptables -t nat -A POSTROUTING -o &lt;your network interface, ex. eth0&gt; -j MASQUERADE</code></pre><p>Like the server, you&rsquo;ll also need to enable IP forwarding. Run the following command to do that. You might also need to edit your /etc/sysctl.conf to make it persist after a reboot.</p>





<pre tabindex="0"><code>sysctl net.ipv4.ip_forward=1</code></pre>
<h2 id="testing-it-all-out"> <a href="#testing-it-all-out">
    Testing It All Out
</a> </h2>

<p>You can enable, start, and check the status of Wireguard with these commands on both the client and the server:</p>





<pre tabindex="0"><code>systemctl enable --now wg-quick@wg0
systemctl status wg-quick@wg0
wg show</code></pre><p>If everything&rsquo;s worked out you should be able to tell that the connection is active when you see a &ldquo;latest handshake&rdquo; and &ldquo;transfer&rdquo; in the output for &ldquo;wg show&rdquo;.</p>

<h2 id="references"> <a href="#references">
    References
</a> </h2>

<ul>
<li><a href="https://www.kmr.me/posts/wireguard/">https://www.kmr.me/posts/wireguard/</a></li>
<li><a href="https://hacdias.com/articles/2020/11/access-network-behind-cgnat/">https://hacdias.com/articles/2020/11/access-network-behind-cgnat/</a></li>
</ul>
]]></content:encoded>
    </item>
  </channel>
</rss>
