<?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>ServerAdmins.NET &#187; udp</title>
	<atom:link href="http://serveradmins.net/tag/udp/feed/" rel="self" type="application/rss+xml" />
	<link>http://serveradmins.net</link>
	<description>Stuff for Server Admins...</description>
	<lastBuildDate>Wed, 22 Feb 2012 02:04:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>cPanel TCP and UDP ports&#8230;</title>
		<link>http://serveradmins.net/cpanel-tcp-and-udp-ports/</link>
		<comments>http://serveradmins.net/cpanel-tcp-and-udp-ports/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 03:26:40 +0000</pubDate>
		<dc:creator>chrism</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Utility]]></category>
		<category><![CDATA[cpanel]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[imap]]></category>
		<category><![CDATA[passive]]></category>
		<category><![CDATA[pop3]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[ports]]></category>
		<category><![CDATA[smtp]]></category>
		<category><![CDATA[tcp]]></category>
		<category><![CDATA[udp]]></category>

		<guid isPermaLink="false">http://serveradmins.net/?p=69</guid>
		<description><![CDATA[The ports necessary for creating a useful and successful firewall for a cPanel hosting machine.  This includes the UDP, TCP and Passive Port port ranges.]]></description>
			<content:encoded><![CDATA[<p>A little post here, more for reference than anything&#8230;   Here&#8217;s a list of the common ports used by cPanel for your firewall building pleasure&#8230;</p>
<p>TCP<br />
21 FTP<br />
22 SSH<br />
25 SMTP<br />
26 SMTP (Alternative port, configurable via WHM)<br />
80 HTTP<br />
110 POP3<br />
143 IMAP<br />
443 HTTPS<br />
465 SMTPS<br />
993 IMAP4<br />
995 POP3<br />
2082 cPanel (NON Encrypted)<br />
2083 cPanel (HTTPS)<br />
2086 WHM (NON Encrypted)<br />
2087 WHM (Encrypted)<br />
2095 Webmail (NON Encrypted)<br />
2096 Webmail (Encrypted)<br />
3306 MySQL (Only if allowing Remote Connections)</p>
<p>&#8211;UDP<br />
53 DNS </p>
<p>It should be noted that if you&#8217;re firewalling off your server, you should open up a portrange for the FTP PassivePort Rolloff.  Typically these are higher up ports and a wide range, such as 30000-50000.  You&#8217;ll also need to modify your FTPd configuration to use this portrange as well.  If you don&#8217;t, you&#8217;ll see issues with FTP connections dropping, successful logins, but a hang, pause or delay when dong an ls or beginning a transfer that results in a dropped connection.  Typically this will affect ftp clients that are behind a firewall/router doing NAT translations.</p>
<p>Anyway, that&#8217;s it, quick and simple. <img src='http://serveradmins.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />    Enjoy</p>
]]></content:encoded>
			<wfw:commentRss>http://serveradmins.net/cpanel-tcp-and-udp-ports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Port to PID mappings, or What process is using that port?</title>
		<link>http://serveradmins.net/port-to-pid-mappings-or-what-process-is-using-that-port/</link>
		<comments>http://serveradmins.net/port-to-pid-mappings-or-what-process-is-using-that-port/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 00:59:37 +0000</pubDate>
		<dc:creator>chrism</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Utility]]></category>
		<category><![CDATA[fuser]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mapping]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[tcp]]></category>
		<category><![CDATA[udp]]></category>

		<guid isPermaLink="false">http://serveradmins.net/?p=54</guid>
		<description><![CDATA[fuser is awesome for port to pid mappings or what process is using a specific port.]]></description>
			<content:encoded><![CDATA[<p>Okay, I&#8217;m lazy.  I fully admit it.   Want proof?  Instead of writing up a huge long post articulating something with awesome analogies, I&#8217;m only going to talk about one command today. </p>
<p>Fuser.</p>
<p>Why? </p>
<p>fuser is awesome.  Not awesome in a &#8220;run it and it fixes everything&#8221; way, but awesome in a &#8220;What in the hell is binding to this port??&#8221; kind of way.   Two classic scenarios where this is handy&#8230;</p>
<p>1.  Apache won&#8217;t start, &#8220;Can&#8217;t bind to port ::80&#8243; or &#8220;Can&#8217;t bind to port ::443&#8243;, etc.  This typically means something else is already tied to that port, and won&#8217;t relinquish it&#8230; </p>
<p>2.  A security scan of your machine shows something funny running on port 6667&#8230; You didn&#8217;t start this or know what it is.  </p>
<p>What to do now? Well you can sift through netstat output, but that&#8217;s, well, boring and slightly annoying.</p>
<p>netstat output<br />
<code><br />
[root@vps ~]# netstat -anp |grep 80<br />
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      3266/httpd<br />
tcp        0      0 127.0.0.1:58725             127.0.0.1:80                TIME_WAIT   -<br />
tcp        0      0 10.10.10.10:2078          192.168.1.23:63024          ESTABLISHED 18088/cpdavd - acce<br />
unix  3      [ ]         STREAM     CONNECTED     49222880 11574/dovecot-auth  /var/run/dovecot/login/default<br />
unix  2      [ ]         DGRAM                    6804658 14078/named<br />
</code></p>
<p>Okay now we see that 3266/httpd is running on 80.  Then we do this to find the process..</p>
<p><code><br />
[root@vps ~]# ps auxwww |grep 3266<br />
nobody    3266  0.0  0.3  65704  3516 ?        S    17:05   0:00 /usr/local/apache/bin/httpd -k start -DSSL<br />
root     21665  0.0  0.0   6024   640 pts/2    S+   18:51   0:00 grep 3266<br />
[root@vps ~]#<br />
</code></p>
<p>Okay there we go&#8230; </p>
<p>Now for hacked systems, this could (and probably) is fully forged for a lot of remote shells.  Going back to my previous post at http://serveradmins.net/ssh-on-nonstandard-ports-how-to-not-do-it/ which talks about priveleged ports, you could in theory have trojaned &#8216;ps&#8217;, top, etc masking that real process.  It may *look* like httpd, but bound to a port like 23425&#8230;     So dont&#8217;t trust that too much, but a bit on that in a second. <img src='http://serveradmins.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The fuser approach&#8230;</p>
<p><code><br />
[root@vps ~]# fuser -n tcp 80<br />
80/tcp:               3266  3267  3268  3269  3271 16078 18274<br />
[root@vps ~]#<br />
</code></p>
<p>Oh look at that a list of all pids bound to that port.  Nice, clean, to the point and easily parsable.    fuser rocks. <img src='http://serveradmins.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Now a bit more about the masked processes&#8230; To run those down, here&#8217;s a quick tip.  Forget ps/top and your other normal utilities, /proc/ is your friend here&#8230;</p>
<p>Proc looks like this on a linux box&#8230;<br />
<code><br />
[root@vps ~]# cd /proc/<br />
[root@vps proc]# ls -al<br />
total 1<br />
dr-xr-xr-x 78 root     root        0 Jan 26 09:58 .<br />
drwxr-xr-x 24 chrismm  chrismm  1024 Feb  4 22:06 ..<br />
dr-xr-xr-x  4 root     root        0 Feb  5 05:05 1<br />
dr-xr-xr-x  4 root     root        0 Feb  5 05:05 11573<br />
dr-xr-xr-x  4 root     root        0 Feb  5 05:05 11574<br />
dr-xr-xr-x  4 dovecot  dovecot     0 Feb  5 05:05 11575<br />
dr-xr-xr-x  4 dovecot  dovecot     0 Feb  5 05:05 11576<br />
...<br />
...<br />
</code></p>
<p>These directories match the pids of the running process&#8230;   So if you have something advertising itself as &#8216;httpd&#8217; on port 234234 and you know it&#8217;s pid 3266, you&#8217;d just do the following&#8230;</p>
<p><code><br />
[root@vps proc]# cd /proc/3266<br />
[root@vps 3266]# ls -al<br />
total 0<br />
dr-xr-xr-x  4 nobody nobody 0 Feb  5 17:08 .<br />
dr-xr-xr-x 78 root   root   0 Jan 26 09:58 ..<br />
-r--------  1 root   root   0 Feb  5 18:56 auxv<br />
-r--r--r--  1 root   root   0 Feb  5 17:08 cmdline<br />
-rw-r--r--  1 root   root   0 Feb  5 18:56 coredump_filter<br />
-r--r--r--  1 root   root   0 Feb  5 18:56 cpuset<br />
lrwxrwxrwx  1 root   root   0 Feb  5 18:54 cwd -> /<br />
-r--------  1 root   root   0 Feb  5 18:56 environ<br />
lrwxrwxrwx  1 root   root   0 Feb  5 17:10 exe -> /usr/local/apache/bin/httpd<br />
dr-x------  2 root   root   0 Feb  5 18:49 fd<br />
?r--r--r--  1 root   root   0 Feb  5 18:56 io<br />
-r--------  1 root   root   0 Feb  5 18:56 limits<br />
-rw-r--r--  1 root   root   0 Feb  5 18:56 loginuid<br />
-r--r--r--  1 root   root   0 Feb  5 18:54 maps<br />
-rw-------  1 root   root   0 Feb  5 18:56 mem<br />
-r--r--r--  1 root   root   0 Feb  5 18:56 mounts<br />
-r--------  1 root   root   0 Feb  5 18:56 mountstats<br />
-r--r--r--  1 root   root   0 Feb  5 18:56 numa_maps<br />
-rw-r--r--  1 root   root   0 Feb  5 18:56 oom_adj<br />
-r--r--r--  1 root   root   0 Feb  5 18:56 oom_score<br />
lrwxrwxrwx  1 root   root   0 Feb  5 18:54 root -> /<br />
-r--r--r--  1 root   root   0 Feb  5 18:56 schedstat<br />
-r--------  1 root   root   0 Feb  5 18:56 smaps<br />
-r--r--r--  1 root   root   0 Feb  5 17:08 stat<br />
-r--r--r--  1 root   root   0 Feb  5 17:10 statm<br />
-r--r--r--  1 root   root   0 Feb  5 17:08 status<br />
dr-xr-xr-x  3 nobody nobody 0 Feb  5 18:56 task<br />
-r--r--r--  1 root   root   0 Feb  5 18:56 wchan<br />
[root@vps 3266]#<br />
</code></p>
<p>Bam, there you go.  cwd and exe are the things you&#8217;re looking for  It shows you the dir it was spawned from (typically a users homedirectory on a shared hosting machine) and the full path/binary actually being executed (usually lame perl/php listeners)&#8230;   Also the ./fd/ folder is kind of neat as it shows you all the open file handles tied up by that pid as well.</p>
<p>Anyway, /proc/ examination too, is for another day, I just wanted to ramble on about one of my favorite, neat little single use utilities that no one else seems to know about. fuser.  Enjoy. =)</p>
]]></content:encoded>
			<wfw:commentRss>http://serveradmins.net/port-to-pid-mappings-or-what-process-is-using-that-port/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
