<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Quis custodiet ipsos custodes?</title>
	<atom:link href="https://cynici.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://cynici.wordpress.com</link>
	<description>Death: To stop sinning suddenly -- Elbert Hubbard (1856-1915)</description>
	<lastBuildDate>Thu, 08 Dec 2022 11:05:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<site xmlns="com-wordpress:feed-additions:1">1551904</site><cloud domain='cynici.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>https://s0.wp.com/i/buttonw-com.png</url>
		<title>Quis custodiet ipsos custodes?</title>
		<link>https://cynici.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="https://cynici.wordpress.com/osd.xml" title="Quis custodiet ipsos custodes?" />
	<atom:link rel='hub' href='https://cynici.wordpress.com/?pushpress=hub'/>
	<item>
		<title>Unlocking screen takes forever on Linux</title>
		<link>https://cynici.wordpress.com/2022/12/08/unlocking-screen-takes-forever-on-linux/</link>
					<comments>https://cynici.wordpress.com/2022/12/08/unlocking-screen-takes-forever-on-linux/#respond</comments>
		
		<dc:creator><![CDATA[cynici]]></dc:creator>
		<pubDate>Thu, 08 Dec 2022 11:05:58 +0000</pubDate>
				<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[linux]]></category>
		<guid isPermaLink="false">http://cynici.wordpress.com/?p=987</guid>

					<description><![CDATA[This happened to me with Ubuntu Jammy 22.04 on a MSI laptop with NVIDIA card. Read on for the solution https://cynici.github.io/2022/12/08/slow-screen-unlock.html]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">This happened to me with Ubuntu Jammy 22.04 on a MSI laptop with NVIDIA card.</p>



<p class="wp-block-paragraph">Read on for the solution <a href="https://cynici.github.io/2022/12/08/slow-screen-unlock.html" rel="nofollow">https://cynici.github.io/2022/12/08/slow-screen-unlock.html</a></p>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
					<wfw:commentRss>https://cynici.wordpress.com/2022/12/08/unlocking-screen-takes-forever-on-linux/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">987</post-id>
		<media:content url="https://2.gravatar.com/avatar/8236f09362d67e08ce48220f632f66189ce250afad2a45752b6032b028e78286?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cynici</media:title>
		</media:content>
	</item>
		<item>
		<title>Touchpad intermittent malfunction on on Linux</title>
		<link>https://cynici.wordpress.com/2020/10/17/touchpad-intermittent-malfunction-on-on-linux/</link>
					<comments>https://cynici.wordpress.com/2020/10/17/touchpad-intermittent-malfunction-on-on-linux/#respond</comments>
		
		<dc:creator><![CDATA[cynici]]></dc:creator>
		<pubDate>Sat, 17 Oct 2020 05:39:06 +0000</pubDate>
				<category><![CDATA[tips]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[opensuse]]></category>
		<category><![CDATA[tumbleweed]]></category>
		<guid isPermaLink="false">http://cynici.wordpress.com/?p=976</guid>

					<description><![CDATA[The touchpad on my new laptop running Linux 5.8.14-1 openSUSE Tumbleweed 20201009 failed to work intermittently. The symptom appeared already in the graphical login screen; the pointer won’t respond to the touchpad and appeared stuck in the middle on the screen. dmesg output would show this error: When this happened, I had to reboot repeatedly [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">The touchpad on my new laptop running Linux 5.8.14-1 <a href="https://software.opensuse.org/distributions/tumbleweed">openSUSE Tumbleweed</a> 20201009 failed to work intermittently. The symptom appeared already in the graphical login screen; the pointer won’t respond to the touchpad and appeared stuck in the middle on the screen.</p>



<p class="wp-block-paragraph"><code>dmesg</code> output would show this error:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
&#91;    2.984796] i2c_hid i2c-UNIW0001:00: HID over i2c has not been provided an Int IRQ
&#91;    2.984864] i2c_hid: probe of i2c-UNIW0001:00 failed with error -22

</pre></div>


<p class="wp-block-paragraph">When this happened, I had to reboot repeatedly until I could move the pointer on the login screen using the touchpad.</p>



<h2 class="wp-block-heading" id="laptop-hardware">Laptop hardware</h2>



<p class="wp-block-paragraph"><a href="https://www.wootware.co.za/wootbook-metal-ii-pf4nu1f-amd-ryzen-7-4800h-2-9ghz-octa-core-14-full-hd-1920x1080-ips-space-black-laptop.html">WootBook Metal II PF4NU1F</a> AMD Ryzen 7 4800H 2.9GHz Octa Core 14” Full HD (1920&#215;1080) IPS Space Black Laptop rebranded from Tongfang PF4NU1F made by a company in China.</p>



<p class="wp-block-paragraph">This hardware is also sold with different names in other markets, <a href="https://www.reddit.com/r/AMDLaptops/comments/hzlcjo/all_of_the_vendors_that_are_offering_the_tongfang/">https://www.reddit.com/r/AMDLaptops/comments/hzlcjo/all_of_the_vendors_that_are_offering_the_tongfang/</a> E.g.:</p>



<ul class="wp-block-list"><li>Eluktronics THINN-15</li><li>Schenker VIA 15 Pro</li><li>TUXEDO Pulse 14”/15”</li><li>PCZ 14” Fusion Pro</li><li>Juno Computer (Linux) Aurora 15</li><li>Slimbook (Linux) Slimbook Pro X 14”/15” (AMD)</li><li>Slimbook (Linux) KDE Slimbook 14”/15”</li><li>LaptopwithLinux PF4NU1F (14”) / PF5NU1G (15”)</li><li>Skikk 15GRR1</li><li>Laptopparts4less Tongfang PF4NU1F (14”) / PF5NU1G (15”)</li><li>RaionTech RaionBook UB1R (14”)</li><li>Mechrevo Mechrevo S2 Air (14”)</li><li>Mechrevo Mechrevo Code 01 (15”)</li><li>Monsterlabs/Hansung TFX44-0H (14”)</li><li>Monsterlabs/Hansung TFX54-0H (15”)</li><li>Illegear Ionic 15 Ryzen</li><li>Commandos Helium 5 Ryzen</li></ul>



<h2 class="wp-block-heading" id="solution">Solution</h2>



<p class="wp-block-paragraph">Thanks to Jeroen Jeurissen sharing <a href="https://bugzilla.suse.com/show_bug.cgi?id=1177049#c4">his solution</a> on <a href="https://bugzilla.kernel.org/show_bug.cgi?id=209413#c8">linux kernel bugzilla</a></p>



<p class="wp-block-paragraph">I saved and compared <code>lsmod</code> output in both cases &#8211; fell back to terminal using Control+Alt+F2 hotkey when the touchpad malfunctioned. The kernel modules <code>hid_i2c</code> and <code>hid_generic</code> were absent when the touchpad didn’t work.</p>



<p class="wp-block-paragraph">Based on Jeroen’s solution for Elan touchpad, I created <code>/etc/modules-load.d/99_touchpad.conf</code></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
softdep hid_i2c pre: pinctrl_amd
softdep hid_generic pre: pinctrl_amd

</pre></div>


<p class="wp-block-paragraph">Didn&#8217;t work unfortunately. Second attempt,</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
sudo rmmod i2c_hid
sudo modprobe i2c_hid
</pre></div>


<h3 class="wp-block-heading">2020-10-25 update</h3>



<p class="wp-block-paragraph">So, my final solution on openSUSE Tumbleweed:</p>



<ol class="wp-block-list"><li><a href="https://www.linuxbabe.com/linux-server/how-to-enable-etcrc-local-with-systemd">Enable rc.local</a></li><li>Create /etc/rc.local</li></ol>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
#! /usr/bin/env bash

if lsmod | grep -q i2c_hid ; then
    echo "Touch pad detected."
else
    rmmod i2c_hid
    modprobe i2c_hid
fi
</pre></div>]]></content:encoded>
					
					<wfw:commentRss>https://cynici.wordpress.com/2020/10/17/touchpad-intermittent-malfunction-on-on-linux/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">976</post-id>
		<media:content url="https://2.gravatar.com/avatar/8236f09362d67e08ce48220f632f66189ce250afad2a45752b6032b028e78286?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cynici</media:title>
		</media:content>
	</item>
		<item>
		<title>A python psycopg2 quirk</title>
		<link>https://cynici.wordpress.com/2019/04/10/a-python-psycopg2-quirk/</link>
					<comments>https://cynici.wordpress.com/2019/04/10/a-python-psycopg2-quirk/#respond</comments>
		
		<dc:creator><![CDATA[cynici]]></dc:creator>
		<pubDate>Wed, 10 Apr 2019 06:01:01 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[python]]></category>
		<guid isPermaLink="false">http://cynici.wordpress.com/?p=974</guid>

					<description><![CDATA[psycopg2 is the de-facto Python module to interface with PostgreSQL database but it has a quirk you ought to beware of. Parameterized query is the recommended way to modify your SQL statement programmatically where you could sprinkle your SQL statement with variable placeholders like %s or %(myvar)s. But, if the statement happens to use any [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>psycopg2 is the de-facto Python module to interface with PostgreSQL database but it has a quirk you ought to beware of.</p>
<p>Parameterized query is the recommended way to modify your SQL statement programmatically where you could sprinkle your SQL statement with variable placeholders like <code class="docutils literal notranslate"><span class="pre">%s</span></code> or <code class="docutils literal notranslate"><span class="pre">%(myvar)s</span></code>. But, if the statement happens to use any ILIKE operator e.g. <code class="docutils literal notranslate"><span class="pre">'%pattern%'</span></code>, you must escape every occurrence of <code class="docutils literal notranslate"><span class="pre">%</span></code> in your operand with <code class="docutils literal notranslate"><span class="pre">%%</span></code>, i.e. <code class="docutils literal notranslate"><span class="pre">'%%pattern%%'</span></code>. Otherwise psycopg2 will throw the exception error message “<strong>argument formats can&#8217;t be mixed</strong>”.</p>
<p>This <em>feature</em> is actually mentioned in the documentation, <a href="http://initd.org/psycopg/docs/usage.html#passing-parameters-to-sql-queries" rel="nofollow">http://initd.org/psycopg/docs/usage.html#passing-parameters-to-sql-queries</a></p>
<blockquote><p>When parameters are used, in order to include a literal <code class="docutils literal notranslate"><span class="pre">%</span></code> in the query you can use the <code class="docutils literal notranslate"><span class="pre">%%</span></code> string</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://cynici.wordpress.com/2019/04/10/a-python-psycopg2-quirk/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">974</post-id>
		<media:content url="https://2.gravatar.com/avatar/8236f09362d67e08ce48220f632f66189ce250afad2a45752b6032b028e78286?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cynici</media:title>
		</media:content>
	</item>
		<item>
		<title>Customize screensaver on Lubuntu 18.04</title>
		<link>https://cynici.wordpress.com/2019/02/25/customize-screensaver-on-lubuntu-18-04/</link>
					<comments>https://cynici.wordpress.com/2019/02/25/customize-screensaver-on-lubuntu-18-04/#respond</comments>
		
		<dc:creator><![CDATA[cynici]]></dc:creator>
		<pubDate>Mon, 25 Feb 2019 02:54:04 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">http://cynici.wordpress.com/?p=970</guid>

					<description><![CDATA[On minimal-install Lubuntu 18.04.5, the default timeout for the screensaver to activate is 5 seconds, which is too short for my liking. Took me a roundabout to learn that the screensaver settings is hidden in Xfce Power Manager (Preferences / Power Manager). If you have replaced the default Desktop Manager with something else, you might [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>On minimal-install Lubuntu 18.04.5, the default timeout for the screensaver to activate is 5 seconds, which is too short for my liking.</p>
<p>Took me a roundabout to learn that the screensaver settings is hidden in <strong>Xfce Power Manager</strong> (Preferences / Power Manager).</p>
<p>If you have replaced the default Desktop Manager with something else, you might need to download and install the following packages to customize its settings.</p>
<pre>sudo apt install python-gi light-locker-settings</pre>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cynici.wordpress.com/2019/02/25/customize-screensaver-on-lubuntu-18-04/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">970</post-id>
		<media:content url="https://2.gravatar.com/avatar/8236f09362d67e08ce48220f632f66189ce250afad2a45752b6032b028e78286?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cynici</media:title>
		</media:content>
	</item>
		<item>
		<title>Configure Postfix to authenticate clients against LDAP</title>
		<link>https://cynici.wordpress.com/2018/12/03/configure-postfix-to-authenticate-clients-against-ldap/</link>
					<comments>https://cynici.wordpress.com/2018/12/03/configure-postfix-to-authenticate-clients-against-ldap/#respond</comments>
		
		<dc:creator><![CDATA[cynici]]></dc:creator>
		<pubDate>Mon, 03 Dec 2018 09:56:31 +0000</pubDate>
				<category><![CDATA[sysadm]]></category>
		<category><![CDATA[linux]]></category>
		<guid isPermaLink="false">http://cynici.wordpress.com/?p=961</guid>

					<description><![CDATA[How to set up a SMTP relay without mailboxes using Postfix? From http://www.postfix.org/SMTPD_ACCESS_README.html By default, Postfix has a moderately restrictive approach to mail relaying. Postfix forwards mail only from clients in trusted networks, from clients that have authenticated with SASL, or to domains that are configured as authorized relay destinations. It took me awhile to [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>How to set up a SMTP relay without mailboxes using Postfix?</p>
<p>From <a href="http://www.postfix.org/SMTPD_ACCESS_README.html">http://www.postfix.org/SMTPD_ACCESS_README.html</a></p>
<blockquote><p>By default, Postfix has a moderately restrictive approach to mail relaying. Postfix forwards mail only from clients in trusted networks, from clients that have authenticated with SASL, or to domains that are configured as authorized relay destinations.</p></blockquote>
<p>It took me awhile to figure out how to get Postfix on my CentOS 7 box to support SMTP AUTH over TLS and authenticate SMTP users via LDAP. In this setup, I am using SSL certificate issued by <a href="https://letsencrypt.org/getting-started/">LetsEncrypt</a>.</p>
<p>Initially, I had wanted to configure saslauthd (provided by cyrus-sasl) to authenticate against LDAP directory server but couldn&#8217;t get it to work. I ended up letting saslauthd authenticate via PAM-LDAP (nslcd provided by nss-pam-ldapd).</p>
<h3>Required packages</h3>
<ul>
<li>postfix</li>
<li>cyrus-sasl</li>
<li>cyrus-sasl-plain</li>
<li>nss-pam-ldapd</li>
<li>openldap-clients    # optional, for testing LDAP configuration</li>
<li>telnet    # optional, for testing postfix</li>
</ul>
<h3>Edit /etc/postfix/main.cf</h3>
<pre>smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_type = cyrus
smtpd_sasl_path = smtpd
smtpd_sasl_security_options = noanonymous
smtpd_tls_loglevel = 1
smtpd_tls_security_level = may
# When TLS layer encryption is optional ("smtpd_tls_security_level = may"), 
# it may however still be useful to only offer AUTH when TLS is active 
# to avoid sending AUTH data over unencrypted channel.
smtpd_tls_auth_only = yes
smtpd_tls_cert_file=/etc/pki/tls/certs/fullchain.pem
smtpd_tls_key_file=/etc/pki/tls/private/privkey.pem
smtpd_tls_received_header = yes

smtpd_relay_restrictions = permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination</pre>
<h3>Edit /etc/sysconfig/saslauthd</h3>
<pre># Couldn't get this to work. Resort to PAM instead. :-(
#MECH=ldap
MECH=pam</pre>
<h3>Edit /etc/nslcd.conf, set variables where applicable</h3>
<pre>uri 
base
binddn
bindpw
scope
filter
map</pre>
<h3>Edit /etc/pam.d/smtp.postfix</h3>
<pre>#%PAM-1.0
auth required pam_ldap.so debug
account required pam_ldap.so debug</pre>
<h2>Procedure</h2>
<ol>
<li>Save LetsEncrypt fullchain.pem in <tt>/etc/pki/tls/certs/</tt>, owner root, mode 0444</li>
<li>Save LetsEncrypt privkey.pem in <tt>/etc/pki/tls/private/</tt>, owner root, mode 0400</li>
<li><tt>sudo systemctl enable nslcd saslauthd postfix</tt></li>
<li><tt>sudo systemctl start nslcd saslauthd postfix</tt></li>
<li>Check for service error with <tt>sudo journalctl -f</tt></li>
<li>Test saslauthd-PAM-LDAP, <tt>testsaslauthd -u {ldap_mail_user} -p {ldap_mail_user_password} -s smtp</tt></li>
<li>Test postfix STARTTLS, <a href="https://qmail.jms1.net/test-auth.shtml" rel="nofollow">https://qmail.jms1.net/test-auth.shtml</a></li>
</ol>
]]></content:encoded>
					
					<wfw:commentRss>https://cynici.wordpress.com/2018/12/03/configure-postfix-to-authenticate-clients-against-ldap/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">961</post-id>
		<media:content url="https://2.gravatar.com/avatar/8236f09362d67e08ce48220f632f66189ce250afad2a45752b6032b028e78286?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cynici</media:title>
		</media:content>
	</item>
		<item>
		<title>Restrict SSH to rsync and scp to one specific internal server via bastion host</title>
		<link>https://cynici.wordpress.com/2018/06/07/restrict-ssh-to-rsync-and-scp-to-specific-internet-server-on-bastion-host/</link>
					<comments>https://cynici.wordpress.com/2018/06/07/restrict-ssh-to-rsync-and-scp-to-specific-internet-server-on-bastion-host/#respond</comments>
		
		<dc:creator><![CDATA[cynici]]></dc:creator>
		<pubDate>Thu, 07 Jun 2018 09:35:05 +0000</pubDate>
				<category><![CDATA[sysadm]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[tips]]></category>
		<guid isPermaLink="false">http://cynici.wordpress.com/?p=947</guid>

					<description><![CDATA[Scenario Every so often, an external data provider needs to copy files from his server (A) to an internal server (C) which I manage through a SSH bastion host (B) which I do not manage. So, I want to restrict A to using rsync or scp to C via B, and nothing else, i.e. A [&#8230;]]]></description>
										<content:encoded><![CDATA[<h3>Scenario</h3>
<p>Every so often, an external data provider needs to copy files from his server (A) to an internal server (C) which I manage through a SSH bastion host (B) which I do not manage. So, I want to restrict A to using rsync or scp to C via B, and nothing else, i.e.</p>
<ul>
<li>A must not get a shell on B or C</li>
<li>A knows absolutely nothing about C</li>
<li>A cannot change the destination server, i.e. no ProxyCommand</li>
</ul>
<h3>Solution</h3>
<ul>
<li>Install and configure rssh on C</li>
<li>Create a dedicated login account on C, e.g. joe, for receiving incoming files using rssh as the login shell</li>
<li>Set password for C because on systems like Ubuntu, account is locked unless it has a password set.</li>
<li>Ensure that <tt>AllowUsers</tt> or <tt>AllowGroups</tt> directives, if present in <tt>/etc/ssh/sshd_config</tt>, includes C</li>
<li>Add a custom script on B to be run from authorized_keys of my login account on B, e.g. proxy@B</li>
<li>Generate a dedicated SSH key pair for proxy@B and authorize this new key to ssh to joe@C</li>
</ul>
<h3>Install and configure rssh on C</h3>
<ul>
<li>Follow instructions on <a href="https://ubuntuforums.org/showthread.php?t=1929414">https://ubuntuforums.org/showthread.php?t=1929414</a></li>
<li>Slight deviation from the article
<ul>
<li>No need to set password for destination owner, joe</li>
<li>No need to configure rsyslogd</li>
<li>Edit <code>/etc/rssh.conf</code> to include these lines
<pre>allowscp
allowrsync
user=joe:077:100110:/home/chroot
</pre>
</li>
<li>Out of the box, despite the configurable options in <code>/etc/rssh.conf</code>, rssh only actually works for scp and not rsync &#8211; rsync fails to run in chroot environment because it needs additional dynamic libraries not included by <code>mkchroot.sh</code></li>
</ul>
</li>
<li>How to make rsync run in chroot environment?
<ul>
<li>Identify the libraries required by rsync using <code>ldd /usr/bin/rsync</code> and copy all of them to the corresponding directory in /home/chroot/&#8230;</li>
<li>Be sure to copy the actual file and its symlink are both copied over</li>
<li>On Ubuntu system, <code>chmod 4755 /usr/lib/rssh/rssh_chroot_helper</code> otherwise your SSH session will authenticate successfully but mysteriously abort with this error message logged to syslog <tt>rssh_chroot_helper: chroot() failed, 1: Operation not permitted</tt> (<a href="https://ubuntuforums.org/archive/index.php/t-1178391.html" rel="nofollow">https://ubuntuforums.org/archive/index.php/t-1178391.html</a>)</li>
</ul>
</li>
</ul>
<h3>Add a custom script on B</h3>
<p>Say my login username on the bastion host is called <code>proxy</code></p>
<p>Generate a dedicated SSH key pair for this purpose, say</p>
<ul>
<li><code>/home/proxy/.ssh/copyfiles</code></li>
<li><code>/home/proxy/.ssh/copyfiles.pub</code></li>
</ul>
<p>Authorize the public key in <code>/home/chroot/home/joe/.ssh/authorized_keys</code> on destination server C.</p>
<p>Save the script as <code>/home/proxy/sshcmd.sh</code> and chmod ugo+x.</p>
<pre>#! /bin/sh
#
# Used by specific SSH authorized_keys as command
# Restrict to commands literrally beginning with 'scp' or 'rsync'
#
echo "${SSH_ORIGINAL_COMMAND:-}" | grep -qE '^(scp|rsync) '
if [ $? -eq 0 ] ; then
    ssh -i ~/.ssh/copyfile joe@C $SSH_ORIGINAL_COMMAND
else
    echo Access Denied
fi
</pre>
<p>Get the SSH public key from the data provider. The provider will use the corresponding SSH private key on A to initiate rsync or scp.</p>
<p>Append into <code>/home/proxy/.ssh/authorized_keys</code> where ellipsis below denotes the content of the SSH public key file.</p>
<pre>command="./sshcmd.sh",no-agent-forwarding,no-pty,no-user-rc,no-X11-forwarding ...
</pre>
<h3>Gotcha</h3>
<p>When specifying the destination in the scp/rsync argument, the data provider should not use &#8216;~&#8217; because it gets expanded incorrectly as <code>/home/chroot/home/euracedu</code>.</p>
<p>Let&#8217;s say the SSH key on A is named <code>akey</code> and the file to copy over is named XXX:</p>
<pre>rsync -aruv -e "ssh -i akey" XXX proxy@B:./
scp -i akey XXX proxy@B:./
</pre>
<p>If SSH key authentication works fine, scp/sftp shows &#8220;lost connection&#8221; or rsync shows something like the following, double check that you have copied all libraries and symbolic links shown as dependencies by scp, sftp, rsync, etc. to the chroot subdirectory.</p>
<pre>
sync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.2]
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://cynici.wordpress.com/2018/06/07/restrict-ssh-to-rsync-and-scp-to-specific-internet-server-on-bastion-host/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">947</post-id>
		<media:content url="https://2.gravatar.com/avatar/8236f09362d67e08ce48220f632f66189ce250afad2a45752b6032b028e78286?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cynici</media:title>
		</media:content>
	</item>
		<item>
		<title>docker info rpc error on manager node</title>
		<link>https://cynici.wordpress.com/2018/05/31/docker-info-rpc-error-on-manager-node/</link>
					<comments>https://cynici.wordpress.com/2018/05/31/docker-info-rpc-error-on-manager-node/#comments</comments>
		
		<dc:creator><![CDATA[cynici]]></dc:creator>
		<pubDate>Thu, 31 May 2018 06:16:07 +0000</pubDate>
				<category><![CDATA[sysadm]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[docker]]></category>
		<guid isPermaLink="false">http://cynici.wordpress.com/?p=943</guid>

					<description><![CDATA[I have a Ubuntu Trusty 16.04.4 server which is a manager node of a docker swarm, running docker 18.03.1-ce. Let&#8217;s call it foobar. There are four other healthy managers in the swarm. After rebooting this server, it became dissociated from the swarm. docker node ls output: Error response from daemon: rpc error: code = Unknown desc [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I have a Ubuntu Trusty 16.04.4 server which is a manager node of a docker swarm, running docker 18.03.1-ce. Let&#8217;s call it <tt>foobar</tt>. There are four other healthy managers in the swarm.</p>
<p>After rebooting this server, it became dissociated from the swarm.</p>
<p><tt>docker node ls</tt> output:</p>
<blockquote><p>Error response from daemon: rpc error: code = Unknown desc = The swarm does not have a leader. It&#8217;s possible that too few managers are online. Make sure more than half of the managers are online.</p></blockquote>
<p>Rebooting the server and restarting docker service didn&#8217;t help.</p>
<p>Here&#8217;s what I finally worked for me:</p>
<ol>
<li>On any of the healthy manager node,
<pre>docker node update --availability drain foobar
docker node rm foobar</pre>
</li>
<li>On foobar,
<pre>docker swarm leave --force
docker swarm join --token {swarm_manager_token} {swarm_leader_ipaddr}
</pre>
</li>
</ol>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cynici.wordpress.com/2018/05/31/docker-info-rpc-error-on-manager-node/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">943</post-id>
		<media:content url="https://2.gravatar.com/avatar/8236f09362d67e08ce48220f632f66189ce250afad2a45752b6032b028e78286?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cynici</media:title>
		</media:content>
	</item>
		<item>
		<title>Youtube video doesn&#8217;t play in VirtualBox Ubuntu guest</title>
		<link>https://cynici.wordpress.com/2016/10/25/youtube-video-doesnt-play-in-virtualbox-ubuntu-guest/</link>
					<comments>https://cynici.wordpress.com/2016/10/25/youtube-video-doesnt-play-in-virtualbox-ubuntu-guest/#respond</comments>
		
		<dc:creator><![CDATA[cynici]]></dc:creator>
		<pubDate>Tue, 25 Oct 2016 05:06:38 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">http://cynici.wordpress.com/?p=923</guid>

					<description><![CDATA[I run 64-bit Ubuntu 16.04 as a guest OS in VirtualBox 5.1.8 on Windoiws 10. Both Chrome and FireFox won&#8217;t playback any video on Youtube. Only a message to the effect of restarting device is shown. I did the following to solve the problem: Changed the VM Audio Controller from ICH 97 to Intel HD [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I run 64-bit Ubuntu 16.04 as a guest OS in VirtualBox 5.1.8 on Windoiws 10.</p>
<p>Both Chrome and FireFox won&#8217;t playback any video on Youtube. Only a message to the effect of restarting device is shown.</p>
<p>I did the following to solve the problem:</p>
<ul>
<li>Changed the VM Audio Controller from ICH 97 to Intel HD [<a href="http://askubuntu.com/questions/816780/videos-not-playing">link</a>]</li>
<li>Increased the Video Memory from 16MB to the maximum, 128 MB [<a href="http://askubuntu.com/questions/814721/media-not-playing-on-ubuntu-installed-on-virtualbox">link</a>]</li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cynici.wordpress.com/2016/10/25/youtube-video-doesnt-play-in-virtualbox-ubuntu-guest/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">923</post-id>
		<media:content url="https://2.gravatar.com/avatar/8236f09362d67e08ce48220f632f66189ce250afad2a45752b6032b028e78286?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cynici</media:title>
		</media:content>
	</item>
		<item>
		<title>Flash Redmi Note 4 ROM</title>
		<link>https://cynici.wordpress.com/2016/10/12/flash-redmi-note-4-rom/</link>
					<comments>https://cynici.wordpress.com/2016/10/12/flash-redmi-note-4-rom/#respond</comments>
		
		<dc:creator><![CDATA[cynici]]></dc:creator>
		<pubDate>Wed, 12 Oct 2016 13:20:40 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">http://cynici.wordpress.com/?p=859</guid>

					<description><![CDATA[The Xiaomi Redmi Note 4 mobile phone appears to offer great value for money based on its specification alone. It lacks scratch-resistant screen and stereo speakers though. Well, I was foolish enough to order from GearBest without realizing that the set comes with a ROM intended for the Chinese market where Google is banned. In [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>The Xiaomi Redmi Note 4 mobile phone appears to offer great value for money based on its <a href="http://www.gsmarena.com/xiaomi_redmi_note_4-8291.php">specification</a> alone. It lacks scratch-resistant screen and stereo speakers though.</p>
<p>Well, I was foolish enough to order from <a href="http://www.gearbest.com/cell-phones/pp_436902.html">GearBest</a> without realizing that the set comes with a ROM intended for the Chinese market where Google is banned. In short, the phone is 90% Xiaomi and 10% Android. All apps are to be downloaded not from Google Play Store but MiStore, and the keyboard is quite insistent in wanting Chinese input despite having selected English in the phone setting. Enough reasons to force me to take drastic measures to replace the ROM to the one intended for international market at the risk of bricking my new phone. I did brick the phone once in the process of trying out various methods.</p>
<p>Bottom line, I succeeded with the help of plenty of indispensable advice on the web. Phew! Here&#8217;s how I did it. A Windows PC is necessary because all the software are for Windows only.</p>
<ul>
<li>Register to create a <a href="http://en.miui.com/cloud.php">MI account</a></li>
<li><a href="http://en.miui.com/unlock/">Submit a unlock request and unlock using the Mi Unlock program</a></li>
<li>Having unlocked successfully, <a href="http://xiaomiadvices.com/miui-7-enable-developer-options-and-usb-debugging-on-xiaomi-android-phones/">enable developer mode</a></li>
<li>Download the latest Xiaomi Mi Flash Tool from <a href="https://androidmtk.com/download-xiaomi-mi-flash-tool" rel="nofollow">https://androidmtk.com/download-xiaomi-mi-flash-tool</a></li>
<li>Download the correct 1.2 GB fastboot <strong>tgz</strong> file for my phone, i.e. <a href="http://update.miui.com/updates/v1/fullromdownload.php?d=nikel_global&amp;b=F&amp;r=global&amp;n=">Redmi Note 4 MTK Latest Global Stable Version Fastboot</a></li>
<li>Use the <a href="http://en.miui.com/a-234.html">&#8220;Fastboot&#8221; method</a> to flash the ROM but use the latest <a href="https://androidmtk.com/download-xiaomi-mi-flash-tool">Mi Flash</a> and not following the link given on the Miui page</li>
</ul>
<h3>Foot note</h3>
<ul>
<li>The MIUI web site offers three methods of replace the ROM but both <a href="http://en.miui.com/a-232.html">System Update</a> and <a href="http://en.miui.com/a-233.html">Recovery Update</a> methods did not work for me.</li>
<li>System Update simply aborted with &#8220;Cound&#8217;t verify update package&#8221; error. I don&#8217;t know if it was because the version on the phone was 8.0.9 while the global ROM was 8.0.3.</li>
<li>The phone won&#8217;t boot into recovery mode. It displayed <a href="https://i.ytimg.com/vi/tTzdQpex7BQ/hqdefault.jpg">this instead</a>.</li>
<li>If you live in South Africa, do not buy from <a href="http://www.gearbest.com/">GearBest</a> unless they switch their courier service provider from <a href="http://www.aramex.co.za/">ARAMEX</a>. I paid GearBest about R3200 for the phone but ARAMEX made me paid additional R2200 for dubious custom levy and they won&#8217;t show me the official invoice.issued by the custom department.</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://cynici.wordpress.com/2016/10/12/flash-redmi-note-4-rom/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">859</post-id>
		<media:content url="https://2.gravatar.com/avatar/8236f09362d67e08ce48220f632f66189ce250afad2a45752b6032b028e78286?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cynici</media:title>
		</media:content>
	</item>
		<item>
		<title>Upgraded Windows 10 version 1511 slow</title>
		<link>https://cynici.wordpress.com/2016/03/16/upgraded-windows-10-version-1511-slow/</link>
					<comments>https://cynici.wordpress.com/2016/03/16/upgraded-windows-10-version-1511-slow/#respond</comments>
		
		<dc:creator><![CDATA[cynici]]></dc:creator>
		<pubDate>Wed, 16 Mar 2016 03:46:58 +0000</pubDate>
				<category><![CDATA[windows]]></category>
		<category><![CDATA[tips]]></category>
		<guid isPermaLink="false">http://cynici.wordpress.com/?p=857</guid>

					<description><![CDATA[I recently (free) online-upgraded a HP ProBook 450 G2 with Intel Core i7, 16 GB RAM from OEM Windows 7 Pro to Windows 10 Pro version 1511. With Win 7, booting up and logging in were a breeze; system ready in less than 15 seconds. After upgrade, the same process took over 3 minutes, extremely [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I recently (free) online-upgraded a HP ProBook 450 G2 with Intel Core i7, 16 GB RAM from OEM Windows 7 Pro to Windows 10 Pro version 1511.</p>
<p>With Win 7, booting up and logging in were a breeze; system ready in less than 15 seconds.</p>
<p>After upgrade, the same process took over 3 minutes, extremely slow both in booting to the login screen and getting desktop ready after login. <img src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f626.png" alt="😦" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>I googled and tried the most promising approach suggested by <a href="http://www.askwoody.com/2015/windows-10-1511-slow-login/comment-page-1/#comment-64958" target="_blank">Joe on AskWoody</a> but it didn&#8217;t help.</p>
<p>Then I noticed that my login account (carried over from the upgrade) strangely belonged to &#8220;Device Administrators&#8221; and not &#8220;Administrator&#8221;. I changed the group membership to the latter and rebooted. Voila, problem solved.</p>
<p>I don&#8217;t know enough about Windows to understand the underlying causes. So, your mileage may vary. <img src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://cynici.wordpress.com/2016/03/16/upgraded-windows-10-version-1511-slow/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">857</post-id>
		<media:content url="https://2.gravatar.com/avatar/8236f09362d67e08ce48220f632f66189ce250afad2a45752b6032b028e78286?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cynici</media:title>
		</media:content>
	</item>
	</channel>
</rss>
