kubernetesadminer

Adminer does not support accessing a database without a password, using mongodb


This is my yaml for the adminer:

kind: Service
metadata:
  name: adminer-1598029219
  labels:
    app.kubernetes.io/name: adminer
    helm.sh/chart: adminer-0.1.5
    app.kubernetes.io/instance: adminer-1598029219
    app.kubernetes.io/managed-by: Helm
spec:
  type: NodePort
  ports:
    - port: 8000
      targetPort: http
      protocol: TCP
      name: http
  selector:
    app.kubernetes.io/name: adminer
    app.kubernetes.io/instance: adminer-1598029219
---
# Source: adminer/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: adminer-1598029219
  labels:
    app.kubernetes.io/name: adminer
    helm.sh/chart: adminer-0.1.5
    app.kubernetes.io/instance: adminer-1598029219
    app.kubernetes.io/managed-by: Helm
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: adminer
      app.kubernetes.io/instance: adminer-1598029219
  template:
    metadata:
      labels:
        app.kubernetes.io/name: adminer
        app.kubernetes.io/instance: adminer-1598029219
    spec:
      containers:
        - name: adminer
          image: "dockette/adminer:full"
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 80
              protocol: TCP
          env:
          - name: ADMINER_PLUGINS
            value:
          - name: ADMINER_DESIGN
            value: pepa-linha
          - name: ADMINER_DEFAULT_SERVER
            value: 
          resources:
            {}
          livenessProbe:
            null
          readinessProbe:
            null

And this my yaml for th mongoDB

kind: Service
metadata:
 name: mongo
 labels:
   name: mongo
   app: mongo
spec:
 ports:
 - port: 27017
   targetPort: 27017
   name: web
 clusterIP: None
 selector:
   role: mongo

---
apiVersion: apps/v1
kind: StatefulSet
metadata:
 name: web
spec:
 selector:
    matchLabels:
      app: mongo # has to match .spec.template.metadata.labels
 serviceName: "mongo"
 replicas: 3
 template:
   metadata:
     labels:
       app: mongo
   spec:
     terminationGracePeriodSeconds: 10
     containers:
       - name: mongo
         image: mongo
         command:
           - mongod
           - "--replSet"
           - rs0
           - "--smallfiles"
           - "--noprealloc"
         ports:
           - containerPort: 27017
             name: web
         volumeMounts:
           - name: mongo-persistent-storage
             mountPath: /data/db
 volumeClaimTemplates:
 - metadata:
     name: mongo-persistent-storage
     annotations:
       volume.beta.kubernetes.io/storage-class: "fast"
   spec:
     accessModes: [ "ReadWriteOnce" ]
     resources:
       requests:
         storage: 1Gi

So my problem is that i can't log in into mongod becuse i get this from Adminer : Adminer does not support accessing a database without a password. Is there any simple solution to this problem where i can log into my mongod? P.S i run kubernetes


Solution

  • The answer to your question can be found in Adminer's documentation:

    Accessing a database without a password

    Adminer 4.6.3 and newer does not support accessing a database without a password. The reason is that a forgotten Adminer uploaded on a place accessible by an attacker could have been used to access a database. There are these options:

    1. Set up the database server to require a password. This is possible with all databases except SQLite and SimpleDB.
    2. Use the login-password-less plugin to set up a password required by Adminer but not passed to the database (example).
    3. Use the login-ip plugin to check the IP address and allow an empty password.
    4. Implement the login method to add your custom authentication.

    You may find this answer helpful as well. It describes the whole process in a great detail.