Commit 18915f8b authored by Ali Allaoui's avatar Ali Allaoui
Browse files

[api] Dockerfile and its files for 8.0-alpha1

parent 27b060ae
FROM webdevops/php-apache:debian-8-php7
FROM marsonline/php-apache-pgsql:debian-9
MAINTAINER ali.allaoui@gmail.com
RUN /usr/local/bin/apt-install php7.0-pgsql php7.0-mysql
RUN rm /var/www/html/index.html
RUN wget https://framagit.org/pasteque/pasteque-server/repository/archive.tar.gz?ref=7.2
RUN tar xzf archive.tar.gz?ref=7.2
RUN wget https://framagit.org/pasteque/pasteque-server/repository/archive.tar.gz?ref=8.0-alpha1
RUN tar xzf archive.tar.gz?ref=8.0-alpha1
RUN cp -r pasteque-server*/* /var/www/html
RUN rm -rf pasteque-server
RUN ls /var/www/html
COPY main-config.php /var/www/html/config.php
COPY db-config.php /var/www/html/core_modules/database/static/config.php
COPY ident-config.php /var/www/html/core_modules/ident/inifile/config.php
WORKDIR /var/www/html
RUN composer install
COPY cli-config.php config
COPY setup.sh /opt/docker/provision/entrypoint.d/30-pasteque.sh
COPY user_ini.php /var/www/html/src/http/public
RUN mkdir /etc/pasteque
COPY pasteque_id.ini /etc/pasteque
\ No newline at end of file
RUN mkdir /etc/pasteque/auth
RUN mkdir /var/log/pasteque
RUN sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf
RUN sed -i 's|/var/www/|/var/www/html/src/http/public/|g' /etc/apache2/apache2.conf
FROM marsonline/php-apache-pgsql:debian-9
MAINTAINER ali.allaoui@gmail.com
RUN rm /var/www/html/index.html
RUN wget https://framagit.org/pasteque/pasteque-server/repository/archive.tar.gz?ref=8.0-alpha1
RUN tar xzf archive.tar.gz?ref=8.0-alpha1
RUN cp -r pasteque-server*/* /var/www/html
RUN rm -rf pasteque-server
WORKDIR /var/www/html
RUN composer install
COPY cli-config.php config
COPY setup.sh /opt/docker/provision/entrypoint.d/30-pasteque.sh
COPY user_ini.php /var/www/html/src/http/public
RUN mkdir /etc/pasteque
RUN mkdir /etc/pasteque/auth
RUN mkdir /var/log/pasteque
RUN sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf
RUN sed -i 's|/var/www/|/var/www/html/src/http/public/|g' /etc/apache2/apache2.conf
<?php
namespace Pasteque\Server;
use \Pasteque\Server\System\DAO\DoctrineDAO;
$cfg = parse_ini_file(__DIR__ . '/config.ini');
$dbInfo = ['type' => $cfg['database/static/type'], 'host' => $cfg['database/static/host'],
'port' => $cfg['database/static/port'], 'name' => $cfg['database/static/name'],
'user' => $cfg['database/static/user'], 'password' => $cfg['database/static/password']];
$dao = new DoctrineDAO($dbInfo, ['debug' => false]);
return \Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet($dao->getEntityManager());
#!/bin/sh
# Pasteque Server
##########################
cd /var/www/html
php vendor/bin/doctrine orm:generate-proxies
<!-- Public domain -->
<html dir="ltr" lang="en-US">
<head>
<meta charset="UTF-8" />
<title>password_hash</title>
<style type="text/css">
pre { border: 1px solid #444; padding: 1ex; }
</style>
</head>
<body>
<h1>Password hash generator</h1>
<form action="user_ini.php" method="POST" onsubmit="javascript:sendpwd();">
<p>Enter password here</p>
<p><input type="password" name="password" placeholder="password to hash" /></p>
<p><input type="submit" value="send" /></p>
</form>
<h2>Your &lt;user&gt;_id.ini file</h2>
<pre><?php
if (array_key_exists('password', $_POST)) {
echo htmlspecialchars("password=" . password_hash($_POST['password'], PASSWORD_DEFAULT));
} else {
echo "Empty, use the form above";
}?></pre>
<h2>Server source code</h2>
<p>This is the php code running this page and filling the &lt;user&gt;_id.ini block.</p>
<pre>if (array_key_exists('password', $_POST)) {
echo htmlspecialchars("password=" . password_hash($_POST['password'], PASSWORD_DEFAULT));
} else {
echo "Empty, use the form above";
}</pre>
<h2>Standalone script</h2>
<p>Call with php-cli, enter the password twice, outputs the hash. Usage:</p>
<pre>php hasher.php > login_id.ini</pre>
<pre>&lt;?php
if ($argc < 2) {
system("stty -echo");
$password = substr(fread(STDIN, 80), 0, -1);
$password2 = substr(fread(STDIN, 80), 0, -1);
system("stty echo");
if ($password != $password2) {
file_put_contents("php://stderr", "Password mismatch\n");
die();
}
} else {
$password = $argv[1];
}
echo "password=" . password_hash($password, PASSWORD_DEFAULT);</pre>
<body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment