<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>I have not tested but you can probably use mark to accomplish
this. Mark any request coming directly to port 7778, drop
anything with mark set and then redirect request on port 80 to
7778.<br>
</p>
<font face="monospace, monospace">iptables -t mangle -A PREROUTING
-p tcp --dport 7778 -j MARK --set-mark 1<br>
iptables -A INPUT -m mark --mark 1 -j DROP<br>
iptables -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT
--to-ports 7778 </font><font face="monospace, monospace"><br>
<br>
Thank You<br>
</font>
<pre class="moz-signature" cols="72">Amit K Nepal
(CISM, CISSP, RHCE, CCENT, C|EH, C|HFI, GIAC ISO 27000 Specialist)
</pre>
<div class="moz-cite-prefix">On 9/17/2017 8:58 PM, Daniel Stasinski
wrote:<br>
</div>
<blockquote
cite="mid:CAL_oeF26vjYhYPTHwya8j5cE6QBE-OykwkdVwYs2D87CC_Akbg@mail.gmail.com"
type="cite">
<div dir="ltr">Right after I posted, I figured out a solution.
<div><br>
</div>
<div>I just added redirect from 7778 to 80. Since 80 is not
active, it drops it</div>
<div><br>
</div>
<div><span
style="font-family:monospace,monospace;font-size:12.8px">A
PREROUTING -p tcp -m tcp --dport 7778-j REDIRECT --to-ports
80</span><br>
</div>
<div><span
style="font-family:monospace,monospace;font-size:12.8px"><br>
</span></div>
<div><b style="font-size:12.8px">Daniel P. Stasinski</b><br>
</div>
<div class="gmail_extra">
<div>
<div class="gmail_signature"
data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div><a moz-do-not-send="true"
href="mailto:daniel@GenericInbox.com"
target="_blank">daniel@GenericInbox.com</a><br>
</div>
<font size="4">I</font> 💛<font size="4">✞</font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="gmail_quote">On Sun, Sep 17, 2017 at 8:24 PM,
Daniel Stasinski <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:daniel@genericinbox.com" target="_blank">daniel@genericinbox.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div><br>
</div>
<div>On my server, I am redirecting incoming port 80 to
port 7778 via iptables, but I'm unsure how to block
connects directly to port 7778 from the outside.
I've hit a brick wall in my understanding of pre and
post routing.</div>
<div><br>
</div>
<div>I could use a little wisdom here. Thanks. :)<br>
</div>
<div><br>
</div>
<div><font face="monospace, monospace">#<span
style="color:rgb(0,0,0)">/etc/sysconfig/iptables</span></font></div>
<div>
<div><font face="monospace, monospace"><span
style="color:rgb(0,0,0)">*nat
</span><br>
:PREROUTING ACCEPT [15:1051]
<br>
:POSTROUTING ACCEPT [63:4394]
<br>
:OUTPUT ACCEPT [63:4394]
<br>
-A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT
--to-ports 7778
<br>
COMMIT
<br>
*filter
<br>
:INPUT ACCEPT [0:0]
<br>
:FORWARD ACCEPT [0:0]
<br>
:OUTPUT ACCEPT [1661:376223]
<br>
-A INPUT -m state --state RELATED,ESTABLISHED -j
ACCEPT
<br>
-A INPUT -p icmp -j ACCEPT
<br>
-A INPUT -i lo -j ACCEPT
<br>
-A INPUT -p tcp -m state --state NEW -m tcp
--dport 7778 -j ACCEPT
<br>
-A INPUT -j REJECT --reject-with
icmp-host-prohibited
<br>
-A FORWARD -j REJECT --reject-with
icmp-host-prohibited
<br>
COMMIT<br>
</font></div>
</div>
<div><br>
</div>
<div>
<div class="m_8966898144488848888gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div><b style="font-size:12.8px">Daniel
P. Stasinski</b><br>
<a moz-do-not-send="true"
href="mailto:daniel@GenericInbox.com"
target="_blank">daniel@GenericInbox.com</a><br>
</div>
<font size="4">I</font> 💛<font
size="4">✞</font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">---------------------------------------------------
PLUG-discuss mailing list - <a class="moz-txt-link-abbreviated" href="mailto:PLUG-discuss@lists.phxlinux.org">PLUG-discuss@lists.phxlinux.org</a>
To subscribe, unsubscribe, or to change your mail settings:
<a class="moz-txt-link-freetext" href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss">http://lists.phxlinux.org/mailman/listinfo/plug-discuss</a></pre>
</blockquote>
<br>
</body>
</html>