<?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>Pix &#8211; Phocean.net</title>
	<atom:link href="/tag/pix/feed" rel="self" type="application/rss+xml" />
	<link>/</link>
	<description>Computer Security Blog</description>
	<lastBuildDate>Fri, 24 Feb 2017 21:17:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.9.10</generator>
	<item>
		<title>Postfix : TLS not working outside my network</title>
		<link>/2008/06/11/postfix-tls-not-working-outside-my-network.html</link>
		<pubDate>Tue, 10 Jun 2008 23:37:28 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Defense]]></category>
		<category><![CDATA[Cisco]]></category>
		<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Pix]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[TLS]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=110</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=110</guid>
		<description><![CDATA[As I just finished setting TLS and SASL to secure the access to my Postfix server, I realized that it was working only from inside my network. What I got from my lan : $ telnet mars 25 Trying 192.168.222.10... Connected to phocean.net. Escape character is '^]'. 220 phocean.net ESMTP Postfix (Debian/GNU) ehlo phocean.net 250-phocean.net...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2008/06/11/postfix-tls-not-working-outside-my-network.html">Continue Reading</a></span>]]></description>
		<description><![CDATA[As I just finished setting TLS and SASL to secure the access to my Postfix server, I realized that it was working only from inside my network. What I got from my lan : $ telnet mars 25 Trying 192.168.222.10... Connected to phocean.net. Escape character is '^]'. 220 phocean.net ESMTP Postfix (Debian/GNU) ehlo phocean.net 250-phocean.net...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2008/06/11/postfix-tls-not-working-outside-my-network.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p>As I just finished setting TLS and SASL to secure the access to my Postfix server, I realized that it was working only from inside my network.</p>
<p>What I got from my lan :</p>
<pre>$ telnet mars 25
Trying 192.168.222.10...
Connected to phocean.net.
Connected to phocean.net.
Escape character is '^]'.
220 phocean.net ESMTP Postfix (Debian/GNU)
220 phocean.net ESMTP Postfix (Debian/GNU)
ehlo phocean.net
ehlo phocean.net
250-phocean.net
250-phocean.net
250-PIPELINING
250-SIZE 200000000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH NTLM DIGEST-MD5 CRAM-MD5
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN</pre>
<p>I shows well that the TLS handshake is initiated.</p>
<p>But from this outside, I just got this weired thing :</p>
<pre>$ telnet phocean.net 25
<pre>$ telnet phocean.net 25
Trying 81.64.194.119...
Connected to phocean.net.
Connected to phocean.net.
Escape character is '^]'.
220 **********************************************
ehlo phocean.net
ehlo phocean.net
502 5.5.2 Error: command not recognized</pre>
<p>Of course, the firewall, a Cisco Pix one, was properly set to redirect port 25 UDP/TCP to my server.</p>
<p>However, I soon focused my effort on this equipment. I considered a while that the cause could be some filtering from my provider, but most probably, the problem came from the Pix.</p>
<p>That was not difficult to figure out : it had some protocol inspector activated for SMTP :</p>
<pre>$ sh ru
[...]
fixup protocol smtp 25
[...]</pre>
<p>Just after :</p>
<pre>&gt; no fixup protocol smtp 25</pre>
<p>&#8230; it started to work perfectly well !!!</p>
<p>The engine for the SMTP protocol could not recognize the TLS handshake, considered that the SMTP session as not valid and therefore blocked it !</p>
<p>I can deactivate it without any fear as my Postfix server is already pretty well secured, or at least configured to reject any weired SMTP dialog.</p>
]]></content:encoded>
			</item>
		<item>
		<title>How to connect to a Cisco device using the serial port on Linux</title>
		<link>/2007/11/13/how-to-connect-to-a-cisco-device-using-the-serial-port-on-linux.html</link>
		<comments>/2007/11/13/how-to-connect-to-a-cisco-device-using-the-serial-port-on-linux.html#comments</comments>
		<pubDate>Tue, 13 Nov 2007 11:41:35 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Defense]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Cisco]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Minicom]]></category>
		<category><![CDATA[Pix]]></category>
		<category><![CDATA[serial port]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=84</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=84</guid>
		<description><![CDATA[Using the serial port is still necessary to manage some devices, when it is reseted to factory defaults. It could be also a security choice&#8230; Nowadays many computers &#8211; and especially laptops don&#8217;t have anymore a built-in serial port. Not a problem, there are many cheap serial-usb converters like this. As an alternative to the...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2007/11/13/how-to-connect-to-a-cisco-device-using-the-serial-port-on-linux.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p>Using the serial port is still necessary to manage some devices, when it is reseted to factory defaults. It could be also a security choice&#8230;</p>
<p>Nowadays many computers &#8211; and especially laptops don&#8217;t have anymore a built-in serial port.  Not a problem, there are many cheap serial-usb converters <a href="http://www.usbgear.com/USB-1S1PQ.html" target="_blank">like this</a>.</p>
<p>As an alternative to the Hyperterminal of Microsoft, there is Minicom on Linux.</p>
<p>It is very easy to install and configure :</p>
<pre>$ apt-get install minicom lrzsz</pre>
<p>Before going further, you need to know what is the corresponding Linux device for the port where you plugged the router. As I used an usb adapter, my device was <strong>/dev/ttyUSB0</strong>. Otherwise, it will probably be one of the <strong>/dev/ttyS*</strong> devices.<br />
Checking the <strong>dmesg</strong> output while you plug the device will give you the right device to use.</p>
<p>Now start minicom this way to edit the configuration :</p>
<pre>$ minicom -s</pre>
<p>In the menu, select <em>Serial Port Configuration</em> and  :</p>
<ul>
<li> press A and update the serial port path with the one you found in dmesg</li>
<li>press E and then C to change the speed to 9600</li>
<li>press F to switch off the hardware flow control</li>
<li>select <em>Save the configuration as&#8230;</em> and name it as, let&#8217;s say, &#8220;cisco&#8221;</li>
</ul>
<p>You should be able to connect right now. Next time, just start Minicom like this :</p>
<pre>$ minicom cisco</pre>
<p>That&#8217;s it !</p>
]]></content:encoded>
			<wfw:commentRss>/2007/11/13/how-to-connect-to-a-cisco-device-using-the-serial-port-on-linux.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>FTP configuration issues</title>
		<link>/2007/11/02/the-horror-of-ftp-and-cisco-firewall.html</link>
		<comments>/2007/11/02/the-horror-of-ftp-and-cisco-firewall.html#comments</comments>
		<pubDate>Fri, 02 Nov 2007 16:10:28 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Defense]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Asa]]></category>
		<category><![CDATA[Cisco]]></category>
		<category><![CDATA[FTP]]></category>
		<category><![CDATA[Pix]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=80</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=80</guid>
		<description><![CDATA[I found that it was a real mess to set up a FTP server in a DMZ, behind a firewall Cisco Asa (501 model with IOS version 7.0). The FTP server is on the DMZ area, and therefore I natted a public IP to the private IP in the DMZ subnet of this server. static...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2007/11/02/the-horror-of-ftp-and-cisco-firewall.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p>I found that it was a real mess to set up a FTP server in a DMZ, behind a firewall Cisco Asa (501 model with IOS version 7.0).</p>
<p>The FTP server is on the DMZ area, and therefore I natted a public IP to the private IP in the DMZ subnet of this server.</p>
<pre>static (dmz,outside) &lt;public IP&gt; &lt;private_IP&gt; netmask 255.255.255.255</pre>
<p>Doing so, I expect that my FTP server (like Vsftpd on Linux) to be reachable within its public IP, from the Asa external interface.<br />
<span id="more-80"></span><br />
<strong>Choosing a FTP transfer mode </strong></p>
<p>Before going further, let&#8217;s recall the two modes in which the FTP protocol can work :</p>
<ul>
<li>active mode : this is the historical mode, but should be considered obsolete now because of the numerous issues it contains. In this mode, after the client initiate the communication on the port 21 (command chanel), the server initiate the data transfert chanel from its port 20 toward a port specified by the client. It causes two big problems :
<ul>
<li>the client must configure its firewaling to allow incomming traffic on this port. In the real life, this is most likely to be like allowing the 1024-65535 range port for incoming traffic. Not really secure, isn&#8217;t it ?</li>
<li>if the client is behind a NAT, it won&#8217;t work ! As the server initiate the connection, the router does not have any entry for the flow in its NAT table. It will just drop the connexion.</li>
</ul>
</li>
<li>passive mode : the difference here is that the server chooses on what port the data transfert will be operated. The port is given to the client when this one initiate the communication. Actually, the server never initiate any connexion, so the name &#8220;passive&#8221;. The only thing to do on the server side is to set the right firewall rule to allow the server ports. The client then initiate the transfert on the given port. It solves the client side firewalling problem, because the firewall will see it as outbound traffic. With correct rules, especially if the firewall is statefull, this is an easy thing.</li>
</ul>
<p><strong>Configuring the passive mode on the server </strong></p>
<p>So, is the passive mode the end of all problems ?</p>
<p>Not yet&#8230;</p>
<p>By default, the FTP server will be listening on its netword interface and answer to the FTP requests with its private IP, if, like probably in many case, the FTP server is located on a DMZ network.</p>
<p>In such a case, the client gets a private IP to connect with&#8230; and can never reach the server properly.</p>
<p>To workaround this problem, most of FTP servers can be configured to answer with there public IP.</p>
<p>With VSFTP, this is a line like :</p>
<pre>pasv_address = $public_IP</pre>
<p>There another two issues for that :</p>
<ul>
<li>the server won&#8217;t be reachable anymore within its private IP, for instance from the local subnet</li>
<li>the Cisco Asa firewall drops the traffic</li>
</ul>
<p><strong>Cisco Asa issue </strong></p>
<p>The Asa log file shows :</p>
<pre>FTP port command different address: $IP_addr ($IP_addr2) to $IP_addr_3 on interface int_name</pre>
<p>The explanation from the cisco website :<br />
<em>A client issued an FTP port command and supplied an address other than the address used in the connection. This error message is indicative</em></p>
<p><em>of an attempt to avert the site&#8217;s security policy. For example, one might attempt to hijack an FTP session by changing the packet on the way, and putting</em></p>
<p><em>different source information instead of the correct source information. The PIX Firewall drops the packet, terminates the connection, and logs the event.</em></p>
<p><em>In the error message displayed, the IP address in parentheses is the address from the PORT command.</em><br />
Well, as there is nothing to do against this behaviour, I won&#8217;t use the pasv_address option.</p>
<p><strong>Private IP issue</strong></p>
<p>So, for now we stick with a server sending its private IP address in any case. That solves any issue in the local subnet, but is it possible to do anything for external clients which needs to get a public IP ?</p>
<p>Actually, and this is really not a satisfying answer, it depends on the client. Most of the FTP client must have the some options to workaround this issue, but not all.</p>
<p>Let&#8217;s check how it is with a few FTP clients.<br />
<em><strong><br />
<em> Basic FTP command line client (Linux)</em></strong></em></p>
<pre>$ ftp X.X.X.X
ftp&gt; dir
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-rw-r--    1 102      1001           21 Aug 16 10:53 test
226 Directory send OK.</pre>
<p>Humm&#8230; it is working, but it shouldn&#8217;t as my server is configured for passive mode.</p>
<p>Let&#8217;s see what is going on with Wireshark&#8230; Two packets are interesting :</p>
<pre>28    35    192.168.1.2    X.X.X.X   FTP    Request: PORT 192,168,1,2,173,87
29    36    X.X.X.X    192.168.1.2    FTP    Response: 200 PORT command successful. Consider using PASV.</pre>
<p>From the client, we have a PORT request, which shows that our client is connecting in active mode.</p>
<p>Surprise, the server replies ! And says successful, even if the IP given is a private one. That should not work and, if any response, not go out of the external firewall&#8230;<br />
<strong>Note</strong> : (192,168,1,2,173,87) is the FTP way to manage IPs and port. The IP is simply given by the four first numbers : 192,168,1,2 &lt;=&gt; 192.168.1.2.<br />
The 2 last ones gives you the port number with this formula : 173,87 =&gt; 173 x 256 + 87 = port n°44375<br />
Anyway, let&#8217;s try the passive mode :</p>
<pre>ftp&gt; passive on
Passive mode on.
ftp&gt; dir
227 Entering Passive Mode (10,1,1,1,15,195)
receive aborted
waiting for remote to finish abort</pre>
<p>We tried to switch to passive mode. The server gaves its IP, but its private one (192.168.10.1). The client trying to reach this address can&#8217;t and falls in timeout (I killed it, no more patience :) ) .</p>
<p>Now, let&#8217;s summarize.<br />
Using the ftp basic client, we can&#8217;t go through in passive mode. We get a private IP and we have no workaround.<br />
The active mode works, but it is thanks to the behaviour of VSFTP.</p>
<p>A look on the man page of VSFTP gives some answers : the</p>
<pre>port_enable</pre>
<p>directive, set to YES by default, allow the PORT command from the client even in passive mode. So, we could add in the vsftd.conf configuration file :</p>
<pre>port_enable=NO</pre>
<p>After that the server will answer</p>
<pre>550 Permission denied</pre>
<p>when a PORT command is issued. At the end, I won&#8217;t set this, because such a behaviour is actually nice.</p>
<p>I still wonder how VSFTP could get the public IP when the PORT command send the private IP. I guess, and it would be a smart behaviour, that the program checks the underlying protocol layers and takes the right IP from the IP header&#8230; I will have it confirmed and update this post.</p>
<p><em><em><strong>Gftp</strong></em></em></p>
<p>This Gnome FTP client behave like the ftp command line client in passive mode : it falls into timeout.</p>
<p>It doesn&#8217;t try by default to fail over active mode.</p>
<p>You can configure either active mode or ignoring the passive command IP in the options :</p>
<p><em><a title="gftp - ftp connexion parameters" href="/wp-content/uploads/2007/11/gftp-pasv.png" rel="lightbox[80]"><img src="/wp-content/uploads/2007/11/gftp-pasv.thumbnail.png" alt="gftp - ftp connexion parameters" /></a></em></p>
<p><em><em><strong>Filezilla</strong></em></em></p>
<p>Filezilla has the most interesting behaviour. When the standard passive mode fails, it is able to fail over by using active mode or using the public IP seen from the server.</p>
<p>This can be configured in the connexion options :</p>
<p><em><a title="filezilla connexion parameters" href="/wp-content/uploads/2007/11/filezilla.png" rel="lightbox[80]"><img src="/wp-content/uploads/2007/11/filezilla.thumbnail.png" alt="filezilla connexion parameters" /></a></em></p>
<p>When Filezilla uses the public IP address instead of the transmitted one :</p>
<pre> PASV
227 Entering Passive Mode (10,1,1,1,15,209)
LIST
150 Here comes the directory listing.
226 Directory send OK.</pre>
<p>When it is configured to switch to active mode :</p>
<pre>PASV
227 Entering Passive Mode (10,1,1,1,15,179)
PORT 192,168,1,2,130,1
200 PORT command successful. Consider using PASV.
LIST
150 Here comes the directory listing.
226 Directory send OK.</pre>
<p><strong>Conclusion</strong></p>
<p>I could not reach the point where I can be 100% sure that it will work in all configurations. The best I could do is a series of small fixes to get the best compromise as possible.</p>
<p>I guess that using VSFTD as a server and recomanding a good client as Filezilla will work pretty well &#8211; and that won&#8217;t be a big deal to get to such a configuration.</p>
<p>If anyone has some better ideas, or see I fooled somewhere before my conclusion, please let me know.</p>
<p>But anyway, really, FTP sucks. It is anoying that the use of this protocol is still required by some companies.</p>
]]></content:encoded>
			<wfw:commentRss>/2007/11/02/the-horror-of-ftp-and-cisco-firewall.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>SSH timout</title>
		<link>/2007/04/21/ssh-timout.html</link>
		<pubDate>Sat, 21 Apr 2007 18:18:00 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Network]]></category>
		<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Cisco]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[Pix]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://192.168.1.10/wordpress/?p=28</guid>
		<description><![CDATA[<p>After a fresh set up of your network, don't be surprised that your ssh connections are slow.</p>]]></description>
				<content:encoded><![CDATA[<p>After a fresh set up of your network, don&#8217;t be surprised that your ssh connections are slow.</p>
<p><span id="more-28"></span></p>
<p>Depending on the systems and equipment you use, you might encounter some timeout that make any login impossible.</p>
<p>I got such timeouts with an OpenBSD machine behind a Pix firewall. With Linux machines, it was very slow but worked.</p>
<p>This issue is related to the reverse DNS check that SSH makes by default during the login process. This is in order to improve the security. Howerver, this is not so secure as a DNS cache can also be spoofed.<br />
Considering this, you can disable this check with not much worry with the right option in your <strong>/etc/sshd_config</strong> file :</p>
<pre>UseDNS no</pre>
<p>Of course, the best solution will be that you set up a full DNS infrastructure as soon as possible.</p>
]]></content:encoded>
			</item>
	</channel>
</rss>
