|
@@ -1,5 +1,5 @@
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
-<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Pleasant Programmer (sysadmin)</title><link>http://pleasantprogrammer.com/</link><description></description><atom:link type="application/rss+xml" href="http://pleasantprogrammer.com/categories/sysadmin.xml" rel="self"></atom:link><language>en</language><lastBuildDate>Fri, 25 Dec 2015 07:25:05 GMT</lastBuildDate><generator>https://getnikola.com/</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Cloudflare Shenanigans</title><link>http://pleasantprogrammer.com/posts/cloudflare-shenanigans.html</link><dc:creator>Thomas Dy</dc:creator><description><div><p>An old client of ours managed to convince a telco to zero-rate the data for their app. In order to whitelist it though, we needed to use plain HTTP for domain whitelisting. For HTTPS, they can only whitelist by IP address. Like any good developer, we were using HTTPS. Also, like any good developer, we put our server behind Cloudflare.</p>
|
|
|
+<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Pleasant Programmer (sysadmin)</title><link>http://pleasantprogrammer.com/</link><description></description><atom:link type="application/rss+xml" rel="self" href="http://pleasantprogrammer.com/categories/sysadmin.xml"></atom:link><language>en</language><lastBuildDate>Fri, 25 Dec 2015 07:29:48 GMT</lastBuildDate><generator>https://getnikola.com/</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Cloudflare Shenanigans</title><link>http://pleasantprogrammer.com/posts/cloudflare-shenanigans.html</link><dc:creator>Thomas Dy</dc:creator><description><div><p>An old client of ours managed to convince a telco to zero-rate the data for their app. In order to whitelist it though, we needed to use plain HTTP for domain whitelisting. For HTTPS, they can only whitelist by IP address. Like any good developer, we were using HTTPS. Also, like any good developer, we put our server behind Cloudflare.</p>
|
|
|
<p>Now the problem is that Cloudflare can put you behind <a href="https://www.cloudflare.com/ips/">any IP they own</a>, which is a huge range. There's no guarantee that the IP we have now is going to be the same later on. So we did the reasonable thing and asked them to whitelist all of the Cloudflare IPs. And the telco agreed! We were in total disbelief when that happened. But hey, if life gives you free internet, you take it.</p>
|
|
|
<p>We never actually empirically tested whether other sites hosted on Cloudflare were also actually zero-rated. But I like to think that we saved a lot of people on their data costs from browsing Reddit and 4chan. But alas, good things must come to an end.</p>
|
|
|
<p>A few months after we started beta testing the app, Cloudflare added more IPs to their range. Unfortunately, our server got moved to those new IPs which were not whitelisted yet. Apparently, the telco whitelisting process was incredibly convoluted and time consuming. Our client didn't want to bother asking them to whitelist more IPs. We also tried asking Cloudflare to move us back to the original IP range, but they could only do that if we were in their enterprise tier. We couldn't really afford that, so we looked for other options.</p>
|
|
@@ -38,7 +38,82 @@ Date: ~~~~~~
|
|
|
|
|
|
|
|
|
<p>Eventually, we did decide to just abandon Cloudflare for the server. We probably weren't going to be the target of a DDOS or anything. This also allowed us to do more secure things like pinning the server certificate in the application itself. Clearly, this is what we should have just done in the first place, but at the time we just wanted a stopgap solution.</p>
|
|
|
-<p>I just still find it funny we were making people's phones go to 4chan.org everyday for more than a year.</p></div></description><category>cloudflare</category><category>sysadmin</category><guid>http://pleasantprogrammer.com/posts/cloudflare-shenanigans.html</guid><pubDate>Fri, 25 Dec 2015 06:13:26 GMT</pubDate></item><item><title>Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU</title><link>http://pleasantprogrammer.com/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html</link><dc:creator>Thomas Dy</dc:creator><description><div><p>I've always thought that people were just too lazy to change their SSIDs when I see "PLDTMyDSLBizCafeJapan". It became apparent when we got our own PLDT line that it was because the bundled router/modem <em>does not</em> allow you to remove the prefix.</p>
|
|
|
+<p>I just still find it funny we were making people's phones go to 4chan.org everyday for more than a year.</p></div></description><category>cloudflare</category><category>sysadmin</category><guid>http://pleasantprogrammer.com/posts/cloudflare-shenanigans.html</guid><pubDate>Fri, 25 Dec 2015 06:13:26 GMT</pubDate></item><item><title>TiddlyWiki in the Sky (or TiddlyWeb for TW5)</title><link>http://pleasantprogrammer.com/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html</link><dc:creator>Thomas Dy</dc:creator><description><div><p>I've always liked <a href="http://tiddlywiki.com">TiddlyWiki</a>. Back when it first came out, it was really amazing. A wiki all in one file, that worked in the browser. It didn't need a backend, it would just save itself as an all new HTML file with all your posts inside. I've used it a lot over the years, as a personal wiki/journal and a class notebook. I even had a blog with it at one point using one of the server-side forks.</p>
|
|
|
+<p>Now, there's TiddlyWiki5 which is a rewrite of the original TiddlyWiki that looks a whole lot snazzier, and I assume has better architecture overall. It also has experimental support for all the server-side platforms (particularly TiddlyWeb) that have cropped up.</p>
|
|
|
+<p>If you're just looking for a simple server setup for TiddlyWiki5, it has native support for that on its own. There's plenty of documentation on the site. But if you're looking for more advanced features (like storing your posts in git or a database), then you'll need to use it with TiddlyWeb. The problem is that most of the documentation for TiddlyWeb still refers to the old TiddlyWiki.</p>
|
|
|
+<p>To support TiddlyWiki5, we'll need a version of the wiki which has the TiddlyWeb plugin already installed and configured. After that, some tweaking is necessary to get TiddlyWeb to provide what the wiki requires.</p>
|
|
|
+<h3>Setting Up TiddlyWiki</h3>
|
|
|
+<p>TiddlyWiki5 provides a command line tool via <code>npm</code> that allows building custom versions of the wiki. In fact, it comes with templates, called "editions", that we can use for our setup. Assuming you already have it installed, create the wiki using</p>
|
|
|
+<pre class="code literal-block">tiddlywiki mywiki --init tw5tank # create wiki from template
|
|
|
+</pre>
|
|
|
+
|
|
|
+
|
|
|
+<p>This creates a wiki intended for use with <a href="https://tank.peermore.com/">Tank</a>, which is built on top of TiddlyWeb. From here, you should look in <code>mywiki/tiddlers/system</code> which contain the entries for <code>SiteTitle</code>, <code>SiteSubtitle</code>, <code>DefaultTiddlers</code>, and <code>tiddlyweb-host</code>. The first 3 should be configured however you want. These are necessary because they're needed before the wiki can load them from the server. <code>tiddlyweb-host</code> contains the location of the TiddlyWeb server, this should be <code>http://localhost:8080/</code> if you're just testing locally. With everything configured, you can build the new wiki by running</p>
|
|
|
+<pre class="code literal-block">tiddlywiki mywiki --build
|
|
|
+</pre>
|
|
|
+
|
|
|
+
|
|
|
+<p>This will output the wiki to <code>mywiki/output/tw5tank.html</code>. You can now serve it using your favorite local webserver, like <code>python -m http.server</code>.</p>
|
|
|
+<h3>Setting Up TiddlyWeb</h3>
|
|
|
+<p>The TiddlyWeb tutorial recommends using <code>tiddlywebwiki</code> which has all the plugins setup for a nice wiki instance for the old TiddlyWiki. It has a lot of features that aren't really needed, so we won't go with that. So first, we'll need to install TiddlyWeb and any plugins we might want to use.</p>
|
|
|
+<pre class="code literal-block">pip install tiddlyweb tiddlywebplugins.status tiddlywebplugins.cherrypy tiddlywebplugins.cors
|
|
|
+</pre>
|
|
|
+
|
|
|
+
|
|
|
+<p>Next, we'll need the tiddlyweb configuration in <code>tiddlywebconfig.py</code></p>
|
|
|
+<pre class="code literal-block"><span class="c"># A basic configuration.</span>
|
|
|
+<span class="c"># `pydoc tiddlyweb.config` for details on configuration items.</span>
|
|
|
+
|
|
|
+<span class="kn">import</span> <span class="nn">tiddlywebplugins.status</span>
|
|
|
+
|
|
|
+<span class="n">config</span> <span class="o">=</span> <span class="p">{</span>
|
|
|
+ <span class="s">'system_plugins'</span><span class="p">:</span> <span class="p">[</span><span class="s">'tiddlywebplugins.status'</span><span class="p">,</span> <span class="s">'tiddlywebplugins.cors'</span><span class="p">],</span>
|
|
|
+ <span class="s">'secret'</span><span class="p">:</span> <span class="s">'36c98d6d14618c79f0ed2d49cd1b9e272d8d4bd0'</span><span class="p">,</span>
|
|
|
+ <span class="s">'wsgi_server'</span><span class="p">:</span> <span class="s">'tiddlywebplugins.cherrypy'</span><span class="p">,</span>
|
|
|
+ <span class="s">'cors.enable_non_simple'</span><span class="p">:</span> <span class="bp">True</span>
|
|
|
+<span class="p">}</span>
|
|
|
+
|
|
|
+<span class="n">original_gather_data</span> <span class="o">=</span> <span class="n">tiddlywebplugins</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="n">_gather_data</span>
|
|
|
+
|
|
|
+<span class="k">def</span> <span class="nf">_status_gather_data</span><span class="p">(</span><span class="n">environ</span><span class="p">):</span>
|
|
|
+ <span class="n">data</span> <span class="o">=</span> <span class="n">original_gather_data</span><span class="p">(</span><span class="n">environ</span><span class="p">)</span>
|
|
|
+ <span class="n">data</span><span class="p">[</span><span class="s">'space'</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="s">'recipe'</span><span class="p">:</span> <span class="s">'default'</span><span class="p">}</span>
|
|
|
+ <span class="k">return</span> <span class="n">data</span>
|
|
|
+
|
|
|
+<span class="n">tiddlywebplugins</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="n">_gather_data</span> <span class="o">=</span> <span class="n">_status_gather_data</span>
|
|
|
+</pre>
|
|
|
+
|
|
|
+
|
|
|
+<p>The tweaks involved are:</p>
|
|
|
+<ul>
|
|
|
+<li>using the status plugin which the wiki requires</li>
|
|
|
+<li>monkeypatching the status plugin for the wiki to use the correct "recipe"</li>
|
|
|
+<li>using cherrypy server instead of the buggy default one</li>
|
|
|
+<li>using cors since we're not hosting the wiki itself on the same server</li>
|
|
|
+</ul>
|
|
|
+<p>With that, we just need to create the store that will hold our data</p>
|
|
|
+<pre class="code literal-block">twanager recipe default &lt;&lt;EOF
|
|
|
+desc: standard TiddlyWebWiki environment
|
|
|
+policy: {"read": [], "create": [], "manage": ["R:ADMIN"], "accept": [], "write": ["R:ADMIN"], "owner": "administrator", "delete": ["R:ADMIN"]}
|
|
|
+
|
|
|
+/bags/default/tiddlers
|
|
|
+EOF
|
|
|
+
|
|
|
+twanager bag default &lt;&lt;EOF
|
|
|
+{"policy": {"read": [], "create": [], "manage": ["R:ADMIN"], "accept": [], "write": [], "owner": "administrator", "delete": []}}
|
|
|
+EOF
|
|
|
+</pre>
|
|
|
+
|
|
|
+
|
|
|
+<p>Finally, we can start the TiddlyWeb server</p>
|
|
|
+<pre class="code literal-block">twanager server
|
|
|
+</pre>
|
|
|
+
|
|
|
+
|
|
|
+<h3>Putting it all together</h3>
|
|
|
+<p>Once you have the TiddlyWeb server running, you can just go to wherever you're hosting the wiki html and it should work. You can try creating some posts, and the check mark on the sidebar should be red for a while and then turn black. Once that's done it's saved. You can refresh your browser and your posts should still be there.</p>
|
|
|
+<p>At this point, you can start customizing your TiddlyWeb instance, by changing your store to something like a database, or adding authorization. You can also tweak the server setup so you won't need CORS anymore.</p>
|
|
|
+<p>TiddlyWiki5 is still relatively new. I hope that eventually, support for server-side and the plugin ecosystem grows to be as great as the old TiddlyWiki.</p></div></description><category>sysadmin</category><category>tiddlywiki</category><guid>http://pleasantprogrammer.com/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html</guid><pubDate>Thu, 24 Dec 2015 06:48:20 GMT</pubDate></item><item><title>Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU</title><link>http://pleasantprogrammer.com/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html</link><dc:creator>Thomas Dy</dc:creator><description><div><p>I've always thought that people were just too lazy to change their SSIDs when I see "PLDTMyDSLBizCafeJapan". It became apparent when we got our own PLDT line that it was because the bundled router/modem <em>does not</em> allow you to remove the prefix.</p>
|
|
|
<p>This is not the kind of thing you expect as a business customer. Even for home customers, I feel it's still a bit dishonest. I'd be fine if it was just the default SSID, but forcing people to have it as part of their SSID is like advertising that your company (I mean PLDT) is a douche.</p>
|
|
|
<p>Of course, we couldn't just leave the SSID prefix there, so we tried a number of things to get rid of it. There are articles for removing it from the <a href="http://www.phandroidinternet.com/2013/06/how-to-remove-on-wifi-name-or-ssid-on.html">Prolink H5004N</a> or the <a href="http://www.symbianize.com/showthread.php?t=730091">ZyXEL P-660HN-T1A</a> but not for the one we got which was the ZyXEL P-2612HNU-F1F.</p>
|
|
|
<p>We did still try the firebug/inspector tricks, but it seems that there is a server-side check that adds in the "PLDTMyDSLBiz". We tried a number of things, but the one that ultimately worked (and we had a good laugh about) was to backup the configuration, edit the dumped file and restore it.</p>
|