<?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/"
	>

<channel>
	<title>authbind &#8211; Giovanni F. Mazzeo De Santolo</title>
	<atom:link href="https://desantolo.com/tag/authbind/feed/" rel="self" type="application/rss+xml" />
	<link>https://desantolo.com</link>
	<description>That italian IT guy</description>
	<lastBuildDate>Sun, 27 Dec 2020 05:38:52 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>
<site xmlns="com-wordpress:feed-additions:1">123042357</site>	<item>
		<title>LXC allow non-root users to bind to port 80 (couchpotato example)</title>
		<link>https://desantolo.com/2017/06/lxc-allow-non-root-users-to-bind-to-port-80-couchpotato-example/</link>
		
		<dc:creator><![CDATA[Giovanni]]></dc:creator>
		<pubDate>Thu, 29 Jun 2017 08:37:42 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Proxmox]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[authbind]]></category>
		<category><![CDATA[containers]]></category>
		<category><![CDATA[couchpotato]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<guid isPermaLink="false">https://desantolo.com/?p=541</guid>

					<description><![CDATA[A follow-up to my last post dealing with unprivileged port access on linux containers. This time, I have a couchpotato container that I want to change its default port from 5050 to port 80, so that it is as simple &#8230; <a href="https://desantolo.com/2017/06/lxc-allow-non-root-users-to-bind-to-port-80-couchpotato-example/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>A follow-up to my last post dealing with unprivileged port access on linux containers.</p>
<p>This time, I have a couchpotato container that I want to change its default port from 5050 to port 80, so that it is as simple as http://mycouch/ to access from the local network.<br />
<span id="more-541"></span><br />
Since CouchPotato is a python script, my other method of whitelisting the binary won&#8217;t work, an alternative is to use <strong>authbind</strong> to get around this by granting a user/group privileges to bind to one of those restricted ports (non-root can&#8217;t bind to ports 1024 or less).</p>
<p><strong>Environment:</strong> LXC Container (Debian 9.0 Stretch) image, with couchpotato defaults running on port 5050 and systemd init script setup (couchpotato user is named gmedia)</p>
<p><code>#  groupadd -g 3200 gmedia</code><br />
<code># useradd -u 3200 -g gmedia -M gmedia</code><br />
<code># apt-get install authbind</code><br />
<code># touch /etc/authbind/byport/80</code><br />
<code># chown gmedia /etc/authbind/byport/80</code><br />
<code># chmod 500 /etc/authbind/byport/80</code></p>
<p>Now edit the startup settings (Exec/user/group):<br />
<strong><span style="color: #444444;"># nano /etc/systemd/system/couchpotato.service</span></strong></p>
<p>Should look something like this:</p>
<p><code>[Unit]</code><br />
<code>Description=CouchPotato application instance</code><br />
<code>After=network.target</code></p>
<p><code>[Service]</code><br />
<code>ExecStart=/usr/bin/authbind --deep /opt/CouchPotatoServer/CouchPotato.py</code><br />
<code>Type=simple</code><br />
<code>User=gmedia</code><br />
<code>Group=gmedia</code></p>
<p><code>[Install]</code><br />
<code>WantedBy=multi-user.target</code></p>
<p>Now its time to test:</p>
<p># systemctl daemon-reload<br />
# systemctl start couchpotato.service<br />
# systemctl status couchpotato.service</p>
<p>Confirm all is hunky dory.</p>
<p><code>root@couchpotato:~# systemctl status couchpotato.service</code><br />
<code>● couchpotato.service - CouchPotato application instance</code><br />
<code> Loaded: loaded (/etc/systemd/system/couchpotato.service; enabled; vendor preset: enabled)</code><br />
<code> Active: active (running) since Thu 2017-06-29 08:35:32 UTC; 2s ago</code><br />
<code> Main PID: 1203 (python)</code><br />
<code> Tasks: 9 (limit: 4915)</code><br />
<code> CGroup: /system.slice/couchpotato.service</code><br />
<code> └─1203 python /opt/CouchPotatoServer/CouchPotato.py</code></p>
<p><code>Jun 29 08:35:32 couchpotato systemd[1]: Started CouchPotato application instance.</code><br />
<code>root@couchpotato:~# lsof -i :80</code><br />
<code>COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME</code><br />
<code>python 1203 gmedia 49u IPv4 6008724 0t0 TCP *:http (LISTEN)</code><br />
<code>python 1203 gmedia 52u IPv4 6024843 0t0 TCP 192.168.200.140:http-&gt;192.168.200.5:56928 (ESTABLISHED)</code><br />
<code>root@couchpotato:~#</code></p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">541</post-id>	</item>
	</channel>
</rss>
