Kann ich ssh so beschränken, dass es Verbindungen nur mit bestimmten IP-Adressen aufbaut? Also nicht, dass ssh nur an einer bestimmten ip-adresse lauscht, sondern dass ich nur eine verbindung aufbauen kann, wenn ich am client eine ip-adresse habe, die mit 217 beginnt.
Ich will so rein ssh "beschneiden", nicht andere services.
ssh Zugriffsbeschränkung IP-Adressen...
Re: ssh Zugriffsbeschränkung IP-Adressen...
siehe http://www.openbsd.org/cgi-bin/man.cgi? ... SD+Current
ein partial matching wirst du wohl kaum hinbekommen..
ListenAddress
Specifies the local addresses sshd should listen on. The follow-
ing forms may be used:
ListenAddress host|IPv4_addr|IPv6_addr
ListenAddress host|IPv4_addr:port
ListenAddress [host|IPv6_addr]:port
If port is not specified, sshd will listen on the address and all
prior Port options specified. The default is to listen on all lo-
cal addresses. Multiple ListenAddress options are permitted. Ad-
ditionally, any Port options must precede this option for non
port qualified addresses.
ein partial matching wirst du wohl kaum hinbekommen..
Re: ssh Zugriffsbeschränkung IP-Adressen...
@Jtb: Ich glaube, du hast cyber_bushi falsch verstanden.
Direkt mit einer Option in der sshd_config geht das nicht. Auf meinem Debian woody ist der sshd allerdings standardmässig so eingestellt, dass er tcp_wrapper benutzt, d.h. du kannst in /etc/hosts.allow sowas reinschreiben:
sshd: 192.168.1.0/255.255.255.0 192.168.10.0/255.255.255.0 127.0.0.1/255.0.0.0
und gleichzeitig in /etc/hosts.deny folgendes:
# Deny everything. This way we must list allowed things in hosts.allow
ALL: ALL
Ansonsten könntest du das natürlich noch über einen lokalen Paketfilter wie z.B. iptables lösen.
Direkt mit einer Option in der sshd_config geht das nicht. Auf meinem Debian woody ist der sshd allerdings standardmässig so eingestellt, dass er tcp_wrapper benutzt, d.h. du kannst in /etc/hosts.allow sowas reinschreiben:
sshd: 192.168.1.0/255.255.255.0 192.168.10.0/255.255.255.0 127.0.0.1/255.0.0.0
und gleichzeitig in /etc/hosts.deny folgendes:
# Deny everything. This way we must list allowed things in hosts.allow
ALL: ALL
Ansonsten könntest du das natürlich noch über einen lokalen Paketfilter wie z.B. iptables lösen.
-
rootmaster
- Posts: 483
- Joined: 2002-04-28 13:30
- Location: Hannover
Re: ssh Zugriffsbeschränkung IP-Adressen...
eine weitere möglichkeit, die ohne tcp_wrapper und sogar auf user-basis funzt, soll nicht verschwiegen bleiben ;) -> pamdodolin wrote:Direkt mit einer Option in der sshd_config geht das nicht. Auf meinem Debian woody ist der sshd allerdings standardmässig so eingestellt, dass er tcp_wrapper benutzt, d.h. du kannst in /etc/hosts.allow sowas reinschreiben:
sshd: 192.168.1.0/255.255.255.0 192.168.10.0/255.255.255.0 127.0.0.1/255.0.0.0
und gleichzeitig in /etc/hosts.deny folgendes:
# Deny everything. This way we must list allowed things in hosts.allow
ALL: ALL
Ansonsten könntest du das natürlich noch über einen lokalen Paketfilter wie z.B. iptables lösen.
in /etc/pam.d/sshd hinzufügen
Code: Select all
account required pam_access.so
Code: Select all
-:userx:ALL EXCEPT 217.
"back to the roots"
Cahn's Axiom:
When all else fails, read the instructions
When all else fails, read the instructions
Re: ssh Zugriffsbeschränkung IP-Adressen...
Coole Sache! Wenn wir schon dabei sind, alle Möglichkeiten zu sammeln, dann sollte man IMHO auch noch diese hier erwähnen:eine weitere möglichkeit, die ohne tcp_wrapper und sogar auf user-basis funzt, soll nicht verschwiegen bleiben -> pam
aus man sshd:
Hatte ich vorhin schon gefunden, es aber nicht erwähnt, weil esAUTHORIZED_KEYS FILE FORMAT
$HOME/.ssh/authorized_keys is the default file that lists the public keys
that are permitted for RSA authentication in protocol version 1 and for
public key authentication (PubkeyAuthentication) in protocol version 2.
AuthorizedKeysFile may be used to specify an alternative file.
[...]
from="pattern-list"
Specifies that in addition to RSA authentication, the canonical
name of the remote host must be present in the comma-separated
list of patterns (`*' and `'? serve as wildcards). The list may
also contain patterns negated by prefixing them with `'!; if the
canonical host name matches a negated pattern, the key is not
accepted. The purpose of this option is to optionally increase
security: RSA authentication by itself does not trust the network
or name servers or anything (but the key); however, if somebody
somehow steals the key, the key permits an intruder to log in
from anywhere in the world. This additional option makes using a
stolen key more difficult (name servers and/or routers would have
to be compromised in addition to just the key).
a) nur pro User geht und
b) nur bei PubKey-Authentication geht, nicht bei Password-Authentication.
IMHO trotzdem eine gute Möglichkeit...