master
bel 2021-09-14 06:39:36 -06:00
commit 8f5d1c4ec5
16 changed files with 356 additions and 0 deletions

3
cypht/build_and_run.sh Executable file
View File

@ -0,0 +1,3 @@
#! /bin/bash
docker compose up

26
cypht/docker-compose.yaml Executable file
View File

@ -0,0 +1,26 @@
version: '3'
services:
db:
image: mariadb:10
volumes:
- ./db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=root_password
- MYSQL_DATABASE=cypht
- MYSQL_USER=cypht
- MYSQL_PASSWORD=cypht_password
cypht:
image: sailfrog/cypht-docker:latest
volumes:
- ./cypht/users:/var/lib/hm3/users
ports:
- "8344:80"
environment:
- CYPHT_AUTH_USERNAME=admin
- CYPHT_AUTH_PASSWORD=admin_password
- CYPHT_DB_CONNECTION_TYPE=host
- CYPHT_DB_HOST=db
- CYPHT_DB_NAME=cypht
- CYPHT_DB_USER=cypht
- CYPHT_DB_PASS=cypht_password
- CYPHT_SESSION_TYPE=DB

3
cypht/review Executable file
View File

@ -0,0 +1,3 @@
doesnt work with gmail and quite slow
does work with app passwords, slow because of additional are-you-sure, does techinally hit all marks with 0 frill

48
cypht2/Dockerfile Executable file
View File

@ -0,0 +1,48 @@
FROM php:7.1.26-alpine3.9
RUN apk add --no-cache \
bash \
ca-certificates \
curl \
fcron \
gcc \
libpng \
libpng-dev \
openssl \
php-bcmath \
php-curl \
php-fpm \
php-gd \
php-intl \
php-mbstring \
php-xml \
php-zip \
php7-gd \
php7-mbstring \
php7-pdo \
php7-pdo_sqlite \
php7-pgsql \
php7-pdo_pgsql \
postgresql \
postgresql-contrib \
postgresql-dev \
rsync \
sqlite \
sqlite-dev \
sudo \
tzdata \
wget
RUN docker-php-ext-install \
gd \
pdo \
pdo_pgsql \
pdo_sqlite
RUN apk del \
libpng-dev \
postgresql-dev \
sqlite-dev
CMD []
ENTRYPOINT ["bash", "/mnt/entrypoint.sh"]

30
cypht2/build_and_run.sh Executable file
View File

@ -0,0 +1,30 @@
#! /bin/bash
set -e
set -u
cd "$(dirname "${BASH_SOURCE[0]}")"
name="$(basename "$(pwd)")"
dir="$(pwd)"
pushd $GOPATH/src/local/rproxy3
CGO_ENABLED=0 GOOS=linux go build -o "$dir/mnt/proxy" -a -installsuffix cgo
popd
#img="php"
#tag="7.1.26-alpine3.9"
#docker pull $img:$tag
docker build -t $name:latest .
mkdir -p ./mnt
cp ./entrypoint.sh ./mnt/
docker run --rm -it \
--entrypoint sh \
--name $name \
-p 8346:8081 \
-v $(pwd)/mnt:/mnt \
$name:latest \
/mnt/entrypoint.sh \
-p 8081 -burst 100 -crt /mnt/server.crt -key /mnt/server.key -r localhost:http://localhost:8080 -rate 100 -timeout 30 \
"$@"

88
cypht2/entrypoint.sh Executable file
View File

@ -0,0 +1,88 @@
#! /bin/sh
set -e
set -u
function install_composer() {
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php --install-dir=bin --filename=composer
php -r "unlink('composer-setup.php');"
}
function install() {
install_composer
mkdir /tmp/cypht-temp
cd /tmp/cypht-temp
wget https://github.com/jasonmunro/cypht/archive/master.zip
unzip master.zip
cd cypht-master && composer install && cd ..
cp cypht-master/hm3.sample.ini cypht-master/hm3.ini
find cypht-master -type d -print | xargs chmod 755
find cypht-master -type f -print | xargs chmod 644
mv cypht-master/* $1
cd $1
rm -rf /tmp/cypht-temp
}
function config_user_gen() {
php ./scripts/config_gen.php
php ./scripts/create_account.php admin admin
}
function run_auth_sqlite() {
echo "CREATE TABLE hm_user_session (hm_id varchar(180), data longblob, date timestamp, primary key (hm_id));" \
| sqlite3 /mnt/test.db || true
echo "CREATE TABLE hm_user (username varchar(250), hash varchar(250), primary key (username));" \
| sqlite3 /mnt/test.db || true
echo "CREATE TABLE hm_user_settings(username varchar(250), settings longblob, primary key (username));" \
| sqlite3 /mnt/test.db || true
}
function run_auth_pgsql() {
echo '127.0.0.1 localhost' >> /etc/hosts
mkdir -p /run/postgresql
chmod -R 777 /run/postgresql
if [ ! -d /mnt/postgresql/data ]; then
sudo -u postgres bash -c '
mkdir -p /mnt/postgresql/data &&
chmod 0700 /mnt/postgresql/data &&
initdb /mnt/postgresql/data &&
echo "host all all 0.0.0.0/8 md5" >> /mnt/postgresql/data/pg_hba.conf &&
echo "listen_addresses='"'"'*'"'"'" >> /mnt/postgresql/data/postgresql.conf &&
pg_ctl -D /mnt/postgresql/data start &&
psql postgresql://localhost:5432 \
--command "CREATE DATABASE test WITH ENCODING UTF8 TEMPLATE=template0;" &&
psql postgresql://localhost:5432/test \
--command "CREATE USER bel WITH SUPERUSER PASSWORD '"'"'pwd'"'"';" &&
psql postgresql://bel:pwd@localhost:5432/test \
--command "GRANT ALL PRIVILEGES ON DATABASE test TO bel;" &&
psql postgresql://bel:pwd@localhost:5432/test \
--command "CREATE TABLE hm_user_session (hm_id varchar(250) primary key not null, data text, date timestamp);" &&
psql postgresql://bel:pwd@localhost:5432/test \
--command "CREATE TABLE hm_user (username varchar(255) primary key not null, hash varchar(255));" &&
psql postgresql://bel:pwd@localhost:5432/test \
--command "CREATE TABLE hm_user_settings (username varchar(250) primary key not null, settings text);"
'
else
sudo -u postgres bash -c 'pg_ctl -D /mnt/postgresql/data start'
fi
}
DESTINATION="/mnt/cypht"
if [ ! -d $DESTINATION ]; then
mkdir -p $DESTINATION
install $DESTINATION
fi
cd $DESTINATION
run_auth_pgsql
#run_auth_sqlite
config_user_gen
mkdir -p /var/lib/hm3
mkdir -p /var/lib/hm3/attachments
mkdir -p /var/lib/hm3/users
mkdir -p /var/lib/hm3/app_data
ln -s /mnt/cypht/site /var/www/html/mail
php -S 0.0.0.0:8080 &
/mnt/proxy "$@"
exit $?

7
cypht3/.env Executable file
View File

@ -0,0 +1,7 @@
DOMAIN=localhost
USER=admin
PASS=pass123
DB_PASS=pass123
DB_USER=cypht
DB=cypht
ROOT_PASS=pass123

53
cypht3/docker-compose.yaml Executable file
View File

@ -0,0 +1,53 @@
version: "3"
services:
cypht_app:
container_name: cypht_app
image: sailfrog/cypht-docker:latest
ports:
- 3308:80
environment:
- DOMAIN=localhost
- USER=admin
- PASS=pass123
- DB_PASS=pass123
- DB_USER=cypht
- DB=cypht
- ROOT_PASS=pass123
- CYPHT_AUTH_USERNAME=${USER}
- CYPHT_AUTH_PASSWORD=${PASS}
- CYPHT_DB_CONNECTION_TYPE=host
- CYPHT_DB_HOST=cypht_db:3306
- CYPHT_DB_NAME=${DB}
- CYPHT_DB_USER=${DB_USER}
- CYPHT_DB_PASS=${DB_PASS}
- CYPHT_ALLOW_EXTERNAL_IMAGE_SOURCES=true
- CYPHT_MODULE_NASA=enable
- CYPHT_DISABLE_IP_CHECK=true
- CYPHT_MODULE_2FA=enable
volumes:
- ${PWD}/users:/var/lib/hm3/users
- ${PWD}/app_data:/var/lib/hm3/app_data
labels:
- "traefik.enable=true"
- "traefik.frontend.rule=Host:mail.${DOMAIN}"
depends_on:
- cypht_db
cypht_db:
container_name: cypht_db
image: mariadb:10
ports:
- 3307:3306
environment:
- DOMAIN=localhost
- USER=admin
- PASS=pass123
- DB_PASS=pass123
- DB_USER=cypht
- DB=cypht
- MYSQL_ROOT_PASSWORD=${ROOT_PASS}
- MYSQL_DATABASE=${DB}
- MYSQL_USER=${DB_USER}
- MYSQL_PASSWORD=${DB_PASS}
volumes:
- ${PWD}/mysql:/var/lib/mysql

17
cypht4/Dockerfile Normal file
View File

@ -0,0 +1,17 @@
FROM php:5-apache
RUN apt-get update && apt-get install -y \
unzip wget openssl curl
COPY install.sh /install.sh
RUN bash /install.sh
RUN mkdir /var/lib/hm3
RUN mkdir /var/lib/hm3/attachments
RUN mkdir /var/lib/hm3/users
RUN mkdir /var/lib/hm3/app_data
RUN chown -R www-data /var/lib/hm3/
WORKDIR /var/lib/hm3
CMD ["php", "-S", "0.0.0.0:33144"]

41
cypht4/install.sh Normal file
View File

@ -0,0 +1,41 @@
#!/bin/bash
# https://cypht.org/install.html
# this is where Cypht will be installed
DESTINATION="/usr/local/share/cypht"
# validate the destination directory
test -r $DESTINATION -a -x $DESTINATION
if [ $? -ne 0 ]; then
mkdir $DESTINATION
fi
# create working directory
mkdir cypht-temp
cd cypht-temp
# grab latest code
wget https://github.com/jasonmunro/cypht/archive/master.zip
# unpack the archive
unzip master.zip
# run composer
cd cypht-master && composer install && cd ..
# create a vanilla ini file
cp cypht-master/hm3.sample.ini cypht-master/hm3.ini
# fix permissions and ownership
find cypht-master -type d -print | xargs chmod 755
find cypht-master -type f -print | xargs chmod 644
chown -R root:root cypht-master
# copy to destination folder
mv cypht-master/* $DESTINATION
# remove working directory
cd ..
rm -rf cypht-temp

11
mailpile/build_and_run.sh Executable file
View File

@ -0,0 +1,11 @@
#! /bin/bash
img="staannoe/mailpile"
tag="latest"
docker pull $img:$tag
docker run --rm -it \
--name ${img##*/} \
-p 8344:33411 \
-v $(pwd)/mnt:/root/.local/share/Mailpile \
$img:$tag

1
mailpile/review Executable file
View File

@ -0,0 +1 @@
WINNER WINNER CHICKEN DINNER

13
rainloop/Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM php:5-apache
WORKDIR /var/www/rainloop/
RUN apt-get update && apt-get install -y \
unzip wget
RUN wget -qO- https://repository.rainloop.net/installer.php | php \
&& find . -type d -exec chmod 755 {} \; \
&& find . -type f -exec chmod 644 {} \; \
&& chown -R www-data: *
CMD ["php", "-S", "0.0.0.0:33144"]

11
rainloop/build_and_run.sh Executable file
View File

@ -0,0 +1,11 @@
#! /bin/bash
docker pull mailu/rainloop:1.6
docker run --rm -it \
--name rainloop \
-p 8344:80 \
-v $(pwd)/mnt:/data \
-e MAX_FILESIZE=500000 \
-e MESSAGE_SIZE_LIMIT=500000 \
mailu/rainloop:1.6

3
rainloop/review Executable file
View File

@ -0,0 +1,3 @@
** litearlly proxies webmail. Default frontend, no login to manage logins, stores gmail/ymail/etc creds in cookies and forwards requests.
not multi account--just log in here rather than webmail

1
rainloop/run_newer.sh Normal file
View File

@ -0,0 +1 @@
docker build -t rainloop:latest . && docker run --rm -it -p 33144:33144 --name rainloop rainloop:latest