Bug 1273842 - Error appears when login in mongodb26 database in container for rhel7 in ose environment
Summary: Error appears when login in mongodb26 database in container for rhel7 in ose ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Software Collections
Classification: Red Hat
Component: rh-mongodb26-container
Version: rh-mongodb26
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Marek Skalický
QA Contact: wewang
URL:
Whiteboard:
Depends On:
Blocks: 1220712
TreeView+ depends on / blocked
 
Reported: 2015-10-21 11:34 UTC by wewang
Modified: 2015-11-16 15:56 UTC (History)
8 users (show)

Fixed In Version: rhscl/mongodb-26-rhel7:2.6-2
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-16 15:56:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2056 0 normal SHIPPED_LIVE new container image: rhscl/mongodb-26-rhel7 2016-04-22 16:34:19 UTC

Description wewang 2015-10-21 11:34:49 UTC
Version-Release number of selected component (if applicable):
openshift v3.0.2.901-61-g568adb6
kubernetes v1.1.0-alpha.1-653-g86b4e77
rhscl/mongodb-26-rhel7          fead03cf7fc4

Description of problem:
when login in mongodb26 in container, appears error "open for '//.mongorc.js' failed with errno:13 Permission denied"

How reproducible:
Always

Steps to Reproduce:
1.Run the mongodb-26-centos7 image
$  mkdir -p /home/user/database && chown -R 234523:998 /home/user/database
$  docker run -d -u 234523 -e MONGODB_USER=user -e MONGODB_PASSWORD=pass -e MONGODB_DATABASE=test_db -e MONGODB_ADMIN_PASSWORD=pass -v /home/user/database:/var/lib/mongodb/data:Z  registry.access.redhat.com/rhscl/mongodb-26-rhel7

2.Access into container
$docker ps | grep mongo  (to get the container id)
$docker inspect <container_id> | grep IPAddress
$docker exec -ti <container_id> scl enable rh-mongodb26 /bin/bash

3. Create SQL queries in container 
bash-4.2$ mongo test_db -u user -p pass
MongoDB shell version: 2.6.9
connecting to: test_db
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
	http://docs.mongodb.org/
Questions? Try the support group
	http://groups.google.com/group/mongodb-user
2015-10-21T05:43:32.119-0400 In File::open(), ::open for '//.mongorc.js' failed with errno:13 Permission denied
> show collections;
> doc={"a":"test1"};
{ "a" : "test1" }



Actual results:
when Login in mongodb26 in container, appear errors
Expected results:
login in successfully ,no errors

Comment 2 wewang 2015-10-22 08:13:38 UTC
reproduced in ose
openshift v3.0.2.902
kubernetes v1.2.0-alpha.1-1107-g4c8e6f4
rhscl/mongodb-26-rhel7   fead03cf7fc4

[root@openshift-154 ~]# docker run -d -u 234523 -e MONGODB_USER=user -e MONGODB_PASSWORD=pass -e MONGODB_DATABASE=test_db -e MONGODB_ADMIN_PASSWORD=pass -v /home/user/database:/var/lib/mongodb/data:Z  registry.access.redhat.com/rhscl/mongodb-26-rhel7
de8b2f8760aebb25796f7049df2761b123629c361b26e4851b8ca44eaeed89ef

[root@openshift-154 ~]# docker exec -ti de8b2f8760aebb25796f7049df2761b123629c361b26e4851b8ca44eaeed89ef scl enable rh-mongodb26 /bin/bash

bash-4.2$ mongo test_db -u user -p pass
MongoDB shell version: 2.6.9
connecting to: test_db
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
	http://docs.mongodb.org/
Questions? Try the support group
	http://groups.google.com/group/mongodb-user
2015-10-22T03:41:11.714-0400 In File::open(), ::open for '//.mongorc.js' failed with errno:13 Permission denied
> exit

Comment 3 Ben Parees 2015-10-22 17:36:57 UTC
sounds like the SCL team needs to update the published image.

Honza can you make sure that happens and this bug gets moved to ON_QA once it does?

Comment 4 Honza Horak 2015-10-22 19:41:41 UTC
Yes, we will take care about that. Do I understand correctly that this is already fixed in github?

Comment 5 Ben Parees 2015-10-22 20:30:55 UTC
that's my impression since the image ci.dev.openshift.redhat.com:5000/rhscl/mongodb-26-rhel7 works and that's built from github.

Comment 8 Marek Skalický 2015-11-02 12:50:15 UTC
*** Bug 1276259 has been marked as a duplicate of this bug. ***

Comment 9 wewang 2015-11-04 07:25:55 UTC
verified in
openshift v3.0.2.905
kubernetes v1.2.0-alpha.1-1107-g4c8e6f4
rhscl/mongodb-26-rhel7   c2edfb2c2498

[root@dhcp-128-91 templates]# oc rsh mongodb-1-q5ehd
bash-4.2$ oc 
bash: oc: command not found
bash-4.2$ 
bash-4.2$  mongo sampledb -u userY8K -paHctmTGt5mMOMoef
MongoDB shell version: 2.6.9
connecting to: sampledb
> show collections;
> doc={"a":"test1"};
{ "a" : "test1" }

I have a question ,when I type "show dbs", the result as follow is correct? because user:userY8K has no permission ? 

> > show dbs;
2015-11-04T02:21:17.642-0500 listDatabases failed:{
	"ok" : 0,
	"errmsg" : "not authorized on admin to execute command { listDatabases: 1.0 }",
	"code" : 13
} at src/mongo/shell/mongo.js:47

Comment 10 wewang 2015-11-04 07:35:19 UTC
and verified in  
rhscl/mongodb-26-rhel7   c2edfb2c2498


root@openshift-127 ~]# mkdir -p /home/user/database && chown -R 234523:998 /home/user/database
[root@openshift-127 ~]# docker run -d -u 234523 -e MONGODB_USER=user -e MONGODB_PASSWORD=pass -e MONGODB_DATABASE=test_db -e MONGODB_ADMIN_PASSWORD=pass -v /home/user/database:/var/lib/mongodb/data:Z  registry.access.redhat.com/rhscl/mongodb-26-rhel7
9868bd8e38054fd352dfe50bc3da080a538de308b23d486ea1228d741a8025ce

[root@openshift-127 ~]# docker exec -ti 9868bd8e3805 scl enable rh-mongodb26 /bin/bash
bash-4.2$ mongo test_db -u user -p pass
MongoDB shell version: 2.6.9
connecting to: test_db
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
	http://docs.mongodb.org/
Questions? Try the support group
	http://groups.google.com/group/mongodb-user
> show collections;
> doc={"a":"test1"};
{ "a" : "test1" }
>

Comment 11 Marek Skalický 2015-11-04 10:02:45 UTC
(In reply to wewang from comment #9)
> 
> I have a question ,when I type "show dbs", the result as follow is correct?
> because user:userY8K has no permission ? 
> 
> > > show dbs;
> 2015-11-04T02:21:17.642-0500 listDatabases failed:{
> 	"ok" : 0,
> 	"errmsg" : "not authorized on admin to execute command { listDatabases: 1.0
> }",
> 	"code" : 13
> } at src/mongo/shell/mongo.js:47

Yes, this is correct. MONGODB_USER have only permissions regarding MONGODB_DATABASE, so he doesn't have permission to show all database (stored in admin database).

"The listDatabases must run against the admin database" (https://docs.mongodb.org/manual/reference/command/listDatabases/), so MONGODB_USER can't run it.

Comment 13 errata-xmlrpc 2015-11-16 15:56:27 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2056.html


Note You need to log in before you can comment on or make changes to this bug.