Jekyll2017-11-03T09:29:35+01:00https://blog.ganneff.de/Ganneff's Little BlogThoughts of a small and very unimportant Debian DeveloperJoerg Jaspertjoerg@ganneff.dehttps://blog.ganneff.de/Automated wifi login, update 22017-11-03T08:24:42+01:002017-11-03T08:24:42+01:00https://blog.ganneff.de/2017/11/more-wifi-login<p>Seems my blog lately just consist of updates to my automated login
script for the ICE wifi… But I do hate the entirely useless “Click a
button” crap, every day, twice. I’ve seen it once, now leave me alone,
please.</p>
<p>Updated script:</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c">#!/bin/bash</span>
<span class="c"># (Some) docs at</span>
<span class="c"># https://wiki.ubuntuusers.de/NetworkManager/Dispatcher/</span>
<span class="nv">IFACE</span><span class="o">=</span><span class="k">${</span><span class="nv">1</span><span class="k">:-</span><span class="s2">"none"</span><span class="k">}</span>
<span class="nv">ACTION</span><span class="o">=</span><span class="k">${</span><span class="nv">2</span><span class="k">:-</span><span class="s2">"up"</span><span class="k">}</span>
<span class="nv">TMPDIR</span><span class="o">=</span><span class="k">${</span><span class="nv">TMPDIR</span><span class="k">:-</span><span class="s2">"/tmp"</span><span class="k">}</span>
<span class="nv">WGET</span><span class="o">=</span><span class="s2">"/usr/bin/wget"</span>
<span class="nv">TIMEOUT</span><span class="o">=</span><span class="s2">"/usr/bin/timeout -k 20 15"</span>
<span class="k">case</span> <span class="k">${</span><span class="nv">ACTION</span><span class="k">}</span> <span class="k">in
</span>up<span class="p">)</span>
<span class="nv">CONID</span><span class="o">=</span><span class="k">${</span><span class="nv">CONNECTION_ID</span><span class="k">:-$(</span>iwconfig <span class="nv">$IFACE</span> | grep ESSID | cut -d<span class="s2">":"</span> -f2 | sed <span class="s1">'s/^[^"]*"\|"[^"]*$//g'</span><span class="k">)}</span>
<span class="k">if</span> <span class="o">[[</span> <span class="k">${</span><span class="nv">CONID</span><span class="k">}</span> <span class="o">==</span> WIFIonICE <span class="o">]]</span>; <span class="k">then
</span><span class="nv">REFERER</span><span class="o">=</span><span class="s2">"http://www.wifionice.de/de/"</span>
<span class="nv">LOGIN</span><span class="o">=</span><span class="s2">"http://www.wifionice.de/de/"</span>
<span class="nv">COOKIETMP</span><span class="o">=</span><span class="k">$(</span>mktemp -p <span class="k">${</span><span class="nv">TMPDIR</span><span class="k">}</span> nmwifionice.XXXXXXXXX<span class="k">)</span>
<span class="nb">trap</span> <span class="s2">"rm -f </span><span class="k">${</span><span class="nv">COOKIETMP</span><span class="k">}</span><span class="s2">"</span> EXIT TERM HUP INT QUIT
<span class="nv">csrftoken</span><span class="o">=</span><span class="k">$(${</span><span class="nv">TIMEOUT</span><span class="k">}</span> <span class="k">${</span><span class="nv">WGET</span><span class="k">}</span> -q -O - --keep-session-cookies --save-cookies<span class="o">=</span><span class="k">${</span><span class="nv">COOKIETMP</span><span class="k">}</span> --referer <span class="k">${</span><span class="nv">REFERER</span><span class="k">}</span> <span class="k">${</span><span class="nv">LOGIN</span><span class="k">}</span> | grep -oP <span class="s1">'CSRFToken"\ value="\K[0-9a-z]+'</span><span class="k">)</span>
<span class="k">if</span> <span class="o">[[</span> -z <span class="k">${</span><span class="nv">csrftoken</span><span class="k">}</span> <span class="o">]]</span>; <span class="k">then
</span><span class="nb">echo</span> <span class="s2">"CSRFToken is empty"</span>
<span class="nb">exit </span>0
<span class="k">fi
</span>sleep 1
<span class="k">${</span><span class="nv">TIMEOUT</span><span class="k">}</span> <span class="k">${</span><span class="nv">WGET</span><span class="k">}</span> -q -O - --load-cookies<span class="o">=</span><span class="k">${</span><span class="nv">COOKIETMP</span><span class="k">}</span> --post-data<span class="o">=</span><span class="s2">"login=true&amp;connect=connect&amp;CSRFToken=</span><span class="k">${</span><span class="nv">csrftoken</span><span class="k">}</span><span class="s2">"</span> --referer <span class="k">${</span><span class="nv">REFERER</span><span class="k">}</span> <span class="k">${</span><span class="nv">LOGIN</span><span class="k">}</span> &gt;/dev/null
<span class="k">fi</span>
<span class="p">;;</span>
<span class="k">*</span><span class="p">)</span>
<span class="c"># We are not interested in this</span>
:
<span class="p">;;</span>
<span class="k">esac</span></code></pre></figure>
Seems my blog lately just consist of updates to my automated loginscript for the ICE wifi… But I do hate the entirely useless “Click abutton” crap, every day, twice. I’ve seen it once, now leave me alone,please.Automated wifi login, update2017-07-24T09:24:42+02:002017-07-24T09:24:42+02:00https://blog.ganneff.de/2017/07/automated-wifi-login-update<p>With recent changes the <a href="/2017/02/automated-wifi-login.html">automated login script</a>
for WifiOnICE stopped working. Fortunately a fix is easy, it is enough
to add a referrer header to the call and have de/ added to the url.</p>
<p>Updated script:</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c">#!/bin/bash</span>
<span class="c"># (Some) docs at</span>
<span class="c"># https://wiki.ubuntuusers.de/NetworkManager/Dispatcher/</span>
<span class="nv">IFACE</span><span class="o">=</span><span class="k">${</span><span class="nv">1</span><span class="k">:-</span><span class="s2">"none"</span><span class="k">}</span>
<span class="nv">ACTION</span><span class="o">=</span><span class="k">${</span><span class="nv">2</span><span class="k">:-</span><span class="s2">"up"</span><span class="k">}</span>
<span class="k">case</span> <span class="k">${</span><span class="nv">ACTION</span><span class="k">}</span> <span class="k">in
</span>up<span class="p">)</span>
<span class="nv">CONID</span><span class="o">=</span><span class="k">${</span><span class="nv">CONNECTION_ID</span><span class="k">:-$(</span>iwgetid <span class="s2">"</span><span class="k">${</span><span class="nv">IFACE</span><span class="k">}</span><span class="s2">"</span> -r<span class="k">)}</span>
<span class="k">if</span> <span class="o">[[</span> <span class="k">${</span><span class="nv">CONID</span><span class="k">}</span> <span class="o">==</span> WIFIonICE <span class="o">]]</span>; <span class="k">then</span>
/usr/bin/timeout -k 20 15 /usr/bin/wget -q -O - --referer http://www.wifionice.de/de/ http://www.wifionice.de/de/?login &gt; /dev/null
<span class="k">fi</span>
<span class="p">;;</span>
<span class="k">*</span><span class="p">)</span>
<span class="c"># We are not interested in this</span>
:
<span class="p">;;</span>
<span class="k">esac</span></code></pre></figure>
With recent changes the automated login scriptfor WifiOnICE stopped working. Fortunately a fix is easy, it is enoughto add a referrer header to the call and have de/ added to the url.Automated wifi login2017-02-23T21:32:42+01:002017-02-23T21:32:42+01:00https://blog.ganneff.de/2017/02/automated-wifi-login<p>If you have the <em>fortune</em> to need to follow some silly “Login” button
for some wifi, regularly, the following little script may help you
avoid this idiotic (and useless) task.</p>
<p>This example uses the <em>WIFIonICE</em>, the free wifi on german ICE trains,
simply as I have it twice a day, and got annoyed by the pointless
Login button. A friend pointed me at just wget-ting the login page, so
I made Network-Manager do this for me. Should work for anything
similar that doesn’t need some elaborate webform filled out.</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c">#!/bin/bash</span>
<span class="c"># (Some) docs at</span>
<span class="c"># https://wiki.ubuntuusers.de/NetworkManager/Dispatcher/</span>
<span class="nv">IFACE</span><span class="o">=</span><span class="k">${</span><span class="nv">1</span><span class="k">:-</span><span class="s2">"none"</span><span class="k">}</span>
<span class="nv">ACTION</span><span class="o">=</span><span class="k">${</span><span class="nv">2</span><span class="k">:-</span><span class="s2">"up"</span><span class="k">}</span>
<span class="k">case</span> <span class="k">${</span><span class="nv">ACTION</span><span class="k">}</span> <span class="k">in
</span>up<span class="p">)</span>
<span class="nv">CONID</span><span class="o">=</span><span class="k">${</span><span class="nv">CONNECTION_ID</span><span class="k">:-$(</span>iwconfig <span class="nv">$IFACE</span> | grep ESSID | cut -d<span class="s2">":"</span> -f2 | sed <span class="s1">'s/^[^"]*"\|"[^"]*$//g'</span><span class="k">)}</span>
<span class="k">if</span> <span class="o">[[</span> <span class="k">${</span><span class="nv">CONID</span><span class="k">}</span> <span class="o">==</span> WIFIonICE <span class="o">]]</span>; <span class="k">then</span>
/usr/bin/timeout -k 20 15 /usr/bin/wget -q -O - http://www.wifionice.de/?login &gt; /dev/null
<span class="k">fi</span>
<span class="p">;;</span>
<span class="k">*</span><span class="p">)</span>
<span class="c"># We are not interested in this</span>
:
<span class="p">;;</span>
<span class="k">esac</span></code></pre></figure>
<p>This script needs to be put into <em>/etc/NetworkManager/dispatcher.d</em>
and made executable, owned by the root user. It will run on every
connection change, thats why the ACTION is checked. The case may be a
bit much here, but it could be easily extended to do a lot more.</p>
<p>Yay, no more silly “Open this webpage and press login” crap.</p>
If you have the fortune to need to follow some silly “Login” buttonfor some wifi, regularly, the following little script may help youavoid this idiotic (and useless) task.New gnupg-agent in Debian2016-08-25T11:55:38+02:002016-08-25T11:55:38+02:00https://blog.ganneff.de/2016/08/new-gnupg-agent-in-debian<p>In case you just upgraded to the latest <a href="https://packages.debian.org/gnupg-agent ">gnupg-agent </a> and
used gnupg-agent as your ssh-agent you may find that ssh refuses to
work with a simple but not helpful</p>
<p><em>sign_and_send_pubkey: signing failed: agent refused operation</em></p>
<p>This seems to come from <a href="https://packages.debian.org/systemd ">systemd </a> starting the agent, no
longer a script at the start of the X session. And so it ends up with
either no or an unusable tty. A simple</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">gpg-connect-agent updatestartuptty /bye</code></pre></figure>
<p>updates that and voila, ssh agent functionality is back in.</p>
<p><em>Note</em>: This assumes you have “enable-ssh-support” in your ~/.gnupg/gpg-agent.conf</p>
In case you just upgraded to the latest gnupg-agent andused gnupg-agent as your ssh-agent you may find that ssh refuses towork with a simple but not helpfulRemoving checksums2016-03-15T23:37:55+01:002016-03-15T23:37:55+01:00https://blog.ganneff.de/2016/03/removing-checksums<p>And as just <a href="https://lists.debian.org/debian-devel-announce/2016/03/msg00006.html" title="Debian Devel Announcement list">announced on d-d-a</a>, I’m trying to break all the tools
dealing with the (Debian) archive. Or something like it. But its about
time to get rid of MD5Sum checksums, and SHA1 can go with it directly.</p>
<p>As it is only in experimental for now, we can test and see what still
breaks. I hope it won’t be too much, so we can get it over all the
archive (minus the stable stuff, of course).</p>
<p>For some reason, what I like most in this change is the following
python code that ended up in our InRelease file generation tool:</p>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="kn">import</span> <span class="nn">apt_pkg</span>
<span class="c"># Note: suite.checksums being an array with possible values of md5sum, sha1, sha256</span>
<span class="n">hashfuncs</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="nb">zip</span><span class="p">([</span><span class="n">x</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s">'UM'</span><span class="p">,</span> <span class="s">'um'</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">suite</span><span class="o">.</span><span class="n">checksums</span><span class="p">],</span>
<span class="p">[</span><span class="nb">getattr</span><span class="p">(</span><span class="n">apt_pkg</span><span class="p">,</span> <span class="s">"</span><span class="si">%</span><span class="s">s"</span> <span class="o">%</span> <span class="p">(</span><span class="n">x</span><span class="p">))</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="p">[</span><span class="n">x</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s">"sum"</span><span class="p">,</span> <span class="s">""</span><span class="p">)</span> <span class="o">+</span> <span class="s">"sum"</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">suite</span><span class="o">.</span><span class="n">checksums</span><span class="p">]]))</span></code></pre></figure>
<p>Though I’m sure this can be done in much more readable ways, it’s
doing what we need, but heck, took me a while to get it.</p>
<p>But probably the change to get rid of gzip will be much more
challenging / hard to get through. Lets see, in the few minutes after
my mail, I already got some notices about possible breakage here.</p>
<p>Fortunately those indices and the release file stuff are nicely
seperated settings, so if it turns out we only take the checksums drop
for now into the other suites, thats doable.</p>
And as just announced on d-d-a, I’m trying to break all the toolsdealing with the (Debian) archive. Or something like it. But its abouttime to get rid of MD5Sum checksums, and SHA1 can go with it directly.Squeeze fully archived2016-03-08T22:48:48+01:002016-03-09T22:45:00+01:00https://blog.ganneff.de/2016/03/squeeze-fully-archived<p>While writing this, the last bits of squeeze that haven’t been on
archive.debian.org yet are moved over there, that is security and the
lts suite. As soon as that script done, some tiny archive magic will
happen and over the next few dinstall runs, the rest of squeeze that
still was there will no longer be on our regular mirror network
anymore.</p>
<p>If you still use it, now is the time to upgrade.</p>
<p><em>Update</em>: Forgot to mention, but yes, squeeze-backports(-sloppy) is
also archived on archive.debian.org.</p>
While writing this, the last bits of squeeze that haven’t been onarchive.debian.org yet are moved over there, that is security and thelts suite. As soon as that script done, some tiny archive magic willhappen and over the next few dinstall runs, the rest of squeeze thatstill was there will no longer be on our regular mirror networkanymore.New ftpsync release2016-03-06T22:36:24+01:002016-03-06T22:36:24+01:00https://blog.ganneff.de/2016/03/new-ftpsync-release<p>It took nearly a year, but today a <a href="https://lists.debian.org/debian-mirrors/2016/03/msg00000.html">new ftpsync version</a> got released.
Most of the work for this release was done by weasel, with one new
feature submitted by waldi, my work was mostly style fixes and a bit
of documentation. And of course the release now.</p>
<p>If you run a mirror, you will find the new version at the usual place,
that is the <em>project/ftpsync/</em> subdirectory. You may also want to
subscribe to the <a href="https://lists.debian.org/debian-mirrors/">debian mirrors</a> mailinglist, as the mirror team will
post more information about changes in ftpsync there.</p>
It took nearly a year, but today a new ftpsync version got released.Most of the work for this release was done by weasel, with one newfeature submitted by waldi, my work was mostly style fixes and a bitof documentation. And of course the release now.tmux - tm2013-07-17T16:49:06+02:002013-07-17T16:49:06+02:00https://blog.ganneff.de/2013/07/tmux_-_tm_1<p>Wohoo, one more in that
<a href="/2013/03/tmux---like-screen-just-nicer.html">little</a>
<a href="/2013/03/tmux---tm.html">series</a>
<a href="/2013/04/tmux---tm-update.html">of</a> mine,
another update to tm.</p>
<p>This time it gained getopts style options - while retaining the “old”
non-getopts style. It now can open more than one multisession to the
same set of hosts, so you can connect multiple times to “host1 host2”
at the same time. No matter if you open them using the “ms” subcommand
or the pre-defined sessions from the .tmux.d directory.</p>
<p>I also took a bit and wrote some zsh completion for it. I’m pretty
sure this can be done better and am happy for patches, but it does
work for me, so for now I’m happy.</p>
<p>You can, as usual, grab tm from <a href="http://git.ganneff.de/cgi-bin/gitweb.cgi?p=misc.git;a=blob;f=bin/tm;hb=HEAD">my misc git
repository</a>,
the zsh completion is in my <a href="http://git.ganneff.de/cgi-bin/gitweb.cgi?p=zsh.git;a=blob;f=.zsh/functions/_tm;hb=HEAD">zsh config
repository</a></p>
<ul>
<li>also at <a href="https://github.com/Ganneff/zsh/blob/master/.zsh/functions/_tm">Github</a>.</li>
</ul>
Wohoo, one more in thatlittleseriesof mine,another update to tm.Wheezy release2013-05-04T20:26:03+02:002013-05-04T20:26:03+02:00https://blog.ganneff.de/2013/05/wheezy_release<p>There was <a href="/2009/02/14/lenny-release.html">Lenny</a>, there was <a href="/2011/02/squeeze-release.html">Squeeze</a>, now there is Wheezy.</p>
<p>Another major release of Debian where I had the pleasure to do the ftpmaster work for the release. Like the last times, Mark joined to help with the work. But 2 FTPMasters aren’t enough for one Wheezy, or so, so Ansgar had his first run aside from point releases.</p>
<p>With the whole load of work the release team did in the past to prepare this, combined with all the changes in dak we had since Squeeze, it turned out to be rather easy for us.</p>
<p>Again, a few moments and not a detailed log (times in CEST):</p>
<ul>
<li>
<p>[10:45] Let’s prepare. Cronjobs go off on ftp-master and security, shared tmux session setup, including a live pipe into a file so other team members can follow using “less +F -R”, a titanpad page opened to share in writing the commands to process later.</p>
</li>
<li>
<p>[11:18] One last package update done manually. The latest and greatest of installation-guide, 20130503, really wants to join the rest in wheezy.</p>
</li>
<li>
<p>[12:00] While I did a database backup and started preparing the set of commands for later, Mark and Ansgar prepared our code to deal with the changes we are about to make.</p>
</li>
<li>
<p>[12:33] I start executing the commands (shell and sql), so somewhen after here we have Squeeze as oldstable (with all its extra suites also renamed), Wheezy as stable (taking its own suites with it, as well as gaining the -updates).</p>
<p>And Jessie starts its life.</p>
</li>
<li>
<p>[12:45] Heissa, wouldn’t be fun if we wouldn’t have some bugs, so we just created a load of directories not needed or wanted. Not getting Jessies either. Ohwell.</p>
</li>
<li>
<p>[13:00] Jessie gets a copy of Wheezy to start with. Made the mistake to try that with our usual tool, control-suite. Err. Wrong. This is doing a set of checks on each package inserted. Would take ages. While one SQL to bypass the checks was a minute or so.</p>
</li>
<li>
<p>[13:xx] Got annoyed by our concept of consistency. Its great. Every tool takes suite names/codenames in a different way. Seperated with spaces, with commas, with codenames, with suitenames, we mix it in all possible combinations.</p>
</li>
<li>
<p>[14:00] Ansgar finished updating our security master host to cope with the changes for the release.</p>
</li>
<li>
<p>[14:39] Squeeze Release files got regenerated and signed again.</p>
</li>
<li>
<p>[14:54] Wheezy Release files got generated and signed.</p>
</li>
<li>
<p>[15:05] The cd build machine has a synced mirror tree, so they can start building our CD/DVD images</p>
</li>
<li>
<p>[16:25] A manual dinstall finished. And while it had some small problems (including nearly overwriting something inside the wheezy dists/ tree), it went pretty smoothly.</p>
</li>
<li>
<p>[21:00] After having kept the archive turned off for the whole day, we have 90 uploads with ~3Gb of uploads waiting. As it is now unlikely that we need larger archive changes, we turn (most of) our cronjobs back on, to get them processed.</p>
</li>
</ul>
<p>Right now (that is, 21:08 CEST) I am mostly waiting for the CD build to finish. Current schedule seems to have that in some two and a half hours, after which we can push the mirrors and our press people announce it. Except if Murphy wants to show up, but lets hope that not.</p>
<p>Thanks go out to everyone involved in preparing this release, be it in the past by fixing bugs, uploading packages, doing whatever was needed, as well as doing the work today.</p>
There was Lenny, there was Squeeze, now there is Wheezy.tmux - tm update2013-04-17T10:43:31+02:002013-04-17T10:43:31+02:00https://blog.ganneff.de/2013/04/tmux_-_tm_update<p>Just did a small update to my tm helper script.</p>
<p>There is now a new variable, TMSESSHOST. If that is set to false, the hostname
of the current machine won’t be prepended to the generated session name. true is the default, as that was the behaviour in the past.</p>
<p>It now can attach to any session, not just the ones it created itself, thus nearly entirely removing my need of ever calling tmux directly.</p>
<p>And cosmetically - window names for sessions defined in the .tmux.d directory are no longer plain “Multisession”, but the session name as defined in the file.</p>
<p>If you are interested, you can get it <a href="http://git.ganneff.de/cgi-bin/gitweb.cgi?p=misc.git;a=blob;f=bin/tm;hb=HEAD">over here from my git repository of misc stuff</a></p>
Just did a small update to my tm helper script.