OpenSSH + Chroot + Ldap

Alle weiteren Dienste, die nicht in die drei oberen Foren gehören.
Antworten
Floh927
Beiträge: 6
Registriert: 26.02.2012 13:25:47

OpenSSH + Chroot + Ldap

Beitrag von Floh927 » 26.02.2012 13:33:05

Hallo,

ich habe eine kleines Problem.
Ich habe einen Delixs-Server (Debian Squeeze) auf dem ich Nutzer via Ldap angelegt habe.
Ich habe einen Nutzer Test. Test ist in der Gruppe "Internet" (GID 1008).
Der Gruppe Internet hab ich über ACL die Rechte zugewiesen. Nun möchte ich der Gruppe einen SSH Zugang ermöglichen, der auf sftp beschränkt ist.
Ich hab gegoogelt und bin auf diese (http://www.debian-administration.org/articles/590) Anleitung gestoßen. Hab alles so gemacht. Und immer wenn ich nun verbinden möchte kommt "Connection closed". Ohne die Chroot-Einstellung geht der SSH Zugang.

Code: Alles auswählen

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
MaxAuthTries 4
LoginGraceTime 30
PermitRootLogin yes
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile	%h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server



# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes


Match group internet
    ChrootDirectory /home
    AllowTCPForwarding no
    X11Forwarding no
    ForceCommand /usr/lib/openssh/sftp-server

Code: Alles auswählen

fsteinbaock@alix:~$ sftp fsteinbaock@10.100.0.1
fsteinbaock@10.100.0.1's password: 
Connection closed
Ich hoffe Ihr habt eine Idee woran das liegt, bzw. was ich falsch mache.


Mfg Floh927

Benutzeravatar
pangu
Beiträge: 1400
Registriert: 15.11.2011 20:50:52
Lizenz eigener Beiträge: GNU General Public License
Wohnort: /proc/1

Re: OpenSSH + Chroot + Ldap

Beitrag von pangu » 26.02.2012 21:43:00

Guck mal hier, wenn's dir evtl. hilft ...

http://www.howtoforge.com/restricting-u ... an-squeeze

Ist drei Jahre aktueller als das Tutorial, das du verwendet hast. Ich hab's mir jetzt nicht detailliert verglichen, aber ich wollte es dir nicht vorenthalten.

Viel Erfolg.
Man gibt Geld aus, das man nicht hat, um damit Dinge zu kaufen, die man nicht braucht, um damit Leute zu beeindrucken, die man nicht mag.

Floh927
Beiträge: 6
Registriert: 26.02.2012 13:25:47

Re: OpenSSH + Chroot + Ldap

Beitrag von Floh927 » 27.02.2012 08:06:41

Danke ich hab gerade keine Zugriff :) sitz in der Schule :(

ich schau heute Abend mal und poste dann das Ergebniss, aber schönen Dank schonmal :)

//edit

Funktioniert jetzt einwandfrei



Mfg Floh927

Floh927
Beiträge: 6
Registriert: 26.02.2012 13:25:47

Re: OpenSSH + Chroot + Ldap

Beitrag von Floh927 » 27.02.2012 17:47:00

gibt es eine Möglichkeit mehrere Chroot Verzeichnisse anzugeben?

Also Gruppe 1 Darf auf /home/all & /home/group oder so?

einfacheres erstellen von mehreren Matchblocks bringt kein erfolg

Floh927
Beiträge: 6
Registriert: 26.02.2012 13:25:47

Re: OpenSSH + Chroot + Ldap

Beitrag von Floh927 » 14.03.2012 17:36:58

ok mal ne andere frage

wenn ich jetzt mein chroot individuell machen will ... dh jeder nutzer sieht nur sein eigenes hab ich in den alten anleitungen %u gefunden. Das kommt hinter den pfad.. geht bei mir aber nicht :(

Antworten