Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Unix Operating Systems > Slackware Linux Support

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-20-2008, 05:50 AM
The Eighth Doctor
 
Posts: n/a
Default SSH visits from users who were not given permission--can they be blocked?

Hello from the Eighth Doctor
The subject line says it all: "SSH visits from users who were not given
permission--can they be blocked?"

Basically my box now running Slack 10.1 is being visited by people who were not
given my permission to do so, read hackers, and other annoyances. I frequently use
SSH from my Manhattan client to show them Linux, or to just keep busy, and I've
given a fellow I know online who's currently using the services of his school to visit
the box. He needs to learn Linux, and I trust him as much as he trusts me.

However since we reached that decision, I've seen scads of IP addresses attempting
to enter the box from the Internet. Sometimes they use FTP, but almost always
SSH. Once I saw something from a UUNET customer attempt a hack, I found out
later that there's a worm running who targets machines which have the SSH port
open.

That being said; once I've got the list of acceptable IP addresses from the I'net, any
suggestions on how to configure the current firewall mechanism to reject everyone
else? Also the router does contain a firewall, but I'm not sure as to how to have it
block those addresses, if it can...
--
Gregg drwho8 atsign att dot net
"This signature is waiting for Garbot."

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-20-2008, 05:50 AM
Grant Coady
 
Posts: n/a
Default Re: SSH visits from users who were not given permission--can they be blocked?

On Fri, 11 Mar 2005 06:11:59 GMT, drwho8__NOTME__@att.net (The Eighth Doctor) wrote:

>That being said; once I've got the list of acceptable IP addresses from the I'net, any
>suggestions on how to configure the current firewall mechanism to reject everyone
>else? Also the router does contain a firewall, but I'm not sure as to how to have it
>block those addresses, if it can...


put them in a list and read into firewall:

# known ssh host data file
# ~~~~~~~~~~~~~~~~~~~~~~~~
# Format of data file for known hosts is one data record per line,
# each tab or space delimited data record contains three fields:
# addr port [# optional comment]
#
# Example: "192.0.2.123 ssh # Fred"
#
# Notes: data file must not contain blank or comment lines, nor a
# newline after the last record. If you use a non-standard ssh port,
# replace 'ssh' with your custom port number in the data file.

SSH_HOSTS_ALLOW_FILE="$INCLUDE_FILE_PATH/allow-ssh-src-addr"
SSH_LOGIN_RATE_LIMIT="4/hour"

function allow_restricted_fw_ingress ()
{
if test -r $SSH_HOSTS_ALLOW_FILE; then
while read addr port rest; do
iptables -A INPUT -p tcp $MSTATE NEW --src $addr \
--dport $port $MLIMIT $SSH_LOGIN_RATE_LIMIT -j ACCEPT
done < $SSH_HOSTS_ALLOW_FILE
fi
.. . .
Cheers,
Grant.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-20-2008, 05:50 AM
The Eighth Doctor
 
Posts: n/a
Default Re: SSH visits from users who were not given permission--can they be blocked?

In article <k6e231h5jd0npvvr7voisaq6kiomg3q1f0@4ax.com>,
grant_nospam@dodo.com.au says...
>
>On Fri, 11 Mar 2005 06:11:59 GMT, drwho8__NOTME__@att.net (The Eighth

Doctor) wrote:
>
>>That being said; once I've got the list of acceptable IP addresses from the I'net,

any
>>suggestions on how to configure the current firewall mechanism to reject

everyone
>>else? Also the router does contain a firewall, but I'm not sure as to how to have it
>>block those addresses, if it can...

>
>put them in a list and read into firewall:
>
># known ssh host data file
># ~~~~~~~~~~~~~~~~~~~~~~~~
># Format of data file for known hosts is one data record per line,
># each tab or space delimited data record contains three fields:
># addr port [# optional comment]
>#
># Example: "192.0.2.123 ssh # Fred"
>#
># Notes: data file must not contain blank or comment lines, nor a
># newline after the last record. If you use a non-standard ssh port,
># replace 'ssh' with your custom port number in the data file.
>
>SSH_HOSTS_ALLOW_FILE="$INCLUDE_FILE_PATH/allow-ssh-src-addr"
>SSH_LOGIN_RATE_LIMIT="4/hour"
>
>function allow_restricted_fw_ingress ()
>{
> if test -r $SSH_HOSTS_ALLOW_FILE; then
> while read addr port rest; do
> iptables -A INPUT -p tcp $MSTATE NEW --src $addr \
> --dport $port $MLIMIT $SSH_LOGIN_RATE_LIMIT -j

ACCEPT
> done < $SSH_HOSTS_ALLOW_FILE
> fi
>. . .
>Cheers,
>Grant.
>

Hello from the Eighth Doctor
Nice, Grant it makes sense. However... One small detail. How do you create a
firewal using the basic tools that Pat provides for Slackware? That's one subject, I'm
not familiar with. I remember telling the installer to install the things from the n disk
that's associated with the technology, but I don't recall going over that step.
-----
Gregg drwho8 atsign att dot net

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-20-2008, 05:50 AM
bmgz
 
Posts: n/a
Default Re: SSH visits from users who were not given permission--can theybe blocked?

The Eighth Doctor wrote:
> How do you create a firewal using the basic tools that Pat provides for Slackware?


GOOGLE "iptables"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-20-2008, 05:50 AM
Grant Coady
 
Posts: n/a
Default Re: SSH visits from users who were not given permission--can they be blocked?

On Fri, 11 Mar 2005 06:54:58 GMT, drwho8__NOTME__@att.net (The Eighth Doctor) wrote:

>In article <k6e231h5jd0npvvr7voisaq6kiomg3q1f0@4ax.com>,
>grant_nospam@dodo.com.au says...
>>
>>On Fri, 11 Mar 2005 06:11:59 GMT, drwho8__NOTME__@att.net (The Eighth

>Doctor) wrote:
>>
>>>That being said; once I've got the list of acceptable IP addresses from the I'net,

>any
>>>suggestions on how to configure the current firewall mechanism to reject

>everyone
>>>else? Also the router does contain a firewall, but I'm not sure as to how to have it
>>>block those addresses, if it can...

>>
>>put them in a list and read into firewall:

.. . .

>Hello from the Eighth Doctor
>Nice, Grant it makes sense. However... One small detail. How do you create a
>firewal using the basic tools that Pat provides for Slackware? That's one subject, I'm
>not familiar with. I remember telling the installer to install the things from the n disk
>that's associated with the technology, but I don't recall going over that step.


vim /etc/rc.d/rc.firewall (not the answer you seek

Try firestarter? Roll your own: start at netfilter.org.

Accept that the 'background radiation' of the Internet is people/'bots
looking for easy targets like shiny new GNU/Linux installs with empty
root password. I chucked my example into the ring as I had to visit
all my network config files this morning as I took out 10-Base-T LAN
segment and put in a CAT5 run to another room. Too unreliable, the
old coax.

Cheers,
Grant.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-20-2008, 05:51 AM
+Alan Hicks+
 
Posts: n/a
Default Re: SSH visits from users who were not given permission--can they be blocked?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

People! Please learn to trim your quotes. It is insane to include that
much crap that you're not directly reploying too. You left 1.3 times
_more_ quoted lines as you reply lines. See how I'm only replying to 3
of your lines, so I trim out the rest? Not doing so makes you look like
an ass.

In alt.os.linux.slackware, Grant Coady dared to utter,
> I took out 10-Base-T LAN
> segment and put in a CAT5 run to another room. Too unreliable, the
> old coax.


I think you mean 10Base2.

10Base2 = thinnet; thin, malable coax cable, runs at up to 10Mbps,
works at out to 185 meters without signal loss
10Base5 = thicknet; fat, ugly coax cable, POS, runs at 10Mbps,
works at out to 500 meters without signal loss
10BaseT = twisted pair; thin, malable 4 pair cat-5 cable, runs at
10, 100, or 1000Mbps and possible beyond with higher
category cable, works without signal degredation out to
100 meters

Note that the IEEE way of writing the various standards is split into
three parts (and doesn't quite follow a standard, ain't that a crock?).

Speed + type + length

Speed is the speed data can travel down the wire in Mbps. Note that
twisted pair is sometimes written 100BaseT or 1000BaseT for this
reason.

Type is either Base or Broad. Base indicates baseband, which means that
a network signal (really just a change in voltage along the cable) is
sent down a single channel. Broadband indicates that the signal is sent
down multiple channels at the same time. Note this has absolutely
nothing to do with your home internet connection.

Length is the approximate distance in 100 meter incriments that the
standard is reliable out to. In 10BaseT, the T means "twisted pair"
instead. Don't ask me why they did this, but they did it.

Everyone happy with your friendly neighborhood networking lesson today?

- --
It is better to hear the rebuke of the wise,
Than for a man to hear the song of fools.
Ecclesiastes 7:5
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFCMZ1cvgVcFKpJf4gRAi+mAJ4r6K7E/C8tZ8Tb2U9KWPVUaLaTXACeOP31
lOj1Nz5jJ4m0YWIOqWaqNyU=
=HQwU
-----END PGP SIGNATURE-----
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-20-2008, 05:51 AM
Sylvain Robitaille
 
Posts: n/a
Default Re: SSH visits from users who were not given permission--can they be blocked?

The Eighth Doctor wrote:

> once I've got the list of acceptable IP addresses from the I'net,
> any suggestions on how to configure the current firewall mechanism
> to reject everyone else?


TCP_Wrappers, on the system running Sshd will do what you want: list
those hostnames/addresses (or domain names, address blocks, etc.) you
want to permit in hosts.allow, and the rest will be denied by default.
You'll also have the benefit of logged rejections, so you'll know a)
who's been knocking at the door (for whatever that knowledge is worth),
and b) if anyone you meant to permit access to is being rejected.

I hope that helps ...

--
----------------------------------------------------------------------
Sylvain Robitaille syl@alcor.concordia.ca

Systems analyst Concordia University
Instructional & Information Technology Montreal, Quebec, Canada
----------------------------------------------------------------------

(sample hosts.allow entry)

# permit Ssh connections from the local network:
sshd :ALL@.concordia.ca \
:allow

# -- default
ALL :ALL@ALL :deny

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-20-2008, 05:51 AM
Mr. I.M. Kitty
 
Posts: n/a
Default Re: SSH visits from users who were not given permission--can theybe blocked?

+Alan Hicks+ wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> People! Please learn to trim your quotes. It is insane to include that
> much crap that you're not directly reploying too. You left 1.3 times
> _more_ quoted lines as you reply lines. See how I'm only replying to 3
> of your lines, so I trim out the rest? Not doing so makes you look like
> an ass.


Bitching makes people look like asses, too.

I remember you. I don't like you specifically for that reason.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-20-2008, 05:51 AM
Joost Kremers
 
Posts: n/a
Default Re: SSH visits from users who were not given permission--can they be blocked?

Mr. I.M. Kitty wrote:
> I remember you. I don't like you specifically for that reason.


must be tough living your life like that, not liking people because you
remember them.

--
Joost Kremers joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 02-20-2008, 05:51 AM
Mr. I.M. Kitty
 
Posts: n/a
Default Re: SSH visits from users who were not given permission--can theybe blocked?

The Eighth Doctor wrote:
> Hello from the Eighth Doctor
> The subject line says it all: "SSH visits from users who were not given
> permission--can they be blocked?"
>


Sounds fairly easy to follow...

> Basically my box now running Slack 10.1 is being visited by people who were not
> given my permission to do so, read hackers, and other annoyances. I frequently use
> SSH from my Manhattan client to show them Linux, or to just keep busy, and I've
> given a fellow I know online who's currently using the services of his school to visit
> the box. He needs to learn Linux, and I trust him as much as he trusts me.
>


That's always a good relationship to have with someone, especially from
afar... ^_^

> However since we reached that decision, I've seen scads of IP addresses attempting
> to enter the box from the Internet. Sometimes they use FTP, but almost always
> SSH. Once I saw something from a UUNET customer attempt a hack, I found out
> later that there's a worm running who targets machines which have the SSH port
> open.
>


This is a given. The moment you stick a box on the net, be it OSX,
Unix, BSD, Windows, Linux, BeOS, etc, it'll get probed and prodded like
a lab rat in a needle testing facility.

> That being said; once I've got the list of acceptable IP addresses from the I'net, any
> suggestions on how to configure the current firewall mechanism to reject everyone
> else? Also the router does contain a firewall, but I'm not sure as to how to have it
> block those addresses, if it can...


Public key authentication is also a good security measure for SSH.

I found this as a little starter:
http://cfm.gs.washington.edu/securit...client-pkauth/

Peruse it if you like or search for more detailed solutions.

Either way, have fun! =

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:28 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
UnixAdminTalk.com

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532