last day (15 days later) » 

10:00 PM
its a shoddy java console
 
I can tell.
;-)
 
Can you paste in the console?
 
sometimes sometimes not
clipboard gets stuck on something
 
Okay I would like you to type the following
sudo /sbin/iptables -P INPUT DROP
sudo /sbin/iptables -P FORWARD DROP
sudo /sbin/iptables -P OUTPUT DROP
This will set the default action for iptables as DROP
(no connection )
 
10:04 PM
ok done
 
Now we need to poke a hole into the chain for ssh.
 
okie dokie lead the way
 
Can you run ifconfig and tell me what your primary connection name is?
Like eth0 or so.
It's the one with your external inet addr: entry
 
venet0 ?
 
Cool does it have your ip address in the listing?
 
10:07 PM
venet0:1
 
Should be right below it.
 
under inet addr
 
Well. Hold on. Now I am confused. :)
It should read like this:
 
venet0:1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr: IP P-t-P: IP Bcast: IP Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
 
You don't have a venet 0:0 ?
 
10:09 PM
oh yeh I do sorry thats wrong IP thats a spare IP i have... venet 0:0 is right
they are in same range I always get confused
 
Which one have you been connecting too with ssh?
 
venet 0:0 one
 
we can call them 0 and 1 from now on.
 
Okay so you've been connecting with 0.
 
10:10 PM
1 is unused
 
Alright.
The way we are setting up your chains it will disable access to 1.
Unless you rerun these commands later.
I will send you a pastebin link when we are done in case you want to modify it later.
 
So 0 is the ip you have your dns record assigned to as well correct?
 
Good man!
Alright back to iptables.
iptables -A INPUT -i venet0:0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT
Oops
sudo /sbin/iptables -A INPUT -i venet0:0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT
That one first.
Did it work?
 
10:14 PM
still typing... copy n paste broken
 
crap
okay get that one finished.
We will have one more then we should be able to switch back to the terminal
 
sudo /sbin/iptables -A INPUT -i venet0:0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCE
PT
Warning: wierd character in interface `venet0:0' (No aliases, :, ! or *).
 
Ah then do this black magic
You didn't type anything else in did you?
 
nope
 
^0:0^0
type that exactly.
wait.
 
10:17 PM
on its own?
 
got that reversed
 
or after venet
 
it should be ^0^0:0
no just type that by itself.
Oh man.
I am too tired. the first one was right.
Hold on.
:-/
lol. So where are we now?
Not building confidence am I?
 
your great mate i'd be lost without ya
 
Okay. So we want to change the 0:0 to 0 and typing ^0:0^0 will change the characters of the last command from 0:0 to 0
 
10:21 PM
it says
oh wait nvm
 
Did it work?
(I am trying to give you a shortcut because of that wonky terminal)
Did it return anything?
 
:18 2012 from 02d99a13.bb.sky.com
Starting PowerConsole v1.1 <> (c)2010 soluslabs ltd.
please wait...
successfully logged in.
entered into CT 6188
[root@s1 /]# ^0:0^0
-bash: !!: event not found
[root@s1 /]# sudo /sbin/iptables -A INPUT -i venet0:0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCE
PT
battling with this terminal
 
yeah
just modify the original command then
 
to sudo /sbin/iptables -A INPUT -i venet0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCE
PT
?
 
type echo $?
 
10:23 PM
$
 
zero?
 
$ returned
 
never mind too late (you need to actually type the question mark)
Next command!
 
oh right 0
sorry =/
 
sudo /sbin/iptables -A OUTPUT -o venet0 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT
np. type that one in next, there are subtle differences. Type carefully!
 
10:25 PM
nothing returned
 
Good!
 
should I have done the dport one also?
 
Yes!
One is Destination and the other is Source.
:D
 
Couldn't load target `ACCE':/lib/iptables/libipt_ACCE.so: cannot open shared object file: No su
ch file or directory
 
Wait.
What just happend?
 
10:27 PM
from the dport command
 
no.
 
I wasnt sure about venet0 so I hadnt run it yet
 
Alright.
:D
Let me look through our chat log.
Ah i see what happened.
Okay, so you see where you had two lines for your dport command?
 
the line ends with ACCE and the next line is PT
(I missed that the first time)
 
10:29 PM
the console does that
doesnt seem to fit
 
It's just one line.
You tell that console who's boss!
So you will need to get that dport line working again.
sudo /sbin/iptables -A INPUT -i venet0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT
 
ok done
 
Did it work this time?
 
yep nothing returned
told that console whos boss
 
Damn straight!
Now fire up your terminal and try to ssh.
(crosses fingers)
 
10:32 PM
im scared...
 
Don't close your console :-)
 
yes for now.
 
we're in baby!
 
BOOOM!
Cool now for the rest!
 
10:33 PM
*highfive
 
*highfive
Now lets add the rules for your web server
sudo /sbin/iptables -A INPUT -i venet0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
sudo /sbin/iptables -A OUTPUT -o venet0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
Copy pasta one then the other.
 
done ... i love my terminal :)
kicks consoles ass
 
:') don't we all!
sudo /sbin/iptables -A OUTPUT -o venet0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT
sudo /sbin/iptables -A INPUT -i venet0 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT
Now these. This will allow you to ssh FROM your server into another.
 
ok done
 
(this is just for completeness)
okay now we need to save these rules.
Hey one qq.
 
10:36 PM
mhhm
 
You're not running email from this are you?
Or https?
 
I recieve email to my domain, I edited my MX records at my DNS to bounce it to gmail... wil this effect it?
 
I don't think it will.
 
cool
 
your MX should bounce regardless.
 
10:37 PM
I do keep getting a message about new email in something root
but i ignore it :)
 
We can handle that in a min.
 
your a machine!
 
okay so the next command is /sbin/service iptables save
sudo /sbin/service iptables save
 
Saving firewall rules to /etc/sysconfig/iptables: [ OK ]
 
Does your website work?
 
10:40 PM
ha ha
website not working :(
 
Even by ip address?
 
Yar? Not working by ip address?
 
yep not working anyway
 
It worked before?
 
10:41 PM
yup
 
Okay let's go through a few of the same things.
 
the domain and the IP point to two different areas though, using an NGINX vhost
 
Can you explain more about your domain and ip?
So hold on.
You have two vhost
one with a domain name
and one with ip address from venet0:0
 
one vhost with the domain name
ip goes to NGINX web root
 
can you ping your domain name from your mac?
 
10:44 PM
its pinging
different ip though 0.0
 
nice!
That means it's your nginx config.
 
its not even in same range though is that right?
 
Oh it's not the same as your current IP?
 
nope
its cloudflare
=/
 
ah they just have you put in their ip and route it around to your server?
(I am reading their docs one minute)
 
10:47 PM
I use their nameservers in the DNS thats all I know, it's a CDN
if I try to ping my IP it timesout
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4
Request timeout for icmp_seq 5
 
Well we didn't open ICMP on your iptables. :D
 
:D
i like the sound of that
 
sudo /sbin/iptables iptables -A INPUT -p icmp -j ACCEPT
 
Bad argument `iptables'
maybe iptables once?
 
Lol wat. Yes that would be better.
 
10:52 PM
k done :0
:)
save now?
 
ping work now?
Test ping first/
 
nope still Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
one vhost
woops
 
`sudo /sbin/iptables -A OUTPUT -p icmp --icmp-type echo-request -j ACCEPT`
`sudo /sbin/iptables -A INPUT -p icmp --icmp-type echo-reply -j ACCEPT`
Do them.
 
k done
 
Ping now?
 
10:57 PM
same timeout :(
 
Hmmm...
Those should have worked.
 
perhaps I should reboot my VPS?
 
Let
That shouldn't make a difference (this isn't windows :D)
Let's reload your iptables
Actually first lets stop iptables.
 

  last day (15 days later) »