Cookie Consent by Free Privacy Policy Generator ๐Ÿ“Œ Adminer With Custom Login Servers Selector Plugin Run In Docker

๐Ÿ  Team IT Security News

TSecurity.de ist eine Online-Plattform, die sich auf die Bereitstellung von Informationen,alle 15 Minuten neuste Nachrichten, Bildungsressourcen und Dienstleistungen rund um das Thema IT-Sicherheit spezialisiert hat.
Ob es sich um aktuelle Nachrichten, Fachartikel, Blogbeitrรคge, Webinare, Tutorials, oder Tipps & Tricks handelt, TSecurity.de bietet seinen Nutzern einen umfassenden รœberblick รผber die wichtigsten Aspekte der IT-Sicherheit in einer sich stรคndig verรคndernden digitalen Welt.

16.12.2023 - TIP: Wer den Cookie Consent Banner akzeptiert, kann z.B. von Englisch nach Deutsch รผbersetzen, erst Englisch auswรคhlen dann wieder Deutsch!

Google Android Playstore Download Button fรผr Team IT Security



๐Ÿ“š Adminer With Custom Login Servers Selector Plugin Run In Docker


๐Ÿ’ก Newskategorie: Programmierung
๐Ÿ”— Quelle: dev.to

In the world of database management, Adminer has emerged as a compact yet powerful tool for handling a wide range of database tasks. While its core functionality is impressive, the real power of Adminer lies in its extensibility through plugins. In this post, weโ€™ll dive into the creation and implementation of a custom plugin for Adminer.

Repo: https://github.com/garis-space/adminer-login-servers

The Genesis of the Plugin
The Adminer Login Server Selector Plugin was born out of a need to streamline the process of connecting to various database servers. Traditionally, connecting to different servers in Adminer requires manual entry of connection details โ€” a process that can be tedious and error-prone. This plugin elegantly solves this problem by allowing users to select their desired server from a predefined list.

How Does the Plugin Work?
The plugin, written in PHP, integrates seamlessly with Adminer. Hereโ€™s a breakdown of its functionality:

  • Dynamic Server List: The plugin reads a JSON-formatted list of server configurations from an environment variable, ADMINER_SERVERS. This list can include details for multiple servers, each with its own driver, server address, username, password, and database name.

  • User Interface Integration: In the Adminer login form, the plugin injects a dropdown menu populated with the server names defined in the ADMINER_SERVERS variable. Users can select a server from this dropdown, and the plugin automatically fills in the corresponding connection details.

  • Customization and Flexibility: The plugin is flexible and easily customizable. Users can add, remove, or modify server configurations in the environment variable without altering the pluginโ€™s code.

Adminer Login Servers Plugin Code

<?php

/**
 * Display servers list from defined ADMINER_SERVERS variable.
 * @link https://www.adminer.org/plugins/#use
 * @author https://github.com/garis-space
*/
class AdminerLoginServers {
  /**
   * Set servers from environment variable
   * Example:
   * $_ENV['ADMINER_SERVERS'] = '{
   *  "Server 1":{"driver":"pgsql","server":"","username":"","password":"","db":""},
   *  "Server 2":{"driver":"pgsql","server":"","username":"","password":"","db":""}
   * }';
  */
  function __construct() {
    $this->servers = array();
    if ($_ENV['ADMINER_SERVERS']) {
      $this->servers = json_decode($_ENV['ADMINER_SERVERS'], true);
    }

    if ($_POST["auth"]["custom_server"]) {
      $key = $_POST["auth"]["custom_server"];
      $_POST["auth"]["driver"] = $this->servers[$key]["driver"];
      $_POST["auth"]["server"] = $this->servers[$key]["server"];
      $_POST["auth"]["username"] = $this->servers[$key]["username"];
      $_POST["auth"]["password"] = $this->servers[$key]["password"];
      $_POST["auth"]["db"] = $this->servers[$key]["db"];
    }
  }

  function loginFormField($name, $heading, $value) {
    if ($name == 'driver') {
      return '<tr><th>Driver<td>' . $value;
    } elseif ($name == 'server') {
      return '<tr><th>Host<td>' . $value;
    } elseif ($name == 'db' && $_ENV['ADMINER_SERVERS'] != '') {
      $out = $heading . $value;
      $out .= '<tr><th><td>or';
      $out .= '<tr><th>Server<td><select name="auth[custom_server]">';
      $out .= '<option value="" selected>--</option>';
      foreach ($this->servers as $serverName => $serverConfig) {
          $out .= '<option value="' . htmlspecialchars($serverName) . '">' . htmlspecialchars($serverName) . '</option>';
      }
      $out .= '</select>';
      return $out;
    }
  }
}

return new AdminerLoginServers();

Configuring Servers via compose.yml or .env
One of the standout features of this plugin is its ability to integrate with Docker Compose and environment variable configurations. This integration offers a high degree of flexibility and ease of use, especially in development and testing environments.

In the compose.yml file, you can define in the ADMINER_SERVERS variable only the server data you want to keep in your repository and save the rest in the .env file. As you have surely noticed, the ADMINER_SERVERS variable from the .env file is added to the end of the permanently defined ADMINER_SERVERS list from compose.yml file. This allows you to separate different login credentials for different environments.

compose.yml file

x-env-file: &env-file
  env_file: .env
x-restart: &restart
  restart: always

services:
  postgres-12:
    ...

  postgres-16:
    ...

  adminer:
    <<: [*env-file, *restart]
    image: adminer:latest
    container_name: adminer
    environment:
      # Login Servers Plugin
      - ADMINER_SERVERS={
          "[env1] PostgreSQL 12":{
            "driver":"pgsql",
            "server":"${POSTGRES_12_HOST}",
            "username":"${POSTGRES_12_USER:-postgres}",
            "password":"${POSTGRES_12_PASSWORD}",
            "db":"${POSTGRES_12_DB:-postgres}"
          },
          "[env2] PostgreSQL 16":{
            "driver":"pgsql",
            "server":"${POSTGRES_16_HOST}",
            "username":"${POSTGRES_16_USER:-postgres}",
            "password":"${POSTGRES_16_PASSWORD}",
            "db":"${POSTGRES_16_DB:-postgres}"
          } ${ADMINER_SERVERS}
        }
    volumes:
      - ./adminer/login-servers.php:/var/www/html/plugins-enabled/login-servers.php
    ports:
      - 8080:8080

.env file

# Adminer
ADMINER_SERVERS=',
  "[env3] GCP Cloud SQL":{
    "driver":"pgsql",
    "server":"postgres-16",
    "username":"postgres",
    "password":"super_secret_password",
    "db":"postgres"
  },
  "[env4] AWS RDS":{
    "driver":"pgsql",
    "server":"postgres-16",
    "username":"postgres",
    "password":"super_secret_password",
    "db":"postgres"
  },
  "[env5] Azure SQL":{
    "driver":"pgsql",
    "server":"postgres-16",
    "username":"postgres",
    "password":"super_secret_password",
    "db":"postgres"
  }
'

Conclusion
The Adminer Login Server Selector Plugin is a testament to the power of customization in software development. By bridging the gap between user convenience and functional flexibility, this plugin not only enhances the Adminer experience but also demonstrates the vast possibilities within the realms of PHP and Docker. Itโ€™s an excellent example of how a small, focused tool can make a significant impact on workflow efficiency.

...



๐Ÿ“Œ Adminer With Custom Login Servers Selector Plugin Run In Docker


๐Ÿ“ˆ 90.61 Punkte

๐Ÿ“Œ How to Increase CSS Class Selector Specificity to Beat the ID Selector Without Using Important


๐Ÿ“ˆ 44.18 Punkte

๐Ÿ“Œ Low CVE-2020-35572: Adminer Adminer


๐Ÿ“ˆ 42.33 Punkte

๐Ÿ“Œ Adminer up to 4.7.9 adminer.php server-side request forgery


๐Ÿ“ˆ 42.33 Punkte

๐Ÿ“Œ Bugtraq: Admin Custom Login WordPress plugin custom login page affected by persistent Cross-Site Scripting


๐Ÿ“ˆ 38.32 Punkte

๐Ÿ“Œ Docker users unhappy with latest forced login to download Docker and Docker Store images


๐Ÿ“ˆ 34.53 Punkte

๐Ÿ“Œ High CVE-2020-35186: Docker Adminer


๐Ÿ“ˆ 30.12 Punkte

๐Ÿ“Œ High CVE-2020-35186: Docker Adminer


๐Ÿ“ˆ 30.12 Punkte

๐Ÿ“Œ Adminer Login 1.4.4 auf WordPress erweiterte Rechte


๐Ÿ“ˆ 28.85 Punkte

๐Ÿ“Œ Adminer Login 1.4.4 on WordPress privilege escalation


๐Ÿ“ˆ 28.85 Punkte

๐Ÿ“Œ Mehrere Probleme in containerd, docker-runc, go1.11, go1.12, golang-github-docker-libnetwork, go und docker (SUSE)


๐Ÿ“ˆ 26.85 Punkte

๐Ÿ“Œ Security: Mehrere Probleme in containerd, docker-runc, go1.11, go1.12, golang-github-docker-libnetwork, go und docker (SUSE)


๐Ÿ“ˆ 26.85 Punkte

๐Ÿ“Œ Mehrere Probleme in containerd, docker-runc, golang-github-docker-libnetwork und docker (SUSE)


๐Ÿ“ˆ 26.85 Punkte

๐Ÿ“Œ Mangelnde Rechteprรผfung in containerd, docker-runc, golang-github-docker-libnetwork und docker (SUSE)


๐Ÿ“ˆ 26.85 Punkte

๐Ÿ“Œ Preisgabe von Informationen in containerd, docker-runc, golang-github-docker-libnetwork und docker (SUSE)


๐Ÿ“ˆ 26.85 Punkte

๐Ÿ“Œ Preisgabe von Informationen in containerd, docker-runc, golang-github-docker-libnetwork und docker (SUSE)


๐Ÿ“ˆ 26.85 Punkte

๐Ÿ“Œ Denial of Service in containerd, docker-runc, golang-github-docker-libnetwork und docker (SUSE)


๐Ÿ“ˆ 26.85 Punkte

๐Ÿ“Œ Preisgabe von Informationen in containerd, docker-runc, golang-github-docker-libnetwork und docker (SUSE)


๐Ÿ“ˆ 26.85 Punkte

๐Ÿ“Œ Ausfรผhren von Code mit hรถheren Privilegien in docker-runc, golang-github-docker-libnetwork, docker und containerd (SUSE)


๐Ÿ“ˆ 26.85 Punkte

๐Ÿ“Œ Mehrere Probleme in docker-runc, golang-github-docker-libnetwork, docker und containerd (SUSE)


๐Ÿ“ˆ 26.85 Punkte

๐Ÿ“Œ Security: Mehrere Probleme in docker-runc, golang-github-docker-libnetwork, docker und containerd (SUSE)


๐Ÿ“ˆ 26.85 Punkte

๐Ÿ“Œ Docker Stack Tutorial | Docker Stack Deploy Docker-Compose.yml


๐Ÿ“ˆ 26.85 Punkte

๐Ÿ“Œ Docker Build VS Docker Run


๐Ÿ“ˆ 26.14 Punkte

๐Ÿ“Œ Docker Learning for Beginners Part 5: Create Ubuntu Container Using Dockerfile : Docker build CMD RUN Example


๐Ÿ“ˆ 26.14 Punkte

๐Ÿ“Œ Fix Cannot Connect to the Docker Daemon at โ€˜unix:///var/run/docker.sockโ€™


๐Ÿ“ˆ 26.14 Punkte

๐Ÿ“Œ Run MacOS VMโ€™s in Docker on Windows & Linux with Docker-OSX


๐Ÿ“ˆ 26.14 Punkte

๐Ÿ“Œ You can run Fluent and Comsol on Opensuse inside Docker (CentOS7 based) without SystemD if you run license server on host


๐Ÿ“ˆ 25.43 Punkte

๐Ÿ“Œ Will Cockpit (project) allow me to administrate multiple servers and run commands against multiple servers at once?


๐Ÿ“ˆ 25 Punkte

๐Ÿ“Œ "Do not run installer as root. Run as your normal login" I AM logged in normally, wtf does this even mean? Not impressed with Ubuntu so far!


๐Ÿ“ˆ 24.17 Punkte

๐Ÿ“Œ Streamlined PHPUnit Testing within Docker using the neotest-docker-phpunit Plugin


๐Ÿ“ˆ 23.13 Punkte

๐Ÿ“Œ WordPress Absolutely Glamorous Custom Admin ag-custom-admin Plugin Database Backup Arbitrary File Download Vulnerability


๐Ÿ“ˆ 22.95 Punkte

๐Ÿ“Œ CVE-2023-32116 | TotalPress.Org Custom Post Types, Custom Fields & More Plugin up to 4.0.12 on WordPress cross site scripting


๐Ÿ“ˆ 22.95 Punkte

๐Ÿ“Œ CVE-2023-6701 | Advanced Custom Fields Plugin up to 6.2.4 on WordPress Custom Field cross site scripting (ID 3022469)


๐Ÿ“ˆ 22.95 Punkte

๐Ÿ“Œ Time Travel Is Easy With A Time Zone Selector Button


๐Ÿ“ˆ 22.09 Punkte











matomo