我在CentOS 6.7上遇到了一个问题,那里的SSHlogin比这个networking上的任何非6.7机器(例如7.2,5.11)多一个。 在客户端运行debugging显示“进入交互式会话”挂起。
我正在使用基于此testing的命令是使用SSH密钥从我的笔记本电脑的time ssh <host> true 。
我已经检查/修改的两件事是UseDNS和GSSAPIAuthentication ,并且都被禁用。
我在一个不同的端口上启动了一个单独的守护进程并进行了debugging,并且发现了短暂挂起的位置:
debug1: SELinux support enabled debug3: ssh_selinux_setup_exec_context: setting execution context {1s hang} debug3: ssh_selinux_setup_exec_context: done
SELinux被设置为“宽容”。 我不知道为什么它会打扰“设置上下文”。 有没有办法让这两个相处得更好,而不是完全禁用SELinux? 我意识到1s并不多,但是我使用这台特定的机器作为一个SSH网关,向拥有IP白名单的主机(这是一个静态的IP机器),并且它在一天中加起来。
运行strace后,挂起更细一些:
22:16:05.445032 open("/selinux/user", O_RDWR|O_LARGEFILE) = 4 <0.000090> 22:16:05.445235 write(4, "unconfined_u:system_r:sshd_t:s0-s0:c0.c1023 unconfined_u", 56) = 56 <0.334742> 22:16:05.780128 read(4, "18\0unconfined_u:system_r:prelink_mask_t:s0-s0:c0.c1023\0unconfined_u:system_r:unconfined_mount_t:s0-s0:c0.c1023\0unconfined_u:system_r:abrt_helper_t:s0-s0:c0.c1023\0unconfined_u:system_r:oddjob_mkhomedir_t:s0-s0:c0.c1023\0unconfined_u:system_r:unconfined_notrans_t:s0-s0:c0.c1023\0unconfined_u:system_r:unconfined_execmem_t:s0-s0:c0.c1023\0unconfined_u:system_r:unconfined_java_t:s0-s0:c0.c1023\0unconfined_u:system_r:unconfined_mono_t:s0-s0:c0.c1023\0unconfined_u:system_r:chkpwd_t:s0-s0:c0.c1023\0unconfined_u:system_r:passwd_t:s0-s0:c0.c1023\0unconfined_u:system_r:updpwd_t:s0-s0:c0.c1023\0unconfined_u:system_r:mount_t:s0-s0:c0.c1023\0unconfined_u:system_r:rssh_t:s0-s0:c0.c1023\0unconfined_u:system_r:xauth_t:s0-s0:c0.c1023\0unconfined_u:system_r:unconfined_t:s0-s0:c0.c1023\0unconfined_u:system_r:openshift_t:s0-s0:c0.c1023\0unconfined_u:unconfined_r:oddjob_mkhomedir_t:s0-s0:c0.c1023\0unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023\0", 4095) = 929 <0.000079>
写入/selinux/user需要350毫秒。
更新1 – 我尝试过的事情 :
semodule -d unconfined – 这有一个积极的影响,减lesslogin时间大约500毫秒。 然而,我的C7和C5.11盒子(我从那以后(重新)学习了SELinux禁用)平均~525毫秒 我问太多了吗? 对于selinux-permissive机器,10-1200ms是可接受的login时间? 好奇别人的基准是什么。