LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-11-2017, 06:58 AM   #1
JamesGT
Member
 
Registered: Oct 2009
Location: St. Louis, MO, USA
Distribution: Slackware64 Live
Posts: 300

Rep: Reputation: 51
IPtables, stumped


I have a server where I run Slackware64 14.1 and last night I seemed to have messed up my iptables setup.

Originally I used these pages to set everything up for protection and for ssh.

https://docs.slackware.com/howtos:security:ssh

http://www.slackware.com/~alien/efg/

I followed everything to the letter, and everything was good for a number of years. I did change the ssh port number as I didn't want to use 22, but it all worked.

Yesterday in an attempt to open up FTP(I never had to use it, I just used SFTP all the time...I was the only one to ever need access), I did something to close off ssh completely.

Port 80, 21, 37 and 113 are the only ports open. I've tried different settings in rc.firewall to make changes, but they don't seem to take effect. I've checked to see if everything is is setup the way it should, but it doesn't seem to make a difference.

I've rolled back all the changes to the site, removing rc.firewall, removing all the rc.hide_ssh items to just use sshd_config and setting it to port 22, but even that doesn't open up the port so I can connect directly.

My only access is rebooting my system into a rescue console where I can mount the drive, then chroot to it to make changes. Once changes are made, I reboot to see if it works, but nothing seems to change to open that specific port for SSH.

Any ideas? Are the iptables rules stored somewhere that need to be flushed? I have tried iptables -F but it seems to flush the rescue console, not the iptables in Slackware.

JamesT
 
Old 09-11-2017, 07:46 AM   #2
slalik
Member
 
Registered: Nov 2014
Location: Moscow
Distribution: Slackware
Posts: 233

Rep: Reputation: 203Reputation: 203Reputation: 203
Quote:
Originally Posted by JamesGT View Post
My only access is rebooting my system into a rescue console where I can mount the drive, then chroot to it to make changes.
Do you also mount /proc /sys /dev before chroot?
Code:
# mount --bind /proc /mnt/proc
# mount --bind /dev /mnt/dev
# mount --bind /sys /mnt/sys
 
Old 09-11-2017, 08:34 AM   #3
JamesGT
Member
 
Registered: Oct 2009
Location: St. Louis, MO, USA
Distribution: Slackware64 Live
Posts: 300

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by slalik View Post
Do you also mount /proc /sys /dev before chroot?
Code:
# mount --bind /proc /mnt/proc
# mount --bind /dev /mnt/dev
# mount --bind /sys /mnt/sys
I did not.

I just did that, made all the same changes, used the following commands

Code:
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t nat -F
iptables -t mangle -F
iptables -F
iptables -X
Rebooted, same result.
 
Old 09-11-2017, 09:17 AM   #4
JamesGT
Member
 
Registered: Oct 2009
Location: St. Louis, MO, USA
Distribution: Slackware64 Live
Posts: 300

Original Poster
Rep: Reputation: 51
Looking at the last boot messages...sshd isn't even running. :/
 
Old 09-11-2017, 09:37 AM   #5
JamesGT
Member
 
Registered: Oct 2009
Location: St. Louis, MO, USA
Distribution: Slackware64 Live
Posts: 300

Original Poster
Rep: Reputation: 51
Ok, I got it.

Comparing the last few reboot logs showed that SSHD wasn't even running at all. I tried to run sshd from the rescue console, and it gave me a error in the config at line 60. Line 60 was a colon. Deleted that, rebooted, access granted.

I was in sshd_config because I noticed I could connect via port 22, and that's not supposed to happen. I went to check it in VI and I guess, I was in insert mode and when I went to exit :q, it put the colon in there. When I tried to exit, I wrote the file and exit(habit...even if I don't make any changes, I still write to the file).

Taking out the colon and rebooting I can ssh back in.

James
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I'm stumped duaneha Linux - Newbie 3 05-26-2008 05:20 PM
Stumped ! CastleBrie General 3 03-24-2006 12:36 PM
Stumped on iptables rgedye Linux - Security 8 01-20-2006 03:59 AM
really has me stumped! brunogartner Linux - Newbie 4 06-30-2003 05:43 AM
Stumped with IPTABLES TruckStuff Linux - Security 6 06-16-2002 07:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration