<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by fclerg on Medium]]></title>
        <description><![CDATA[Stories by fclerg on Medium]]></description>
        <link>https://medium.com/@fclerget?source=rss-92f90d806721------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*b59Q43Gt8CnpLqHX_uZVgg.png</url>
            <title>Stories by fclerg on Medium</title>
            <link>https://medium.com/@fclerget?source=rss-92f90d806721------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 19:16:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fclerget/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Tiny travel router]]></title>
            <link>https://medium.com/@fclerget/tiny-travel-router-6f56b2dc48f4?source=rss-92f90d806721------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f56b2dc48f4</guid>
            <category><![CDATA[openwrt]]></category>
            <category><![CDATA[hotel]]></category>
            <category><![CDATA[wifi]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[travel-router]]></category>
            <dc:creator><![CDATA[fclerg]]></dc:creator>
            <pubDate>Sun, 31 Dec 2023 12:46:41 GMT</pubDate>
            <atom:updated>2025-02-19T22:52:37.795Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZZndGOGVwGBAweYq9zzDdw.jpeg" /></figure><p>DIY travel router ? Sure you can make yourself one that fits in your wallet!</p><p>There are lots of articles about why one might need a travel router. I find it useful to bypass the restriction on the number of WiFi connected devices, in hotels that charge a fee for more than one. It also allows to bypass captive portals of hotel’s WiFi, which is handy to connect a Chromecast to the TV of the hotel room for instance, to cast the beautiful photos of the day on big screen. The setup would look like this :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/859/1*cMCoURcVm68gawz2JssLOA.png" /></figure><h3>The device 🛜</h3><p>Most travel routers are bulky to carry, so this article will walk you through configuring a coin-size OpenWRT based device as a WiFi-only travel router : the <a href="https://vocore.io/">VoCore2 + USB Head</a>. Few years ago, the “Zsun wifi card reader” could be converted to a super tiny OpenWRT router with a bit of work, but it it seems to have been discontinued and is now difficult to find. It costed about $10 while the Vocore2 costs around $20, which is still affordable, plus it has the advantage to come with OpenWRT by default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vIt5kVpuzMZT4daR3-f9LA.png" /></figure><p>The “VoCore2 + USB Head” is powered via USB. The connector only carries over the 5V and does not allow to take control of the router in any way. To do so, you must connect to the WiFi AP exposed by the device, with SSID “Vocore-xxxx”. For that reason, the Vocore will be bricked if you misconfigure this AP.</p><p>In fact, thanks to a USB2TTL converter and with three wires connected on the right PINs of the Vcore, you can get a serial console. I highly recommend to get hold of one. I got mine for $5. Search for “CP2104 USB 2.0 to TTL&quot; online. This model has the advantage to come with the wires. A USB2TTL converter avoids lots of frustrations if you brick the router, but it is also required to get vanilla OpenWRT distribution on the device, without the Vocore default setting. I will come back to this in more details later in this article.</p><h3>First thing first, upgrade OpenWRT 🚀</h3><p>The device comes with a few years old OS version so let’s upgrade it to get the latest security patches and bug fixes.</p><p>Download the latest OpenWRT from this page : <a href="https://firmware-selector.openwrt.org/">https://firmware-selector.openwrt.org/</a></p><p>How convenient, select the latest version from the drop down, type the name of the device (“Vocore2”) and download the “sysupgrade” binary. In my case the file name looked like “<em>openwrt-23.05.2-ramips-mt76x8-vocore_vocore2-squashfs-sysupgrade.bin</em>”.</p><p>Then connect to the “Vocore2-xxxx” WiFi AP, you won’t have internet just yet for obvious reasons, but you can access the OpenWRT web interface on <a href="http://192.168.61.1/">http://192.168.61.1</a>. Login with default credentials `root / vocore`, navigate to “System”, “Backup / Flash Firmware”, select “Flash Image”, browse to the binary and click on “Upload” to flash it.</p><p>Critical moment : a prompt with a checkbox asks whether you want to retain the current configuration. Uncheck the box only if you are ready to get your hands little dirty! I recommend to do so, but it will require a USB2TTL hardware module to re-enable the Wireless capabilities of the Vocore over serial link.</p><h3>The hardware bit 🔧</h3><p>That is the fun part, it isn’t as difficult as it sounds! But it can be skipped if you opted to retain the Vocore config in the previous section.</p><p>Here is the serial link setup :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Bvdtd70zuzU2fP6jfmoZg.png" /></figure><p>See it as three jumper wires. One end plugged into the <em>TXD</em>, <em>RXD</em> and <em>GND</em> respectively, on the USB2TTL module. The other ends are bare stranded wires rolled around the <em>TXD</em>, <em>RXD</em> and <em>GND</em> pins of the Vocore. Do not connect <em>TXD</em> to <em>RXD</em> and vis versa, the USB module does this for you. The challenging part is to fiddle with little wire on the Vocore ends, making sure that the <em>TXD</em> wire doesn’t touch the <em>RXD</em> one. Once done, power in the router, connect the USB2TTL USB port to your computer, and open a serial console. I use C-Kermit with the following parameters :</p><pre>set line /dev/tty.usbserial-<em>xxxxx</em><br>set speed 115200<br>set carrier-watch off<br>set handshake none<br>set flow-control none<br>robust<br>connect</pre><p>You should now have a root shell on the Vocore, time to re-enable the WiFi with the following commands :</p><pre>uci set wireless.radio0.disabled=0<br><br># Also secure the default AP exposed by OpenWrt with WPA2 :<br>uci set wireless.default_radio0.encryption=&#39;psk2&#39;<br># below, replace &#39;TRAVEL_ROUTER_WIFI_PASSWORD&#39; with a password of<br># at least eight characters of your choice<br>uci set wireless.default_radio0.key=&#39;TRAVEL_ROUTER_WIFI_PASSWORD&#39;<br><br># Apply the changes<br>uci commit wireless<br>reboot</pre><p>and set the root password :</p><pre>passwd</pre><h3>Create the final config over SSH ⚙️</h3><p>Connect to the secure WiFi network called “Openwrt” exposed by the freshly installed router. The WPA2 password is the one you created in the previous section. The IP address of the Vocore has changed to the Openwrt default one (<em>192.168.1.1</em>). You can SSH onto it as follow :</p><pre>ssh root@192.168.1.1</pre><p>Note that if you haven’t skipped the previous section, the commands that follows can be run thanks to the serial communication.</p><p>Here is the base configuration :</p><pre><br># configure the settings for the client interface that will <br># connect to the WiFi network with internet access<br>uci set wireless.sta=wifi-iface<br>uci set wireless.sta.device=&#39;radio0&#39;<br>uci set wireless.sta.network=&#39;wwan&#39;<br>uci set wireless.sta.mode=&#39;sta&#39;<br>uci set wireless.sta.ssid=&#39;THE_HOTEL_WIFI_NETWORK&#39;<br><br>## Uncomment next line if is the Hotel WiFi AP doesn&#39;t require a password<br># uci set wireless.sta.encryption=&#39;none&#39;<br>uci set wireless.sta.encryption=&#39;psk2&#39;<br>uci set wireless.sta.key=&#39;THE_HOTEL_WIFI_PASSWORD&#39;<br><br># We update the 3rd octet of the BR-LAN IP subnet range, given that<br># 192.168.1.0 is widely used and could conflict with WAN subnet<br>uci set network.lan.ipaddr=&#39;192.168.111.1&#39;<br><br># Configure the WiFi wan virtual interface<br>uci set network.wwan=interface<br>uci set network.wwan.force_link=&#39;1&#39;<br>uci set network.wwan.proto=&#39;dhcp&#39;<br><br># Configure firewall to forward traffic from the BR-LAN to the WWAN<br># interface, for internet access<br>uci del firewall.cfg03dc81.network<br>uci add_list firewall.cfg03dc81.network=&#39;wan&#39;<br>uci add_list firewall.cfg03dc81.network=&#39;wan6&#39;<br>uci add_list firewall.cfg03dc81.network=&#39;wwan&#39;<br><br># Required for some captive portal<br>uci set dhcp.@dnsmasq[0].rebind_protection=&#39;0&#39;<br><br># Apply the changes and reboot<br>uci commit</pre><p>You can of course set the AP to your home WiFi for testing. Namely by replacing the <em>HOTEL_WIFI_NETWORK</em> and <em>HOTEL_WIFI_PASSWORD</em> strings above.</p><h4>Auto-rescue 🛟</h4><p>When carrying the Vocore to a different place, here are some magic to add to the <em>wireless</em> and <em>rc.local </em>configuration to not brick the Vocore. This would happen when the wifi WAN interface of the travel router can’t connect to an old hotel wifi. Without this configuration, you would loose all access to the Vocore and would need the serial link to rescue it when moving to a different hotel.</p><pre>SCRIPT_PATH=/usr/bin/fix_sta_ap.sh<br>cp /etc/config/wireless /etc/config/wireless.ap+sta<br><br>cat &lt;&lt; &quot;EOF&quot; &gt; $SCRIPT_PATH<br>#!/bin/sh<br>T=30<br>S=3<br>staerr=0<br>while [ $(iwinfo | grep -c &quot;ESSID: unknown&quot;) -ge 1 ]; do<br>let staerr=$staerr+1<br>if [ $((staerr * S)) -ge $T ]; then<br>sed -n -i &#39;/&#39;sta&#39;/q;p&#39; /etc/config/wireless<br>wifi up<br>sleep 3<br>cp /etc/config/wireless.ap+sta /etc/config/wireless<br>break<br>fi<br>sleep $S<br>done<br>EOF<br><br>chmod +x $SCRIPT_PATH<br>sed -i -e &quot;<br>\$i $SCRIPT_PATH &gt; /dev/null &amp;<br>&quot; /etc/rc.local</pre><p>This installs a script inspired from the one documented <a href="https://openwrt.org/docs/guide-user/network/wifi/ap_sta">here</a> on the official OpenWRT website.</p><p>Now Connect your devices to the “OpenWrt” network and voilà, you now have your own WiFi AP abroad with no hassle!</p><h3>Checking in! 🏨</h3><p>When travelling, updating the WiFi SSID and password via the Openwrt web interface (now on <a href="https://192.168.111.1/">https://192.168.111.1</a>) is easier than over SSH. A preview of how to do it :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*I559QralUi41N0N0uo1eTA.gif" /></figure><h3>And the captive portals bypass ?</h3><p>After configuring the travel router to connect to the WiFi, connect a device to the AP exposed by the travel router and authenticate to the captive portal (the page usually prompts for room number and lastname or similar). Now all devices connected to your router should have access to the internet without being redirected to the authentication page. This is made possible as the only device that the hotel’s WiFi sees is the travel router’s WAN interface. Specifically its MAC address. All devices connected to the router appear as one to the AP of the hotel.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f56b2dc48f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BQ Service Account Permissions]]></title>
            <link>https://medium.com/@fclerget/bq-service-account-permissions-600cbd7b0b93?source=rss-92f90d806721------2</link>
            <guid isPermaLink="false">https://medium.com/p/600cbd7b0b93</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[google-big-query]]></category>
            <dc:creator><![CDATA[fclerg]]></dc:creator>
            <pubDate>Wed, 14 Aug 2019 14:16:10 GMT</pubDate>
            <atom:updated>2019-10-03T11:11:45.364Z</atom:updated>
            <content:encoded><![CDATA[<p>I focus here on Big Query but the parts mentioning Service Accounts are true for all other GCP resources.</p><p>The default setup might give a Service Account much more permissions than what it should have. I will explain how to fine grain this access.</p><p><strong>Big Query Permissions Hierarchy</strong></p><p>Here are the different Big Query components :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*KsriVLjGHy6it7r3qeb_nQ.png" /></figure><p>As described later, the permissions can be applied at the Project or Dataset levels.</p><p><strong>Service Account and Permissions</strong></p><p>Following commands allow to list the roles associate with a Service Account. The roles can be configured through the IAM section of the Google Cloud Platform UI console. By default, roles permissions are project wide :</p><pre>gcloud projects get-iam-policy &lt;PROJECT_ID&gt; --flatten=”bindings[].members” --filter “bindings.members:&lt;SERVICE_ACCOUNT_ID&gt;”</pre><p>The output of the above command should be similar to this :</p><pre>members: serviceAccount:foo<a href="/service/mailto:reviews-bq@articulate-bot-510.iam.gserviceaccount.com">@my-gcp-project.iam.gserviceaccount.com</a><br>role: roles/bigquery.dataEditor</pre><blockquote>Note that following examples will use this “foo” service account from the “<a href="/service/mailto:reviews-bq@articulate-bot-510.iam.gserviceaccount.com">my-gcp-project</a>” project and for the “dataset-x” dataset.</blockquote><p>In this case, the service account (in key “members”) can create job in all the BigQuery datasets of the project by default.<br>We can confirm this by looking at the permissions associated with any dataset of the project:</p><pre>bq show --format=prettyjson <a href="/service/mailto:reviews-bq@articulate-bot-510.iam.gserviceaccount.com">my-gcp-project</a>:<em>dataset-x</em></pre><pre>{<br> “access”: [<br> {<br> “role”: “WRITER”,<br> “specialGroup”: “projectWriters”<br> },<br> . . .<br> {<br> “role”: “READER”,<br> “specialGroup”: “projectReaders”<br> }<br> . . .<br>}</pre><p>The Big Query role giving Read and/or Write access (such as <em>bigquery.dataEditor</em>) to the dataset falls into this “catchall” <em>specialGroup </em>permission.<br>This is problematic if we want to give access to an app to run job only to a specific dataset, instead of giving access to all of them. <br>The solution is to remove roles other than “<a href="https://cloud.google.com/bigquery/docs/access-control">BigQuery Job User</a>&quot; (which should be the only one). Also, the s<em>pecialGroup</em> permissions should be removed from the dataset. To do so, we write the output of the above command to a file, edit it, and upload the edited file :</p><pre>bq show --format=prettyjson <a href="/service/mailto:reviews-bq@articulate-bot-510.iam.gserviceaccount.com">my-gcp-project</a>:<em>dataset-x</em> &gt; /tmp/PERMS<br>bq update --source /tmp/PERMS <a href="/service/mailto:reviews-bq@articulate-bot-510.iam.gserviceaccount.com">my-gcp-project</a>:<em>dataset-x</em></pre><p>The access part of the edited file could look as follow, with no more <em>specialGroup</em> :</p><pre> “access”: [<br> {<br> “role”: “WRITER”,<br> “userByEmail”: “<em>foo</em><a href="/service/mailto:reviews-bq@articulate-bot-510.iam.gserviceaccount.com">@my-gcp-project.iam.gserviceaccount.com</a>”<br> },<br> {<br> “role”: “OWNER”,<br> “userByEmail”: “<a href="/service/mailto:kathy.jay@yourgolftravel.com">jean.bard@jeanmail.com</a>”<br> },<br> {<br> “role”: “READER”,<br> “userByEmail”: “<em>foo</em><a href="/service/mailto:reviews-bq@articulate-bot-510.iam.gserviceaccount.com">@my-gcp-project.iam.gserviceaccount.com</a>”<br> }<br> ]</pre><p><strong>Cross Accounts Permissions</strong></p><p>Our Big Query service accounts are defined in the “<a href="/service/mailto:reviews-bq@articulate-bot-510.iam.gserviceaccount.com">my-gcp-project</a>” project. To run a job running from another project, the gcloud configuration must be set up as follow :</p><pre>gcloud config set project &lt;PROJECT&gt;</pre><p>Alternatively, the “— project_id” must be provided to the “bq” command.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=600cbd7b0b93" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>