Blob


1 version=pmwiki-2.3.20 ordered=1 urlencoded=1
2 agent=Mozilla/5.0 (Android 12; Mobile; rv:125.0) Gecko/125.0 Firefox/125.0
3 author=Yonle
4 charset=UTF-8
5 csum=
6 ctime=1689339659
7 host=182.1.45.249
8 name=Openbsd.Snac
9 rev=18
10 targets=Acme-client.Configure
11 text=(:title Setting up Snac in OpenBSD:)%0a%0aA simple, minimalistic microblogging ActivityPub instance that allows you to post in such of lightweight interface.%0a%0a!! Features%0a* Lightweight, minimal dependencies%0a* Multiuser%0a* Simple web interface%0a* No database, javascript, or even cookies needed.%0a* Supports @@unveil()@@ in OpenBSD%0a* Backend is completely [[https://codeberg.org/grunfink/snac2|written in C]]%0a* Support FastCGI, Allowing setup with only OpenHTTPd%0a%0ahttps://yonle.lecturify.net/fedi/yonle/s/5f55afb155b9aee70cf335daa44b47f3.jpg%0a%0a!! Configuring httpd.conf%0aEdit @@/etc/httpd.conf@@:%0a%0a[@%0a# $OpenBSD: httpd.conf,v 1.22 2020/11/04 10:34:18 denis Exp $%0a%0aserver "snac.example.com" {%0a listen on * port 80%0a%0a location "/.well-known/acme-challenge/*" {%0a root "/acme"%0a request strip 2%0a }%0a%0a location * {%0a fastcgi socket tcp "127.0.0.1" 8001%0a }%0a%0a gzip-static%0a%0a connection { max request body 104857600 }%0a}%0a@]%0a%0aReplace @@snac.example.com@@ with your hostname.%0a%0aSave the file, Then enable and start httpd (as root):%0a[@%0a# rcctl enable httpd%0a# rcctl start httpd%0a@]%0a%0aGet SSL Certificate with [[Acme-client.Configure|acme-client]]. Once successfully obtained SSL certs, Edit @@/etc/httpd.conf@@ and add the following lines after @@listen on * port 80@@:%0a[@%0aserver "snac.example.com" {%0a listen on * port 80%0a listen on * tls port 443 # for TLS%0a tls {%0a certificate "/etc/ssl/snac.example.com.crt"%0a key "/etc/ssl/private/snac.example.com.key"%0a }%0a%0a location * {%0a fastcgi socket tcp "127.0.0.1" 8001%0a }%0a%0a connection { max request body 104857600 }%0a}%0a@]%0a%0aReplace @@snac.example.com@@ with your hostname, and finally reload httpd by @@rcctl reload httpd@@ and https should works.%0a%0a!! Installation%0aInstall required packages:%0a[@%0a# pkg_add curl git nano%0a@]%0a%0aClone the repository, then start installing.%0a[@%0a$ git clone https://codeberg.org/grunfink/snac2%0a$ cd snac2%0a$ make%0a$ doas make install%0a@]%0a%0aLet's copy the @@examples/snac_openbsd@@ to @@/etc/rc.d/@@, then start editing%0a%0a[@%0a# cp examples/snac_openbsd /etc/rc.d/snac%0a# chmod +x /etc/rc.d/snac%0a# nano /etc/rc.d/snac%0a@]%0a%0aThen you will see the code as the following:%0a[@%0a#!/bin/ksh%0a%0adaemon_args="httpd /PATH/TO/SNAC/BASEDIR"%0adaemon_logger="daemon.info"%0adaemon_user="SNACUSER"%0adaemon="/usr/local/bin/snac ${daemon_args}"%0a%0a. /etc/rc.d/rc.subr%0a%0apexp="${daemon}.*"%0arc_reload=NO%0arc_bg=YES%0a%0arc_cmd $1%0a%0a# this is an OpenBSD /etc/rc.d startup script. Edit and run as root:%0a#%0a# install snac_openbsd /etc/rc.d/snac%0a# rcctl enable snac%0a# rcctl start snac%0a@]%0a%0aChange @@/PATH/TO/SNAC/BASEDIR@@ to @@/var/snac/data@@, and @@SNACUSER@@ as @@snac@@%0a%0aSave it by doing CTRL + S, Then close @@nano@@ editor with CTRL + X.%0a%0a%0aNow, We will set up the user & the datadir.%0a[@%0a# useradd -m -d /var/snac snac%0a# doas -u snac snac init /var/snac/data%0aNetwork address [127.0.0.1]:%0aNetwork port [8001]:%0aHost name: snac.example.com%0aURL prefix:%0aAdmin email address (optional):%0aDone.%0a@]%0a%0aReplace @@snac.example.com@@ with your domain.%0a%0aEdit @@/var/snac/data/server.json@@ (as @@root@@ / @@snac@@ user):%0a[@%0a{%0a "prefix": "",%0a "address": "127.0.0.1",%0a "port": 8001,%0a "dbglevel": 0,%0a "queue_retry_minutes": 2,%0a "queue_retry_max": 10,%0a "cssurls": [%0a ""%0a ],%0a "max_timeline_entries": 128,%0a "timeline_purge_days": 120,%0a "local_purge_days": 0,%0a "admin_account": "",%0a "title": "",%0a "short_description": "",%0a "fastcgi": false,%0a "layout": 2.7,%0a "host": "snac.example.com",%0a "admin_email": ""%0a}%0a@]%0aChange @@"fastcgi": false@@ to @@"fastcgi": true@@%0a%0aSave the server.json file,%0a%0aNow, create an user.%0a[@%0a$ doas -u snac snac adduser /var/snac/data yourname%0aCreating RSA key...%0aDone.%0a%0aUser password is abcdefg1234567%0a%0aGo to https://snac.example.com/yourname and continue configuring your user there.%0a@]%0a%0aStart the @@snac@@ daemon, and visit your snac website.%0a[@%0a# rcctl enable snac%0a# rcctl start snac%0a@]
12 time=1712593846
13 title=Setting up Snac in OpenBSD
14 author:1712593846=Yonle
15 diff:1712593846:1702820309:=33,34d32%0a%3c %0a%3c gzip-static%0a
16 host:1712593846=182.1.45.249
17 author:1702820309=Yonle
18 diff:1702820309:1702820278:=46c46%0a%3c Get SSL Certificate with [[Acme-client.Configure|acme-client]]. Once successfully obtained SSL certs, Edit @@/etc/httpd.conf@@ and add the following lines after @@listen on * port 80@@:%0a---%0a> Get SSL Certificate with [[Acme-client.Configure|acme-client]]. Once successfully obtained SSL certs, Edit @@/etc/httpd.conf@@ and add the following lines:%0a
19 host:1702820309=2a09:bac5:3a21:137d::1f1:1fc
20 author:1702820278=Yonle
21 diff:1702820278:1702813456:=49,50c49%0a%3c listen on * port 80%0a%3c listen on * tls port 443 # for TLS%0a---%0a> listen on * tls port 443%0a
22 host:1702820278=2a09:bac5:3a21:137d::1f1:1fc
23 author:1702813456=Yonle
24 diff:1702813456:1702813373:=40c40%0a%3c Save the file, Then enable and start httpd (as root):%0a---%0a> Save the file, Then enable and start relayd (as root):%0a
25 host:1702813456=182.1.36.65
26 author:1702813373=Yonle
27 diff:1702813373:1702787250:=33,34d32%0a%3c %0a%3c connection { max request body 104857600 }%0a58,59d55%0a%3c %0a%3c connection { max request body 104857600 }%0a
28 host:1702813373=182.1.36.65
29 author:1702787250=Yonle
30 diff:1702787250:1702737131:=3c3%0a%3c A simple, minimalistic microblogging ActivityPub instance that allows you to post in such of lightweight interface.%0a---%0a> A simple, minimalistic ActivityPub instance that allows you to post in such of lightweight interface.%0a
31 host:1702787250=182.1.36.65
32 author:1702737131=Yonle
33 diff:1702737131:1702737066:=78c78%0a%3c # cp examples/snac_openbsd /etc/rc.d/snac%0a---%0a> # mv examples/snac_openbsd /etc/rc.d/snac%0a
34 host:1702737131=2a09:bac1:34e0:48::23:3f7
35 author:1702737066=Yonle
36 diff:1702737066:1702736575:=126c126%0a%3c Edit @@/var/snac/data/server.json@@ (as @@root@@ / @@snac@@ user):%0a---%0a> Edit @@data/server.json@@:%0a146c146%0a%3c "host": "snac.example.com",%0a---%0a> "host": "snac.lecturify.net",%0a156c156%0a%3c $ doas -u snac snac adduser /var/snac/data yourname%0a---%0a> $ snac adduser data yourname%0a165c165%0a%3c Start the @@snac@@ daemon, and visit your snac website.%0a---%0a> Finally, logout from user @@snac@@, then start the @@snac@@ daemon, and visit your snac website.%0a
37 host:1702737066=2a09:bac1:34e0:48::23:3f7
38 author:1702736575=Yonle
39 diff:1702736575:1702736446:=115c115,116%0a%3c # doas -u snac snac init /var/snac/data%0a---%0a> # su -l snac%0a> $ snac init data%0a
40 host:1702736575=2a09:bac1:34e0:48::23:3f7
41 author:1702736446=Yonle
42 diff:1702736446:1702735549:=107,108c107,108%0a%3c Change @@/PATH/TO/SNAC/BASEDIR@@ to @@/var/snac/data@@, and @@SNACUSER@@ as @@snac@@%0a%3c %0a---%0a> Change @@/PATH/TO/SNAC/BASEDIR@@ to @@/home/_snac/data@@, and @@SNACUSER@@ as @@_snac@@%0a> %0a114,115c114,115%0a%3c # useradd -m -d /var/snac snac%0a%3c # su -l snac%0a---%0a> # useradd -m _snac%0a> # su -l _snac%0a
43 host:1702736446=2a09:bac1:34e0:48::23:3f7
44 author:1702735549=Yonle
45 diff:1702735549:1689914735:=12,13c12%0a%3c * Support FastCGI, Allowing setup with only OpenHTTPd%0a%3c %0a---%0a> %0a17,18c16,17%0a%3c Edit @@/etc/httpd.conf@@:%0a%3c %0a---%0a> httpd will used for [[Acme-client.Configure|acme-client]]. Edit @@/etc/httpd.conf@@:%0a> %0a24d22%0a%3c %0a31c29%0a%3c fastcgi socket tcp "127.0.0.1" 8001%0a---%0a> block return 302 "https://$HTTP_HOST$REQUEST_URI"%0a38c36%0a%3c Save the file, Then enable and start relayd (as root):%0a---%0a> Then enable and start relayd (as root):%0a44c42,44%0a%3c Get SSL Certificate with [[Acme-client.Configure|acme-client]]. Once successfully obtained SSL certs, Edit @@/etc/httpd.conf@@ and add the following lines:%0a---%0a> !! Configuring relayd.conf%0a> relayd will be used as the reverse proxy. Insert the following configuration in @@/etc/relayd.conf@@:%0a> %0a46,55c46,58%0a%3c server "snac.example.com" {%0a%3c listen on * tls port 443%0a%3c tls {%0a%3c certificate "/etc/ssl/snac.example.com.crt"%0a%3c key "/etc/ssl/private/snac.example.com.key"%0a%3c }%0a%3c %0a%3c location * {%0a%3c fastcgi socket tcp "127.0.0.1" 8001%0a%3c }%0a---%0a> # $OpenBSD: relayd.conf,v 1.4 2018/03/23 09:55:06 claudio Exp $%0a> %0a> ext_inet="%3cIPv4 address>"%0a> ext_inet6="%3cIPv6 address>"%0a> %0a> table %3csnac_server> { 127.0.0.1 }%0a> %0a> http protocol snac {%0a> tls { keypair snac.example.com }%0a> %0a> # Append a bunch of headers%0a> match request header set "X-Forwarded-For" value "$REMOTE_ADDR"%0a> match request header set "X-Forwarded-By" value "$SERVER_ADDR:$SERVER_PORT"%0a56a60,75%0a> %0a> relay www {%0a> listen on $ext_inet port https tls%0a> %0a> protocol snac%0a> %0a> forward to %3csnac_server> port 8001%0a> }%0a> %0a> relay www6 {%0a> listen on $ext_inet6 port https tls%0a> %0a> protocol snac%0a> %0a> forward to %3csnac_server> port 8001%0a> }%0a59,62c78,82%0a%3c Replace @@snac.example.com@@ with your hostname, and finally reload httpd by @@rcctl reload httpd@@ and https should works.%0a%3c %0a%3c !! Installation%0a%3c Install required packages:%0a---%0a> Change @@snac.example.com@@ with your instance domain.%0a> %0a> Again, change @@%3cIPv4 address>@@ and @@%3cIPv6 address>@@ to your server's address(es).%0a> %0a> Then enable and start relayd (as root):%0a64c84,85%0a%3c # pkg_add curl git nano%0a---%0a> # rcctl enable relayd%0a> # rcctl start relayd%0a67c88,89%0a%3c Clone the repository, then start installing.%0a---%0a> !! Installation%0a> Install required packages:%0a68a91,95%0a> # pkg_add curl git nano%0a> @]%0a> %0a> Clone the repository, then start installing.%0a> [@%0a126,153d152%0a%3c %0a%3c Edit @@data/server.json@@:%0a%3c [@%0a%3c {%0a%3c "prefix": "",%0a%3c "address": "127.0.0.1",%0a%3c "port": 8001,%0a%3c "dbglevel": 0,%0a%3c "queue_retry_minutes": 2,%0a%3c "queue_retry_max": 10,%0a%3c "cssurls": [%0a%3c ""%0a%3c ],%0a%3c "max_timeline_entries": 128,%0a%3c "timeline_purge_days": 120,%0a%3c "local_purge_days": 0,%0a%3c "admin_account": "",%0a%3c "title": "",%0a%3c "short_description": "",%0a%3c "fastcgi": false,%0a%3c "layout": 2.7,%0a%3c "host": "snac.lecturify.net",%0a%3c "admin_email": ""%0a%3c }%0a%3c @]%0a%3c Change @@"fastcgi": false@@ to @@"fastcgi": true@@%0a%3c %0a%3c Save the server.json file,%0a
46 host:1702735549=2a09:bac1:34e0:48::23:3f7
47 author:1689914735=Yonle
48 diff:1689914735:1689914141:=10c10%0a%3c * Supports @@unveil()@@ in OpenBSD%0a---%0a> * Supports `unveil()` in OpenBSD%0a13c13%0a%3c https://yonle.lecturify.net/fedi/yonle/s/5f55afb155b9aee70cf335daa44b47f3.jpg%0a---%0a> https://snac.lecturify.net/yonle/s/5b6c0f9f2ef44c29acefbb348da73933.jpg%0a
49 host:1689914735=182.1.23.58
50 author:1689914141=Yonle
51 diff:1689914141:1689768107:=10d9%0a%3c * Supports `unveil()` in OpenBSD%0a
52 host:1689914141=182.1.23.58
53 author:1689768107=Yonle
54 diff:1689768107:1689341360:=164,168c164%0a%3c Finally, logout from user @@snac@@, then start the @@snac@@ daemon, and visit your snac website.%0a%3c [@%0a%3c # rcctl enable snac%0a%3c # rcctl start snac%0a%3c @]%0a\ No newline at end of file%0a---%0a> Finally, logout from user @@snac@@, then start the @@snac@@ daemon, and visit your snac website.%0a\ No newline at end of file%0a
55 host:1689768107=107.189.3.129
56 author:1689341360=Yonle
57 diff:1689341360:1689339807:=105d104%0a%3c # chmod +x /etc/rc.d/snac%0a
58 host:1689341360=114.125.22.230
59 author:1689339807=Yonle
60 diff:1689339807:1689339687:=3c3%0a%3c A simple, minimalistic ActivityPub instance that allows you to post in such of lightweight interface.%0a---%0a> A simple, minimalistic ActivityPub instance%0a
61 host:1689339807=114.125.61.96
62 author:1689339687=Yonle
63 diff:1689339687:1689339659:=163c163,165%0a%3c Finally, logout from user @@snac@@, then start the @@snac@@ daemon, and visit your snac website.%0a\ No newline at end of file%0a---%0a> Finally, logout from user @@snac@@, then start the @@snac@@ daemon.%0a> %0a> !! Setting up the relayd%0a\ No newline at end of file%0a
64 host:1689339687=114.125.61.96
65 author:1689339659=Yonle
66 diff:1689339659:1689339659:=1,165d0%0a%3c (:title Setting up Snac in OpenBSD:)%0a%3c %0a%3c A simple, minimalistic ActivityPub instance%0a%3c %0a%3c !! Features%0a%3c * Lightweight, minimal dependencies%0a%3c * Multiuser%0a%3c * Simple web interface%0a%3c * No database, javascript, or even cookies needed.%0a%3c * Backend is completely [[https://codeberg.org/grunfink/snac2|written in C]]%0a%3c %0a%3c https://snac.lecturify.net/yonle/s/5b6c0f9f2ef44c29acefbb348da73933.jpg%0a%3c %0a%3c !! Configuring httpd.conf%0a%3c httpd will used for [[Acme-client.Configure|acme-client]]. Edit @@/etc/httpd.conf@@:%0a%3c %0a%3c [@%0a%3c # $OpenBSD: httpd.conf,v 1.22 2020/11/04 10:34:18 denis Exp $%0a%3c %0a%3c server "snac.example.com" {%0a%3c listen on * port 80%0a%3c location "/.well-known/acme-challenge/*" {%0a%3c root "/acme"%0a%3c request strip 2%0a%3c }%0a%3c %0a%3c location * {%0a%3c block return 302 "https://$HTTP_HOST$REQUEST_URI"%0a%3c }%0a%3c }%0a%3c @]%0a%3c %0a%3c Replace @@snac.example.com@@ with your hostname.%0a%3c %0a%3c Then enable and start relayd (as root):%0a%3c [@%0a%3c # rcctl enable httpd%0a%3c # rcctl start httpd%0a%3c @]%0a%3c %0a%3c !! Configuring relayd.conf%0a%3c relayd will be used as the reverse proxy. Insert the following configuration in @@/etc/relayd.conf@@:%0a%3c %0a%3c [@%0a%3c # $OpenBSD: relayd.conf,v 1.4 2018/03/23 09:55:06 claudio Exp $%0a%3c %0a%3c ext_inet="%3cIPv4 address>"%0a%3c ext_inet6="%3cIPv6 address>"%0a%3c %0a%3c table %3csnac_server> { 127.0.0.1 }%0a%3c %0a%3c http protocol snac {%0a%3c tls { keypair snac.example.com }%0a%3c %0a%3c # Append a bunch of headers%0a%3c match request header set "X-Forwarded-For" value "$REMOTE_ADDR"%0a%3c match request header set "X-Forwarded-By" value "$SERVER_ADDR:$SERVER_PORT"%0a%3c }%0a%3c %0a%3c relay www {%0a%3c listen on $ext_inet port https tls%0a%3c %0a%3c protocol snac%0a%3c %0a%3c forward to %3csnac_server> port 8001%0a%3c }%0a%3c %0a%3c relay www6 {%0a%3c listen on $ext_inet6 port https tls%0a%3c %0a%3c protocol snac%0a%3c %0a%3c forward to %3csnac_server> port 8001%0a%3c }%0a%3c @]%0a%3c %0a%3c Change @@snac.example.com@@ with your instance domain.%0a%3c %0a%3c Again, change @@%3cIPv4 address>@@ and @@%3cIPv6 address>@@ to your server's address(es).%0a%3c %0a%3c Then enable and start relayd (as root):%0a%3c [@%0a%3c # rcctl enable relayd%0a%3c # rcctl start relayd%0a%3c @]%0a%3c %0a%3c !! Installation%0a%3c Install required packages:%0a%3c [@%0a%3c # pkg_add curl git nano%0a%3c @]%0a%3c %0a%3c Clone the repository, then start installing.%0a%3c [@%0a%3c $ git clone https://codeberg.org/grunfink/snac2%0a%3c $ cd snac2%0a%3c $ make%0a%3c $ doas make install%0a%3c @]%0a%3c %0a%3c Let's copy the @@examples/snac_openbsd@@ to @@/etc/rc.d/@@, then start editing%0a%3c %0a%3c [@%0a%3c # mv examples/snac_openbsd /etc/rc.d/snac%0a%3c # nano /etc/rc.d/snac%0a%3c @]%0a%3c %0a%3c Then you will see the code as the following:%0a%3c [@%0a%3c #!/bin/ksh%0a%3c %0a%3c daemon_args="httpd /PATH/TO/SNAC/BASEDIR"%0a%3c daemon_logger="daemon.info"%0a%3c daemon_user="SNACUSER"%0a%3c daemon="/usr/local/bin/snac ${daemon_args}"%0a%3c %0a%3c . /etc/rc.d/rc.subr%0a%3c %0a%3c pexp="${daemon}.*"%0a%3c rc_reload=NO%0a%3c rc_bg=YES%0a%3c %0a%3c rc_cmd $1%0a%3c %0a%3c # this is an OpenBSD /etc/rc.d startup script. Edit and run as root:%0a%3c #%0a%3c # install snac_openbsd /etc/rc.d/snac%0a%3c # rcctl enable snac%0a%3c # rcctl start snac%0a%3c @]%0a%3c %0a%3c Change @@/PATH/TO/SNAC/BASEDIR@@ to @@/home/_snac/data@@, and @@SNACUSER@@ as @@_snac@@%0a%3c %0a%3c Save it by doing CTRL + S, Then close @@nano@@ editor with CTRL + X.%0a%3c %0a%3c %0a%3c Now, We will set up the user & the datadir.%0a%3c [@%0a%3c # useradd -m _snac%0a%3c # su -l _snac%0a%3c $ snac init data%0a%3c Network address [127.0.0.1]:%0a%3c Network port [8001]:%0a%3c Host name: snac.example.com%0a%3c URL prefix:%0a%3c Admin email address (optional):%0a%3c Done.%0a%3c @]%0a%3c %0a%3c Replace @@snac.example.com@@ with your domain.%0a%3c %0a%3c Now, create an user.%0a%3c [@%0a%3c $ snac adduser data yourname%0a%3c Creating RSA key...%0a%3c Done.%0a%3c %0a%3c User password is abcdefg1234567%0a%3c %0a%3c Go to https://snac.example.com/yourname and continue configuring your user there.%0a%3c @]%0a%3c %0a%3c Finally, logout from user @@snac@@, then start the @@snac@@ daemon.%0a%3c %0a%3c !! Setting up the relayd%0a\ No newline at end of file%0a
67 host:1689339659=114.125.61.96