Blame


1 6ec26a7b 2023-05-29 jrmu version=pmwiki-2.3.20 ordered=1 urlencoded=1
2 6ec26a7b 2023-05-29 jrmu agent=Mozilla/5.0 (Linux; Android 8.1.0; vivo 1820 Build/O11019) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.5414.118 Mobile Safari/537.36
3 6ec26a7b 2023-05-29 jrmu author=Yonle
4 6ec26a7b 2023-05-29 jrmu charset=UTF-8
5 12ece3b8 2023-06-01 jrmu csum=There's a reason why i connect to IPv6 instead of IPv4
6 6ec26a7b 2023-05-29 jrmu ctime=1685242804
7 12ece3b8 2023-06-01 jrmu host=2a09:bac1:34c0:18::19b:a
8 6ec26a7b 2023-05-29 jrmu name=Openbsd.Gnost-relay
9 12ece3b8 2023-06-01 jrmu rev=6
10 6ec26a7b 2023-05-29 jrmu targets=Relayd.Acceleration
11 12ece3b8 2023-06-01 jrmu text=(:title Gnost-relay:)%0a%0a[[https://github.com/barkyq/gnost-relay|Gnost-relay]] is an Nostr relay written in Go.%0a%0a!! Setting up%0a%0aYou need to have Golang, git and PostgreSQL installed in your machine:%0a%0a[@%0a~ # pkg_add golang postgresql gjt%0a@]%0a%0a!!! Setting up Database%0aLet's make the PostgreSQL database first, Then start PostgreSQL:%0a[@%0a# su -l _postgresql%0a$ initdb -D data -U postgres -E utf-8%0a$ exit%0a# rcctl start postgresql%0a@]%0a%0aIf needed, Make PostgreSQL start after boot:%0a[@%0a# rcctl enable postgresql%0a@]%0a%0aNow make @@gnost_relay@@ user and it is database:%0a[@%0a# psql -U postgres%0apsql (15.2)%0aType "help" for help.%0a%0apostgres=# CREATE USER 'gnost_relay' WITH ENCRYPTED PASSWORD 'wJ3v49LPP';%0aCREATE USER%0apostgres=# CREATE DATABASE 'gnost_relay' OWNER 'gnost_relay';%0aCREATE ROLE%0apostgres=# \q%0a#%0a@]%0a%0aChange @@wJ3v49LPP@@ with your preferred password.%0a%0a!!! Setting up Gnost%0a%0aNow let's make @@_nostr@@ user then login:%0a%0a[@%0a# useradd -m _nostr%0a# su -l _nostr%0a@]%0a%0aClone the repository and enter into the directory:%0a[@%0a$ git clone https://github.com/barkyq/gnost-relay%0a$ cd gnost-relay%0a@]%0a%0aModify the listen address if needed. By default, it is @@localhost:8080@@. For chroot environment, It should be @@127.0.0.1:8080@@:%0a%0a[@%0a$ sed -i "s/localhost:8080/127.0.0.1:8080/g" main.go%0a@]%0a%0aThen start compiling:%0a[@%0a$ go build%0a@]%0a%0aOnce done, There should be @@gnost-relay@@ bin inside the directory:%0a%0a[@%0a$ stat gnost-relay%0a1024 32073755 -rwxr-xr-x 1 _nostr _nostr 128184144 13579046 "May 27 07:04:28 2023" "May 27 07:04:01 2023" "May 27 07:04:01 2023" 32768 26624 0 gnost-relay%0a@]%0a%0aYou may modify @@config.json@@ accordingly.%0a%0a!!! Setting up the chroot environment%0aExit and go back as root, Then go to @@/home/_nostr/@@, and make jail folder:%0a%0a[@%0a$ exit%0a# cd /home/_nostr%0a# mkdir jailbox%0a@]%0a%0aCopy @@gnost-relay@@ bin and @@config.json@@ into the @@jailbox@@ directory%0a%0a[@%0a# cp gnost-relay/gnost-relay gnost-relay/config.json jailbox%0a@]%0a%0acd into the @@jailbox@@ folder, ldd the @@gnost-relay@@ bin and copy the required libs:%0a[@%0a# cd jailbox%0a# ldd gnost-relay%0agnost-relay:%0a Start End Type Open Ref GrpRef Name%0a 0000000000400000 0000000000d63000 exe 2 0 0 gnost-relay%0a 0000000201305000 00000002013fb000 rlib 0 1 0 /usr/lib/libc.so.97.0%0a 00000002a1aef000 00000002a1afb000 rlib 0 1 0 /usr/lib/libpthread.so.27.0%0a 0000000268f2d000 0000000268f2d000 ld.so 0 1 0 /usr/libexec/ld.so%0a# mkdir -p usr/lib{exec,}%0a# cp /usr/libexec/ld.so usr/libexec%0a# cp /usr/lib/libc.so.97.0 /usr/lib/libpthread.so.27.0 usr/lib%0a@]%0a%0aGo back to the previous folder (Should be @@/home/_nostr@@), Start editing @@start.sh@@:%0a%0a[@%0a# cd /home/_nostr%0a# vi start.sh%0a@]%0a%0astart.sh:%0a[@%0a#!/bin/sh%0a%0aexport DATABASE_URL='postgres://gnost_relay:YOURDBPASS@[::1]:5432/gnost_relay'%0achroot -u _nostr /home/_nostr/jailbox/ /gnost-relay --config /config.json | tee -a /home/_nostr/logfile%0a@]%0a%0aReplace @@YOURDBPASS@@ with the database password that you provide for @@gnost_relay@@ before.%0a%0aSave it, and make it executeable:%0a[@%0a# chmod +x start.sh%0a@]%0a%0aYou may like to test whenever you have a working set up by running @@./start.sh@@.%0a%0a!!! Setting up rc.d service%0aEdit @@/etc/rc.d/nostr@@:%0a%0a[@%0a#!/bin/ksh%0a%0adaemon="/home/_nostr/start.sh"%0adaemon_logger=daemon.info%0a%0a. /etc/rc.d/rc.subr%0a%0apexp="/gnost-relay.*"%0a%0arc_stop_signal=KILL%0arc_usercheck=NO%0arc_reload=NO%0arc_bg=YES%0a%0arc_cmd $1%0a@]%0a%0aSave it, then make it as executeable:%0a[@%0a# chmod +x /etc/rc.d/nostr%0a@]%0a%0aThen try start it:%0a[@%0a# rcctl start nostr%0anostr(ok)%0a#%0a@]%0a%0aIf needed, You could make gnost to start after boot:%0a[@%0a# rcctl enable nostr%0a@]%0a%0a!! Configuring relayd%0aRelayd will be used for reverse proxy. Edit @@/etc/relayd.conf@@ and insert the following:%0a%0a[@%0a# $OpenBSD: relayd.conf,v 1.4 2018/03/23 09:55:06 claudio Exp $%0a%0aext_inet="%3cIPv4 address>"%0aext_inet6="%3cIPv6 address>"%0a%0atable %3cnostr_server> { 127.0.0.1 }%0a%0ahttp protocol honk { # Protocol for upstream honk server%0a #tcp { nodelay, sack, socket buffer 65536, backlog 128 } # Uncomment and adjust as you see fit%0a tls { keypair example.com }%0a%0a # Append a bunch of headers%0a match request header append "X-Forwarded-For" value "$REMOTE_ADDR"%0a match request header append "X-Forwarded-By" value "$SERVER_ADDR:$SERVER_PORT"%0a%0a http websockets%0a}%0a%0arelay www {%0a listen on $ext_inet port https tls # Comment to disable listening on IPv4%0a%0a protocol nostr%0a%0a forward to %3cnostr_server> port 8080%0a}%0a%0arelay www6 {%0a listen on $ext_inet6 port https tls # Comment to disable listening on IPv6%0a%0a protocol nostr%0a%0a forward to %3cnostr_server> port 8080%0a}%0a@]%0a%0aChange @@example.com@@ with your domain address.%0a%0aAnd change @@%3cIPv4 address>@@ and @@%3cIPv6 address>@@ to your server's address(es) and comment one of the two listen options if needed.%0a%0aCheck the configuration with @@relayd -n@@, if it is OK, enable and start relayd (as root):%0a[@%0a# rcctl enable relayd%0a# rcctl start relayd%0a@]%0a%0a!! Also read%0a- [[Relayd.Acceleration]] - TLS Acceleration with relayd
12 12ece3b8 2023-06-01 jrmu time=1685530435
13 6ec26a7b 2023-05-29 jrmu title=Gnost-relay
14 12ece3b8 2023-06-01 jrmu author:1685530435=Yonle
15 12ece3b8 2023-06-01 jrmu csum:1685530435=There's a reason why i connect to IPv6 instead of IPv4
16 12ece3b8 2023-06-01 jrmu diff:1685530435:1685316449:=119c119%0a%3c export DATABASE_URL='postgres://gnost_relay:YOURDBPASS@[::1]:5432/gnost_relay'%0a---%0a> export DATABASE_URL=postgres://gnost_relay:YOURDBPASS@127.0.0.1:5432/gnost_relay%0a
17 12ece3b8 2023-06-01 jrmu host:1685530435=2a09:bac1:34c0:18::19b:a
18 6ec26a7b 2023-05-29 jrmu author:1685316449=Yonle
19 6ec26a7b 2023-05-29 jrmu csum:1685316449=Log into daemon.info
20 6ec26a7b 2023-05-29 jrmu diff:1685316449:1685243499:=139d138%0a%3c daemon_logger=daemon.info%0a
21 6ec26a7b 2023-05-29 jrmu host:1685316449=114.125.52.229
22 6ec26a7b 2023-05-29 jrmu author:1685243499=Yonle
23 6ec26a7b 2023-05-29 jrmu diff:1685243499:1685243412:=217,219d216%0a%3c %0a%3c !! Also read%0a%3c - [[Relayd.Acceleration]] - TLS Acceleration with relayd%0a\ No newline at end of file%0a
24 6ec26a7b 2023-05-29 jrmu host:1685243499=114.125.52.212
25 6ec26a7b 2023-05-29 jrmu author:1685243412=Yonle
26 6ec26a7b 2023-05-29 jrmu diff:1685243412:1685242821:=167,216c167%0a%3c @]%0a%3c %0a%3c !! Configuring relayd%0a%3c Relayd will be used for reverse proxy. Edit @@/etc/relayd.conf@@ and insert the following:%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 %3cnostr_server> { 127.0.0.1 }%0a%3c %0a%3c http protocol honk { # Protocol for upstream honk server%0a%3c #tcp { nodelay, sack, socket buffer 65536, backlog 128 } # Uncomment and adjust as you see fit%0a%3c tls { keypair example.com }%0a%3c %0a%3c # Append a bunch of headers%0a%3c match request header append "X-Forwarded-For" value "$REMOTE_ADDR"%0a%3c match request header append "X-Forwarded-By" value "$SERVER_ADDR:$SERVER_PORT"%0a%3c %0a%3c http websockets%0a%3c }%0a%3c %0a%3c relay www {%0a%3c listen on $ext_inet port https tls # Comment to disable listening on IPv4%0a%3c %0a%3c protocol nostr%0a%3c %0a%3c forward to %3cnostr_server> port 8080%0a%3c }%0a%3c %0a%3c relay www6 {%0a%3c listen on $ext_inet6 port https tls # Comment to disable listening on IPv6%0a%3c %0a%3c protocol nostr%0a%3c %0a%3c forward to %3cnostr_server> port 8080%0a%3c }%0a%3c @]%0a%3c %0a%3c Change @@example.com@@ with your domain address.%0a%3c %0a%3c And change @@%3cIPv4 address>@@ and @@%3cIPv6 address>@@ to your server's address(es) and comment one of the two listen options if needed.%0a%3c %0a%3c Check the configuration with @@relayd -n@@, if it is OK, enable and start relayd (as root):%0a%3c [@%0a%3c # rcctl enable relayd%0a%3c # rcctl start relayd%0a%3c @]%0a---%0a> @]%0a\ No newline at end of file%0a
27 6ec26a7b 2023-05-29 jrmu host:1685243412=114.125.52.212
28 6ec26a7b 2023-05-29 jrmu author:1685242821=Yonle
29 6ec26a7b 2023-05-29 jrmu diff:1685242821:1685242804:=43c43%0a%3c !!! Setting up Gnost%0a---%0a> !! Setting up Gnost%0a
30 6ec26a7b 2023-05-29 jrmu host:1685242821=114.125.52.212
31 6ec26a7b 2023-05-29 jrmu author:1685242804=Yonle
32 6ec26a7b 2023-05-29 jrmu diff:1685242804:1685242804:=1,167d0%0a%3c (:title Gnost-relay:)%0a%3c %0a%3c [[https://github.com/barkyq/gnost-relay|Gnost-relay]] is an Nostr relay written in Go.%0a%3c %0a%3c !! Setting up%0a%3c %0a%3c You need to have Golang, git and PostgreSQL installed in your machine:%0a%3c %0a%3c [@%0a%3c ~ # pkg_add golang postgresql gjt%0a%3c @]%0a%3c %0a%3c !!! Setting up Database%0a%3c Let's make the PostgreSQL database first, Then start PostgreSQL:%0a%3c [@%0a%3c # su -l _postgresql%0a%3c $ initdb -D data -U postgres -E utf-8%0a%3c $ exit%0a%3c # rcctl start postgresql%0a%3c @]%0a%3c %0a%3c If needed, Make PostgreSQL start after boot:%0a%3c [@%0a%3c # rcctl enable postgresql%0a%3c @]%0a%3c %0a%3c Now make @@gnost_relay@@ user and it is database:%0a%3c [@%0a%3c # psql -U postgres%0a%3c psql (15.2)%0a%3c Type "help" for help.%0a%3c %0a%3c postgres=# CREATE USER 'gnost_relay' WITH ENCRYPTED PASSWORD 'wJ3v49LPP';%0a%3c CREATE USER%0a%3c postgres=# CREATE DATABASE 'gnost_relay' OWNER 'gnost_relay';%0a%3c CREATE ROLE%0a%3c postgres=# \q%0a%3c #%0a%3c @]%0a%3c %0a%3c Change @@wJ3v49LPP@@ with your preferred password.%0a%3c %0a%3c !! Setting up Gnost%0a%3c %0a%3c Now let's make @@_nostr@@ user then login:%0a%3c %0a%3c [@%0a%3c # useradd -m _nostr%0a%3c # su -l _nostr%0a%3c @]%0a%3c %0a%3c Clone the repository and enter into the directory:%0a%3c [@%0a%3c $ git clone https://github.com/barkyq/gnost-relay%0a%3c $ cd gnost-relay%0a%3c @]%0a%3c %0a%3c Modify the listen address if needed. By default, it is @@localhost:8080@@. For chroot environment, It should be @@127.0.0.1:8080@@:%0a%3c %0a%3c [@%0a%3c $ sed -i "s/localhost:8080/127.0.0.1:8080/g" main.go%0a%3c @]%0a%3c %0a%3c Then start compiling:%0a%3c [@%0a%3c $ go build%0a%3c @]%0a%3c %0a%3c Once done, There should be @@gnost-relay@@ bin inside the directory:%0a%3c %0a%3c [@%0a%3c $ stat gnost-relay%0a%3c 1024 32073755 -rwxr-xr-x 1 _nostr _nostr 128184144 13579046 "May 27 07:04:28 2023" "May 27 07:04:01 2023" "May 27 07:04:01 2023" 32768 26624 0 gnost-relay%0a%3c @]%0a%3c %0a%3c You may modify @@config.json@@ accordingly.%0a%3c %0a%3c !!! Setting up the chroot environment%0a%3c Exit and go back as root, Then go to @@/home/_nostr/@@, and make jail folder:%0a%3c %0a%3c [@%0a%3c $ exit%0a%3c # cd /home/_nostr%0a%3c # mkdir jailbox%0a%3c @]%0a%3c %0a%3c Copy @@gnost-relay@@ bin and @@config.json@@ into the @@jailbox@@ directory%0a%3c %0a%3c [@%0a%3c # cp gnost-relay/gnost-relay gnost-relay/config.json jailbox%0a%3c @]%0a%3c %0a%3c cd into the @@jailbox@@ folder, ldd the @@gnost-relay@@ bin and copy the required libs:%0a%3c [@%0a%3c # cd jailbox%0a%3c # ldd gnost-relay%0a%3c gnost-relay:%0a%3c Start End Type Open Ref GrpRef Name%0a%3c 0000000000400000 0000000000d63000 exe 2 0 0 gnost-relay%0a%3c 0000000201305000 00000002013fb000 rlib 0 1 0 /usr/lib/libc.so.97.0%0a%3c 00000002a1aef000 00000002a1afb000 rlib 0 1 0 /usr/lib/libpthread.so.27.0%0a%3c 0000000268f2d000 0000000268f2d000 ld.so 0 1 0 /usr/libexec/ld.so%0a%3c # mkdir -p usr/lib{exec,}%0a%3c # cp /usr/libexec/ld.so usr/libexec%0a%3c # cp /usr/lib/libc.so.97.0 /usr/lib/libpthread.so.27.0 usr/lib%0a%3c @]%0a%3c %0a%3c Go back to the previous folder (Should be @@/home/_nostr@@), Start editing @@start.sh@@:%0a%3c %0a%3c [@%0a%3c # cd /home/_nostr%0a%3c # vi start.sh%0a%3c @]%0a%3c %0a%3c start.sh:%0a%3c [@%0a%3c #!/bin/sh%0a%3c %0a%3c export DATABASE_URL=postgres://gnost_relay:YOURDBPASS@127.0.0.1:5432/gnost_relay%0a%3c chroot -u _nostr /home/_nostr/jailbox/ /gnost-relay --config /config.json | tee -a /home/_nostr/logfile%0a%3c @]%0a%3c %0a%3c Replace @@YOURDBPASS@@ with the database password that you provide for @@gnost_relay@@ before.%0a%3c %0a%3c Save it, and make it executeable:%0a%3c [@%0a%3c # chmod +x start.sh%0a%3c @]%0a%3c %0a%3c You may like to test whenever you have a working set up by running @@./start.sh@@.%0a%3c %0a%3c !!! Setting up rc.d service%0a%3c Edit @@/etc/rc.d/nostr@@:%0a%3c %0a%3c [@%0a%3c #!/bin/ksh%0a%3c %0a%3c daemon="/home/_nostr/start.sh"%0a%3c %0a%3c . /etc/rc.d/rc.subr%0a%3c %0a%3c pexp="/gnost-relay.*"%0a%3c %0a%3c rc_stop_signal=KILL%0a%3c rc_usercheck=NO%0a%3c rc_reload=NO%0a%3c rc_bg=YES%0a%3c %0a%3c rc_cmd $1%0a%3c @]%0a%3c %0a%3c Save it, then make it as executeable:%0a%3c [@%0a%3c # chmod +x /etc/rc.d/nostr%0a%3c @]%0a%3c %0a%3c Then try start it:%0a%3c [@%0a%3c # rcctl start nostr%0a%3c nostr(ok)%0a%3c #%0a%3c @]%0a%3c %0a%3c If needed, You could make gnost to start after boot:%0a%3c [@%0a%3c # rcctl enable nostr%0a%3c @]%0a\ No newline at end of file%0a
33 6ec26a7b 2023-05-29 jrmu host:1685242804=114.125.52.212