smengcl edited a comment on pull request #10:
URL: 
https://github.com/apache/ozone-docker-runner/pull/10#issuecomment-1030642660


   The root cause for issue (2) is that centos 8.4's 
`openssh-server-8.0p1-10.el8.x86_64` package installed by ozone repo's 
`compose/ozonescripts/Dockerfile` has `pam_nologin.so` listed as required in 
`/etc/pam.d/sshd`, and `/run/nologin` somehow not removed:
   
   ```bash
   [root@d6aa10d75824 /]# cat /etc/pam.d/sshd
   #%PAM-1.0
   auth       substack     password-auth
   auth       include      postlogin
   account    required     pam_sepermit.so
   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    required     pam_namespace.so
   session    optional     pam_keyinit.so force revoke
   session    optional     pam_motd.so
   session    include      password-auth
   session    include      postlogin
   [root@d6aa10d75824 /]# rpm -q --whatprovides /etc/pam.d/sshd
   openssh-server-8.0p1-10.el8.x86_64
   ```
   
   Therefore, when `/opt/hadoop/sbin/start-ozone.sh` script starts to ssh (as 
non-root user) into other containers, the ssh server in other containers checks 
the existence of `/run/nologin`, which should have been removed by some systemd 
service startup but it hasn't, and eventually the ssh login is rejected.
   
   ~The solution is to add a line in Ozone repo's 
`compose/ozonescripts/Dockerfile` to either:~
   ~1) Remove `/run/nologin`; or~
   ~2) Remote the line `account    required     pam_nologin.so` from 
`/etc/pam.d/sshd`~
   
   Turns out I forgot to rebuild the ozone-runner-scripts image used by 
`ozonescripts`. So I actually can just remove it from the Dockerfile for 
`ozone-docker-runner`. Problem solved
   
   ```bash
   $ docker-compose exec scm bash
   bash-4.4$ cat /etc/*release
   CentOS Linux release 8.4.2105
   NAME="CentOS Linux"
   VERSION="8"
   ID="centos"
   ID_LIKE="rhel fedora"
   VERSION_ID="8"
   PLATFORM_ID="platform:el8"
   PRETTY_NAME="CentOS Linux 8"
   ANSI_COLOR="0;31"
   CPE_NAME="cpe:/o:centos:centos:8"
   HOME_URL="https://centos.org/";
   BUG_REPORT_URL="https://bugs.centos.org/";
   CENTOS_MANTISBT_PROJECT="CentOS-8"
   CENTOS_MANTISBT_PROJECT_VERSION="8"
   CentOS Linux release 8.4.2105
   CentOS Linux release 8.4.2105
   bash-4.4$ ls -l /run/nologin
   ls: cannot access '/run/nologin': No such file or directory
   bash-4.4$ ssh om
   Warning: Permanently added 'om,172.26.0.3' (ECDSA) to the list of known 
hosts.
   [hadoop@2a810ad3016a ~]$
   [hadoop@2a810ad3016a ~]$ logout
   Connection to om closed.
   bash-4.4$ ssh datanode
   Warning: Permanently added 'datanode,172.26.0.4' (ECDSA) to the list of 
known hosts.
   [hadoop@c847a4f84b94 ~]$
   [hadoop@c847a4f84b94 ~]$ logout
   Connection to datanode closed.
   bash-4.4$
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to