summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2021-07-01 13:42:47 -0400
committerGitHub <noreply@github.com>2021-07-01 13:42:47 -0400
commit40a71d15124cbeb472919e49296fd289bb18acaf (patch)
treefa3a840eb19e547b3bf14d3c5282cc106757fdc3
parent09e8d8df7a96cae0b9b12af236a7f6958e79fe70 (diff)
parentb52ddb17e8f505f70ed98e8a87268b411511b128 (diff)
Merge branch 'master' into master
-rw-r--r--README.md30
-rw-r--r--bitcoin.html4
-rw-r--r--cron.html2
-rw-r--r--dns.html2
-rw-r--r--gemini.html103
-rw-r--r--index.html3
-rw-r--r--rss.xml464
-rw-r--r--sshkeys.html24
-rw-r--r--tor.html49
9 files changed, 647 insertions, 34 deletions
diff --git a/README.md b/README.md
index 31f4c3d..78663d2 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,35 @@ Simple step-by-step text and image-based tutorials for creating websites, email
Suggestions welcome.
-## Submissions
+## Submission guidelines
- follow the general style of pre-existing articles
+- use the root user (i.e. no `sudo`) unless there is a specific need.
+- do not preface commands with `$` or `#` or anything.
- use `.svg` files for icons/logos and for illustrative images, keep filesize low
+- Use `example.org`
+- custom command/file info should be highlighted with `<strong>` tags
+
+### On `<pre>` tags
+
+
+In-line code should be in `<code>` tags, while codeblocks should be in a `<code>` tag *inside* of a `<pre>` tag.
+`<pre>` allows formatting preserving whitespace.
+That said, do *not* format `<pre>` tags as following:
+
+```
+<pre><code>
+ echo "Here is a command."
+ echo "Here is another."
+</code></pre>
+```
+
+but do it like this:
+
+```
+<pre><code>echo "Here is a command."
+echo "Here is another."</code></pre>
+```
+
+**All** whitespace, including tabbing in and initial and final newlines are displayed by `<pre>`.
+To maintain consistency and avoid goofy-looking extra lines, add no extra whitespace.
diff --git a/bitcoin.html b/bitcoin.html
index ce3206b..ec41f23 100644
--- a/bitcoin.html
+++ b/bitcoin.html
@@ -46,10 +46,10 @@
<p>
<strong>These words are your money.</strong>
Once you are shown them, <strong>immediately</strong> write them down on physical paper, and you will be storing this somewhere it will not be lost or found.
- You can memorize these tweleve words if you trust your memory.
+ You can memorize these twelve words if you trust your memory.
</p>
<p>
- These tweleve words unlock all of the funds/addresses you will have on this wallet.
+ These twelve words unlock all of the funds/addresses you will have on this wallet.
Whoever has your seed has the ability to spend your money.
</p>
<p>Note obviously that I have included a picture of a seed phrase above in this tutorial.
diff --git a/cron.html b/cron.html
index 6b12269..3f61f23 100644
--- a/cron.html
+++ b/cron.html
@@ -56,7 +56,7 @@
| | | | .---- day of week (0 - 6)
| | | | |
* * * * *
-30 3 * * 1 apt -y update && apt -y dist-upgrade</code></pre>
+30 3 * * 1 apt -y update && apt -y upgrade</code></pre>
<h3>Some notes</h3>
<ul>
diff --git a/dns.html b/dns.html
index d14ea02..3464eaa 100644
--- a/dns.html
+++ b/dns.html
@@ -115,7 +115,7 @@
<img src="pix/dns-ping.png" alt="Pinging landchad.net">
<p>
- As you can see, our ping to <code>landchad.net</code> is now being directed to <code>104.238.126.105</code>.
+ As you can see, our ping to <code>landchad.net</code> is now being directed to <code>104.238.128.105</code>.
That means we have successfully set up our DNS records!
You can also run the command <code>host</code> if you have it, which will list both IPv4 and IPv6 addresses for a domain name.
</p>
diff --git a/gemini.html b/gemini.html
new file mode 100644
index 0000000..aa6d83e
--- /dev/null
+++ b/gemini.html
@@ -0,0 +1,103 @@
+<!DOCTYPE html>
+<html lang=en>
+ <head>
+ <title>How to set up your own gemini server</title>
+ <meta charset="utf-8"/>
+ <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel='alternate' type='application/rss+xml' title='Land Chad RSS' href='/rss.xml'>
+ </head>
+<body>
+ <header><h1> Creating and serving gemini capsules </h1></header>
+ <nav></nav>
+ <main>
+ <h2 id="whatis">What is Gemini?</h2>
+ <p><a href="https://gemini.circumlunar.space" target="_blank">Gemini</a> is a new internet protocol which is different from the HTTP and Gopher. It's much cleaner and has a growing community and audience of hackers.</p>
+ <h3>Why use gemini protocol?</h3>
+ <ul>
+ <li>Gemini capsules (webpages of gemini) are lightweight, minimal, and don't use many resources to operate.</li>
+ <li>It can run along with your websites. Gemini capsules use port 1965 by default. Your webserver can run at port 80 or 443 along with gemini server at port 1965. </li>
+ <li>By exploring an alternative protocol, you can check different ways to serve data and blogs.</li>
+ </ul>
+ <p>To access any gemini urls i.e. <code>gemini://example.org</code>, you can use any gemini client such as <a href="https://github.com/makeworld-the-better-one/amfora" target="_blank">amfora</a>, <a href="https://gmi.skyjake.fi/lagrange" target="_blank">lagrange</a>, <a href="https://thelambdalab.xyz/elpher/" target="_blank">elpher</a>, etc.
+ <h2 id="instructions">Instructions</h2>
+ <h3>Create a gemini user</h3>
+ <p>
+ It is most secure and clean to have a separate <code>gemini</code> user, so let's create one:
+ </p>
+ <pre><code>useradd -m -s /bin/bash gemini</code></pre>
+ <p>Now log in as <code>gemini</code> with the following command:</p>
+ <pre><code>su -l gemini</code></pre>
+ <p>To create and serve a gemini capsule, we need three basic steps:</p>
+ <ol>
+ <li>Content &ndash; the webpages in our capsule</li>
+ <li>TLS certificate &ndash; Gemini requires encrypted connection.</li>
+ <li>Gemini server &ndash; the program that makes our capsule available (similar to Nginx for HTTP)</li>
+ </ol>
+ <p>As the gemini user, we can create three different directories to simplify the process:</p>
+ <pre><code>mkdir -p ~/gemini/{content,certificate,server}</code></pre>
+ <h3>Content</h3>
+ <p>This will be the directory where you capsule files will be contained. Gemini uses text/gemini markup (in place of HTTP's equivalent HTML). It heavily borrows from Markdown. Similar to .html or .md, gemini uses .gmi as its extension.</p>
+ <p>To create one gemini file, go inside the <code>content</code> directory and create one <code>index.gmi</code> file.</p>
+ <pre><code>nano gemini/content/index.gmi</code></pre>
+ <p>We can add the content we want in our Gemini capsule here:</p>
+ <pre><code># This is Sample Gemini page
+## With header 1 and header 2
+And a short paragraph like this.
+=> /index.gmi Link to the same page</code></pre>
+ <h3>TLS certificate</h3>
+ <p>Go to the <code>certificate</code> directory which we created earlier and generate a TLS certificate using OpenSSL.</p>
+ <pre><code>cd ~/gemini/certificate/
+openssl req -new -subj "/CN=<strong>example.org</strong>" -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -days 3650 -nodes -out cert.pem -keyout key.pem</code></pre>
+ <h3>Gemini server</h3>
+ <h4>Download and prepare the server</h4>
+ <p>There are <a href="https://gemini.circumlunar.space/software">many gemini server software choices available</a>.
+ We will use <code>agate</code> server for now. This is a simple gemini server written in Rust.</p>
+ <p>It's a good idea to always get the most recent version, which you can see <a href="https://github.com/mbrubeck/agate/releases">on the agate releases page</a>. At the time of this writing, that is agate v3.1.0 which we will now download. We will download it to the <code>server</code> directory we made.</p>
+ <pre><code>cd ~/gemini/server
+wget https://github.com/mbrubeck/agate/releases/download/v3.1.0/agate.x86_64-unknown-linux-gnu.gz</code></pre>
+ <p>Unzip the gz, then rename and make it executable:</p>
+ <pre><code>gunzip agate.x86_64-unknown-linux-gnu.gz
+mv agate.x86_64-unknown-linux-gnu agate-server
+chmod +x agate-server</code></pre>
+ <h4>Create a system service</h4>
+ <p>Now we need to create a systemd service to autostart and manage agate.
+ The gemini user does not have permission to do this, so press <code>ctrl-d</code> to log out of the gemini user and return to root.
+ As root, create the file below by opening it in your text editor (nano, vim, etc.):</p>
+ <pre><code>nano /etc/systemd/system/agate.service</code></pre>
+ <p>Add the following content to the file <strong>customizing highlighted text</strong> to your use.</p>
+ <pre><code>[Unit]
+Description=agate
+After=network.target
+
+[Service]
+User=gemini
+Type=simple
+ExecStart=/home/gemini/gemini/server/agate-server --content /home/gemini/gemini/content --certs /home/gemini/gemini/certificate/ --hostname <strong>example.org</strong> --lang <strong>en-US</strong>
+
+[Install]
+WantedBy=default.target</code></pre>
+ <p>Now we are ready to run server. Enable and run agate server.</p>
+ <pre><code>systemctl enable agate
+systemctl start agate</code></pre>
+ <h4>Firewall</h4>
+ <p>Lastly, if you have a firewall running, remember to open port 1965, which is the port number used by gemini:</p>
+ <pre><code>ufw allow 1965</code></pre>
+ <h2>Finalization</h2>
+ <p>Now your server should be running. If everything went okay, you can access your gemini capsule via any gemini client with a url like this:</p>
+ <pre><code>gemini://<strong>example.org</strong></code></pre>
+ <p>Sample gemini site for reference:</p>
+ <pre><code>gemini://gemini.circumlunar.space</code></pre>
+ <p>Enjoy your first gemini capsule.</p>
+ <p>
+ For information about how to write in "gemtext" the markup language in Gemini, see this site: <a href="https://gemini.circumlunar.space/docs/gemtext.gmi">https://gemini.circumlunar.space/docs/gemtext.gmi</a>.
+ As you might guess it also has an analogous gemini capsule here: gemini://gemini.circumlunar.space/docs/gemtext.gmi
+ </p>
+ <hr>
+ <p><em>Written by <a href="https://nihar.page">nihar.page</a></em></p>
+
+ </main>
+ <footer><a href="https://landchad.net">LandChad.net</a></br>Because Everyone should be an Internet LandChad.</br><li><a href="index.html"><img src="pix/chad.gif" alt="chad"></a></li><li><a href="rss.xml"><img src="pix/rss.svg" alt="RSS"></a></li><li><a href="pix/btc.png"><img src="pix/btc.svg" alt="BTC"></a></li><li><a href="pix/xmr.png"><img src="pix/xmr.svg" alt="XMR"></a></li><li><a href="https://github.com/lukesmithxyz/landchad"><img src="pix/git.svg" alt="Github"></a></footer>
+</body>
+</html>
diff --git a/index.html b/index.html
index 80b9557..b775553 100644
--- a/index.html
+++ b/index.html
@@ -52,7 +52,8 @@
<li><a href="cron.html">Schedule tasks with Crontabs/Cronjobs.</a></li>
<li><a href="tor.html">Mirror your site on <img src="pix/tor.svg">Tor.</a></li>
<li><a href="auth.html">Password-protecting Webpages (HTTP Authentication)</a></li>
- <li><a href="ufw.html">Using ufw as a firewall.</a></li>
+ <li><a href="ufw.html">Using ufw as a firewall.</a></li>
+ <li><a href="gemini.html">Create a Gemini Capsule.</a></li>
</ul>
<h3 id=platform>"Build your own platform!"</h3>
diff --git a/rss.xml b/rss.xml
index b37b9e3..50dda18 100644
--- a/rss.xml
+++ b/rss.xml
@@ -13,6 +13,470 @@
<link>https://landchad.net/rss.xml</link>
</image>
+<!-- LB -->
+
+<item>
+<title>Hosting Your Own Git Repositories &ndash; LandChad.net</title>
+<guid>https://landchad.net/git.html</guid>
+<link>https://landchad.net/git.html</link>
+<pubDate>Thu, 01 Jul 2021 07:19:51 -0400</pubDate>
+<description><![CDATA[
+ <header><h1>Hosting Your Own Git Repositories</h1></header>
+
+ <main>
+ <img class=titleimg src="pix/git.svg">
+ <p>
+ Once you have your own VPS or other Internet-available server, you can
+ start hosting your own git repositories. The goal of this tutorial is
+ for you to go from</p>
+ <pre><code>git clone github.com/...</code></pre>
+ <p>to</p>
+ <pre><code>git clone YourLandChadDomainName.xyz/...</code></pre>
+ <p>
+ so you can cultivate your own homegrown, grass-fed code, rather than
+ relying on a centralized proprietary service like GitHub.
+ </p>
+ <h2>Installing git</h2>
+ <p>
+ You most likely already have it installed on your server, but if not,
+ run:</p>
+ <pre><code>apt install git</code></pre>
+ <p>
+ We don't need any additional software, <code>git</code> itself ships
+ with everything needed to host a remote repository!
+ </p>
+ <h2>Creating bare repositories</h2>
+ <p>
+ For each repository you want to host, you will need to manually create
+ what's called a "bare" repository on your server. These hold all the
+ commits and any other git data needed for your repository, but without
+ an expanded "index" in which you can just browse all the files of a
+ certain commit in the file system.
+ </p>
+ <p>
+ These repositories need to be owned by the <code>git</code> user, and
+ you should probably pick a directory where you will store them all. One
+ sane choice is under <code>/srv/git/</code>, and we will use this as the
+ example directory for the rest of the tutorial, but any other path will
+ do as well.
+ </p>
+ <h3>Become the git user and create the directory</h3>
+ <p>
+ If you're logged in to your server as root and have <code>git</code>
+ installed, you can become the <code>git</code> user by executing
+ </p>
+ <pre><code>su git</code></pre>
+ <p>
+ Now navigate to/create your desired directory, for example
+ </p>
+ <pre><code>cd /srv
+mkdir git</code></pre>
+ <h3>Create the repo</h3>
+ <p>
+ Now you can create the bare repository with
+ </p>
+ <pre><code>git init --bare my-repo.git</code></pre>
+ <p>
+ By convention, bare repository names end with ".git".
+ </p>
+ <p>
+ Repeat the above command for any other repositories you want to host.
+ </p>
+ <h2>Syncing local repositories with your server</h2>
+ <h3>Set up SSH login for the git user</h3>
+ <p>
+ You will need to be able to login remotely via <code>ssh</code> as the
+ <code>git</code> user we've used before. To do this, you will either
+ need to set up a password for the <code>git</code> user by running
+ <code>passwd git</code>,
+ or copy your public SSH key from your local machine to
+ <code>/home/git/.ssh/authorized_keys</code>.
+ See the <a href="sshkeys.html">SSH keys instructional</a> for details
+ (just log in as <code>git</code> instead of <code>root</code>).
+ </p>
+ <h3>Syncing a new repository with your server</h3>
+ <p>
+ If you've just created a new repository on your local machine, you will
+ need to tell <code>git</code> where the remote repository is to be able
+ to sync with it (using commands like <code>git push</code> or
+ <code>git pull</code>). We do this by defining a "remote" for your
+ repository.
+ </p>
+ <p>
+ A remote is just a named URL remembered in your repo's configuration. So
+ we need a name and a URL. By convention, the "main" remote is called
+ "origin". The URL has the format <code>user@host:path</code>, where:
+ </p>
+ <ul>
+ <li>
+ <code>user</code> is <code>git</code>, the <code>git</code> user
+ we've already worked with before.
+ </li>
+ <li>
+ <code>host</code> is your domain name.
+ Alternatively you could even use your server's raw IP address.
+ </li>
+ <li>
+ <code>path</code> is the absolute path to the repository on the
+ server, in our example <code>/srv/git/my-repo.git</code>
+ </li>
+ </ul>
+ </p>
+ <p>
+ So, to create a new remote, run:
+ </p>
+ <pre><code>git remote add origin git@yourdomain.xyz:/srv/git/my-repo.git</code></pre>
+ <p>
+ Now you'll be able to run <code>git push origin master</code> to push
+ your commits or <code>git pull origin</code> to pull from the remote.
+ </p>
+ <h3>Syncing an existing repository</h3>
+ <p>
+ If you've already set up your local repository to sync with a service
+ like GitHub it probably already has a remote called "origin". You can
+ see your repo's remotes with:
+ </p>
+ <pre><code>git remote -v</code></pre>
+ <p>
+ You can follow the above instructions, substituting an arbitrary other
+ name other than "origin" to create a differently named remote, e.g.
+ </p>
+ <pre><code>git remote add vps git@...</code></pre>
+ <p>
+ Now you'll be able to push/pull with <code>git push vps master</code>
+ and <code>git pull vps</code>, respectively.
+ </p>
+ <p>
+ Or, to completely sever ties with your centralized git provider, first
+ remove the original origin with:
+ <code>git remote remove origin</code>
+ and then follow the instructions as above.
+ </p>
+ <h2>Contribution</h2>
+ <ul>
+ <li>Martin Chrzanowski -- <a
+ href="https://m-chrzan.xyz">website</a>, <a href="https://m-chrzan.xyz/crypto.html">donate</a></li>
+ </ul>
+ </main>
+
+]]></description>
+</item>
+
+
+<item>
+<title>Requiring Passwords for Webpages (HTTP Authentication) &ndash; LandChad.net</title>
+<guid>https://landchad.net/auth.html</guid>
+<link>https://landchad.net/auth.html</link>
+<pubDate>Thu, 01 Jul 2021 07:19:27 -0400</pubDate>
+<description><![CDATA[
+ <header><h1>Requiring Passwords for Webpages</h1></header>
+
+ <main>
+ <img class=titleimg src="pix/auth.svg" alt="access control with nginx"/>
+ <p>HTTP basic authentication will allow you to secure parts (or all) of your website with a username and password without the trouble of PHP or Javascript.
+ This will work with any Nginx server.
+ </p>
+ <h2>Installation</h2>
+ <p>We will be using the command <code>htpasswd</code> to make username and password pairs.</p>
+ <pre><code>apt install apache2-utils</code></pre>
+ <aside>
+ <p>The apache utils has a small username-password pair encryption tool.</p>
+ <p>Like the other on this site, this tutorial is for Nginx, <strong>not</strong> for Apache servers.</p>
+ </aside>
+ <p>
+ Now think of a username and password and remember them.
+ </p>
+ <pre><code>htpasswd -c /etc/nginx/<strong>myusers</strong> <strong>username</strong></code></pre>
+ <aside>
+ <p>The <code>-c</code> flag creates a file. You can make the path of this file anywhere outside of your webroot.</p>
+ <p>Obviously the username is up to you as well.</p>
+ </aside>
+ <p>
+ Type out your password twice to confirm. You can do this as many times as you'd like.
+ </p>
+ <p>Check out user name password pairs (the password will be securely hashed):</p>
+ <pre><code>cat /etc/nginx/<strong>myusers</strong></code></pre>
+ <h2>Nginx Config and Auth Basic</h2>
+ <p>
+ From here, we are going to edit our websites config file in <code>/etc/nginx/sites-enabled</code>.
+ Have in mind which folder you'd like to secure. Add something like this:
+ </p>
+ <pre><code>server {
+ #...
+ location /<strong>secret-folder </strong> {
+ auth_basic "What's the Password?" ;
+ auth_basic_user_file /etc/nginx/<strong>myusers</strong> ;
+ }
+ #...
+}</code></pre>
+ <aside>
+ <h4>Huh?</h4>
+ <p>If you're stuck, try finding the line <code>location / {</code></p>
+ <p>Just below this block is where you should add the custom location block</p>
+ </aside>
+ <p>If you'd like to do the opposite, such as making the entire site private except for a public section, do this:</p>
+ <pre><code>server {
+ #...
+ auth_basic "What's the Password?" ;
+ auth_basic_user_file /etc/nginx/<strong>myusers</strong> ;
+ location /<strong>public</strong>/ {
+ #...
+ auth_basic off ;
+ }
+ #...
+}</code></pre>
+ <h3>IP Addresses</h3>
+ <p>If passwords aren't enough we can ban an ip or accept one.</p>
+ <pre><code>location /api {
+ #...
+ allow 192.168.1.23:8080 ;
+ deny 127.0.0.1 ;
+}</code></pre>
+ <p>If you want to check both a username and password with an ip address, use the <code>satisfy</code> directive.</p>
+ <pre><code>location /api {
+ #...
+ satify all ;
+ allow 192.168.1.23:8080 ;
+ deny 127.0.0.1 ;
+ auth_basic "What's the Password?" ;
+ auth_basic_user_file /etc/nginx/<strong>myusers</strong> ;
+}</code></pre>
+ <h3>Complete Example</h3>
+ <pre><code>http {
+ server {
+ listen 80;
+ root /var/www/website ;
+ #...
+ location /<strong>secret-folder</strong> {
+ satisfy all ;
+ allow 192.168.1.3/24;
+ deny 127.0.0.1 ;
+ auth_basic "What's the Password?" ;
+ auth_basic_user_file /etc/nginx/<strong>myusers</strong> ;
+ }
+ }
+}</code></pre>
+ <p>
+ Now check your configuration with <code>nginx -t</code>
+ </p>
+ <p>Reload nginx and you're good to go!</p>
+ <strong>Contributor</strong> - <a href="https://tomfasano.xyz" target="_blank">tomfasano.xyz</a>
+ </main>
+
+]]></description>
+</item>
+
+
+<item>
+<title>Cronjobs &ndash; LandChad.net</title>
+<guid>https://landchad.net/cron.html</guid>
+<link>https://landchad.net/cron.html</link>
+<pubDate>Thu, 01 Jul 2021 07:19:04 -0400</pubDate>
+<description><![CDATA[
+ <header><h1>Using Cronjobs to run scheduled tasks</h1></header>
+
+ <main>
+ <p>
+ Cron is a service that lets you run scheduled tasks. These tasks are called <strong> cronjobs. </strong> If you have already followed the initial course you will have already used cron when you set up certbot.
+ </p>
+ <h2> What tasks would I want to schedule? </h2>
+ <p>
+ You can schedule anything! Some examples of what you might have done already include:
+ <ul>
+ <li> <code> updatedb </code> to update your <code> locate </code> database </li>
+ <li> <code> certbot </code> to update renewing of your https certs </li>
+ </ul>
+ Some tasks that you might <em>want</em> to schedule may include:
+ <ul>
+ <li> Package updates - if you really just want to leave your server alone you can automated updating packages on your server </li>
+ <li> Backups - you may want to backup certain files every day and some every week, this is possible with cron </li>
+ </ul>
+ <p>
+ And many more, anything you can do can be turned into a cronjob.
+ </p>
+ <h2>Basic Cronjobs</h2>
+ <p>
+ This the preferred method for personal tasks and scripts, it's also the easiest to get started with. Run the command <code> crontab -e </code> to access your users crontab
+ </p>
+ <p>
+ Once you have figured out the command you want to run you need to figure out how often you want to run it and when. I am going to schedule my system updates once a week on at 3:30 AM on a Monday.
+ </p>
+ <p>
+ We now have to convert this time (Every Monday at 3:30 AM) into a cron time. Cron uses a simple but effective way of scheduling when to run things.
+ </p>
+ <p>
+ Crontab expressions look like this <code> * * * * * command-to-run </code>
+ The five elements before the command tell when the command is supposed to be run automatically.
+ <p>
+ So for our Monday at 3:30AM job we would do the following:
+ <p>
+ <pre><code> .---------------- minute (0 - 59)
+ | .------------- hour (0 - 23)
+ | | .---------- day of month (1 - 31)
+ | | | .------- month (1 - 12
+ | | | | .---- day of week (0 - 6)
+ | | | | |
+ * * * * *
+30 3 * * 1 apt -y update && apt -y upgrade</code></pre>
+ <h3>Some notes</h3>
+ <ul>
+ <li>On the day of the week option, Sunday is 0 and counting up from there, Saturday will be 6.</li>
+ <li><code>*</code> designates "everything". Our command above has a <code>*</code> in the day of month and month columns. This means it will run regardless of the day of the month or month.</li>
+ <li>The hour option uses 24 hour time. 3 = 3AM, while use 15 for 3PM.</li>
+ </ul>
+ <h3>More examples</h3>
+ <p>
+ Let's add another job, our backup job (for the purposes of this our backup command is just called <code> backup</code>) We want to run <code> backup </code> Every evening at 11PM, once we work out the timings for this we can add the to the same file as the above by running <code> crontab -e </code> This would mean our full crontab would look like this:
+ <pre><code>0 23 * * * backup</code></pre>
+ <h3>Consecutive times</h3>
+ <p>
+ Suppose we want a command to run every weekday.
+ We know we can put <code>1</code> (Monday), but we can also use <code>1-5</code>
+ to signify from day 1 (Monday) to day 5 (Friday).
+ </p>
+ <pre><code>0 6 * * 1-5 echo "Wakey, wakey, wagie!" >> /home/wagie/alarm</code></pre>
+ <p>The above <code>echo</code> command runs every Monday through Friday at 6:00AM.</p>
+ <h3>Non-consecutive times</h3>
+ <p>
+ We can also randomly specify non-consecutive arguments with a comma.
+ Suppose you have a script you want to run at the midday of the 1st, 15th, and 20th day of every month.
+ You can specify that my putting <code>1,15,20</code> for the day of the month argument:
+ </p>
+ <pre><code>0 12 1,15,20 * * /usr/bin/pay_bills_script</code></pre>
+ <h3>"Every X minutes/days/months"</h3>
+ <p>We can also easily run a command very several minutes or months, without specifying the specific times:
+ </p>
+ <pre><code>*/15 * * * * updatedb</code></pre>
+ <p>
+ This cronjob will run the <code>updatedb</code> command every 15 minutes.
+ </p>
+ <h3>Beware of this Rookie Mistake Though...</h3>
+ <p>
+ Suppose you want to run a script once every other month.
+ You might be <em>tempted</em> write this:
+ </p>
+ <pre><code>* * * */2 *</code></pre>
+ <p>
+ That might <em>feel right</em>, but this script <em>will be running once every minute during that every other month</em>.
+ You should specify the first two arguments, because with <code>*</code> it will be running every minute and hour!
+ </p>
+ <pre><code>0 0 1 */2 *</code></pre>
+ <p>This makes the command run <em>only</em> at 0:00 (12:00AM) on the first day of every two months, which is what we really want.</p>
+ <p>
+ Consult the website <a href="https://crontab.guru">crontab.guru</a> for an intuitive and interactive tester of cronjobs.
+ </p>
+ <h2>User vs. Root Cronjobs</h2>
+ <p>
+ It is important to note that user accounts all have different cronjobs.
+ If you have a user account <code>chad</code> and edit his crontab with <code>crontab -e</code>,
+ the commands you add will be run as the <code>chad</code> user, not <code>root</code> or anyone else.
+ </p>
+ <p>
+ Bear in mind that if you need root access to run a particular command,
+ you will usually want to add it as root.
+ </p>
+ <h2>System-wide cron directories</h2>
+ <p>
+ <code>crontab -e</code> is the typical interface for adding cronjobs, but it's important to at least know that system-wide jobs are often stored in the file directory.
+ Some programs which need cronjobs will automatically install them in the following way.
+ </p>
+ <p>
+ Run the command <code> ls /etc/cron* </code> you should see a list of directories and there contents. The directories should be something like the below
+ <ul>
+ <li> /etc/cron.d <em> This is a crontab like the ones that you create with </em> <code> crontab -e </code> </li>
+ <li> /etc/cron.hourly </li>
+ <li> /etc/cron.daily </li>
+ <li> /etc/cron.weekly </li>
+ <li> /etc/cron.monthly </li>
+ </ul>
+ <p>
+ The directories cron.{hourly,daily,weekly,monthly} are where you can put <strong> scripts </strong> to run at those times. You don't put normal cron entries here. I prefer to use these directories for system wide jobs that don't relate to an individual user.
+ </p>
+ <h2>Contribution</h2>
+ <ul>
+ <li>Mark McNally -- <a href="https://mark.mcnally.je">website</a>, <a href="https://www.youtube.com/channel/UCMiInY8BhSUtCarO6uu6i_g">Youtube</a></li>
+ <li>Edits and examples by Luke</li>
+ </ul>
+ </main>
+
+]]></description>
+</item>
+
+
+<item>
+<title>Mirror your site over tor</title>
+<guid>https://landchad.net/tor.html</guid>
+<link>https://landchad.net/tor.html</link>
+<pubDate>Thu, 01 Jul 2021 07:15:39 -0400</pubDate>
+<description><![CDATA[
+ <header><h1>Mirror Your Site Over Tor</h1></header>
+
+ <main>
+ <img class=titleimg src="pix/tor.svg" alt="Tor logo">
+ <p>
+ Now that you have a website, why not offer it on a private alternative such as the onion network?
+ </p>
+ <h2>Setting up Tor</h2>
+ <h3>Installing Tor</h3>
+ <p>Firstly we need to add the tor repo's to have the latest up to date version or tor.</p>
+ <pre><code>apt install -y apt-transport-https gpg
+echo "deb https://deb.torproject.org/torproject.org buster main
+deb-src https://deb.torproject.org/torproject.org buster main" > /etc/apt/sources.list.d/tor.list</code></pre>
+ <p>Then we need to add the gpg keys to our keyring</p>
+ <pre><code>curl -s https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --import
+gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -</code></pre>
+ <p>Now update and install tor</p>
+ <pre><code>apt update
+apt install tor deb.torproject.org-keyring</code></pre>
+ <h3>Enabling Tor</h3>
+ <p>Then edit the file <code>/etc/tor/torrc</code>, uncommenting the following lines:</p>
+ <pre><code>HiddenServiceDir /var/lib/tor/hidden_service/
+HiddenServicePort 80 127.0.0.1:80</code></pre>
+ <aside>
+ <h4>Optional: Running multiple onion services</h4>
+ <p>If you want to forward multiple virtual ports for a single onion
+ service, just add more HiddenServicePort lines (replace the 80 with any unoccupied port).
+ </p>
+ <p>If you want to run multiple onion services from the same Tor client, just add another
+ HiddenServiceDir line.</p>
+ </aside>
+ <p>Now start and enable tor at boot</p>
+ <pre><code> systemctl enable --now tor </code></pre>
+ <p>If the next command outputs <q>active</q> in green you're golden!</p>
+ <pre><code> systemctl status tor</code></pre>
+ <p>Now you're server is on the dark web. The following command will give you your onion address:</p>
+ <pre><code> cat /var/lib/tor/hidden_service/hostname</code></pre>
+ <h2>Adding the Nginx Config</h2>
+ <p>
+ 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
+ <a href="nginx.html">tutorial</a> up until the server block of code. Instead, paste this:
+ </p>
+ <pre><code> server {
+ listen 127.0.0.1:80 ;
+ root /var/www/<strong>landchad</strong> ;
+ index index.html ;
+ server_name <strong>your-onion-address</strong>.onion ;
+ }</code></pre>
+ <aside>
+ <h4>Clarification</h4>
+ <p>Nginx will listen on port 80 for your <em>server's</em> localhost.</p>
+ <p>The <code>root</code> line is the path to whichever website of yours you'd like to mirror.</p>
+ </aside>
+ <p>
+ From here we are almost done, all we have to do is enable the site and reload nginx which is also covered in <a href="nginx.html#enable">the webserver tutorial</a>.
+ </p>
+ <h3>Update regularly!</h3>
+ <p>Make sure to update Tor on a regular basis by running:</p>
+ <pre><code>apt update
+apt install tor</code></pre>
+ <p><strong>Contributor</strong> - <a href="https://tomfasano.xyz" target="_blank">tomfasano.xyz</a></p>
+ </main>
+
+]]></description>
+</item>
+
+
<item>
<title>Cryptocurrency Tutorials Completed</title>
<guid>https://landchad.net/index.html#crypto</guid>
diff --git a/sshkeys.html b/sshkeys.html
index 53382ee..24154ba 100644
--- a/sshkeys.html
+++ b/sshkeys.html
@@ -18,15 +18,15 @@
This allows us to do two main things:
</p>
<ol>
- <li><strong>Password-less login</strong>: With SSH keys, we can permanently designate our profile on our local computer as safe for hour server, allowing us to bypass password verification when logging into our server.</li>
+ <li><strong>Password-less login</strong>: With SSH keys, we can permanently designate our profile on our local computer as safe for our server, allowing us to bypass password verification when logging into our server.</li>
<li><strong>Prevent hacking</strong>: Since we no longer need a password to log in, we can simply deactivate password logins on our server altogether, which prevents hacking from people who may be so lucky as to guess our password!</li>
</ol>
<p>
- In order words, using an SSH key to login is <strong>both safer, faster and easier</strong>.
+ In other words, using an SSH key to login is <strong>both safer, faster and easier</strong>.
</p>
<p>
- This is especially better once you start making scripts on your computer that interact with your server.
+ This is especially useful once you start making scripts on your computer that interact with your server.
You can upload files in the background, edit your spam filters or anything else from your local computer without having to input
your password each time you touch the server.
</p>
@@ -58,15 +58,15 @@
<h2>Making your server trust your key.</h2>
<p>
- Now that you have an SSH key generate, just run the following:
+ Now that you have generated an SSH key, just run the following:
</p>
<pre><code>ssh-copy-id root@yourdomain.com</code></pre>
<p>
- That will ask for your server's root password and will log you in briefly.
+ The command will ask for your server's root password and log you in briefly.
What this does is that it puts your public SSH key fingerprint on your server in a file <code>/root/.ssh/authorized_keys</code>.
- What this does is that it allows approved SSH keys to login without passwords.
+ This file in turn allows approved SSH keys to log in without passwords.
</p>
<aside>
@@ -83,7 +83,7 @@
<pre><code>ssh root@yourdomain.com</code></pre>
<p>
- It should now let your log in without a password prompt!
+ It should now let you log in without a password prompt!
</p>
<aside class=callout>
<p>
@@ -107,7 +107,7 @@
<p>
Once we have authorized ssh keys for all the devices we need, we can actually just disable password logins.
If you've ever looked at your system logs (<code>journalctl -xe</code>) you will find that there are always hundreds of random Chinese computers trying to brute force every server connected to the internet with random passwords.
- They usually always are unsuccessful, but let's make it <strong>impossible</strong> for them.
+ They are usually unsuccessful, but let's make it <strong>impossible</strong> for them.
</p>
<p>
@@ -124,7 +124,7 @@ ChallengeResponseAuthentication <strong>no</strong>
UsePAM <strong>no</strong></code></pre>
<p>
- Once we've done that, we will reload hour SSH daemon:
+ Once we've done that, we will reload our SSH daemon:
</p>
<pre><code>systemctl reload sshd</code></pre>
@@ -142,11 +142,11 @@ UsePAM <strong>no</strong></code></pre>
<h2>What if I lose my SSH key?!</h2>
<p>
- Firstly, don't do this. Make every precaution that you have a backup.
+ Firstly, don't do this. Take every precaution that you have a backup.
</p>
<p>
- If this does happens, Vultr and most other VPS providers will have one little out.
+ If this does happen, Vultr and most other VPS providers will have a way out.
Log onto their website and select the server you want to log into.
</p>
@@ -163,7 +163,7 @@ UsePAM <strong>no</strong></code></pre>
</p>
<p>
- From here, simply reverse the settings we set above and you can login via SSH with a password and you can reapprove a newly created SSH key or whatever you want to do.
+ From here, simply reverse the settings we set above and you can log in via SSH with a password and reapprove a newly created SSH key or whatever you want to do.
</p>
</main>
diff --git a/tor.html b/tor.html
index 0d54b5f..eb7bad9 100644
--- a/tor.html
+++ b/tor.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang=en>
<head>
- <title>Mirror your site over tor</title>
+ <title>Mirror your site over Tor</title>
<meta charset="utf-8"/>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel='stylesheet' type='text/css' href='style.css'>
@@ -17,21 +17,31 @@
<p>
Now that you have a website, why not offer it on a private alternative such as the onion network?
</p>
- <aside>
- <a href="https://landchad.net" >LandChad.net</a> does not condone
- any illegal activities or websites on the dark web nor the usage of
- this tutorial to launch such sites.
- </aside>
<h2>Setting up Tor</h2>
- <p>First, install tor. On Debian it's as simple as:</p>
+ <h3>Installing Tor</h3>
+
+ <p>Firstly we need to add the Tor repos to our system to get the latest version of Tor:</p>
+ <pre><code>apt install -y apt-transport-https gpg
+echo "deb https://deb.torproject.org/torproject.org buster main
+deb-src https://deb.torproject.org/torproject.org buster main" > /etc/apt/sources.list.d/tor.list</code></pre>
+
+ <p>Then we need to add the gpg keys to our keyring:</p>
+
+ <pre><code>curl -s https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --import
+gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -</code></pre>
- <pre><code> apt install tor</code></pre>
+ <p>Now update and install Tor:</p>
- <p>Then edit the file <code>/etc/tor/torrc</code>, uncommenting the following lines:</p>
- <pre><code> HiddenServiceDir /var/lib/tor/hidden_service/
- HiddenServicePort 80 127.0.0.1:80</code></pre>
+ <pre><code>apt update
+apt install tor deb.torproject.org-keyring</code></pre>
+
+ <h3>Enabling Tor</h3>
+
+ <p>Next edit the file <code>/etc/tor/torrc</code>, uncommenting the following lines:</p>
+ <pre><code>HiddenServiceDir /var/lib/tor/hidden_service/
+HiddenServicePort 80 127.0.0.1:80</code></pre>
<aside>
<h4>Optional: Running multiple onion services</h4>
<p>If you want to forward multiple virtual ports for a single onion
@@ -41,19 +51,19 @@
HiddenServiceDir line.</p>
</aside>
- <p>Now start and enable tor at boot</p>
+ <p>Now start and enable Tor at boot:</p>
<pre><code> systemctl enable --now tor </code></pre>
<p>If the next command outputs <q>active</q> in green you're golden!</p>
<pre><code> systemctl status tor</code></pre>
- <p>Now you're server is on the dark web. The following command will give you your onion address:</p>
+ <p>Now your server is on the dark web. The following command will give you your onion address:</p>
<pre><code> cat /var/lib/tor/hidden_service/hostname</code></pre>
<h2>Adding the Nginx Config</h2>
<p>
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
+ Follow the steps as if you were making a new website in the webserver
<a href="nginx.html">tutorial</a> up until the server block of code. Instead, paste this:
</p>
@@ -70,9 +80,16 @@
<p>The <code>root</code> line is the path to whichever website of yours you'd like to mirror.</p>
</aside>
<p>
- From here we are almost done, all we have to do is enable the site and reload nginx which is also covered in <a href="nginx.html#enable">the webserver tutorial</a>.
+ Now we are almost done, all we have to do is enable the site and reload nginx which, is also covered in <a href="nginx.html#enable">the webserver tutorial</a>.
</p>
- <strong>Contributor</strong> - <a href="https://tomfasano.xyz" target="_blank">tomfasano.xyz</a>
+
+ <h3>Update regularly!</h3>
+
+ <p>Make sure to update Tor on a regular basis by running:</p>
+ <pre><code>apt update
+apt install tor</code></pre>
+
+ <p><strong>Contributor</strong> - <a href="https://tomfasano.xyz" target="_blank">tomfasano.xyz</a></p>
</main>
<footer><a href="https://landchad.net">LandChad.net</a></br>Because Everyone should be an Internet LandChad.</br><li><a href="index.html"><img src="pix/chad.gif" alt="chad"></a></li><li><a href="rss.xml"><img src="pix/rss.svg" alt="RSS"></a></li><li><a href="pix/btc.png"><img src="pix/btc.svg" alt="BTC"></a></li><li><a href="pix/xmr.png"><img src="pix/xmr.svg" alt="XMR"></a></li><li><a href="https://github.com/lukesmithxyz/landchad"><img src="pix/git.svg" alt="Github"></a></footer>