diff options
| -rw-r--r-- | content/dendrite.md | 6 | ||||
| -rw-r--r-- | content/ejabberd.md | 5 | ||||
| -rw-r--r-- | content/i2p.md | 82 | ||||
| -rw-r--r-- | content/monerod.md | 228 | ||||
| -rw-r--r-- | content/prosody.md | 52 | ||||
| -rw-r--r-- | static/pix/monerod/monerod-step-1.webp | bin | 0 -> 31984 bytes | |||
| -rw-r--r-- | static/pix/monerod/monerod-step-2.webp | bin | 0 -> 33428 bytes | |||
| -rw-r--r-- | static/pix/monerod/monerod-step-3.webp | bin | 0 -> 16130 bytes | |||
| -rw-r--r-- | static/pix/monerod/monerod-step-4.webp | bin | 0 -> 10362 bytes | |||
| -rw-r--r-- | static/pix/monerod/monerod-step-5.webp | bin | 0 -> 40168 bytes |
10 files changed, 327 insertions, 46 deletions
diff --git a/content/dendrite.md b/content/dendrite.md index 79d2417..9a7a291 100644 --- a/content/dendrite.md +++ b/content/dendrite.md @@ -118,10 +118,10 @@ Now download the Dendrite repository using `git` and change directory to it: git clone https://github.com/matrix-org/dendrite cd dendrite ``` -Finally, run the `./build.sh` script to compile Dendrite: +Finally, compile Dendrite using `go build`: ```sh -./build.sh +go build -o bin/ ./cmd/... ``` *This might take a few minutes,* but once the process is finished you should find the final Dendrite programs populating the `bin/` directory. @@ -231,7 +231,7 @@ chown -R dendrite:dendrite /opt/dendrite ### Setting up a systemd Service -Now setup a **systemd service** to run Dendrite automatically for you. Make sure to set the `WorkingDirectory` to the directory where your Dendrite repository is located! +Now setup a **systemd service** in `/etc/systemd/system/dendrite.service` to run Dendrite automatically for you. Make sure to set the `WorkingDirectory` to the directory where your Dendrite repository is located! ```systemd [Unit] diff --git a/content/ejabberd.md b/content/ejabberd.md index c725465..eff3b36 100644 --- a/content/ejabberd.md +++ b/content/ejabberd.md @@ -191,6 +191,11 @@ PostgreSQL is available in the Debian repositories: apt install postgresql ``` +In addition, you will have to install the **appropriate headers for Erlang,** the language ejabberd is written in, so it can actually interact with the PostgreSQL server: +```sh +apt install erlang-p1-pgsql +``` + Start the PostgreSQL daemon to begin using it: ```sh diff --git a/content/i2p.md b/content/i2p.md index d0b2edb..88b05b4 100644 --- a/content/i2p.md +++ b/content/i2p.md @@ -7,13 +7,11 @@ tags: ['service'] short_desc: "A private and uncensorable web-layer similar to Tor." --- -Now you have a website, why not offer it in a private alternative such -as the Invisible Internet? +Now you have a website, why not offer it in a private alternative such as the Invisible Internet? ## Setting up I2P -There are 2 main I2P implementations, I2P and i2pd, we are using i2pd in -this guide because it\'s easier to use in servers. +There are 2 main I2P implementations, I2P and i2pd, we are using i2pd in this guide because it\'s easier to use in servers. ### Installing I2P @@ -25,9 +23,7 @@ apt install i2pd ### Enabling I2P -We are going to create a user for i2pd, because i2pd finds the -configuration files in its home directory. And it\'s easier (and more -tidy) to have it in a separate user: +We are going to create a user for i2pd, because i2pd finds the configuration files in its home directory. And it\'s easier (and more tidy) to have it in a separate user: ```sh useradd -m i2p -s /bin/bash @@ -36,9 +32,7 @@ mkdir ~/.i2pd cd ~/.i2pd ``` -Now that you\'re in \~/.i2pd, you have to create a file named -\"tunnels.conf\". Which is the config file for every hidden service -you\'re offering over I2P, the content should be like this: +Now that you\'re in \~/.i2pd, you have to create a file named \"tunnels.conf\". Which is the config file for every hidden service you\'re offering over I2P, the content should be like this: ```systemd [example] @@ -48,13 +42,58 @@ port = 8080 keys = example.dat ``` +#### Optional: Generating a Vanity Address + +If you run `i2pd` with the configuration above, it will generate a random private key (`example.dat`) for your website in `example.dat` with a matching address made up of 52 random characters, derived from this same key. + +If you instead pre-generate a private key for your website, you can use brute-force computation to make a "vanity" address, such as the following: +``` +{{<hl>}}chad{{</hl>}}aor3jc08ht340c30mg5cf340j395gj095kuazj5tokipr34f.32.i2p +``` + +To accomplish this, a set of tools named `i2pd-tools` can be installed. + +Begin by cloning their repository: +```sh +git clone --recursive https://github.com/purplei2p/i2pd-tools +``` + +The repository comes with a dependency installation script included. Run this to list the compilation dependencies you'll need, and install them: +```sh +cd i2pd-tools +sh dependencies.sh +``` + +Then compile using the `make` command: +```sh +make -j$(nproc) +``` + +This will build a variety of useful tools for i2p, with `vain` being the command of interest to generate an address: +```sh +./vain {{<hl>}}chad{{</hl>}} +``` +This command will begin running and output a new set of private keys named `private.dat` to the same directory it's ran from. Copy this file to your i2p configuration and you'll have your vanity address: + +```sh +cp private.dat /home/i2p/.i2pd/example.dat +``` + +#### Optional: Authentication Strings for Registrars + +I2P has various **registrars** that let users link their long I2P addresses to shorter, more memorable ones, like `example.i2p`. To actually register your site on one of these registrars, you will need an **authentication string.** Luckily, `i2pd-tools` includes such a tool in their repository: + +```sh +./regaddr private.dat {{<hl>}}example.2ip{{</hl>}} > {{<hl>}}auth_string.txt{{</hl>}} +``` + +The command above will save the string to a file named `auth_string.txt`. You will have to place the text contained in that file on a registration page like [http://reg.i2p/add](http://reg.i2p/add) or [http://stats.i2p/i2p/addkey.html](http://stats.i2p/i2p/addkey.html). + ### Getting your I2P Hostname -Then, run `/usr/sbin/i2pd --daemon` to start i2pd and we can retreive -our I2P hostname. +Then, run `/usr/sbin/i2pd --daemon` to start i2pd and we can retreive our I2P hostname. -This can be done in lynx or a command-line browser by going to -`http://127.0.0.1:7070/?page=i2p_tunnels` to get your I2P hostname. +This can be done in lynx or a command-line browser by going to `http://127.0.0.1:7070/?page=i2p_tunnels` to get your I2P hostname. You can also run these commands to find your hostname: @@ -63,12 +102,11 @@ printf "%s.b32.i2p " $(head -c 391 /home/i2p/.i2pd/example.dat |sha256sum|xxd -r -p | base32 |sed s/=//g | tr A-Z a-z) ``` +*(If you've generated your own keys to obtain a vanity address, now's a good time to make sure i2pd is properly reading those keys by verifying the address is the same as the one generated with the `vain` command.)* + ## Adding the Nginx Config -From here, the steps are almost identical to setting up a normal website -configuration file. Follow the steps as if you were making a new website -on the webserver [tutorial](/basic/nginx) up until the server block of -code. Instead, paste this: +From here, the steps are almost identical to setting up a normal websitenconfiguration file. Follow the steps as if you were making a new website on the webserver [tutorial](/basic/nginx) up until the server block of code. Instead, paste this: ```nginx server { @@ -82,13 +120,9 @@ server { #### -Nginx will listen in port 8080, but i2pd will forward your port 8080 to -the i2p site port 80. This way you don\'t have to deal with server names -or anything like that +Nginx will listen in port 8080, but i2pd will forward your port 8080 to the i2p site port 80. This way you don\'t have to deal with server names or anything like that. -From here we are almost done, all we have to do is enable the site and -reload nginx which is also covered in [the webserver -tutorial](nginx.html#enable). +From here we are almost done, all we have to do is enable the site and reload nginx which is also covered in [the webserver tutorial](nginx.html#enable). ### Update regularly! diff --git a/content/monerod.md b/content/monerod.md new file mode 100644 index 0000000..5e00645 --- /dev/null +++ b/content/monerod.md @@ -0,0 +1,228 @@ +--- +title: "Monero Node" +icon: 'xmr.svg' +date: '2021-06-29' +tags: ['service'] +short_desc: "Contribute to the Monero network." +--- + +The Monero cryptocurrency relies on a network of [decentralized nodes](https://www.getmonero.org/resources/moneropedia/node.html) to store the private transaction information and maintain consensus. + +Running your own node will let you relay transactions and contribute to the Monero network by dedicating storage and processing power to the task. You can then connect to your node from a wallet (if you enable rps). + +Some other benefits of a full node are: + +- More reliable and trusted as opposed to using a public node +- More secure for RPC calls for payment processors +- The ability to mine using [p2pool](https://p2pool.io/#help) +- The ability to run a mining pool or solo mine\* + +**Note: Solo mining can be very unreliable and it is not recommended unless you have a very powerful computer.* + +**Warning:** Running a Monero node requires *a lot of storage* (at least 100GB) and a reasonable amount of memory and processing power. If you are hosting at home, make sure to use an **SSD** and not a hard disk drive, as advised by `monerod`. + +## Installation + +Because of the nature of Monero as an ever-evolving decentralized project, it is advised to download and keep an up-to-date version of it for your node. This can be accomplished by downloading the software manually: + +```sh +wget https://downloads.getmonero.org/linux64 +tar -xvjf linux64 +mv linux64/monero* /usr/bin/ +``` + +## Configuration + +By default, Monero comes with no sample configuration files. Create one in `/etc/monerod.conf` using a text editor, and enter the following details: + +```sh +# Configuration for monerod +# Syntax: any command line option may be specified as 'clioptionname=value'. +# Boolean options such as 'no-igd' are specified as 'no-igd=1'. +# See 'monerod --help' for all available options. + +data-dir={{<hl>}}/var/lib/monero{{</hl>}} +log-file={{<hl>}}/var/log/monero/monero.log{{</hl>}} +log-level=0 + +# 1048576 kB/s == 1GB/s; a raise from default 2048 kB/s; contribute more to p2p network +limit-rate-up=1048576 +limit-rate-down=1048576 + +# Be more generous to wallets connecting +disable-rpc-ban=1 +``` + +### Log files + +The logfile at `/var/log/monero/monerod.log` will get **very large, very soon** if you do not limit it's size. Add these options to `/etc/monerod.conf` to limit it's size, and limit the creation of additional log + backups: + +```sh +# Limit log size to 10 MiB +max-log-file-size=10485760 +max-log-files=5 +``` + +### Making a Public Node + +To advertise and let other users connect to your node, enable the following options: + +```sh +restricted-rpc=true +# Bind to all addresses (useful if under NAT) +p2p-bind-ip=0.0.0.0 +rpc-bind-ip=0.0.0.0 +confirm-external-bind=1 + +public-node=true +``` + +### User creation + +Create a dedicated user to run `monerod` named `monero`: +```sh +useradd -m -d /var/lib/monero monero +``` + +Create the directories, and ensure the user has the relevant permissions on them: +```sh +mkdir /var/lib/monero && chown -R monero:monero /var/lib/monero +mkdir /var/log/monero && chown -R monero:monero /var/log/monero +``` + +### Pruning the blockchain + +When running a node, [pruning](https://www.getmonero.org/resources/moneropedia/pruning.html) allows the user to save data by only storing 1/8th of the ring signature information. Every "pruned" node contains a random 1/8th of the data, so the information is never lost. While this isn't as helpful to the network as running a full node, it is a very reasonable option when storage space and bandwidth are limited. **A pruned node will only use 1/3rd of storage compared to a full node.** + +To enable pruning, add the following options to `/etc/monerod.conf`: +```sh +prune-blockchain=true +# This option should speed up the syncing process +sync-pruned-blocks=true +``` + +## Tor/I2P Setup + +from the Monero documentation: + +> Only handshakes, peer timed syncs and transaction broadcast messages are supported over anonymity networks. + +Monero nodes **cannot sync the blockchain over Tor or I2P,** but the node can broadcast transactions and *let users connect* over these anonymizing networks. + +To set this up, first install [Tor](/tor) and/or [I2P](/i2p). + +When creating a hidden service, create the following configuration: + +### Tor + +Edit `/etc/tor/torrc` and add the following: + +```sh +HiddenServiceDir /var/lib/tor/monerod + +# For wallets connecting over RPC: +HiddenServicePort 18081 127.0.0.1:18081 +# For other nodes: +HiddenServicePort 18083 127.0.0.1:18083 +``` + +Now restart Tor: +```sh +systemctl restart tor +``` + +You can acquire the Tor address by running: +```sh +cat /var/lib/tor/monerod/hostname +``` + +### I2P + +Edit `tunnels.conf` (Which may be located in `/home/i2p/.i2pd/` if you followed [this](/i2p) guide) and add the following tunnels: + +```systemd +[monerod] +type = http +host = 127.0.0.1 +port = 18083 +keys = monerod.dat + +[monerod-rpc] +type = http +host = 127.0.0.1 +port = 18081 +keys = monerod-rpc.dat +``` + +Now restart `i2pd`: +```sh +systemctl restart i2pd +``` + +You can acquire the I2P address by running: +```sh +printf "%s.b32.i2p +" $(head -c 391 /home/i2p/.i2pd/monerod.dat | sha256sum |xxd -r -p | base32 | sed s/=//g | tr A-Z a-z) +``` + +### Configuring monerod + +Then, in `/etc/monerod.conf`, add the following: + +```sh +# I2P config +tx-proxy=i2p,127.0.0.1:4447 +anonymous-inbound={{<hl>}}your-i2p-address-here.b32.i2p{{</hl>}}:80,127.0.0.1:18083,16 # Maximum 16 simultaneous connections + +# Tor config +tx-proxy=tor,127.0.0.1:9050,10 +anonymous-inbound={{<hl>}}your-tor-address-here.onion{{</hl>}}:18083,127.0.0.1:18083,16 +``` + +## Running the Node + +Then, run this command to download the systemd daemon configuration for `monerod`. This will allow your node to run in the background and start automatically on boot as a service. + +```sh +curl https://raw.githubusercontent.com/monero-project/monero/master/utils/systemd/monerod.service > {{<hl>}}/etc/systemd/system/monerod.service{{</hl>}} +``` + +*Note: This configuration assumes that you've created a user named `monero` which runs the program `monerod` in it's home directory, and which points to the configuration in `/etc/monerod.conf`. Edit any of these details in `/etc/systemd/system/monerod.service` if they don't apply to your configuration.* + +Now reload the systemd service file: +```sh +systemctl daemon-reload +``` + +To run the node, restart the systemd service: +```sh +systemctl restart monerod +``` + +To monitor the node's status at any time (for example, to check sync progress) check the log file using `tail`: +```sh +tail -f /var/log/monero/monerod.log +``` + +## Connecting to your Node + +To connect to your node using the GUI wallet, first open it: + +{{< img src=/pix/monerod/monerod-step-1.webp >}} + +On the mode selection screen, make sure to pick **Advanced mode:** + +{{< img src=/pix/monerod/monerod-step-2.webp >}} + +When you reach daemon settings, select the **Connect to a remote node** option, and then click **add remote node.** + +{{< img src=/pix/monerod/monerod-step-3.webp >}} + +A prompt will appear, asking for your node's details. Add your **address,** set the port to **18081,** and make to click **Mark as trusted daemon.** + +{{< img src=/pix/monerod/monerod-step-4.webp >}} + +When you reach the main wallet screen, you'll see **"Remote Node"** in the bottom-left corner. Now you can enjoy using your Monero node straight from your wallet! + +{{< img src=/pix/monerod/monerod-step-5.webp >}} diff --git a/content/prosody.md b/content/prosody.md index 2797a8e..08262ab 100644 --- a/content/prosody.md +++ b/content/prosody.md @@ -96,21 +96,18 @@ apt install prosody-modules Then we can add the following line to you prosody config file to enable file uploads: ```cfg -Component "uploads.example.org" "http_upload" +Component "{{<hl>}}uploads.example.org{{</hl>}}" "http_file_share" ``` As you will notice, you need another subdomain for this. We will add an ssl certficate for this later. -You will also need to go back to `modules_enabled` and uncomment the `http_files` module. -This is used to actually serve the files to users. - ### Proxy Support This helps with file transfers for devices behind a NAT, and unless you are using XMPP in a LAN, you **probably need this.** Enable the proxy by adding the following line to the config: ```cfg -Component "proxy.example.org" "proxy65" +Component " {{<hl>}}proxy.example.org{{</hl>}}" "proxy65" ``` As you can see, another subdomain is needed. We will add ssl certificates for this later. @@ -120,26 +117,45 @@ At this point, file sharing is now setup and ready to be used. Although there ar A big concern with file sharing is large files, seeing as all files shared over XMPP will be stored on your server. This can become a problem when many (and large) files are being shared. We can put a cap on large files by adding the following line to our config: ```cfg -http_upload_file_size_limit = 20971520 +http_file_share_file_size_limit = 20971520 ``` This puts a 20MB cap on all files being shared. The value is specified in bytes. You can also specify after how long files should be deleted by adding the following line: ```cfg -http_upload_expire_after = 60 * 60 * 24 * 7 +http_file_share_expire_after = 60 * 60 * 24 * 7 ``` The value is specified in seconds. The above line will make prosody delete files after a week. -If it is for some reason neccessary, you can also manually invoke expiry with the following command: +### Database Setup -```cfg -prosodyctl mod_http_upload expire +Prosody includes the `internal` and `sql` storage backends by default. +If you wish to run Prosody with PostgreSQL, begin by installing the PostgreSQL: + +```sh +apt install postgresql ``` -### Database Setup +Then start the daemon: + +```sh +systemctl restart postgresql +``` -Prosody includes the `internal` and `sql` storage backends by default. If you wish to run Prosody with PostgreSQL, edit the following lines: +Now create a user named `prosody` to manage your database: + +```sh +su -c "createuser --pwprompt prosody" postgres +``` + +And finally, create the actual database: + +```sh +su -c "psql -c 'CREATE DATABASE prosody OWNER prosody;'" postgres +``` + +Finally, in `/etc/prosody/prosody.cfg.lua`, edit the following lines: ```cfg storage = "sql" @@ -153,8 +169,6 @@ sql = { } ``` -(This is assuming you've installed the `postgresql` package, and setup a database named `prosody` with a user named `prosody` as the owner.) - ### Voice and Video Calling Prosody supports XMPP voice and video calls through an external TURN and STUN server. @@ -194,14 +208,14 @@ Obviously, we want to have client-to-server and server-to-server encryption. Now **If you have multi-user chat enabled, be sure to get a certificate for that subdomain as well.** Include the `--nginx` option assuming you have an Nginx server running. ```sh -certbot -d chat.example.org --nginx +certbot -d {{<hl>}}chat.example.org{{</hl>}} --nginx ``` **If you have file sharing enabled, be sure to get a certificate for those subdomains as well.** ```sh -certbot -d uploads.example.org --nginx -certbot -d proxy.example.org --nginx +certbot -d {{<hl>}}uploads.example.org{{</hl>}} --nginx +certbot -d {{<hl>}}proxy.example.org{{</hl>}} --nginx ``` Once you have the certificates for encryption, run the following to import them into Prosody. @@ -219,7 +233,7 @@ Note that you might get an error that a certificate has not been found if your ` Let's manually create the admin user we prepared for above. Note that you can indeed do this in your XMPP client if you have not disabled registration, but this is how it is done on the command line: ```sh -prosodyctl adduser chad@example.org +prosodyctl adduser {{<hl>}}chad@example.org{{</hl>}} ``` This will prompt you to create a password as well. @@ -259,6 +273,6 @@ Remember that MUCs are kept on a separate subdomain that we created and should'v ### Note on firewalls and opening ports -If you use a firewall, you should open ports 5222 and 5281. The first one is needed for clients to be able to connect to your server. The second is only necessary if you are using the `http_upload` module for file sharing. +If you use a firewall, you should open ports 5222 and 5281. The first one is needed for clients to be able to connect to your server. The second is only necessary if you are using the `http_file_share` module for file sharing, as 5281 is the port for serving content over HTTPS. A complete list of ports used by Prosody can be found [here](https://prosody.im/doc/ports). diff --git a/static/pix/monerod/monerod-step-1.webp b/static/pix/monerod/monerod-step-1.webp Binary files differnew file mode 100644 index 0000000..382a1b8 --- /dev/null +++ b/static/pix/monerod/monerod-step-1.webp diff --git a/static/pix/monerod/monerod-step-2.webp b/static/pix/monerod/monerod-step-2.webp Binary files differnew file mode 100644 index 0000000..48255d6 --- /dev/null +++ b/static/pix/monerod/monerod-step-2.webp diff --git a/static/pix/monerod/monerod-step-3.webp b/static/pix/monerod/monerod-step-3.webp Binary files differnew file mode 100644 index 0000000..77630ec --- /dev/null +++ b/static/pix/monerod/monerod-step-3.webp diff --git a/static/pix/monerod/monerod-step-4.webp b/static/pix/monerod/monerod-step-4.webp Binary files differnew file mode 100644 index 0000000..e0d6759 --- /dev/null +++ b/static/pix/monerod/monerod-step-4.webp diff --git a/static/pix/monerod/monerod-step-5.webp b/static/pix/monerod/monerod-step-5.webp Binary files differnew file mode 100644 index 0000000..f2050a3 --- /dev/null +++ b/static/pix/monerod/monerod-step-5.webp |
