Compare commits

...

13 Commits

Author SHA1 Message Date
950c9a6aea gitea ui tweaks 2025-01-02 02:22:57 +00:00
414c300b41 recenter gitea link 2024-09-05 20:24:47 -07:00
a5ac19a2a4 Merge pull request 'remove hard tabs oops' (#5) from tab_to_softtab into master
Reviewed-on: #5
2024-09-02 22:48:05 +00:00
78c0895418 disable gitea reg if link on tld 2024-09-02 07:47:47 +00:00
8cbe7eecd3 remove tabs from html 2024-09-02 07:22:23 +00:00
9090da987f gitea link in header 2024-09-02 00:04:58 -07:00
650e77210e move onion address to nginx header 2024-08-20 19:40:33 +00:00
16a45c495d restart always incomp with env switch 2024-08-10 06:30:54 -07:00
08ae04a154 ssh tunnel env switch and logging 2024-08-10 06:12:26 -07:00
78384a31fb Merge pull request 'initial working ssh entry' (#4) from ssh_in into master
Reviewed-on: #4
2024-08-10 02:18:05 +00:00
60280917c6 set default to prod 2024-08-10 02:08:35 +00:00
8f8c0c1401 fix composes 2024-08-09 18:58:40 -07:00
979adc3b13 initial working ssh entry 2024-08-09 18:47:22 -07:00
23 changed files with 345 additions and 259 deletions

7
.gitignore vendored
View File

@ -1,7 +1,8 @@
gitea/
gitea
.env
pmb-pf/
pmb-pf
venv
zapp.db
db/bu
tor/hidden_service/
tor/hidden_service
sshtun/oilykey

View File

@ -2,7 +2,7 @@
{% block content %}
<h2>File Not Found</h1>
<p><a href="{{ url_for('index') }}">Back</a></p>
<h2>File Not Found</h1>
<p><a href="{{ url_for('index') }}">Back</a></p>
{% endblock %}

View File

@ -2,8 +2,8 @@
{% block content %}
<h2>An unexpected error has occurred.</h1>
<p>Administrator has been notified.</p>
<p><a href="{{ url_for('index') }}">Back</a></p>
<h2>An unexpected error has occurred.</h1>
<p>Administrator has been notified.</p>
<p><a href="{{ url_for('index') }}">Back</a></p>
{% endblock %}

View File

@ -1,11 +1,11 @@
<tr style="vertical-align: top;">
<td style="vertical-align: middle; width: 60px;">
<img style="vertical-align: middle; width: 40px;" src="data:image/png;base64,{{ post.author.gen_avatar(write_png=False) }}">
</td>
<td style="word-break: break-word;">
<a href="{{ url_for('user', username=post.author.username) }}">
{{ post.author.username }}
</a> says:<br>
{{ post.body }}
</td>
</tr>
<tr style="vertical-align: top;">
<td style="vertical-align: middle; width: 60px;">
<img style="vertical-align: middle; width: 40px;" src="data:image/png;base64,{{ post.author.gen_avatar(write_png=False) }}">
</td>
<td style="word-break: break-word;">
<a href="{{ url_for('user', username=post.author.username) }}">
{{ post.author.username }}
</a> says:<br>
{{ post.body }}
</td>
</tr>

View File

@ -1,14 +1,14 @@
<div>
{% if prev_url %}
<a class="button" href="{{ prev_url }}">Newer</a>
{% else %}
<a class="button" aria-disabled=true>Newer</a>
{% endif %}
<div>
{% if prev_url %}
<a class="button" href="{{ prev_url }}">Newer</a>
{% else %}
<a class="button" aria-disabled=true>Newer</a>
{% endif %}
{% if next_url %}
<a class="button" href="{{ next_url }}">Older</a>
{% else %}
<a class="button" aria-disabled=true>Older</a>
{% endif %}
</div>
{% if next_url %}
<a class="button" href="{{ next_url }}">Older</a>
{% else %}
<a class="button" aria-disabled=true>Older</a>
{% endif %}
</div>

View File

@ -1,42 +1,44 @@
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="{{ url_for('static', filename='simple.css') }}">
{% if title %}
<title>{{ title }}</title>
{% else %}
<title>oily page</title>
{% endif %}
</head>
<body>
<header>
<nav>
<a {% block indexcurrent %}{% endblock %} href="{{ url_for('index') }}">home</a>
<a {% block explorecurrent %}{% endblock %} href="{{ url_for('explore') }}">explore</a>
{% if current_user.is_anonymous %}
<a {% block logincurrent %}{% endblock %} href="{{ url_for('login') }}">login</a>
{% else %}
<a {% block profilecurrent %}{% endblock %} href="{{ url_for('user', username=current_user.username) }}">profile</a>
<a href="{{ url_for('logout') }}">logout</a>
{% endif %}
<head>
<link rel="stylesheet" href="{{ url_for('static', filename='simple.css') }}">
{% if title %}
<title>{{ title }}</title>
{% else %}
<title>oily page</title>
{% endif %}
</head>
<body>
<header>
<nav>
<a {% block indexcurrent %}{% endblock %} href="{{ url_for('index') }}">home</a>
<a {% block explorecurrent %}{% endblock %} href="{{ url_for('explore') }}">explore</a>
{% if current_user.is_anonymous %}
<a {% block logincurrent %}{% endblock %} href="{{ url_for('login') }}">login</a>
{% else %}
<a {% block profilecurrent %}{% endblock %} href="{{ url_for('user', username=current_user.username) }}">profile</a>
<a href="{{ url_for('logout') }}">logout</a>
{% endif %}
<a href="https://gut.oily.dad/explore/repos">
<img style="vertical-align: middle; horizontal-align: center; height: 22px" src="https://gut.oily.dad/assets/img/logo.svg" alt="Logo" aria-hidden="true">
</a>
</nav>
</nav>
<h2>oily.dad</h2>
<h5>oilydada7ckiseinkbeathsefwgkvjrce743xy7x7iiybkuxh4vheead.onion</h5>
</header>
<hr>
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul>
{% for message in messages %}
<p class="notice">{{ message }}</p>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
<h2>oily.dad</h2>
</header>
<hr>
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul>
{% for message in messages %}
<p class="notice">{{ message }}</p>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
{% block content %}{% endblock %}
</body>
{% block content %}{% endblock %}
</body>
</html>

View File

@ -1,24 +1,24 @@
{% extends "base.html" %}
{% block content %}
<h2>Edit Profile</h1>
<form action="" method="post">
{{ form.hidden_tag() }}
<p>
{{ form.username.label }}
{{ form.username(size=32) }}
{% for error in form.username.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>
{{ form.about_me.label }}
{{ form.about_me(cols=50, rows=4) }}
{% for error in form.about_me.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>{{ form.submit }}</p>
</form>
<h2>Edit Profile</h1>
<form action="" method="post">
{{ form.hidden_tag() }}
<p>
{{ form.username.label }}
{{ form.username(size=32) }}
{% for error in form.username.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>
{{ form.about_me.label }}
{{ form.about_me(cols=50, rows=4) }}
{% for error in form.about_me.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>{{ form.submit }}</p>
</form>
{% endblock %}

View File

@ -1,10 +1,10 @@
<!doctype html>
<html>
<body>
<p>User {{ user.username }} requested password reset.</p>
<p>Reset link:</p>
<p><a href="{{ hostname }}{{ url_for('reset_password', token=token) }}">click here</a>
<p>If you did not request this, ignore this message.</p>
</body>
<body>
<p>User {{ user.username }} requested password reset.</p>
<p>Reset link:</p>
<p><a href="{{ hostname }}{{ url_for('reset_password', token=token) }}">click here</a>
<p>If you did not request this, ignore this message.</p>
</body>
</html>

View File

@ -3,26 +3,26 @@
{% block explorecurrent %}class="current"{% endblock %}
{% block content %}
{% if form %}
<form action="" method="post">
{{ form.hidden_tag() }}
<p>
{{ form.post.label }}
{{ form.post(cols=32, rows=4) }}
{% for error in form.post.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>{{ form.submit() }}</p>
</form>
{% endif %}
<table>
{% for post in posts %}
{% include '_post.html' %}
{% endfor %}
</table>
{% if form %}
<form action="" method="post">
{{ form.hidden_tag() }}
<p>
{{ form.post.label }}
{{ form.post(cols=32, rows=4) }}
{% for error in form.post.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>{{ form.submit() }}</p>
</form>
{% endif %}
<table>
{% for post in posts %}
{% include '_post.html' %}
{% endfor %}
</table>
{% include '_postnav.html' %}
{% include '_postnav.html' %}
{% endblock %}

View File

@ -3,26 +3,26 @@
{% block indexcurrent %}class="current"{% endblock %}
{% block content %}
{% if form %}
<form action="" method="post">
{{ form.hidden_tag() }}
<p>
{{ form.post.label }}
{{ form.post(cols=32, rows=4) }}
{% for error in form.post.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>{{ form.submit() }}</p>
</form>
{% endif %}
<table>
{% for post in posts %}
{% include '_post.html' %}
{% endfor %}
</table>
{% if form %}
<form action="" method="post">
{{ form.hidden_tag() }}
<p>
{{ form.post.label }}
{{ form.post(cols=32, rows=4) }}
{% for error in form.post.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>{{ form.submit() }}</p>
</form>
{% endif %}
<table>
{% for post in posts %}
{% include '_post.html' %}
{% endfor %}
</table>
{% include '_postnav.html' %}
{% include '_postnav.html' %}
{% endblock %}

View File

@ -3,31 +3,31 @@
{% block logincurrent %}class="current"{% endblock %}
{% block content %}
<h2>Sign In</h1>
<form action="" method="post" novalidate>
{{ form.hidden_tag() }}
<p>
{{ form.username.label }}<br>
{{ form.username(size=32) }}<br>
{% for error in form.username.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>
{{ form.password.label }}<br>
{{ form.password(size=32) }}<br>
{% for error in form.password.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>{{ form.remember_me() }} {{ form.remember_me.label }}</p>
<p>
{{ form.submit }}
<a class="button" href="{{ url_for('register') }}">Register</a>
</p>
</form>
<h2>Sign In</h1>
<form action="" method="post" novalidate>
{{ form.hidden_tag() }}
<p>
{{ form.username.label }}<br>
{{ form.username(size=32) }}<br>
{% for error in form.username.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>
{{ form.password.label }}<br>
{{ form.password(size=32) }}<br>
{% for error in form.password.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>{{ form.remember_me() }} {{ form.remember_me.label }}</p>
<p>
{{ form.submit }}
<a class="button" href="{{ url_for('register') }}">Register</a>
</p>
</form>
<p><a href="{{ url_for('reset_password_request') }}">Reset Password</a></p>
<p><a href="{{ url_for('reset_password_request') }}">Reset Password</a></p>
{% endblock %}

View File

@ -2,39 +2,39 @@
{% block content %}
<h2>Register</h1>
<form action="" method="post">
{{ form.hidden_tag() }}
<p>
{{ form.username.label }}<br>
{{ form.username(size=32) }}<br>
{% for error in form.username.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>
{{ form.email.label }}<br>
{{ form.email(size=64) }}<br>
{% for error in form.email.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>
{{ form.password.label }}<br>
{{ form.password(size=64) }}<br>
{% for error in form.password.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>
{{ form.password2.label }}<br>
{{ form.password2(size=64) }}<br>
{% for error in form.password2.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>{{ form.submit }}</p>
</form>
<h2>Register</h1>
<form action="" method="post">
{{ form.hidden_tag() }}
<p>
{{ form.username.label }}<br>
{{ form.username(size=32) }}<br>
{% for error in form.username.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>
{{ form.email.label }}<br>
{{ form.email(size=64) }}<br>
{% for error in form.email.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>
{{ form.password.label }}<br>
{{ form.password(size=64) }}<br>
{% for error in form.password.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>
{{ form.password2.label }}<br>
{{ form.password2(size=64) }}<br>
{% for error in form.password2.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>{{ form.submit }}</p>
</form>
{% endblock %}

View File

@ -2,25 +2,25 @@
{% block content %}
<h2>Reset Your Password</h1>
<form action="" method="post">
{{ form.hidden_tag() }}
<p>
{{ form.password.label }}
{{ form.password(size=32) }}
{% for error in form.password.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>
{{ form.password2.label }}
{{ form.password2(size=32) }}
{% for error in form.password2.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>{{ form.submit() }}</p>
</form>
<h2>Reset Your Password</h1>
<form action="" method="post">
{{ form.hidden_tag() }}
<p>
{{ form.password.label }}
{{ form.password(size=32) }}
{% for error in form.password.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>
{{ form.password2.label }}
{{ form.password2(size=32) }}
{% for error in form.password2.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>{{ form.submit() }}</p>
</form>
{% endblock %}

View File

@ -1,17 +1,17 @@
{% extends "base.html" %}
{% block content %}
<h2>Reset Password</h1>
<form action="" method="post">
{{ form.hidden_tag() }}
<p>
{{ form.email.label }}<br>
{{ form.email(size=64) }}<br>
{% for error in form.email.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>{{ form.submit() }}</p>
</form>
<h2>Reset Password</h1>
<form action="" method="post">
{{ form.hidden_tag() }}
<p>
{{ form.email.label }}<br>
{{ form.email(size=64) }}<br>
{% for error in form.email.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
<p>{{ form.submit() }}</p>
</form>
{% endblock %}

View File

@ -3,40 +3,40 @@
{% block profilecurrent %}class="current"{% endblock %}
{% block content %}
<article>
<h2>
<img style="vertical-align: middle; width: 60px;" src="data:image/png;base64,{{ user.gen_avatar(write_png=False) }}">
User: {{ user.username }}
</h2>
{% if user.about_me %}<p>{{ user.about_me }}</p>{% endif %}
{% if user.last_seen %}<p>Last activity: {{ user.last_seen }}</p>{% endif %}
{% if user == current_user %}
<p><a class="button" href="{{ url_for('edit_profile') }}">Edit Profile</a></p>
{% elif not current_user.is_following(user) %}
<p>
<form action="{{ url_for('follow', username=user.username) }}" method="post">
{{ form.hidden_tag() }}
{{ form.submit(value='Follow') }}
</form>
</p>
{% else %}
<p>
<form action="{{ url_for('unfollow', username=user.username) }}" method="post">
{{ form.hidden_tag() }}
{{ form.submit(value='Unfollow') }}
</form>
</p>
{% endif %}
</article>
<hr>
<article>
<h2>
<img style="vertical-align: middle; width: 60px;" src="data:image/png;base64,{{ user.gen_avatar(write_png=False) }}">
User: {{ user.username }}
</h2>
{% if user.about_me %}<p>{{ user.about_me }}</p>{% endif %}
{% if user.last_seen %}<p>Last activity: {{ user.last_seen }}</p>{% endif %}
{% if user == current_user %}
<p><a class="button" href="{{ url_for('edit_profile') }}">Edit Profile</a></p>
{% elif not current_user.is_following(user) %}
<p>
<form action="{{ url_for('follow', username=user.username) }}" method="post">
{{ form.hidden_tag() }}
{{ form.submit(value='Follow') }}
</form>
</p>
{% else %}
<p>
<form action="{{ url_for('unfollow', username=user.username) }}" method="post">
{{ form.hidden_tag() }}
{{ form.submit(value='Unfollow') }}
</form>
</p>
{% endif %}
</article>
<hr>
<table>
{% for post in posts %}
{% include '_post.html' %}
{% endfor %}
</table>
{% include '_postnav.html' %}
<table>
{% for post in posts %}
{% include '_post.html' %}
{% endfor %}
</table>
{% include '_postnav.html' %}
{% endblock %}

View File

@ -77,8 +77,10 @@ services:
- GITEA__mailer__SMTP_PORT=25
- GITEA__service__REGISTER_EMAIL_CONFIRM=true
- GITEA__service__ENABLE_NOTIFY_MAIL=true
- GITEA__server__LANDING_PAGE=explore
- GITEA__ui__REACTIONS="+1, -1, fu, heart, laugh, confused, hooray, eyes, gun, boom, poop, kiss"
# To disable new users after setup:
#- GITEA__service__DISABLE_REGISTRATION=false
- GITEA__service__DISABLE_REGISTRATION=true
networks:
- backnet
- frontnet
@ -100,8 +102,8 @@ services:
- /home/finn/d/cert/var/lib/letsencrypt:/var/lib/letsencrypt:ro
- /home/finn/d/cert/etc/letsencrypt:/etc/letsencrypt:ro
ports:
- 80:80
- 443:443
- "80:80"
- "443:443"
depends_on:
- backend
networks:
@ -135,6 +137,20 @@ services:
networks:
- backnet
sshtun:
build:
context: sshtun
dockerfile: Dockerfile
restart: on-failure
environment:
- USE_TUN=${USE_TUN}
ports:
- "22222:22"
expose:
- "11112"
networks:
- frontnet
volumes:
db-data:
pmb-root:

View File

@ -78,7 +78,7 @@ services:
- GITEA__service__REGISTER_EMAIL_CONFIRM=true
- GITEA__service__ENABLE_NOTIFY_MAIL=true
# To disable new users after setup:
#- GITEA__service__DISABLE_REGISTRATION=false
- GITEA__service__DISABLE_REGISTRATION=true
networks:
- backnet
- frontnet
@ -100,8 +100,8 @@ services:
# - /home/finn/d/cert/var/lib/letsencrypt:/var/lib/letsencrypt:ro
# - /home/finn/d/cert/etc/letsencrypt:/etc/letsencrypt:ro
ports:
- 80:80
- 443:443
- "80:80"
- "443:443"
depends_on:
- backend
networks:
@ -135,6 +135,20 @@ services:
networks:
- backnet
sshtun:
build:
context: sshtun
dockerfile: Dockerfile
restart: on-failure
environment:
- USE_TUN=${USE_TUN}
ports:
- "22222:22"
expose:
- "11112"
networks:
- frontnet
volumes:
db-data:
pmb-root:

View File

@ -77,8 +77,10 @@ services:
- GITEA__mailer__SMTP_PORT=25
- GITEA__service__REGISTER_EMAIL_CONFIRM=true
- GITEA__service__ENABLE_NOTIFY_MAIL=true
- GITEA__server__LANDING_PAGE=explore
- GITEA__ui__REACTIONS="+1, -1, fu, heart, laugh, confused, hooray, eyes, gun, boom, poop, kiss"
# To disable new users after setup:
#- GITEA__service__DISABLE_REGISTRATION=false
- GITEA__service__DISABLE_REGISTRATION=true
networks:
- backnet
- frontnet
@ -100,8 +102,8 @@ services:
- /home/finn/d/cert/var/lib/letsencrypt:/var/lib/letsencrypt:ro
- /home/finn/d/cert/etc/letsencrypt:/etc/letsencrypt:ro
ports:
- 80:80
- 443:443
- "80:80"
- "443:443"
depends_on:
- backend
networks:
@ -135,6 +137,20 @@ services:
networks:
- backnet
sshtun:
build:
context: sshtun
dockerfile: Dockerfile
restart: on-failure
environment:
- USE_TUN=${USE_TUN}
ports:
- "22222:22"
expose:
- "11112"
networks:
- frontnet
volumes:
db-data:
pmb-root:

3
dotenv
View File

@ -13,6 +13,9 @@ BUILD_GPG_PP=
# Tor:
# true/false:
USE_TOR=false
# SSH Tun:
# true/false:
USE_TUN=false
# Backend:
FLASK_SECRET_KEY="flaskkey"

View File

@ -22,6 +22,7 @@ server {
root /var/www/html;
index index.php index.html index.htm;
add_header Onion-Location http://oilydada7ckiseinkbeathsefwgkvjrce743xy7x7iiybkuxh4vheead.onion$request_uri;
location / {
proxy_pass http://backend:8000/;

View File

@ -22,6 +22,7 @@ server {
root /var/www/html;
index index.php index.html index.htm;
add_header Onion-Location http://oilydada7ckiseinkbeathsefwgkvjrce743xy7x7iiybkuxh4vheead.onion$request_uri;
location / {
proxy_pass http://backend:8000/;

18
sshtun/Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM debian:12-slim
RUN apt update && apt install -y openssh-server socat
RUN adduser --disabled-password --gecos "" finn
RUN mkdir /home/finn/.ssh
# only one pubkey -- wildcard to conceal filename
COPY ./oilykey/*.pub /home/finn/.ssh/authorized_keys
RUN mkdir /var/run/sshd
RUN echo "PermitRootLogin no" >> /etc/ssh/sshd_config
RUN echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
COPY ./entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]

14
sshtun/entrypoint.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
# Container goal: egress
# first: physical_box$ autossh -N -R 11111:localhost:11434 -i sshtun/oilykey/<SOMEKEY> -p 22222 <rem_vps_url>
# will forward rem_c_port:physical_box:physical_box_port ...some args... rem_vps_p rem_vps_url
# then: frontnet_c$ curl sshtun.frontnet:11112 --> physical_box:11434
if $USE_TUN ; then
echo "@@@@@@@@@@ SSH TUNNEL ENABLED BY ENV"
nohup socat TCP-LISTEN:11112,fork TCP:localhost:11111 &
/usr/sbin/sshd -De
else
echo "@@@@@@@@@@ SSH TUNNEL DISABLED BY ENV"
fi