sshd - PasswordAuthentication nur von bestimmten Adressen

Stefan U. Hegner stefan at hegner-online.de
Mon Oct 28 21:15:39 CET 2013


Hi Frank,

Am 28.10.2013 19:26, schrieb Frank Bergmann:
> On Mon, Oct 28, 2013 at 06:50:21PM +0100, Stefan U. Hegner wrote:
>> Allerdings möchte ich gerne für Zugriff aus dem WAN aus
>> sicherheitsgründen die PasswordAuthentication ausknipsen und nur
>> Zugriffe per key zulassen.
>>
>> Gibt es eine Möglichkeit, dem sshd solch eine differenzierte
>> Vorgehensweise beizubiegen? Oder muss ich dazu einen zweiten sshd mit
>> anderer Config z.B. über den xinetd an einem anderen Port lauschen lassen?
> Laut "man sshd_config": Match
> Ansonsten kann man pro Account den Login einfach selbst beschränken:
> ~/.ssh/authorized_keys:
> from="192.168.1.1" ssh-rsa ....
> Infos dazu stehen in der man-page ssh_config, Stichwort "PATTERNS".
> Hilft das?
Ja. - Typischer Fall von RTFM .... Grrrr, wieder erwischt!

Praktische Anwendungen habe ich hier gefunden:
http://blog.rootshell.be/2010/09/02/configuring-conditional-ssh-connections/

Nur leider funzt es noch gar nicht wie es soll.

Vom Prinzip ist das .2er Subnetz das von extern erreichbare Router-Netz
und das .1er Subnetz das interne und weiter gesicherte LTSP Netz.

Meine sshd_config sieht jetzt so aus (Ausschnitte):

    Port 22
    ListenAddress 192.168.2.0/24
    ListenAddress 192.168.1.0/24

    [...]

    Match Address 192.168.1.0/24
    # Change to no to disable tunnelled clear text passwords
    PasswordAuthentication yes

    Match Address 192.168.2.0/24
    # Change to no to disable tunnelled clear text passwords
    PasswordAuthentication no

    #EOF

Obwohl explizit "Multiple ListenAddress options are permitted." bekomme
ich mit der o.g. Config keine Verbindung aus dem .2er Subnetz. - Das
verstehe ich nicht. Daher habe ich die beiden Listen Statements erstmal
wieder ausgeknipst.

Mit den beiden Match-Pairs müsste aus dem .2er Netz keine
Password-Anmeldung möglich sein. - Aber leider geht das trotzdem. Dabei
liest sich das so schön einfach

    "When a condition is met, all the directives below will be applied
    until the next "/Match/" section or the end-of-file. This is why,
    they must be defined at the end of your sshd_config file."

Stehe ich gerade wieder mal voll auf der Leitung ?!?!? (Ach ja, sicher
ich habe den sshd neu durchgestartet ...).

Any Hints?

Danke

Stefan.

-- 
Stefan U. Hegner 
         <stefan at hegner-online.de>
              * * *
D-32584 Löhne --- good ole Germany
internet: http://www.hegner-web.de
              * * *
GPG-Key | D9DB 51BD 2DA6 9B3A 41CB
F-Print | 0287 05A1 8D11 38BA CE91

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lug-owl.de/pipermail/linux/attachments/20131028/f70f43d5/attachment.sig>


More information about the Linux mailing list