2013-07-06 4 views
0

PCI 준수를 위해 chrooting을 시도하고 있습니다. 나는 소수의 사용자 만이 ftp가 아닌 sftp를 통해 연결할 수 있기를 바란다. 나는 쉽게 제한 할 수있다. 그러나 나는 그들이 sirp 사용자가 chroot되어서 dir tree를 가로 질러 모든 것을 볼 수 있도록해야한다. 직후,openssh에서 chroot가 작동하지 않습니다. 6.2

$ sftp -v [email protected] 
OpenSSH_5.9p1, OpenSSL 0.9.8x 10 May 2012 
debug1: Reading configuration data /etc/ssh_config 
debug1: /etc/ssh_config line 20: Applying options for * 
debug1: /etc/ssh_config line 53: Applying options for * 
debug1: Connecting to hostname [x.x.x.x] port 22. 
debug1: Connection established. 
debug1: identity file /Users/me/.ssh/id_rsa type 1 
debug1: identity file /Users/me/.ssh/id_rsa-cert type -1 
debug1: identity file /Users/me/.ssh/id_dsa type -1 
debug1: identity file /Users/me/.ssh/id_dsa-cert type -1 
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.2p2-hpn13v14 FreeBSD-openssh-portable-6.2.p2_2,1 
debug1: match: OpenSSH_6.2p2-hpn13v14 FreeBSD-openssh-portable-6.2.p2_2,1 pat OpenSSH* 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_5.9 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: server->client aes128-ctr hmac-md5 none 
debug1: kex: client->server aes128-ctr hmac-md5 none 
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP 
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY 
debug1: Server host key: RSA 54:8b:66:39:15:d4:6f:ed:82:d4:c2:82:b0:a3:45:03 
debug1: Host 'hostname' is known and matches the RSA host key. 
debug1: Found key in /Users/me/.ssh/known_hosts:35 
debug1: ssh_rsa_verify: signature correct 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: SSH2_MSG_NEWKEYS received 
debug1: Roaming not allowed by server 
debug1: SSH2_MSG_SERVICE_REQUEST sent 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug1: Authentications that can continue: publickey,password 
debug1: Next authentication method: publickey 
debug1: Offering RSA public key: /Users/me/.ssh/id_rsa 
debug1: Authentications that can continue: publickey,password 
debug1: Trying private key: /Users/me/.ssh/id_dsa 
debug1: Next authentication method: password 
[email protected]'s password: 
debug1: Authentication succeeded (password). 
Authenticated to hostname ([x.x.x.x]:22). 
debug1: channel 0: new [client-session] 
debug1: Requesting [email protected] 
debug1: Entering interactive session. 
debug1: channel 0: free: client-session, nchannels 1 
debug1: fd 0 clearing O_NONBLOCK 
Connection to hostname closed by remote host. 
Transferred: sent 1920, received 2560 bytes, in 0.0 seconds 
Bytes per second: sent 1111840.9, received 1482454.5 
debug1: Exit status -1 
Connection closed 

당신이 볼 수 있듯이 :

Match User dbl 
ChrootDirectory %h 
AllowTCPForwarding no 
X11Forwarding no 
ForceCommand internal-sftp 

내가 시도

내가이 출력을 얻을 연결 :

나는 첫 번째 사용자에 테스트 내에서 OpenSSH의 ssd_config 파일이 추가 암호를 입력하면 즉시 연결이 닫힙니다. 그것은 sftp 프롬프트를 불러 오지도 않습니다. 나는 여기에 관련되어 보이지만 어디서나 얻지 못한 몇 가지 다른 게시물을 시도했다.

각 사용자는/bin/sh를 쉘로 가지고 있습니다.

나는 비슷한 문제 사람들이 과거에 SFTP로했고 한의 무리를 본 적이

답변

0

Subsystem  sftp  internal-sftp 
Match Group sftponly 
    ChrootDirectory /home/%u 
    ForceCommand internal-sftp 
    AllowTcpForwarding no 

또한 당신이 계획하는 경우 sshd_config에에 실종은 상단 줄을 추가하여 해결되었다 대부분의 시간 몇 명의 사용자를 추가하려면 아래의 설정과 같은 sftp 그룹을 설정하는 것이 좋습니다.

블로그 게시물을 약간 뒤로 올려 놓았지만, openssh-5를 사용했습니다. 또한 초 안에 새 사용자를 설정하는 더럽지 만 효과적인 대화 형 스크립트가 포함되어 있습니다. 새 클라이언트가 들어올 때 항상 작업에 사용하십시오.

http://264nmtechblog.wordpress.com/2013/10/

희망이 도움은 - 어쩌면/로그인 /의 보안은/var를 게시하지 않을 경우 문제 권한을 기반으로하는 경우까지 당신에게 더 나은 머리를 줄 수도있다.