Guy Attrill
2014-03-21 10:50:04 UTC
my docker file
the base image is tianon/centos with java5 java6 maven and jenkins user
created
FROM guya/centos-6.5-build-slave-base:base
RUN yum update -y
RUN wget
http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
RUN wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
RUN rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
RUN yum install openssh-server supervisor policycoreutils-python-2.0.83
selinux-policy policycoreutils-python -y
RUN mkdir -p /var/run/sshd
RUN mkdir -p /var/run/sshd
RUN mkdir -p /var/log/supervisor
ADD supervisor.conf /etc/supervisor.conf
RUN mkdir -p /var/run/sshd ; chmod -rx /var/run/sshd
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
RUN sed -ri 's/#PermitRootLogin yes/PermitRootLogin yes/g'
/etc/ssh/sshd_config
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
RUN sed -ri 's/#UsePAM no/UsePAM no/g' /etc/ssh/sshd_config
RUN echo 'root:secret' | chpasswd
RUN sed -ri 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config
RUNrun sed -i -e 's/session required pam_loginuid.so/#session
required pam_loginuid.so/' /etc/pam.d/sshd sed -i -e 's/session
required pam_loginuid.so/#session required pam_loginuid.so/'
/etc/pam.d/sshd
EXPOSE 22
CMD ["/usr/bin/supervisord","-c","/etc/supervisor.conf"]
supervisor conf
[supervisord]
nodaemon=true
[program:sshd]
command=/usr/sbin/sshd -d
sshd starts up fine
but when i attempt to log in as root
debug1: Authentication succeeded (password).
Authenticated to localhost ([127.0.0.1]:49204).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-***@openssh.com
debug1: Entering interactive session.
debug1: channel 0: free: client-session, nchannels 1
Connection to localhost closed by remote host.
Connection to localhost closed.
Transferred: sent 2976, received 2392 bytes, in 0.0 seconds
Bytes per second: sent 1829168.9, received 1470219.1
debug1: Exit status -1
[***@guyabox buildslave]$ docker run -i -t -p 22 guya/jenkins-slave bash
bash-4.1# /usr/sbin/sshd -d
debug1: sshd version OpenSSH_5.3p1
debug1: read PEM private key done: type RSA
debug1: private host key: #0 type 1 RSA
Could not load host key: /etc/ssh/ssh_host_dsa_key
debug1: rexec_argv[0]='/usr/sbin/sshd'
debug1: rexec_argv[1]='-d'
Set /proc/self/oom_score_adj from 0 to -1000
debug1: Bind to port 22 on 0.0.0.0.
Server listening on 0.0.0.0 port 22.
debug1: Bind to port 22 on ::.
Server listening on :: port 22.
debug1: Server will not fork when running in debugging mode.
debug1: rexec start in 5 out 5 newsock 5 pipe -1 sock 8
debug1: inetd sockets after dupping: 3, 3
Connection from 172.17.42.1 port 56560
debug1: Client protocol version 2.0; client software version OpenSSH_6.2
debug1: match: OpenSSH_6.2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: permanently_set_uid: 74/74
debug1: list_hostkey_types: ssh-rsa
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST received
debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT
debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: KEX done
debug1: userauth-request for user root service ssh-connection method none
debug1: attempt 0 failures 0
debug1: userauth-request for user root service ssh-connection method
publickey
debug1: attempt 1 failures 0
debug1: test whether pkalg/pkblob are acceptable
debug1: temporarily_use_uid: 0/0 (e=0/0)
debug1: trying public key file /root/.ssh/authorized_keys
debug1: Could not open authorized keys '/root/.ssh/authorized_keys': No
such file or directory
debug1: restore_uid: 0/0
debug1: temporarily_use_uid: 0/0 (e=0/0)
debug1: trying public key file /root/.ssh/authorized_keys2
debug1: Could not open authorized keys '/root/.ssh/authorized_keys2': No
such file or directory
debug1: restore_uid: 0/0
Failed publickey for root from 172.17.42.1 port 56560 ssh2
debug1: userauth-request for user root service ssh-connection method
password
debug1: attempt 2 failures 1
Accepted password for root from 172.17.42.1 port 56560 ssh2
debug1: monitor_child_preauth: root has been authenticated by privileged
process
debug1: temporarily_use_uid: 0/0 (e=0/0)
debug1: ssh_gssapi_storecreds: Not a GSSAPI mechanism
debug1: restore_uid: 0/0
debug1: SELinux support enabled
ssh_selinux_getctxbyname: Failed to get default SELinux security context
for root
ssh_selinux_setup_exec_context: security_getenforce() failed
debug1: do_cleanup
Any idea how i tell selinx to allow sshd?-bash-4.1# sestatus -v
sestatus does the following
SELinux status: enabled
SELinuxfs mount: not mounted
Please mount selinuxfs for proper results.
the base image is tianon/centos with java5 java6 maven and jenkins user
created
FROM guya/centos-6.5-build-slave-base:base
RUN yum update -y
RUN wget
http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
RUN wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
RUN rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
RUN yum install openssh-server supervisor policycoreutils-python-2.0.83
selinux-policy policycoreutils-python -y
RUN mkdir -p /var/run/sshd
RUN mkdir -p /var/run/sshd
RUN mkdir -p /var/log/supervisor
ADD supervisor.conf /etc/supervisor.conf
RUN mkdir -p /var/run/sshd ; chmod -rx /var/run/sshd
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
RUN sed -ri 's/#PermitRootLogin yes/PermitRootLogin yes/g'
/etc/ssh/sshd_config
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
RUN sed -ri 's/#UsePAM no/UsePAM no/g' /etc/ssh/sshd_config
RUN echo 'root:secret' | chpasswd
RUN sed -ri 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config
RUNrun sed -i -e 's/session required pam_loginuid.so/#session
required pam_loginuid.so/' /etc/pam.d/sshd sed -i -e 's/session
required pam_loginuid.so/#session required pam_loginuid.so/'
/etc/pam.d/sshd
EXPOSE 22
CMD ["/usr/bin/supervisord","-c","/etc/supervisor.conf"]
supervisor conf
[supervisord]
nodaemon=true
[program:sshd]
command=/usr/sbin/sshd -d
sshd starts up fine
but when i attempt to log in as root
debug1: Authentication succeeded (password).
Authenticated to localhost ([127.0.0.1]:49204).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-***@openssh.com
debug1: Entering interactive session.
debug1: channel 0: free: client-session, nchannels 1
Connection to localhost closed by remote host.
Connection to localhost closed.
Transferred: sent 2976, received 2392 bytes, in 0.0 seconds
Bytes per second: sent 1829168.9, received 1470219.1
debug1: Exit status -1
[***@guyabox buildslave]$ docker run -i -t -p 22 guya/jenkins-slave bash
bash-4.1# /usr/sbin/sshd -d
debug1: sshd version OpenSSH_5.3p1
debug1: read PEM private key done: type RSA
debug1: private host key: #0 type 1 RSA
Could not load host key: /etc/ssh/ssh_host_dsa_key
debug1: rexec_argv[0]='/usr/sbin/sshd'
debug1: rexec_argv[1]='-d'
Set /proc/self/oom_score_adj from 0 to -1000
debug1: Bind to port 22 on 0.0.0.0.
Server listening on 0.0.0.0 port 22.
debug1: Bind to port 22 on ::.
Server listening on :: port 22.
debug1: Server will not fork when running in debugging mode.
debug1: rexec start in 5 out 5 newsock 5 pipe -1 sock 8
debug1: inetd sockets after dupping: 3, 3
Connection from 172.17.42.1 port 56560
debug1: Client protocol version 2.0; client software version OpenSSH_6.2
debug1: match: OpenSSH_6.2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: permanently_set_uid: 74/74
debug1: list_hostkey_types: ssh-rsa
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST received
debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT
debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: KEX done
debug1: userauth-request for user root service ssh-connection method none
debug1: attempt 0 failures 0
debug1: userauth-request for user root service ssh-connection method
publickey
debug1: attempt 1 failures 0
debug1: test whether pkalg/pkblob are acceptable
debug1: temporarily_use_uid: 0/0 (e=0/0)
debug1: trying public key file /root/.ssh/authorized_keys
debug1: Could not open authorized keys '/root/.ssh/authorized_keys': No
such file or directory
debug1: restore_uid: 0/0
debug1: temporarily_use_uid: 0/0 (e=0/0)
debug1: trying public key file /root/.ssh/authorized_keys2
debug1: Could not open authorized keys '/root/.ssh/authorized_keys2': No
such file or directory
debug1: restore_uid: 0/0
Failed publickey for root from 172.17.42.1 port 56560 ssh2
debug1: userauth-request for user root service ssh-connection method
password
debug1: attempt 2 failures 1
Accepted password for root from 172.17.42.1 port 56560 ssh2
debug1: monitor_child_preauth: root has been authenticated by privileged
process
debug1: temporarily_use_uid: 0/0 (e=0/0)
debug1: ssh_gssapi_storecreds: Not a GSSAPI mechanism
debug1: restore_uid: 0/0
debug1: SELinux support enabled
ssh_selinux_getctxbyname: Failed to get default SELinux security context
for root
ssh_selinux_setup_exec_context: security_getenforce() failed
debug1: do_cleanup
Any idea how i tell selinx to allow sshd?-bash-4.1# sestatus -v
sestatus does the following
SELinux status: enabled
SELinuxfs mount: not mounted
Please mount selinuxfs for proper results.