Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to login sqlite file without password? #162

Open
geekyouth opened this issue Dec 9, 2023 · 1 comment
Open

how to login sqlite file without password? #162

geekyouth opened this issue Dec 9, 2023 · 1 comment

Comments

@geekyouth
Copy link

geekyouth commented Dec 9, 2023

this is my docker-compose.yaml

services:
  adminer:
    image: adminer:4.8.1-standalone
    # restart: unless-stopped
    ports:
      - "8080:8080"
    environment:
      TZ: Asia/Shanghai
      ADMINER_DEFAULT_SERVER: mysql57
      ADMINER_DESIGN: hydra
      ADMINER_PLUGINS: 'tables-filter tinymce login-password-less'
    volumes:
      - ./hydra.css:/var/www/html/designs/hydra/adminer.css:ro  # fix hydra style
      - ./demo/sqlite.db:/demo/sqlite.db

after run ,the error log as blow:

2023-12-09T06:00:46.570928858Z Unable to load plugin file "login-password-less", because it has required parameters: password_hash
2023-12-09T06:00:46.570946114Z Create a file "/var/www/html/plugins-enabled/login-password-less.php" with the following contents to load the plugin:
2023-12-09T06:00:46.570947891Z 
2023-12-09T06:00:46.570948996Z <?php
2023-12-09T06:00:46.570950347Z require_once('plugins/login-password-less.php');
2023-12-09T06:00:46.570951422Z 
2023-12-09T06:00:46.570952603Z /** Set allowed password
2023-12-09T06:00:46.570953684Z 	* @param string result of password_hash
2023-12-09T06:00:46.570954791Z 	*/
2023-12-09T06:00:46.570955832Z return new AdminerLoginPasswordLess(
2023-12-09T06:00:46.570956911Z 	$password_hash = ???
2023-12-09T06:00:46.570957973Z );

then as ablove guide,i mount file login-password-less.php :

<?php
require_once('plugins/login-password-less.php');

/** Set allowed password
	* @param string result of password_hash
	*/
return new AdminerLoginPasswordLess(
	$password_hash = password_hash("admin", PASSWORD_BCRYPT)
);

now my docker-compose.yaml like this ( onle add a line - ./login-password-less.php:/var/www/html/plugins-enabled/login-password-less.php ):

services:
  adminer:
    image: adminer:4.8.1-standalone
    # restart: unless-stopped
    ports:
      - "8080:8080"
    environment:
      TZ: Asia/Shanghai
      ADMINER_DEFAULT_SERVER: mysql57
      ADMINER_DESIGN: hydra
      ADMINER_PLUGINS: 'tables-filter tinymce login-password-less'
    volumes:
      - ./hydra.css:/var/www/html/designs/hydra/adminer.css:ro  # fix hydra style
      - ./demo/sqlite.db:/demo/sqlite.db
      - ./login-password-less.php:/var/www/html/plugins-enabled/login-password-less.php

after run docker compose down -v; docker compose up -d , i recived the same error:

image

then i add /var/www/html/plugins-enabled/sqlite.php file #78 :

<?php
require("plugins/login-password-less.php");
// TODO: inline the result of password_hash() so that the password is not visible in source codes
return new AdminerLoginPasswordLess(password_hash("YOUR_PASSWORD_HERE", PASSWORD_DEFAULT));

and mount with docker-compose.yaml as blow

services:
  adminer:
    image: adminer:4.8.1-standalone
    # restart: unless-stopped
    ports:
      - "8080:8080"
    environment:
      TZ: Asia/Shanghai
      ADMINER_DEFAULT_SERVER: mysql57
      ADMINER_DESIGN: hydra
      ADMINER_PLUGINS: 'tables-filter tinymce'
    volumes:
      - ./hydra.css:/var/www/html/designs/hydra/adminer.css:ro  # fix hydra style
      - ./demo/sqlite.db:/demo/sqlite.db
      #- ./login-password-less2.php:/var/www/html/plugins-enabled/login-password-less.php
      - ./sqlite.php:/var/www/html/plugins-enabled/sqlite.php

after run docker compose up -d;

it works:

image

but it is readonly

image

@geekyouth geekyouth changed the title how to login sqlite file without password, i have tyied every methods and failed how to login sqlite file without password? Dec 9, 2023
@geekyouth
Copy link
Author

geekyouth commented Dec 9, 2023

method2:

services:
  adminer:
    image: adminer:4.8.1-standalone
    # restart: unless-stopped
    ports:
      - "8080:8080"
    environment:
      TZ: Asia/Shanghai
      ADMINER_DEFAULT_SERVER: mysql57
      ADMINER_DESIGN: hydra
      ADMINER_PLUGINS: 'tables-filter tinymce'
    volumes:
      - ./hydra.css:/var/www/html/designs/hydra/adminer.css:ro  # fix hydra style
      - ./demo/:/demo/:rw
      - ./login-password-less.php:/var/www/html/plugins-enabled/login-password-less.php

./login-password-less.php

<?php
require_once('plugins/login-password-less.php');

/** Set allowed password
 * @param string result of password_hash
 */
return new AdminerLoginPasswordLess(
  $password_hash = password_hash("admin", PASSWORD_DEFAULT)
);

now the sqlite is writeable with - ./demo/:/demo/:rw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant