From b46c107a85856854715248acc84bd0ebc58ccff6 Mon Sep 17 00:00:00 2001
From: Maurice <mauricegolverdingen@gmail.com>
Date: Thu, 3 Nov 2022 17:30:34 +0100
Subject: [PATCH] Configuration and cli example

---
 config/nginx.txt |  6 ++++++
 config/openrc.sh | 16 ++++++++++++----
 pastabble-cli.sh | 15 +++++++++++++++
 3 files changed, 33 insertions(+), 4 deletions(-)
 create mode 100644 pastabble-cli.sh

diff --git a/config/nginx.txt b/config/nginx.txt
index 67acb30..7188507 100644
--- a/config/nginx.txt
+++ b/config/nginx.txt
@@ -1,5 +1,11 @@
 server {
+    listen 443 http2;
     server_name paste.plabble.org;
+    access_log /var/log/nginx/access.log;
+    
+	ssl_early_data on;
+    include certs/plabble.org/config.conf;
+
     location / {
         proxy_pass  http://127.0.0.1:8080;
     }
diff --git a/config/openrc.sh b/config/openrc.sh
index 68b0ab0..1cb557d 100644
--- a/config/openrc.sh
+++ b/config/openrc.sh
@@ -1,11 +1,19 @@
 #!/sbin/openrc-run
-# Copyright 2022 Plabble
+
+depend() { need sysfs cgroups; }
 
 start() {
-    podman rm pastabble-c || true
-    podman run --name pastabble-c -p 8080:8080 -v pastabble-v:/data -dt pastabble
+    su podman -c 'podman rm pastabble-c' || true
+	su podman -c 'podman run \
+	--name pastabble-c -d \
+	--read-only \
+    --cap-drop ALL \
+	--security-opt=no-new-privileges \
+	-p 127.0.0.1:8080:8080 \
+	-v pastabble-v:/app/data \
+	pastabble'
 }
 
 stop() {
-    podman stop pastabble-c
+    su podman -c 'podman stop pastabble' || true
 }
\ No newline at end of file
diff --git a/pastabble-cli.sh b/pastabble-cli.sh
new file mode 100644
index 0000000..fddbeb5
--- /dev/null
+++ b/pastabble-cli.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+# Shell aliasses and functions. 
+# Load or copy this file into your .profile or (b)ashrc
+PURL="paste.plabble.org"
+
+alias pcopy="curl -F 'content=<-' $PURL -w '\n'"
+alias pshort="curl -F 'link=<-' $PURL/to -w '\n'"
+
+function ppaste() {
+    curl $PURL/$1
+}
+
+function pgo() {
+    firefox $PURL/to/$1
+}
\ No newline at end of file