podman icon indicating copy to clipboard operation
podman copied to clipboard

MongoDB Authentication failed.

Open LightSith opened this issue 5 years ago • 4 comments

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

Can't run mongodb with authentication enabled while it works in docker

Steps to reproduce the issue:

podman pull docker.io/mongo
podman run -d --name tmongo -e MONGO_INITDB_ROOT_USERNAME=mongoadmin -e MONGO_INITDB_ROOT_PASSWORD=secret mongo
podman exec -it tmongo bash
mongo -u monogoadmin -p msecret --authenticationDatabase admin

Describe the results you received:

❯ podman exec -it tmongo bash                                                                                    
WARN[0000] The cgroupv2 manager is set to systemd but there is no systemd user session available 
WARN[0000] For using systemd, you may need to login using an user session 
WARN[0000] Alternatively, you can enable lingering with: `loginctl enable-linger 1000` (possibly as root) 
WARN[0000] Falling back to --cgroup-manager=cgroupfs    
root@4050da86b554:/# mongo -u monogoadmin -p secret --authenticationDatabase admin
MongoDB shell version v5.0.3
connecting to: mongodb://127.0.0.1:27017/?authSource=admin&compressors=disabled&gssapiServiceName=mongodb
Error: Authentication failed. :
connect@src/mongo/shell/mongo.js:372:17
@(connect):2:6
exception: connect failed
exiting with code 1
root@4050da86b554:/# 

Describe the results you expected: same as docker. Just replace podman in above commands with sudo docker

Additional information you deem important (e.g. issue happens only occasionally):

using rootless podman.

Output of podman version:

Version:      3.4.1
API Version:  3.4.1
Go Version:   go1.17.1
Git Commit:   a6493ae6904a5b7dde2395a374cb77fc45c8a3bc
Built:        Wed Oct 20 22:57:47 2021
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.0.30-1
    path: /usr/bin/conmon
    version: 'conmon version 2.0.30, commit: 2792c16f4436f1887a7070d9ad99d9c29742f38a'
  cpus: 8
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: KryetA
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 5.14.16-zen1-1-zen
  linkmode: dynamic
  logDriver: journald
  memFree: 9457885184
  memTotal: 20831989760
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.2-1
    path: /usr/bin/crun
    version: |-
      crun version 1.2
      commit: 4f6c8e0583c679bfee6a899c05ac6b916022561b
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1000/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.12-1
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.2
  swapFree: 0
  swapTotal: 0
  uptime: 12h 43m 3.63s (Approximately 0.50 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries: {}
store:
  configFile: /home/smit/.config/containers/storage.conf
  containerStore:
    number: 1
    paused: 0
    running: 1
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: /usr/bin/fuse-overlayfs is owned by fuse-overlayfs 1.7.1-1
      Version: |-
        fusermount3 version: 3.10.5
        fuse-overlayfs: version 1.7.1
        FUSE library version 3.10.5
        using FUSE kernel interface version 7.31
  graphRoot: /home/smit/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 2
  runRoot: /run/user/1000/containers
  volumePath: /home/smit/.local/share/containers/storage/volumes
version:
  APIVersion: 3.4.1
  Built: 1634750867
  BuiltTime: Wed Oct 20 22:57:47 2021
  GitCommit: a6493ae6904a5b7dde2395a374cb77fc45c8a3bc
  GoVersion: go1.17.1
  OsArch: linux/amd64
  Version: 3.4.1

Package info (e.g. output of rpm -q podman or apt list podman):

Repository      : community
Name            : podman
Version         : 3.4.1-1
Description     : Tool and library for running OCI-based containers in pods
Architecture    : x86_64
URL             : https://github.com/containers/podman
Licenses        : Apache
Groups          : None
Provides        : None
Depends On      : cni-plugins  conmon  containers-common  crun  fuse-overlayfs  iptables  libdevmapper.so=1.02-64  libgpgme.so=11-64
                  libseccomp.so=2-64  slirp4netns
Optional Deps   : apparmor: for AppArmor support
                  btrfs-progs: support btrfs backend devices
                  catatonit: --init flag support
                  podman-docker: for Docker-compatible CLI
Conflicts With  : None
Replaces        : None
Download Size   : 16.58 MiB
Installed Size  : 72.63 MiB
Packager        : Morten Linderud <[email protected]>
Build Date      : Wed 20 Oct 2021 10:57:47 PM IST
Validated By    : MD5 Sum  SHA-256 Sum  Signature

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)

Yes

Additional environment details (AWS, VirtualBox, physical, etc.): Physical host ArchLinux kernel 5.14.16-zen1-1-zen with export DBUS_SESSION_BUS_ADDRESS=; cause of this:- https://bbs.archlinux.org/viewtopic.php?id=253966

LightSith avatar Nov 08 '21 17:11 LightSith

The passwords in your example don't seem to match - -p msecret vs -e MONGO_INITDB_ROOT_PASSWORD=secret?

mheon avatar Nov 08 '21 17:11 mheon

The passwords in your example don't seem to match - -p msecret vs -e MONGO_INITDB_ROOT_PASSWORD=secret?

sorry, copy pasting mistake somehow. edited

LightSith avatar Nov 08 '21 18:11 LightSith

Does it work with rootfull Podman? Does it work with rootless podman run --privileged

rhatdan avatar Nov 08 '21 18:11 rhatdan

extremely sorry. this was caused by old volumes which I was using. I did not used volumes with docker thats why it was working. in reproducible example, I was using wrong credentials.

LightSith avatar Nov 09 '21 16:11 LightSith