mirror cantonese + two more articles
authorRob <robin@robinkrens.nl>
Sat, 16 Mar 2019 18:09:19 +0000 (02:09 +0800)
committerRob <robin@robinkrens.nl>
Sat, 16 Mar 2019 18:09:19 +0000 (02:09 +0800)
docs/backups.html [new file with mode: 0644]
docs/backups.txt [new file with mode: 0644]
docs/tunneling.html
docs/tunneling.txt
docs/wireguard.html [new file with mode: 0644]
docs/wireguard.txt [new file with mode: 0644]
index.html

diff --git a/docs/backups.html b/docs/backups.html
new file mode 100644 (file)
index 0000000..6a40510
--- /dev/null
@@ -0,0 +1,90 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title></title>
+<meta name="generator" content="HTML::TextToHTML v2.51"/>
+<link rel="stylesheet" type="text/css" href="../files/style.css"/>
+</head>
+<body>
+<h1><a name="section_1">Simple Backups</a></h1>
+
+<p>Don't forget to make backups folks! I strongly argue against cloud backup services, because most of the time you have no clue <u>how</u> and <u>where</u> data is being backed up. Besides that, it's really not that hard to do it yourself. If you are not running a server with &gt;1000 people, you would probably just do fine backing up your home directory. 
+</p>
+<h2><a name="section_1_1">How to backup?</a></h2>
+
+<p>A simple backup archive of your home directory: 
+</p>
+<pre>
+        $
+        $ tar --create  --file BACKUP.tar /home/rob
+</pre>
+<p>This creates a so-called <em>tarball</em> of your folder. Data from your home directory is written to BACKUP.tar. If you are not that familiar with linux, this is similar to the famous Windows zip file, but without compression. You might have encountered the <u>tar.gz</u> a few times. This is just like a tarball but compressed. We can add the option --auto-compress to compress. Tar automatically recognizes the extension of the file your are writing the backup to and compresses it accordingly. The first line creates a tar.gz file, the second one writes to a zip file.
+</p>
+<pre>
+        $ tar --create --auto-compress --file BACKUP.tar.gz /home/rob
+        $ tar --create --auto-compress --file BACKUP.zip /home/rob
+</pre>
+<h2><a name="section_1_2">Where to backup?</a></h2>
+<p>Good question. Some options:
+</p>
+<ul>
+  <li>to another folder: if you screw up editing some files in your current working directory
+  </li><li>to another partition: if you screw up your filesystem on your current partition 
+  </li><li>to another drive: if your current drives gets toasted, i.e. mechanical failure. 
+  </li><li>to another computer: if you accidentily burn your house down
+  </li><li>to many other computers, aka the cloud: if you want to make sure your data is backed up, but besides that also saved forever and being spread amongst many places around the world, vulnerable for whatever law is set by those countries.
+</li></ul>
+<p>Option a is similar as the command described above. Just make sure your backup is not in the same folder.
+</p>
+<p>Option b, c are similar to each other. You can also use the option --directory to write the backup file to another partition or (external) hard drive. The following command writes a compressed tarball of my home directory to my external harddrive mounted out /media/externaldrive:
+</p>
+<pre>
+        $ tar --create --auto-compress \
+        --file /media/externalharddrive/BACKUP.tar.gz /home/rob
+</pre>
+<p>Option d. In this case we just simple copy the file (secure ssh copy) to another computer.
+        
+</p><pre>
+        $ tar --create --auto-compress --file BACKUP.tar.gz /home/rob
+        $ scp BACKUP.tar.gz rob@1.2.3.4:/var/backups/
+</pre>
+        
+
+<h2><a name="section_1_3">When to backup?</a></h2>
+<p>Another good question. 
+</p>
+<ul>
+  <li>never
+  </li><li>rarely (or manually)
+  </li><li>scheduled, cronjobs
+  </li><li>on change, inotify
+  </li><li>always
+</li></ul>
+<p>Option b is just manually typing in backup commands a few times a week.
+For option c you can write a simple shell script (i.e. backup.sh) and put it in <u>/etc/cron.daily</u>. For example, the following script would write a daily backup (format like: BACKUP-2019-03-04.tar.gz) to a backup directory
+        
+</p><pre>
+        #!/bin/bash
+        # write full backups to external drive 
+        BACKUP_OF_DIR=/home/rob
+        WRITE_TO_DIR=/media/external
+        DATE=$(date -I)
+
+        # if directory exist, create an archive
+        if [-d $WRITE_TO_DIR ]; then
+                tar --create --auto-compress --file $WRITE_TO_DIR/BACKUP-$DATE.tar.gz 
+        fi
+
+        # remove made backups older than 90 days
+        # TODO
+</pre>
+<p>Option d: TODO
+        
+</p><p>So, option e would be some kind of trojan horse on your computer or device, continuously scanning folders, eating resources and uploading to the cloud.
+</p>
+<h2><a name="section_1_4">Final words</a></h2>
+<p>This article can be viewed as the basics of basics. Of course, there are many other ways to do backups. There are also a few security and performance issues involved. Nonetheless, when and where to backup are equal or even more important.</p>
+
+</body>
+</html>
diff --git a/docs/backups.txt b/docs/backups.txt
new file mode 100644 (file)
index 0000000..74882da
--- /dev/null
@@ -0,0 +1,76 @@
+Simple Backups
+********
+
+Don't forget to make backups folks! I strongly argue against cloud backup services, because most of the time you have no clue _how_ and _where_ data is being backed up. Besides that, it's really not that hard to do it yourself. If you are not running a server with >1000 people, you would probably just do fine backing up your home directory. 
+
+How to backup?
+============
+
+A simple backup archive of your home directory: 
+
+       $
+       $ tar --create  --file BACKUP.tar /home/rob
+
+This creates a so-called *tarball* of your folder. Data from your home directory is written to BACKUP.tar. If you are not that familiar with linux, this is similar to the famous Windows zip file, but without compression. You might have encountered the _tar.gz_ a few times. This is just like a tarball but compressed. We can add the option --auto-compress to compress. Tar automatically recognizes the extension of the file your are writing the backup to and compresses it accordingly. The first line creates a tar.gz file, the second one writes to a zip file.
+
+       $ tar --create --auto-compress --file BACKUP.tar.gz /home/rob
+       $ tar --create --auto-compress --file BACKUP.zip /home/rob
+
+Where to backup?
+===========
+Good question. Some options:
+
+       * to another folder: if you screw up editing some files in your current working directory
+       * to another partition: if you screw up your filesystem on your current partition 
+       * to another drive: if your current drives gets toasted, i.e. mechanical failure. 
+       * to another computer: if you accidentily burn your house down
+       * to many other computers, aka the cloud: if you want to make sure your data is backed up, but besides that also saved forever and being spread amongst many places around the world, vulnerable for whatever law is set by those countries.
+
+Option a is similar as the command described above. Just make sure your backup is not in the same folder.
+
+Option b, c are similar to each other. You can also use the option --directory to write the backup file to another partition or (external) hard drive. The following command writes a compressed tarball of my home directory to my external harddrive mounted out /media/externaldrive:
+
+       $ tar --create --auto-compress \
+       --file /media/externalharddrive/BACKUP.tar.gz /home/rob
+
+Option d. In this case we just simple copy the file (secure ssh copy) to another computer.
+       
+       $ tar --create --auto-compress --file BACKUP.tar.gz /home/rob
+       $ scp BACKUP.tar.gz rob@1.2.3.4:/var/backups/
+       
+
+When to backup?
+============
+Another good question. 
+
+       * never
+       * rarely (or manually)
+       * scheduled, cronjobs
+       * on change, inotify
+       * always
+
+Option b is just manually typing in backup commands a few times a week.
+For option c you can write a simple shell script (i.e. backup.sh) and put it in _/etc/cron.daily_. For example, the following script would write a daily backup (format like: BACKUP-2019-03-04.tar.gz) to a backup directory
+       
+       #!/bin/bash
+       # write full backups to external drive 
+       BACKUP_OF_DIR=/home/rob
+       WRITE_TO_DIR=/media/external
+       DATE=$(date -I)
+
+       # if directory exist, create an archive
+       if [-d $WRITE_TO_DIR ]; then
+               tar --create --auto-compress --file $WRITE_TO_DIR/BACKUP-$DATE.tar.gz 
+       fi
+
+       # remove made backups older than 90 days
+       # TODO
+
+
+Option d: TODO
+       
+So, option e would be some kind of trojan horse on your computer or device, continuously scanning folders, eating resources and uploading to the cloud.
+
+Final words
+=============
+This article can be viewed as the basics of basics. Of course, there are many other ways to do backups. There are also a few security and performance issues involved. Nonetheless, when and where to backup are equal or even more important.
index ab0dbfc..16d8836 100644 (file)
@@ -12,8 +12,9 @@
 <p>This page lists tutorials and sample code.
 </p>
 <ul>
-  <li><a href="./tinc.html">Tinc setup</a>: A simple setup with tinc as a gateway
-  </li><li><a href="./fastd.html">Fastd setup</a>: Similar setup as the above with fastd. 
+  <li><a href="./tinc.html">Tinc setup</a>: A simple setup with tinc as a gateway.
+  </li><li><a href="./fastd.html">Fastd setup</a>: Similar setup as the above with fastd.
+  </li><li><a href="./wireguard.html">WireGuard setup</a>: Similar setup as the above with wireguard. 
   </li><li>Strongswan: A mobike setup (not published).
 </li></ul>
 
index b52d4ef..711447a 100644 (file)
@@ -3,7 +3,8 @@ VPN and tunneling
 
 This page lists tutorials and sample code.
 
-* <URL:./tinc.html:Tinc setup>: A simple setup with tinc as a gateway
-* <URL:./fastd.html:Fastd setup>: Similar setup as the above with fastd. 
+* <URL:./tinc.html:Tinc setup>: A simple setup with tinc as a gateway.
+* <URL:./fastd.html:Fastd setup>: Similar setup as the above with fastd.
+* <URL:./wireguard.html:WireGuard setup>: Similar setup as the above with wireguard. 
 * Strongswan: A mobike setup (not published).
 
diff --git a/docs/wireguard.html b/docs/wireguard.html
new file mode 100644 (file)
index 0000000..7ef3822
--- /dev/null
@@ -0,0 +1,69 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title></title>
+<meta name="generator" content="HTML::TextToHTML v2.51"/>
+<link rel="stylesheet" type="text/css" href="../files/style.css"/>
+</head>
+<body>
+<h1><a name="section_1">Wireguard gateway setup</a></h1>
+
+<p>WireGuard securely encapsulates IP packets over UDP. You add a WireGuard interface, configure it with your private key and your peers' public keys, and then you send packets across it. It's that easy. Compared to OpenVPN, Ipsec, or even tinc, this is by far the easiest to configure.
+</p>
+<hr/>
+
+<p><em>Adapted from a mail conversation</em><br/>
+So in this particular setup we have a listening server and a client. 
+The client tunnels all IP requests (wildcard 0.0.0.0/0) through the wireguard interface.
+The server only allows accept connections from one IP (and furthermore checks if the key is OK).
+</p>
+<h2><a name="section_1_1">Generate public and private keys for client and server</a></h2>
+
+<p>The following cmd will create a private key with a corresponding public key.
+Create these for both the server and your client.
+</p>
+<pre>
+        umask 077
+        wg genkey | tee private.key | wg pubkey &gt; public.key
+</pre>
+<h2><a name="section_1_2">My configuration files are as follows:</a></h2>
+
+<p>A server with a virtual IP 172.16.16.1 (you can use any local LAN IP) is listening on port 51820.
+Right now, it only accepts connection from one peer (172.16.16.2). Traffics from other peers or with invalid keys are dropped.
+The server config is as follows
+</p>
+<pre>
+        [Interface]
+        Address = 172.16.16.1/24
+        ListenPort = 51820
+        PrivateKey = xxxxxxxx
+
+        [Peer]
+        PublicKey = xxxxxxxxxxxxxx
+        AllowedIPs = 172.16.16.2/32
+</pre>
+<p>On the client side, we have a client with virtual IP 172.16.16.2. As for the peer, we have set a wildcard with 0.0.0.0/0. The endpoint
+is our server. All traffic is sent through this tunnel (except for maybe LAN traffic). 
+</p>
+<pre>
+        [Interface]
+        Address = 172.16.16.2/32
+        PrivateKey = xxxxxxxxx
+        DNS = 8.8.8.8
+
+        [Peer]
+        PublicKey = xxxxxxxxxxxxxx
+        Endpoint = 1.2.3.4:51820
+        AllowedIPs = 0.0.0.0/0
+        PersistentKeepalive = 21
+</pre>
+<h2><a name="section_1_3">Running</a></h2>
+<p>You can start and stop your client/server with the wg-quick tool (if you compile by yourself, remember to build this tool as well)
+        
+</p><pre>
+        wg-quick up wg0.conf
+        wg-quick down wg0.conf
+</pre>
+</body>
+</html>
diff --git a/docs/wireguard.txt b/docs/wireguard.txt
new file mode 100644 (file)
index 0000000..e7d0669
--- /dev/null
@@ -0,0 +1,59 @@
+Wireguard gateway setup
+=====
+
+WireGuard securely encapsulates IP packets over UDP. You add a WireGuard interface, configure it with your private key and your peers' public keys, and then you send packets across it. It's that easy. Compared to OpenVPN, Ipsec, or even tinc, this is by far the easiest to configure.
+
+-------------- 
+
+*Adapted from a mail conversation*
+So in this particular setup we have a listening server and a client. 
+The client tunnels all IP requests (wildcard 0.0.0.0/0) through the wireguard interface.
+The server only allows accept connections from one IP (and furthermore checks if the key is OK).
+
+Generate public and private keys for client and server
+***********
+
+The following cmd will create a private key with a corresponding public key.
+Create these for both the server and your client.
+
+       umask 077
+       wg genkey | tee private.key | wg pubkey > public.key
+
+My configuration files are as follows:
+************
+
+A server with a virtual IP 172.16.16.1 (you can use any local LAN IP) is listening on port 51820.
+Right now, it only accepts connection from one peer (172.16.16.2). Traffics from other peers or with invalid keys are dropped.
+The server config is as follows
+
+       [Interface]
+       Address = 172.16.16.1/24
+       ListenPort = 51820
+       PrivateKey = xxxxxxxx
+
+       [Peer]
+       PublicKey = xxxxxxxxxxxxxx
+       AllowedIPs = 172.16.16.2/32
+
+
+On the client side, we have a client with virtual IP 172.16.16.2. As for the peer, we have set a wildcard with 0.0.0.0/0. The endpoint
+is our server. All traffic is sent through this tunnel (except for maybe LAN traffic). 
+
+       [Interface]
+       Address = 172.16.16.2/32
+       PrivateKey = xxxxxxxxx
+       DNS = 8.8.8.8
+
+       [Peer]
+       PublicKey = xxxxxxxxxxxxxx
+       Endpoint = 1.2.3.4:51820
+       AllowedIPs = 0.0.0.0/0
+       PersistentKeepalive = 21
+
+Running
+********
+You can start and stop your client/server with the wg-quick tool (if you compile by yourself, remember to build this tool as well)
+       
+       wg-quick up wg0.conf
+       wg-quick down wg0.conf
+
index a9f357f..b78132a 100644 (file)
@@ -26,7 +26,7 @@
 </pre>
 
 
-  <p>Hi! I'm mr_woggle, but some people call me Rob. I like simple things. Simple code, simple servers, etc. This website is mostly used for email and personal articles / programming projects. Please scan the tag below to contact me.
+  <p>Hi! I'm mr_woggle, but some people call me Rob. I like simple things. Simple code, simple servers, etc. This website is mostly used for email and personal articles / programming projects. Please scan the tag below to contact me, or just send a mail to robin at robinkrens dot nl.
   </p>
   
 <h2>Docs</h2>
     <li><a href="/docs/backups.html">How to backup</a>
     </li>
 
-    <li><a href="chinese/">Chinese learning</a>
+    <li><a href="docs/resources.html">Linux stuff</a>
     </li>
+  </ul>
 
-    <li><a href="docs/resources.html">Linux stuff</a>
+
+  <h2>Chinese</h2>
+  <ul>
+    <li><a href="chinese/www.clc.scicube.info/book_link/book_link.html">Cantonese e-books (mirror)</a></li>
+    <li><a href="chinese/">Mandarin advanced resources</a>
     </li>
   </ul>
 
+
   <h2>Servers and Playgrounds</h2>
 
        <ul>
            <li><a href="gitweb/">My own github server</a>   </li>
            <li><a href="gopher://45.76.159.1">WoggleWEB (gopher protocol)</a>
            <li><a href="crux-ports/">CRUX Repository</a></li>
-           <li>MAIL</li>
+           <li><a href="squirrelmail/">Squirrelmail</a> (apply for a free account!)</li>
        <li>DW</li>
        </li>
        </ul>
 
   <h2>Personal</h2>
   <ul>
+    <li>The finger of Rob</li>
     <li><a href="snapshots/">Snapshots (Rob's view)</a></li>
     <li>My travel maps
        <ul>
@@ -70,7 +77,7 @@
     
    <li><a href="./todo/TODO">TODO</a> | <a href="./todo/COMPLETED">COMPLETED</a> | <a href="./todo/">(DIR)</a>
   </ul>
-  <h2>Contact</h2>
+  <h2>Contact </h2>
   <p>
     <img src="files/contact.png" alt="contact erweima" width="50px" />
   </p>