Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f395e5ac6f | ||
|
|
3f7a2d2d61 |
@@ -0,0 +1,19 @@
|
||||
# HTTP site: redirect everything to HTTPS
|
||||
http://localhost {
|
||||
redir https://{host}{uri} permanent
|
||||
}
|
||||
|
||||
# HTTPS site
|
||||
https://localhost {
|
||||
reverse_proxy web:80
|
||||
tls internal
|
||||
|
||||
# Optional: security headers (defense-in-depth)
|
||||
header {
|
||||
X-Content-Type-Options "nosniff"
|
||||
X-Frame-Options "DENY"
|
||||
Referrer-Policy "no-referrer"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,12 @@ CREATE TABLE IF NOT EXISTS `dummy` (
|
||||
`id` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- Create a dedicated DB user for the web application (least privilege).
|
||||
-- Grant only the required privileges on the application database.
|
||||
CREATE USER IF NOT EXISTS 'passman_app'@'%' IDENTIFIED BY 'passman_app_pw';
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON pwd_mgr.* TO 'passman_app'@'%';
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `login_users` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(20) NOT NULL,
|
||||
@@ -31,7 +37,7 @@ CREATE TABLE IF NOT EXISTS `login_users` (
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
INSERT INTO `login_users` (`id`, `username`, `password`) VALUES
|
||||
(1, 'u1', '$2y$10$L18u5/PyVkDgsce/DsUOQu0sKhTzh854Euhog3cVb1W4YAfgRzY8W'); /* php -r 'echo password_hash("p1", PASSWORD_DEFAULT), PHP_EOL;' */
|
||||
(1, 'u1', '$2y$10$L18u5/PyVkDgsce/DsUOQu0sKhTzh854Euhog3cVb1W4YAfgRzY8W'); -- php -r 'echo password_hash("p1", PASSWORD_DEFAULT), PHP_EOL;'
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `notes` (
|
||||
`notesid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
|
||||
@@ -2,18 +2,30 @@
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
ports:
|
||||
- "80:80"
|
||||
# ports:
|
||||
# - "80:80"
|
||||
volumes:
|
||||
- ./php:/var/www/html
|
||||
environment:
|
||||
DB_HOST: db
|
||||
DB_USER: root
|
||||
DB_PASS: rootpass
|
||||
DB_NAME: pwd_mgr
|
||||
DB_USER: passman_app
|
||||
DB_PASS: passman_app_pw
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
proxy:
|
||||
image: caddy:2
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ./Caddyfile:/etc/caddy/Caddyfile:ro
|
||||
- caddy_data:/data
|
||||
- caddy_config:/config
|
||||
depends_on:
|
||||
- web
|
||||
|
||||
db:
|
||||
image: mariadb:11
|
||||
container_name: passman_db
|
||||
@@ -30,4 +42,6 @@ services:
|
||||
|
||||
volumes:
|
||||
dbdata:
|
||||
caddy_data:
|
||||
caddy_config:
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// NOTE: In Docker, the DB host is the service name (e.g., "db"), not "localhost".
|
||||
|
||||
$DB_HOST = getenv('DB_HOST') ?: 'db';
|
||||
$DB_USER = getenv('DB_USER') ?: 'root';
|
||||
$DB_PASS = getenv('DB_PASS') ?: 'rootpass';
|
||||
$DB_USER = getenv('DB_USER') ?: 'passman_app';
|
||||
$DB_PASS = getenv('DB_PASS') ?: 'passman_app_pw';
|
||||
$DB_NAME = getenv('DB_NAME') ?: 'pwd_mgr';
|
||||
|
||||
// Create a DB connection.
|
||||
|
||||
@@ -15,23 +15,23 @@
|
||||
<br />
|
||||
<ul>
|
||||
<li>
|
||||
<a href="http://localhost/passman/register.php">Registration Form</a>
|
||||
<a href="/passman/register.php">Registration Form</a>
|
||||
</li>
|
||||
<br />
|
||||
<li>
|
||||
<a href="http://localhost/passman/login.php">Login Page</a>
|
||||
<a href="/passman/login.php">Login Page</a>
|
||||
</li>
|
||||
<br />
|
||||
<li>
|
||||
<a href="http://localhost/passman/logout.php">Logout Page</a>
|
||||
<a href="/passman/logout.php">Logout Page</a>
|
||||
</li>
|
||||
<br />
|
||||
<li>
|
||||
<a href="http://localhost/passman/dashboard.php">Dashboard</a> (display passwords for websites)
|
||||
<a href="/passman/dashboard.php">Dashboard</a> (display passwords for websites)
|
||||
</li>
|
||||
<br />
|
||||
<li>
|
||||
<a href="http://localhost/passman/notes.php">Notes</a> (notes/comments/announcements)
|
||||
<a href="/passman/notes.php">Notes</a> (notes/comments/announcements)
|
||||
</li>
|
||||
<br />
|
||||
</ul>
|
||||
@@ -41,18 +41,18 @@
|
||||
<br />
|
||||
<ul>
|
||||
<li>
|
||||
Test <a href="http://localhost/passman/test_hash.php">hashing</a> functions in PHP (server side)
|
||||
Test <a href="/passman/test_hash.php">hashing</a> functions in PHP (server side)
|
||||
</li>
|
||||
<br />
|
||||
<li>
|
||||
Test <a href="http://localhost/passman/test_encrypt.php">encrypting/decrypting</a> functions in PHP (server side)
|
||||
Test <a href="/passman/test_encrypt.php">encrypting/decrypting</a> functions in PHP (server side)
|
||||
</li>
|
||||
<br />
|
||||
</ul>
|
||||
|
||||
<br />
|
||||
Hacker's side (for using stealing cookies using XSS):
|
||||
<a href="http://localhost/passman/xss">http://localhost/passman/xss</a>
|
||||
<a href="/passman/xss">passman/xss</a>
|
||||
<br />
|
||||
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user