sshd chroot [SFTP] [PAM] - réseaux et sécurité - Linux et OS Alternatifs
MarshPosté le 15-04-2013 à 16:15:13
Bonjour
Je cherche a comprendre comment je pourrais ajouter un identification via une Berkeley DB a mon SFTP ? Donc, mon user pourrait ne pas être un user du système mais bien un user virtuel (façon vsftpd)
J'ai bien essayé de jouer avec le pam_userdb.so mais soit ca foire authen ssh soit le user n'est pas reconnu
/etc/ssh/sshd_config
Citation :
Port 22 Protocol 2
SyslogFacility AUTHPRIV PermitRootLogin no
PasswordAuthentication no ChallengeResponseAuthentication no
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE AcceptEnv XMODIFIERS
X11Forwarding no
Match User jack ChrootDirectory /tmp/sftp/%u AllowTcpForwarding no ForceCommand internal-sftp PasswordAuthentication yes
/etc/pam.d/sshd
Citation :
#%PAM-1.0 auth required pam_sepermit.so auth include password-auth account required pam_nologin.so account include password-auth password include password-auth # pam_selinux.so close should be the first session rule session required pam_selinux.so close session required pam_loginuid.so # pam_selinux.so open should only be followed by sessions to be executed in the user context session required pam_selinux.so open env_params session optional pam_keyinit.so force revoke session include password-auth
/etc/pam.d/password-auth
Citation :
# This file is auto-generated. # User changes will be destroyed the next time authconfig is run. auth required pam_env.so auth sufficient pam_unix.so nullok try_first_pass auth requisite pam_succeed_if.so uid >= 500 quiet auth required pam_deny.so
Marsh Posté le 15-04-2013 à 16:15:13
Bonjour
Je cherche a comprendre comment je pourrais ajouter un identification via une Berkeley DB a mon SFTP ?
Donc, mon user pourrait ne pas être un user du système mais bien un user virtuel (façon vsftpd)
J'ai bien essayé de jouer avec le pam_userdb.so mais soit ca foire authen ssh soit le user n'est pas reconnu
/etc/ssh/sshd_config
Port 22
Protocol 2
SyslogFacility AUTHPRIV
PermitRootLogin no
PasswordAuthentication no
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
UsePAM yes
Subsystem sftp internal-sftp -f AUTH -l VERBOSE
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS
X11Forwarding no
Match User jack
ChrootDirectory /tmp/sftp/%u
AllowTcpForwarding no
ForceCommand internal-sftp
PasswordAuthentication yes
/etc/pam.d/sshd
#%PAM-1.0
auth required pam_sepermit.so
auth include password-auth
account required pam_nologin.so
account include password-auth
password include password-auth
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session required pam_loginuid.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open env_params
session optional pam_keyinit.so force revoke
session include password-auth
/etc/pam.d/password-auth
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth required pam_env.so
auth sufficient pam_unix.so nullok try_first_pass
auth requisite pam_succeed_if.so uid >= 500 quiet
auth required pam_deny.so
account required pam_unix.so
account sufficient pam_localuser.so
account sufficient pam_succeed_if.so uid < 500 quiet
account required pam_permit.so
password requisite pam_cracklib.so try_first_pass retry=3 type=
password sufficient pam_unix.so md5 shadow nullok try_first_pass use_authtok
password required pam_deny.so
session optional pam_keyinit.so revoke
session required pam_limits.so
session [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session required pam_unix.so
C'est possible ou je dois utiliser un autre moyen ?
merci