Commit 3d4da5ac60

3d4da5ac6000a4871c5caa80d1e61f2782da3069

parent: dcf0186e16

Unsigned

cmc <hello@cleberg.net> · 2023-12-03 05:27 UTC

feat: finish converting md to org

Layout: unified · split

blog/2021-01-01-seum.org +104 −81
@@ -1,84 +1,107 @@
1+++
2date = 2021-01-01
3title = "SEUM: Speedrunners from Hell"
4description = "A video game review for SEUM: Speedrunners from Hell, an incredibly fast-paced mashup of a puzzle game and a free-running game."
5+++
6
7## Game Description
8
9[SEUM: Speedrunners from Hell](https://store.steampowered.com/app/457210/SEUM_Speedrunners_from_Hell/)
10is an incredibly fast-paced mashup of a puzzle game and a free-running game.
11Created by [Pine Studio](https://pinestudio.co) in early 2016 and first released
12as a
13[demo on GameJolt](https://gamejolt.com/games/seum-speedrunners-from-hell-demo/154868),
14this game was successfully green-lit on Steam and has amassed a cult
15following on multiple consoles.
1#+title: SEUM: Speedrunners from Hell
2#+date: 2021-01-01
3
4** Game Description
5:PROPERTIES:
6:CUSTOM_ID: game-description
7:ID: 809DA4E6-4E0D-4179-B8FF-6C9E767EC74D
8:END:
9[[https://store.steampowered.com/app/457210/SEUM_Speedrunners_from_Hell/][SEUM:
10Speedrunners from Hell]] is an incredibly fast-paced mashup of a puzzle
11game and a free-running game. Created by [[https://pinestudio.co][Pine
12Studio]] in early 2016 and first released as a
13[[https://gamejolt.com/games/seum-speedrunners-from-hell-demo/154868][demo
14on GameJolt]], this game was successfully green-lit on Steam and has
15amassed a cult following on multiple consoles.
1616
1717Here's the game description straight from the developers:
1818
19> Like a bastard child of Quake 3 and Super Meat Boy, SEUM: Speedrunners from
20> Hell is truly hardcore and focuses on speed and fast reaction.
21
22## Story
23
24SEUM does a great job setting the stage when you open the game for the first
25time, playing an animated video in the form of comic book images. You see Marty,
26the protagonist, sitting around drinking his beer as Satan busts down the door,
27cuts his hand off, and steals all his beer and bacon. As Satan is leaving, Marty
28whips a vinyl record across the room and cuts off one of Satan's hands. This
29hand is what allows you to use all the powers in the game.
30
31Check out the screenshot below for one of the first panels of the storyline:
32
33![SEUM Story](https://img.cleberg.net/blog/20210101-seum/seum_story.png)
34
35## Gameplay
36
37To accomplish each level, you will need to get to the final blue portal under a
38certain time limit. You can beat a level by getting to the portal before the
39time meter runs out or "Dominate" a level by beating it within a shorter time
40limit (noted by a bright red/orange color in the time meter).
41
42The portal is usually set behind locked gates, protected by dangerous defenses,
43or in hard-to-reach places. To reach the portal, you'll need to go through any
44existing orange portals, light all yellow beacons, avoid things like fireballs
45and blades, or use any satanic power orbs lying around. These special abilities
46include:
47
48- Gravity
49- Teleport
50- Rewind
51- Spawn platform
52- Roar (DLC)
53- Rocket (DLC)
54- Shadow world (DLC)
55
56For the main storyline, there are nine floors to beat. Each floor contains nine
57regular levels, one boss level, and one bonus level; although you don't
58technically need to beat all levels to advance to the next floor.
59
60![SEUM Floor Menu](https://img.cleberg.net/blog/20210101-seum/seum_floor.png)
61
62## In-Game Screenshots
63
64The main menu gives you plenty of options for tuning your system, playing main
65levels, playing the DLC, or exploring the other game modes.
66
67![SEUM Main Menu](https://img.cleberg.net/blog/20210101-seum/seum_menu.png)
68
69Once you enter a level, you can look around and strategize before starting.
70Clicking any button will start the menu, and you'll have to restart if you die.
71One of the great things about SEUM is that it has great keyboard shortcuts. You
72can quickly smash `R` to restart the level or `M` to return to the level menu.
73
74![SEUM Level](https://img.cleberg.net/blog/20210101-seum/seum_level.png)
75
76Once you're able to win a level, you'll see the high scores and can watch
77replays of the best scores.
78
79![SEUM Win](https://img.cleberg.net/blog/20210101-seum/seum_win.png)
80
81Each regular level contains a beer in a disguised location that may take some
82out-of-the-box thinking.
83
84![SEUM Beer](https://img.cleberg.net/blog/20210101-seum/seum_beer.png)
19#+begin_quote
20Like a bastard child of Quake 3 and Super Meat Boy, SEUM: Speedrunners
21from Hell is truly hardcore and focuses on speed and fast reaction.
22
23#+end_quote
24
25** Story
26:PROPERTIES:
27:CUSTOM_ID: story
28:ID: BF401145-763D-4399-922B-7D73322B5B40
29:END:
30SEUM does a great job setting the stage when you open the game for the
31first time, playing an animated video in the form of comic book images.
32You see Marty, the protagonist, sitting around drinking his beer as
33Satan busts down the door, cuts his hand off, and steals all his beer
34and bacon. As Satan is leaving, Marty whips a vinyl record across the
35room and cuts off one of Satan's hands. This hand is what allows you to
36use all the powers in the game.
37
38Check out the screenshot below for one of the first panels of the
39storyline:
40
41#+caption: SEUM Story
42[[https://img.cleberg.net/blog/20210101-seum/seum_story.png]]
43
44** Gameplay
45:PROPERTIES:
46:CUSTOM_ID: gameplay
47:ID: A55CB1AF-E818-4CA7-BF69-E8141369C269
48:END:
49To accomplish each level, you will need to get to the final blue portal
50under a certain time limit. You can beat a level by getting to the
51portal before the time meter runs out or "Dominate" a level by beating
52it within a shorter time limit (noted by a bright red/orange color in
53the time meter).
54
55The portal is usually set behind locked gates, protected by dangerous
56defenses, or in hard-to-reach places. To reach the portal, you'll need
57to go through any existing orange portals, light all yellow beacons,
58avoid things like fireballs and blades, or use any satanic power orbs
59lying around. These special abilities include:
60
61- Gravity
62- Teleport
63- Rewind
64- Spawn platform
65- Roar (DLC)
66- Rocket (DLC)
67- Shadow world (DLC)
68
69For the main storyline, there are nine floors to beat. Each floor
70contains nine regular levels, one boss level, and one bonus level;
71although you don't technically need to beat all levels to advance to the
72next floor.
73
74#+caption: SEUM Floor Menu
75[[https://img.cleberg.net/blog/20210101-seum/seum_floor.png]]
76
77** In-Game Screenshots
78:PROPERTIES:
79:CUSTOM_ID: in-game-screenshots
80:ID: C779F008-4C8A-4BA4-AA31-60A1BF5A3EE3
81:END:
82The main menu gives you plenty of options for tuning your system,
83playing main levels, playing the DLC, or exploring the other game modes.
84
85#+caption: SEUM Main Menu
86[[https://img.cleberg.net/blog/20210101-seum/seum_menu.png]]
87
88Once you enter a level, you can look around and strategize before
89starting. Clicking any button will start the menu, and you'll have to
90restart if you die. One of the great things about SEUM is that it has
91great keyboard shortcuts. You can quickly smash =R= to restart the level
92or =M= to return to the level menu.
93
94#+caption: SEUM Level
95[[https://img.cleberg.net/blog/20210101-seum/seum_level.png]]
96
97Once you're able to win a level, you'll see the high scores and can
98watch replays of the best scores.
99
100#+caption: SEUM Win
101[[https://img.cleberg.net/blog/20210101-seum/seum_win.png]]
102
103Each regular level contains a beer in a disguised location that may take
104some out-of-the-box thinking.
105
106#+caption: SEUM Beer
107[[https://img.cleberg.net/blog/20210101-seum/seum_beer.png]]
blog/2021-01-04-fediverse.org +116 −99
@@ -1,106 +1,123 @@
1+++
2date = 2021-01-04
3title = "A Simple Guide to the Fediverse"
4description = "A simple guide to the fediverse, a federated universe of servers commonly used for sharing content, like social media."
5draft = false
6+++
7
8## What is the Fediverse?
9
10The fediverse is a federated universe of servers commonly used for sharing
11content, like social media. So, instead of having to rely on a single
12organization to run the server (e.g. Facebook), the fediverse is a giant
13collection of servers across the world, owned by many people and organizations.
14
15Take a look at this depiction of a federated network.
16Each server in this photo is owned and run by different
17administrators/owners.
18Federated networks are best explained as email servers: you have an email
19account that exists on a server (e.g. Outlook), your friend has an account on
20a different server (e.g. GMail), and another friend has an account on a
21third server (e.g. ProtonMail).
22All three of you can talk and communicate back and forth without having to
23be on the same server.
24However, responsible email admins are there to set rules and control the
1#+title: A Simple Guide to the Fediverse
2#+date: 2021-01-04
3
4** What is the Fediverse?
5:PROPERTIES:
6:CUSTOM_ID: what-is-the-fediverse
7:END:
8The fediverse is a federated universe of servers commonly used for
9sharing content, like social media. So, instead of having to rely on a
10single organization to run the server (e.g. Facebook), the fediverse is
11a giant collection of servers across the world, owned by many people and
12organizations.
13
14Take a look at this depiction of a federated network. Each server in
15this photo is owned and run by different administrators/owners.
16Federated networks are best explained as email servers: you have an
17email account that exists on a server (e.g. Outlook), your friend has an
18account on a different server (e.g. GMail), and another friend has an
19account on a third server (e.g. ProtonMail). All three of you can talk
20and communicate back and forth without having to be on the same server.
21However, responsible email admins are there to set rules and control the
2522traffic going in/out of the server.
2623
27![Federated services diagram](https://img.cleberg.net/blog/20210104-a-simple-guide-to-the-fediverse/federated-example.svg)
24#+caption: Federated services diagram
25[[https://img.cleberg.net/blog/20210104-a-simple-guide-to-the-fediverse/federated-example.svg]]
2826
29The main objective of this architecture is to decentralize the control within
30the internet connections. For example, if you run your own Mastodon instance,
31you and your users can't be censored or impacted in any way by authorities of
32another Mastodon instance. Some users have praised these features due to recent
33criticism of popular social media websites that may be over-censoring their
34users.
27The main objective of this architecture is to decentralize the control
28within the internet connections. For example, if you run your own
29Mastodon instance, you and your users can't be censored or impacted in
30any way by authorities of another Mastodon instance. Some users have
31praised these features due to recent criticism of popular social media
32websites that may be over-censoring their users.
3533
3634This strategy is great for making sure control of the social web isn't
37controlled by a single organization, but it also has some downsides. If I create
38a Mastodon instance and get a ton of users to sign up, I can shut the server
39down at any time. That means you're at risk of losing the content you've created
40unless you back it up, or the server backs it up for you. Also, depending on the
41software used (e.g. Mastodon, Pixelfed, etc.), censorship may still be an issue
42if the server admins decide they want to censor their users. Now, censorship
43isn't always a bad thing and can even benefit the community as a whole, but
44you'll want to determine which servers align with your idea of proper
45censorship.
46
47However, these are risks that we take when we sign up for any online platform.
48Whatever your reason is for trying out federated social networks, they are part
49of the future of the internet. However, the popularity of these services is
50still yet to be determined, especially with the increased difficulty
51understanding and signing up for these platforms. Perhaps increased regulation
52and litigation against current social media sites will push more users into the
53fediverse.
54
55## Federated Alternatives to Popular Sites
56
57The list below is a small guide that will show you federated alternatives to
58current popular websites.
59There are many more out there, so go and explore: you might just find the
60perfect home.
61
62### Reddit
63
64- [Lemmy](https://lemmy.ml/instances)
65
66### Twitter/Facebook/Tumblr
67
68- [Mastodon](https://joinmastodon.org)
69- [Diaspora](https://diasporafoundation.org)
70- [Friendica](https://friendi.ca)
71- [GNU Social](https://gnusocial.network)
72- [Pleroma](https://pleroma.social)
73
74### Instagram
75
76- [Pixelfed](https://pixelfed.org)
77
78### Slack/Discord
79
80- [Matrix](https://element.io)
81
82### Youtube/Vimeo
83
84- [Peertube](https://joinpeertube.org)
85
86### Spotify/Soundcloud
87
88- [Funkwhale](https://funkwhale.audio)
89
90### Podcasting
91
92- [Pubcast](https://pubcast.pub)
93
94### Medium/Blogger
95
96- [WriteFreely](https://writefreely.org)
97
98## Get Started
99
100The best way to get started is to simply sign up and learn as you go. If you're
101comfortable signing up through a Mastodon, Pleroma, or Friendica server, here is
102[a list of themed servers](https://fediverse.party/en/portal/servers) to choose
103from. If you're looking for something else, try a web search for a federated
104alternative to your favorite sites.
35controlled by a single organization, but it also has some downsides. If
36I create a Mastodon instance and get a ton of users to sign up, I can
37shut the server down at any time. That means you're at risk of losing
38the content you've created unless you back it up, or the server backs it
39up for you. Also, depending on the software used (e.g. Mastodon,
40Pixelfed, etc.), censorship may still be an issue if the server admins
41decide they want to censor their users. Now, censorship isn't always a
42bad thing and can even benefit the community as a whole, but you'll want
43to determine which servers align with your idea of proper censorship.
44
45However, these are risks that we take when we sign up for any online
46platform. Whatever your reason is for trying out federated social
47networks, they are part of the future of the internet. However, the
48popularity of these services is still yet to be determined, especially
49with the increased difficulty understanding and signing up for these
50platforms. Perhaps increased regulation and litigation against current
51social media sites will push more users into the fediverse.
52
53** Federated Alternatives to Popular Sites
54:PROPERTIES:
55:CUSTOM_ID: federated-alternatives-to-popular-sites
56:END:
57The list below is a small guide that will show you federated
58alternatives to current popular websites. There are many more out there,
59so go and explore: you might just find the perfect home.
60
61*** Reddit
62:PROPERTIES:
63:CUSTOM_ID: reddit
64:END:
65- [[https://lemmy.ml/instances][Lemmy]]
66
67*** Twitter/Facebook/Tumblr
68:PROPERTIES:
69:CUSTOM_ID: twitterfacebooktumblr
70:END:
71- [[https://joinmastodon.org][Mastodon]]
72- [[https://diasporafoundation.org][Diaspora]]
73- [[https://friendi.ca][Friendica]]
74- [[https://gnusocial.network][GNU Social]]
75- [[https://pleroma.social][Pleroma]]
76
77*** Instagram
78:PROPERTIES:
79:CUSTOM_ID: instagram
80:END:
81- [[https://pixelfed.org][Pixelfed]]
82
83*** Slack/Discord
84:PROPERTIES:
85:CUSTOM_ID: slackdiscord
86:END:
87- [[https://element.io][Matrix]]
88
89*** Youtube/Vimeo
90:PROPERTIES:
91:CUSTOM_ID: youtubevimeo
92:END:
93- [[https://joinpeertube.org][Peertube]]
94
95*** Spotify/Soundcloud
96:PROPERTIES:
97:CUSTOM_ID: spotifysoundcloud
98:END:
99- [[https://funkwhale.audio][Funkwhale]]
100
101*** Podcasting
102:PROPERTIES:
103:CUSTOM_ID: podcasting
104:END:
105- [[https://pubcast.pub][Pubcast]]
106
107*** Medium/Blogger
108:PROPERTIES:
109:CUSTOM_ID: mediumblogger
110:END:
111- [[https://writefreely.org][WriteFreely]]
112
113** Get Started
114:PROPERTIES:
115:CUSTOM_ID: get-started
116:END:
117The best way to get started is to simply sign up and learn as you go. If
118you're comfortable signing up through a Mastodon, Pleroma, or Friendica
119server, here is [[https://fediverse.party/en/portal/servers][a list of
120themed servers]] to choose from. If you're looking for something else,
121try a web search for a federated alternative to your favorite sites.
105122
106123Find a server that focuses on your passions and start there!
blog/2021-01-07-ufw.org +144 −127
@@ -1,158 +1,173 @@
1+++
2date = 2021-01-07
3title = "Secure Your Network with the Uncomplicated Firewall"
4description = "Learn how to use the UFW, one of the simplest and most widely available firewalls on Linux."
5draft = false
6+++
7
8## Uncomplicated Firewall
9
10Uncomplicated Firewall, also known as ufw, is a convenient and beginner-friendly
11way to enforce OS-level firewall rules. For those who are hosting servers or any
12device that is accessible to the world (i.e., by public IP or domain name), it's
13critical that a firewall is properly implemented and active.
14
15Ufw is available by default in all Ubuntu installations after 8.04 LTS. For
16other distributions, you can look to install ufw or check if there are
17alternative firewalls installed already. There are usually alternatives
18available, such as Fedora's `firewall` and the package available on most
19distributions: `iptables`. Ufw is considered a beginner-friendly front-end to
20iptables.
21
22[Gufw](https://gufw.org) is available as a graphical user interface (GUI)
23application for users who are uncomfortable setting up a firewall through a
24terminal.
25
26![](https://img.cleberg.net/blog/20210107-secure-your-network-with-the-uncomplicated-firewall/gufw.png)
27
28## Getting Help
29
30If you need help figuring out commands, remember that you can run the `--help`
31flag to get a list of options.
32
33```sh
1#+title: Secure Your Network with the Uncomplicated Firewall
2#+date: 2021-01-07
3
4** Uncomplicated Firewall
5:PROPERTIES:
6:CUSTOM_ID: uncomplicated-firewall
7:END:
8Uncomplicated Firewall, also known as ufw, is a convenient and
9beginner-friendly way to enforce OS-level firewall rules. For those who
10are hosting servers or any device that is accessible to the world (i.e.,
11by public IP or domain name), it's critical that a firewall is properly
12implemented and active.
13
14Ufw is available by default in all Ubuntu installations after 8.04 LTS.
15For other distributions, you can look to install ufw or check if there
16are alternative firewalls installed already. There are usually
17alternatives available, such as Fedora's =firewall= and the package
18available on most distributions: =iptables=. Ufw is considered a
19beginner-friendly front-end to iptables.
20
21[[https://gufw.org][Gufw]] is available as a graphical user interface
22(GUI) application for users who are uncomfortable setting up a firewall
23through a terminal.
24
25[[https://img.cleberg.net/blog/20210107-secure-your-network-with-the-uncomplicated-firewall/gufw.png]]
26
27** Getting Help
28:PROPERTIES:
29:CUSTOM_ID: getting-help
30:END:
31If you need help figuring out commands, remember that you can run the
32=--help= flag to get a list of options.
33
34#+begin_src sh
3435sudo ufw --help
35```
36
37## Set Default State
38
39The proper way to run a firewall is to set a strict default state and slowly
40open up ports that you want to allow. This helps prevent anything malicious from
41slipping through the cracks. The following command prevents all incoming traffic
42(other than the rules we specify later), but you can also set this for outgoing
43connections, if necessary.
44
45```sh
36#+end_src
37
38** Set Default State
39:PROPERTIES:
40:CUSTOM_ID: set-default-state
41:END:
42The proper way to run a firewall is to set a strict default state and
43slowly open up ports that you want to allow. This helps prevent anything
44malicious from slipping through the cracks. The following command
45prevents all incoming traffic (other than the rules we specify later),
46but you can also set this for outgoing connections, if necessary.
47
48#+begin_src sh
4649sudo ufw default deny incoming
47```
50#+end_src
4851
49You should also allow outgoing traffic if you want to allow the device to
50communicate back to you or other parties. For example, media servers like Plex
51need to be able to send out data related to streaming the media.
52You should also allow outgoing traffic if you want to allow the device
53to communicate back to you or other parties. For example, media servers
54like Plex need to be able to send out data related to streaming the
55media.
5256
53```sh
57#+begin_src sh
5458sudo ufw default allow outgoing
55```
56
57## Adding Port Rules
59#+end_src
5860
59Now that we've disabled all incoming traffic by default, we need to open up some
60ports (or else no traffic would be able to come in). If you need to be able to
61`ssh` into the machine, you'll need to open up port 22.
61** Adding Port Rules
62:PROPERTIES:
63:CUSTOM_ID: adding-port-rules
64:END:
65Now that we've disabled all incoming traffic by default, we need to open
66up some ports (or else no traffic would be able to come in). If you need
67to be able to =ssh= into the machine, you'll need to open up port 22.
6268
63```sh
69#+begin_src sh
6470sudo ufw allow 22
65```
71#+end_src
6672
67You can also issue more restrictive rules. The following rule will allow `ssh`
68connections only from machines on the local subnet.
73You can also issue more restrictive rules. The following rule will allow
74=ssh= connections only from machines on the local subnet.
6975
70```sh
76#+begin_src sh
7177sudo ufw allow proto tcp from 192.168.0.0/24 to any port 22
72```
78#+end_src
7379
74If you need to set a rule that isn't tcp, just append your connection type to
75the end of the rule.
80If you need to set a rule that isn't tcp, just append your connection
81type to the end of the rule.
7682
77```sh
83#+begin_src sh
7884sudo ufw allow 1900/udp
79```
80
81## Enable ufw
85#+end_src
8286
87** Enable ufw
88:PROPERTIES:
89:CUSTOM_ID: enable-ufw
90:END:
8391Now that the firewall is configured and ready to go, you can enable the
8492firewall.
8593
86```sh
94#+begin_src sh
8795sudo ufw enable
88```
96#+end_src
8997
9098A restart may be required for the firewall to begin operating.
9199
92```sh
100#+begin_src sh
93101sudo reboot now
94```
102#+end_src
95103
96## Checking Status
104** Checking Status
105:PROPERTIES:
106:CUSTOM_ID: checking-status
107:END:
108Now that the firewall is enabled, let's check and see what the rules
109look like.
97110
98Now that the firewall is enabled, let's check and see what the rules look like.
99
100```sh
111#+begin_src sh
101112sudo ufw status numbered
102```
113#+end_src
103114
104```txt
115#+begin_src txt
105116Status: active
106117
107118 To Action From
108119 -- ------ ----
109120[ 1] 22 ALLOW IN Anywhere
110121[ 2] 22 (v6) ALLOW IN Anywhere (v6)
111```
112
113## Deleting Rules
122#+end_src
114123
115If you need to delete a rule, you need to know the number associated with that
116rule.
117Let's delete the first rule in the table above.
118You'll be asked to confirm the deletion as part of this process.
124** Deleting Rules
125:PROPERTIES:
126:CUSTOM_ID: deleting-rules
127:END:
128If you need to delete a rule, you need to know the number associated
129with that rule. Let's delete the first rule in the table above. You'll
130be asked to confirm the deletion as part of this process.
119131
120```sh
132#+begin_src sh
121133sudo ufw delete 1
122```
123
124## Managing App Rules
125
126Luckily, there's a convenient way for installed applications to create files
127that ufw can easily implement so that you don't have to search and find which
128ports your application requires. To see if your device has any applications with
129pre-installed ufw rules, execute the following command:
130
131```sh
134#+end_src
135
136** Managing App Rules
137:PROPERTIES:
138:CUSTOM_ID: managing-app-rules
139:END:
140Luckily, there's a convenient way for installed applications to create
141files that ufw can easily implement so that you don't have to search and
142find which ports your application requires. To see if your device has
143any applications with pre-installed ufw rules, execute the following
144command:
145
146#+begin_src sh
132147sudo ufw app list
133```
148#+end_src
134149
135150The results should look something like this:
136151
137```txt
152#+begin_src txt
138153Available applications:
139154 OpenSSH
140155 Samba
141156 plexmediaserver
142157 plexmediaserver-all
143158 plexmediaserver-dlna
144```
159#+end_src
145160
146If you want to get more information on a specific app rule, use the `info`
147command.
161If you want to get more information on a specific app rule, use the
162=info= command.
148163
149```sh
164#+begin_src sh
150165sudo ufw app info plexmediaserver-dlna
151```
166#+end_src
152167
153168You'll get a blurb of info back like this:
154169
155```txt
170#+begin_src txt
156171Profile: plexmediaserver-dlna
157172Title: Plex Media Server (DLNA)
158173Description: The Plex Media Server (additional DLNA capability only)
@@ -160,29 +175,31 @@ Description: The Plex Media Server (additional DLNA capability only)
160175Ports:
161176 1900/udp
162177 32469/tcp
163```
178#+end_src
164179
165You can add or delete app rules the same way that you'd add or delete specific
166port rules.
180You can add or delete app rules the same way that you'd add or delete
181specific port rules.
167182
168```sh
183#+begin_src sh
169184sudo ufw allow plexmediaserver-dlna
170```
185#+end_src
171186
172```sh
187#+begin_src sh
173188sudo ufw delete RULE|NUM
174```
175
176## Creating App Rules
189#+end_src
177190
178If you'd like to create you own app rule, you'll need to create a file in the
179`/etc/ufw/applications.d` directory. Within the file you create, you need to
180make sure the content is properly formatted.
191** Creating App Rules
192:PROPERTIES:
193:CUSTOM_ID: creating-app-rules
194:END:
195If you'd like to create you own app rule, you'll need to create a file
196in the =/etc/ufw/applications.d= directory. Within the file you create,
197you need to make sure the content is properly formatted.
181198
182For example, here are the contents my `plexmediaserver` file, which creates
183three distinct app rules for ufw:
199For example, here are the contents my =plexmediaserver= file, which
200creates three distinct app rules for ufw:
184201
185```config
202#+begin_src config
186203[plexmediaserver]
187204title=Plex Media Server (Standard)
188205description=The Plex Media Server
@@ -197,24 +214,24 @@ ports=1900/udp|32469/tcp
197214title=Plex Media Server (Standard + DLNA)
198215description=The Plex Media Server (with additional DLNA capability)
199216ports=32400/tcp|3005/tcp|5353/udp|8324/tcp|32410:32414/udp|1900/udp|32469/tcp
200```
217#+end_src
201218
202So, if I wanted to create a custom app rule called "mycustomrule," I'd create a
203file and add my content like this:
219So, if I wanted to create a custom app rule called "mycustomrule," I'd
220create a file and add my content like this:
204221
205```sh
222#+begin_src sh
206223sudo nano /etc/ufw/applications.d/mycustomrule
207```
224#+end_src
208225
209```config
226#+begin_src config
210227[mycustomrule]
211228title=My Custom Rule
212229description=This is a temporary ufw app rule.
213230ports=88/tcp|9100/udp
214```
231#+end_src
215232
216233Then, I would just enable this rule in ufw.
217234
218```sh
235#+begin_src sh
219236sudo ufw allow mycustomrule
220```
237#+end_src
blog/2021-02-19-macos.org +172 −152
@@ -1,205 +1,225 @@
1+++
2date = 2021-02-19
3title = "macOS: Testing Out A New OS"
4description = "My personal experience with macOS, from the perspective of a Linux junkie."
5draft = false
6+++
7
8## Diving into macOS
9
10After spending nearly 15 years working with Windows and 8 years on Linux, I
11have experienced macOS for the first time.
12By chance, my spouse happened to buy a new MacBook and gifted me their 2013
13model.
14Of course, I still consider my Linux desktop to be my daily driver and keep
15Windows around for gaming needs, but over the past week I've found myself using
16the MacBook more and more for things that don't require gaming specs or advanced
17dev tools.
18
19## Initial Thoughts
20
21Before I move on to the technical aspects of my set-up, I want to take some time
22and express my thoughts on the overall OS.
23
24![macOS Desktop](https://img.cleberg.net/blog/20210219-macos-testing-out-a-new-os/macos-desktop.png)
25
26As expected, the initial computer setup is a breeze with Mac's guided GUI
27installer.
28
29The desktop itself reminds me of GNOME more than anything else I've seen: even
30Pantheon from [ElementaryOS](https://elementary.io/), which people commonly
31refer to as the closest Linux distro to macOS. The desktop toolbar is great and
32far surpasses the utility of the GNOME toolbar due to the fact that the
33extensions and icons _actually work_. I launch macOS and immediately see my
34shortcuts for Tresorit, Bitwarden, and Mullvad pop up as the computer loads.
35
36Even further, the app dock is very useful and will be yet another familiarity
37for GNOME users. I know many people like panels instead of docks, but I've
38always found docks to have a more pleasing UI. However, I had to disable the
39"Show recent applications in Dock" preference; I can't stand items taking up
40precious screen space if I'm not currently using them. On that same note, it's
41taking me some time to get use to the fact that I have to manually quit an app
42or else it will still stay open/active in the dock, even if I've closed out all
43windows for that app (e.g. Firefox).
44
45Overall, I'm having a lot of fun and for users who spend a large majority of
46their time performing basic tasks like web browsing, writing, watching media,
47etc., macOS is a fantastic option.
1#+title: macOS: Testing Out A New OS
2#+date: 2021-02-19
3
4** Diving into macOS
5:PROPERTIES:
6:CUSTOM_ID: diving-into-macos
7:END:
8After spending nearly 15 years working with Windows and 8 years on
9Linux, I have experienced macOS for the first time. By chance, my spouse
10happened to buy a new MacBook and gifted me their 2013 model. Of course,
11I still consider my Linux desktop to be my daily driver and keep Windows
12around for gaming needs, but over the past week I've found myself using
13the MacBook more and more for things that don't require gaming specs or
14advanced dev tools.
15
16** Initial Thoughts
17:PROPERTIES:
18:CUSTOM_ID: initial-thoughts
19:END:
20Before I move on to the technical aspects of my set-up, I want to take
21some time and express my thoughts on the overall OS.
22
23#+caption: macOS Desktop
24[[https://img.cleberg.net/blog/20210219-macos-testing-out-a-new-os/macos-desktop.png]]
25
26As expected, the initial computer setup is a breeze with Mac's guided
27GUI installer.
28
29The desktop itself reminds me of GNOME more than anything else I've
30seen: even Pantheon from [[https://elementary.io/][ElementaryOS]], which
31people commonly refer to as the closest Linux distro to macOS. The
32desktop toolbar is great and far surpasses the utility of the GNOME
33toolbar due to the fact that the extensions and icons /actually work/. I
34launch macOS and immediately see my shortcuts for Tresorit, Bitwarden,
35and Mullvad pop up as the computer loads.
36
37Even further, the app dock is very useful and will be yet another
38familiarity for GNOME users. I know many people like panels instead of
39docks, but I've always found docks to have a more pleasing UI. However,
40I had to disable the "Show recent applications in Dock" preference; I
41can't stand items taking up precious screen space if I'm not currently
42using them. On that same note, it's taking me some time to get use to
43the fact that I have to manually quit an app or else it will still stay
44open/active in the dock, even if I've closed out all windows for that
45app (e.g. Firefox).
46
47Overall, I'm having a lot of fun and for users who spend a large
48majority of their time performing basic tasks like web browsing,
49writing, watching media, etc., macOS is a fantastic option.
4850
4951The rest of this post explains the technicalities of how I set up my CLI
50environment to make me feel more at-home, similar to the environments I set up
51on Fedora, Ubuntu, etc.
52
53## Making it Feel Like Home
54
55If you're someone who uses Linux primarily, no doubt your first thought when
56booting macOS will be the same as mine was: "Where is the terminal and how do I
57set up my favorite utilities?"
58
59Luckily, macOS hasn't completely hidden away the development tools from the
60average user. You can easily find the Terminal app in the Launchpad area, but
61it's probably not what you're used to. I was surprised (and happy) to see that
62the default shell is `zsh`, the shell I use on all of my Linux distros. However,
63the commands are not the same - even the ones you may think are native to the
64shell. Commands like `dir` do not exist, so other native commands like `ls -la`
65or `pwd` are more useful here.
66
67With only a few minutes of installing and tweaking a few packages, I was able to
68recreate a terminal environment that I feel very comfortable using. See the
69image below for a preview of the iTerm2 app with a split view between my macOS
70desktop shell and an SSH session into my server.
71
72![iTerm2](https://img.cleberg.net/blog/20210219-macos-testing-out-a-new-os/iterm2.png)
73
74## Xcode
75
76My first step was to search the web for any hints on how to get `zsh` back up to
77the state I like, with extensions, themes, etc. My first step was to install the
78CLI tools for [Xcode](https://developer.apple.com/xcode/), Apple's suite of
52environment to make me feel more at-home, similar to the environments I
53set up on Fedora, Ubuntu, etc.
54
55** Making it Feel Like Home
56:PROPERTIES:
57:CUSTOM_ID: making-it-feel-like-home
58:END:
59If you're someone who uses Linux primarily, no doubt your first thought
60when booting macOS will be the same as mine was: "Where is the terminal
61and how do I set up my favorite utilities?"
62
63Luckily, macOS hasn't completely hidden away the development tools from
64the average user. You can easily find the Terminal app in the Launchpad
65area, but it's probably not what you're used to. I was surprised (and
66happy) to see that the default shell is =zsh=, the shell I use on all of
67my Linux distros. However, the commands are not the same - even the ones
68you may think are native to the shell. Commands like =dir= do not exist,
69so other native commands like =ls -la= or =pwd= are more useful here.
70
71With only a few minutes of installing and tweaking a few packages, I was
72able to recreate a terminal environment that I feel very comfortable
73using. See the image below for a preview of the iTerm2 app with a split
74view between my macOS desktop shell and an SSH session into my server.
75
76#+caption: iTerm2
77[[https://img.cleberg.net/blog/20210219-macos-testing-out-a-new-os/iterm2.png]]
78
79** Xcode
80:PROPERTIES:
81:CUSTOM_ID: xcode
82:END:
83My first step was to search the web for any hints on how to get =zsh=
84back up to the state I like, with extensions, themes, etc. My first step
85was to install the CLI tools for
86[[https://developer.apple.com/xcode/][Xcode]], Apple's suite of
7987development tools.
8088
81```sh
89#+begin_src sh
8290sudo xcode-select -r
83```
91#+end_src
8492
85```sh
93#+begin_src sh
8694sudo xcode-select --install
87```
88
89## Homebrew
95#+end_src
9096
91Next up is to install [Homebrew](https://brew.sh), a nifty package manager for
92macOS.
97** Homebrew
98:PROPERTIES:
99:CUSTOM_ID: homebrew
100:END:
101Next up is to install [[https://brew.sh][Homebrew]], a nifty package
102manager for macOS.
93103
94```sh
104#+begin_src sh
95105/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
96```
106#+end_src
97107
98108I ran into a permission error when installing Homebrew:
99109
100```sh
110#+begin_src sh
101111Error: Failed to link all completions, docs and manpages:
102112 Permission denied @ rb_file_s_symlink - (../../../Homebrew/completions/zsh/_brew, /usr/local/share/zsh/site-functions/_brew)
103113Failed during: /usr/local/bin/brew update --force --quiet
104```
114#+end_src
105115
106I found that the following permission modification worked like a charm. However,
107I noted that some users online discussed the fact that this solution may not
108work if your system has multiple users who use Homebrew.
116I found that the following permission modification worked like a charm.
117However, I noted that some users online discussed the fact that this
118solution may not work if your system has multiple users who use
119Homebrew.
109120
110```sh
121#+begin_src sh
111122sudo chown -R $(whoami) $(brew --prefix)/*
112```
123#+end_src
113124
114125Next up is to ensure Homebrew is updated and cleaned.
115126
116```sh
127#+begin_src sh
117128brew update
118```
129#+end_src
119130
120```sh
131#+begin_src sh
121132brew cleanup
122```
133#+end_src
123134
124## iTerm2
135** iTerm2
136:PROPERTIES:
137:CUSTOM_ID: iterm2
138:END:
139Now that I've installed the basic utilities for development, I moved
140onto installing iTerm2, a much better terminal than the default.
125141
126Now that I've installed the basic utilities for development, I moved onto
127installing iTerm2, a much better terminal than the default.
128
129```sh
142#+begin_src sh
130143brew install --cask iterm2
131```
144#+end_src
132145
133I also used the `Make iTerm2 Default Term` and `Install Shell Integration`
134options in the iTerm2 application menu to make sure I don't run into any issues
135later on with different terminals.
146I also used the =Make iTerm2 Default Term= and
147=Install Shell Integration= options in the iTerm2 application menu to
148make sure I don't run into any issues later on with different terminals.
136149
137We will also install `zsh` so we can use it in iTerm2.
150We will also install =zsh= so we can use it in iTerm2.
138151
139```sh
152#+begin_src sh
140153brew install zsh
141```
142
143## Oh-My-Zsh
154#+end_src
144155
145I've shown the great aspects of [Oh My Zsh](https://ohmyz.sh) in other blog
146posts, so I'll skip over that speech for now. Simply install it and run an
147update.
156** Oh-My-Zsh
157:PROPERTIES:
158:CUSTOM_ID: oh-my-zsh
159:END:
160I've shown the great aspects of [[https://ohmyz.sh][Oh My Zsh]] in other
161blog posts, so I'll skip over that speech for now. Simply install it and
162run an update.
148163
149```sh
164#+begin_src sh
150165sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
151```
166#+end_src
152167
153```sh
168#+begin_src sh
154169omz update
155```
170#+end_src
156171
157Finally, restart the iTerm2 application to ensure all changes go into effect.
172Finally, restart the iTerm2 application to ensure all changes go into
173effect.
158174
159## Oh-My-Zsh Themes
175** Oh-My-Zsh Themes
176:PROPERTIES:
177:CUSTOM_ID: oh-my-zsh-themes
178:END:
179Let's change the theme of the terminal to make it a little more
180friendly.
160181
161Let's change the theme of the terminal to make it a little more friendly.
162
163```sh
182#+begin_src sh
164183open ~/.zshrc
165```
184#+end_src
166185
167The third section of this file should contain a line like the code below. Change
168that theme to
169[any theme you want](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes), save the
170file, and exit.
186The third section of this file should contain a line like the code
187below. Change that theme to
188[[https://github.com/ohmyzsh/ohmyzsh/wiki/Themes][any theme you want]],
189save the file, and exit.
171190
172```sh
191#+begin_src sh
173192ZSH_THEME="af-magic"
174```
175
176After changing the `.zshrc` file, you'll need to close your terminal and re-open
177it to see the changes.
178Optionally, just open a new tab if you're using iTerm2, and you'll see the
179new shell config.
193#+end_src
180194
181## Oh-My-Zsh Plugins
182
183Of course, my customization of `zsh` would not be complete without
184[zsh-autosuggestions](https://github.com/zsh-users/zsh-autosuggestions). This
185will bring up commands you've run in the past as you type them. For example, if
186you've run `ssh user@192.168.1.99` before, the terminal will show this command
187as soon as you start typing it (e.g. `zsh u`), and you can hit the right arrow
188to autocomplete the command.
195After changing the =.zshrc= file, you'll need to close your terminal and
196re-open it to see the changes. Optionally, just open a new tab if you're
197using iTerm2, and you'll see the new shell config.
189198
190```sh
199** Oh-My-Zsh Plugins
200:PROPERTIES:
201:CUSTOM_ID: oh-my-zsh-plugins
202:END:
203Of course, my customization of =zsh= would not be complete without
204[[https://github.com/zsh-users/zsh-autosuggestions][zsh-autosuggestions]].
205This will bring up commands you've run in the past as you type them. For
206example, if you've run =ssh user@192.168.1.99= before, the terminal will
207show this command as soon as you start typing it (e.g. =zsh u=), and you
208can hit the right arrow to autocomplete the command.
209
210#+begin_src sh
191211git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
192```
212#+end_src
193213
194```sh
214#+begin_src sh
195215open ~/.zshrc
196```
216#+end_src
197217
198```sh
218#+begin_src sh
199219# Scroll down the script and edit this line to add zsh-autosuggestions
200220plugins=(git zsh-autosuggestions)
201```
221#+end_src
202222
203Remember: After changing the `.zshrc` file, you'll need to close your terminal
204and re-open it to see the changes. Optionally, just open a new tab if you're
205using iTerm2, and you'll see the new shell config.
223Remember: After changing the =.zshrc= file, you'll need to close your
224terminal and re-open it to see the changes. Optionally, just open a new
225tab if you're using iTerm2, and you'll see the new shell config.
blog/2021-03-19-clone-github-repos.org +73 −71
@@ -1,60 +1,59 @@
1+++
2date = 2021-03-19
3title = "How to Clone All Repositories from a GitHub or Sourcehut Account"
4description = "Learn how to properly clone all repositories from a GitHub or sourcehut account."
5draft = false
6+++
7
8## Cloning from GitHub
9
10If you're like me and use a lot of different devices (and sometimes decide to
11just wipe your device and start with a new OS), you probably know the pain of
12cloning all your old code repositories down to your local file system.
13
14If you're using GitHub, you can easily clone all of your code back down in just
15seconds.
16First, create a bash script.
17I do so by opening a new file in `nano`, but you can use `gedit`, `vim`, or
18something else:
19
20```sh
1#+title: How to Clone All Repositories from a GitHub or Sourcehut Account
2#+date: 2021-03-19
3
4** Cloning from GitHub
5:PROPERTIES:
6:CUSTOM_ID: cloning-from-github
7:END:
8If you're like me and use a lot of different devices (and sometimes
9decide to just wipe your device and start with a new OS), you probably
10know the pain of cloning all your old code repositories down to your
11local file system.
12
13If you're using GitHub, you can easily clone all of your code back down
14in just seconds. First, create a bash script. I do so by opening a new
15file in =nano=, but you can use =gedit=, =vim=, or something else:
16
17#+begin_src sh
2118nano clone_github_repos.sh
22```
19#+end_src
2320
24Next, paste in the following information. Note that you can replace the word
25`users` in the first line with `orgs` and type an organization's name instead of
26a user's name.
21Next, paste in the following information. Note that you can replace the
22word =users= in the first line with =orgs= and type an organization's
23name instead of a user's name.
2724
28```sh
25#+begin_src sh
2926CNTX=users; NAME=YOUR-USERNAME; PAGE=1
3027curl "https://api.github.com/$CNTX/$NAME/repos?page=$PAGE&per_page=100" |
3128 grep -e 'git_url*' |
3229 cut -d \" -f 4 |
3330 xargs -L1 git clone
34```
31#+end_src
3532
3633Finally, save the bash script and make it executable.
3734
38```sh
35#+begin_src sh
3936chmod a+x clone_github_repos.sh
40```
37#+end_src
4138
4239Now you can run the script and should see the cloning process begin.
4340
44```sh
41#+begin_src sh
4542./clone_github_repos.sh
46```
43#+end_src
4744
48## Cloning from Sourcehut
49
50I haven't fully figured out how to directly incorporate Sourcehut's GraphQL API
51into a bash script yet, so this one will take two steps.
45** Cloning from Sourcehut
46:PROPERTIES:
47:CUSTOM_ID: cloning-from-sourcehut
48:END:
49I haven't fully figured out how to directly incorporate Sourcehut's
50GraphQL API into a bash script yet, so this one will take two steps.
5251
5352First, log-in to Sourcehut and go to their
54[GraphQL playground for Git](https://git.sr.ht/graphql). Next, paste the
55following query into the left box:
53[[https://git.sr.ht/graphql][GraphQL playground for Git]]. Next, paste
54the following query into the left box:
5655
57```sh
56#+begin_src sh
5857query {
5958 me {
6059 canonicalName
@@ -66,26 +65,27 @@ query {
6665 }
6766 }
6867}
69```
68#+end_src
7069
71The output on the right side will give you an object of all your repositories.
72Just grab that text and remove all the characters such as quotation marks and
73curly brackets. You will need a single-line list of space-separated values for
74the next step.
70The output on the right side will give you an object of all your
71repositories. Just grab that text and remove all the characters such as
72quotation marks and curly brackets. You will need a single-line list of
73space-separated values for the next step.
7574
7675Now let's create the bash script:
7776
78```sh
77#+begin_src sh
7978nano clone_sourcehut_repos.sh
80```
79#+end_src
8180
82Next, paste the following bash script in with the list of repositories you
83obtained above and replace `your-username` with your username.
81Next, paste the following bash script in with the list of repositories
82you obtained above and replace =your-username= with your username.
8483
85Note that this uses the SSH-based Git cloning method (e.g. `git@git...`), so
86you'll need to ensure you have set up Sourcehut with your SSH key.
84Note that this uses the SSH-based Git cloning method
85(e.g. =git@git...=), so you'll need to ensure you have set up Sourcehut
86with your SSH key.
8787
88```sh
88#+begin_src sh
8989repos=(repo1 repo2 repo3)
9090
9191# List all sub-directories in the current directory
@@ -94,36 +94,38 @@ do
9494 # Clone
9595 git clone git@git.sr.ht:~your-username/$repo
9696done
97```
97#+end_src
9898
9999Finally, save the bash script and make it executable.
100100
101```sh
101#+begin_src sh
102102chmod a+x clone_sourcehut_repos.sh
103```
103#+end_src
104104
105105Now you can run the script and should see the cloning process begin.
106106
107```sh
107#+begin_src sh
108108./clone_sourcehut_repos.sh
109```
110
111## Moving Repositories to a New Host
109#+end_src
112110
113Now that you have all of your code repositories cloned to your local computer,
114you may want to change the remote host (e.g., moving from GitHub to GitLab).
115To do this, let's create another bash script:
111** Moving Repositories to a New Host
112:PROPERTIES:
113:CUSTOM_ID: moving-repositories-to-a-new-host
114:END:
115Now that you have all of your code repositories cloned to your local
116computer, you may want to change the remote host (e.g., moving from
117GitHub to GitLab). To do this, let's create another bash script:
116118
117```sh
119#+begin_src sh
118120nano change_remote_urls.sh
119```
121#+end_src
120122
121Past the following information and be sure to change the URL information to
122whichever host you are moving to. For this example, I am looping through all of
123my cloned GitHub directories and changing them to Sourcehut (e.g.
124`<YOUR_NEW_REMOTE_URL>` -\> `git@git.sr.ht:~myusername`).
123Past the following information and be sure to change the URL information
124to whichever host you are moving to. For this example, I am looping
125through all of my cloned GitHub directories and changing them to
126Sourcehut (e.g. =<YOUR_NEW_REMOTE_URL>= -> =git@git.sr.ht:~myusername=).
125127
126```sh
128#+begin_src sh
127129# List all sub-directories in the current directory
128130for dir in */
129131do
@@ -138,16 +140,16 @@ do
138140 # Go back to main directory
139141 cd ..
140142done
141```
143#+end_src
142144
143145Finally, save the bash script and make it executable.
144146
145```sh
147#+begin_src sh
146148chmod a+x change_remote_urls.sh
147```
149#+end_src
148150
149151Now you can run the script and should see the cloning process begin.
150152
151```sh
153#+begin_src sh
152154./change_remote_urls.sh
153```
155#+end_src
blog/2021-03-28-gemini-capsule.org +129 −117
@@ -1,30 +1,29 @@
1+++
2date = 2021-03-28
3title = "Launching a Gemini Capsule"
4description = "Learn more about Gemini, an alternative internet protocol to the World Wide Web (WWW)"
5draft = false
6+++
7
8## What is Gemini?
9
10[Gemini](https://gemini.circumlunar.space/) is an internet protocol introduced
11in June 2019 as an alternative to HTTP(S) or Gopher. In layman's terms, it's an
12alternative way to browse sites (called capsules) that requires a special
13browser. Since Gemini is not standardized as an internet standard, normal web
14browsers won't be able to load a Gemini capsule.
15Instead, you'll need to use [a Gemini-specific browser](https://gemini.
16circumlunar.space/clients.html).
1#+title: Launching a Gemini Capsule
2#+date: 2021-03-28
3
4** What is Gemini?
5:PROPERTIES:
6:CUSTOM_ID: what-is-gemini
7:END:
8[[https://gemini.circumlunar.space/][Gemini]] is an internet protocol
9introduced in June 2019 as an alternative to HTTP(S) or Gopher. In
10layman's terms, it's an alternative way to browse sites (called
11capsules) that requires a special browser. Since Gemini is not
12standardized as an internet standard, normal web browsers won't be able
13to load a Gemini capsule. Instead, you'll need to use
14[[https://gemini.%20circumlunar.space/clients.html][a Gemini-specific
15browser]].
1716
1817The content found within a Gemini page is called
19[Gemtext](https://gemini.circumlunar.space/docs/cheatsheet.gmi) and is
20_extremely_ basic (on purpose).
21Gemini only processes the text, no media content like images. However,
22you're able to style 3 levels of headings, regular text, links (which will
23display on their own line), quotes, and an unordered list.
18[[https://gemini.circumlunar.space/docs/cheatsheet.gmi][Gemtext]] and is
19/extremely/ basic (on purpose). Gemini only processes the text, no media
20content like images. However, you're able to style 3 levels of headings,
21regular text, links (which will display on their own line), quotes, and
22an unordered list.
2423
2524Here's a complete listing of valid Gemtext:
2625
27```txt
26#+begin_src txt
2827# Heading 1
2928## Heading 2
3029### Heading 3
@@ -41,97 +40,109 @@ My List:
4140* Item
4241
4342```Anything between three backticks will be rendered as code.```
44```
45
46## Free Option
47
48There are probably numerous websites that allow you to create your personal
49Gemini capsule, but I'm going to focus on the two sites that I have personally
50tested. The first option below, Midnight Pub, allows you to create/edit any
51Gemini files you want in your account. This is essentially a GUI option with a
52built-in text box for editing. The second option below, Sourcehut, allows you to
53use a Git repository and automatic build process to deploy your personal Gemini
54capsule every time you push a commit.
55
56### Midnight Pub - Beginner Friendly
57
58[Midnight Pub](https://midnight.pub/) is a small, virtual community meant to
59reflect the atmosphere of wandering into a small alley pub. The site is built in
60Gemtext and has a server-side process to convert Gemtext to HTML if someone
61loads the site in an HTTP(S) browser.
62
63To create an account, you'll need to email the owner of the website to obtain a
64key.
65You can find their email on the Midnight Pub homepage.
66Once registered, head to [your account](https://midnight.pub/account) and select
67[manage site](https://midnight.pub/site). This is the screen where you can
68upload or create any files to be displayed on the internet.
69
70For example, I've created both an HTML file and a Gemini file. Remember that
71Gemini is automatically converted to HTML on the Pub, so you don't need an HTML
72version.
73For example, I created an HTML version to add in some extra styling.
74
75All you need to do is create a page like `index.gmi` and use your Gemini browser
76to head over to your-username.midnight.pub to see the result.
77
78That's all there is to it! Easy enough, right? Let's check out a more advanced
79version in the next section.
80
81## Paid Option
82
83As of 2021, Sourcehut has decided to require users to have a paid account in
84order to utilize their automated build system. For now, paid accounts can be as
85low as $2/month.
86
87### Sourcehut
88
89[Sourcehut](https://sourcehut.org/) is a collection of software development
90tools, but mostly surrounds their hosted Git repository service. Simply put,
91it's a minimal and more private alternative to services like GitHub.
92
93This walkthrough is more advanced and involves things like Git, SSH, the command
94line. If you don't think you know enough to do this, check out my walkthrough on
95creating a Gemini capsule for the Midnight Pub instead.
96
97The first thing you'll need to do is create an SSH key pair, if you don't
98already have one on your system. Once created, grab the contents of `id_rsa.pub`
99and add it to your Sourcehut account settings - this will allow you to push and
100pull code changes without using a username/password.
101
102```sh
43#+end_src
44
45** Free Option
46:PROPERTIES:
47:CUSTOM_ID: free-option
48:END:
49There are probably numerous websites that allow you to create your
50personal Gemini capsule, but I'm going to focus on the two sites that I
51have personally tested. The first option below, Midnight Pub, allows you
52to create/edit any Gemini files you want in your account. This is
53essentially a GUI option with a built-in text box for editing. The
54second option below, Sourcehut, allows you to use a Git repository and
55automatic build process to deploy your personal Gemini capsule every
56time you push a commit.
57
58*** Midnight Pub - Beginner Friendly
59:PROPERTIES:
60:CUSTOM_ID: midnight-pub---beginner-friendly
61:END:
62[[https://midnight.pub/][Midnight Pub]] is a small, virtual community
63meant to reflect the atmosphere of wandering into a small alley pub. The
64site is built in Gemtext and has a server-side process to convert
65Gemtext to HTML if someone loads the site in an HTTP(S) browser.
66
67To create an account, you'll need to email the owner of the website to
68obtain a key. You can find their email on the Midnight Pub homepage.
69Once registered, head to [[https://midnight.pub/account][your account]]
70and select [[https://midnight.pub/site][manage site]]. This is the
71screen where you can upload or create any files to be displayed on the
72internet.
73
74For example, I've created both an HTML file and a Gemini file. Remember
75that Gemini is automatically converted to HTML on the Pub, so you don't
76need an HTML version. For example, I created an HTML version to add in
77some extra styling.
78
79All you need to do is create a page like =index.gmi= and use your Gemini
80browser to head over to your-username.midnight.pub to see the result.
81
82That's all there is to it! Easy enough, right? Let's check out a more
83advanced version in the next section.
84
85** Paid Option
86:PROPERTIES:
87:CUSTOM_ID: paid-option
88:END:
89As of 2021, Sourcehut has decided to require users to have a paid
90account in order to utilize their automated build system. For now, paid
91accounts can be as low as $2/month.
92
93*** Sourcehut
94:PROPERTIES:
95:CUSTOM_ID: sourcehut
96:END:
97[[https://sourcehut.org/][Sourcehut]] is a collection of software
98development tools, but mostly surrounds their hosted Git repository
99service. Simply put, it's a minimal and more private alternative to
100services like GitHub.
101
102This walkthrough is more advanced and involves things like Git, SSH, the
103command line. If you don't think you know enough to do this, check out
104my walkthrough on creating a Gemini capsule for the Midnight Pub
105instead.
106
107The first thing you'll need to do is create an SSH key pair, if you
108don't already have one on your system. Once created, grab the contents
109of =id_rsa.pub= and add it to your Sourcehut account settings - this
110will allow you to push and pull code changes without using a
111username/password.
112
113#+begin_src sh
103114ssh keygen
104```
115#+end_src
105116
106Next up, let's create a repository with the proper name so that the Sourcehut
107build system will know we want them to host a website for us. Use the following
108format exactly:
117Next up, let's create a repository with the proper name so that the
118Sourcehut build system will know we want them to host a website for us.
119Use the following format exactly:
109120
110```sh
121#+begin_src sh
111122mkdir your-username.srht.site && cd your-username.srht.site
112```
123#+end_src
113124
114Now that we've created the repo, let's initialize Git and add the proper remote
115URL.
125Now that we've created the repo, let's initialize Git and add the proper
126remote URL.
116127
117```sh
128#+begin_src sh
118129git init
119```
130#+end_src
120131
121```sh
132#+begin_src sh
122133git remote add origin git@git.sr.ht:~your-username/your-username.srht.site
123```
134#+end_src
124135
125Now that our repository is set up and configured, we will need to create at
126least two files:
136Now that our repository is set up and configured, we will need to create
137at least two files:
127138
128- `index.gmi`
129- `.build.yml`
139- =index.gmi=
140- =.build.yml=
130141
131For your `.build.yml` file, use the following content and be sure to update the
132`site` line with your username!
142For your =.build.yml= file, use the following content and be sure to
143update the =site= line with your username!
133144
134```yaml
145#+begin_src yaml
135146image: alpine/latest
136147oauth: pages.sr.ht/PAGES:RW
137148environment:
@@ -142,37 +153,38 @@ tasks:
142153 tar -cvz . > ../site.tar.gz
143154 - upload: |
144155 acurl -f https://pages.sr.ht/publish/$site -Fcontent=@site.tar.gz -Fprotocol=GEMINI
145```
156#+end_src
146157
147For the `index.gmi` file, put whatever you want in there and save it. You could
148even just copy and paste the Gemtext cheatsheet.
158For the =index.gmi= file, put whatever you want in there and save it.
159You could even just copy and paste the Gemtext cheatsheet.
149160
150If you want to serve both HTML and Gemini files from this repository, just add a
151second command to the `upload` section:
161If you want to serve both HTML and Gemini files from this repository,
162just add a second command to the =upload= section:
152163
153```yaml
164#+begin_src yaml
154165- upload: |
155166 acurl -f https://pages.sr.ht/publish/$site -Fcontent=@site.tar.gz -Fprotocol=GEMINI
156167 acurl -f https://pages.sr.ht/publish/$site -Fcontent=@site.tar.gz
157```
168#+end_src
158169
159170Lastly, commit your changes and push them to the remote repo.
160171
161```sh
172#+begin_src sh
162173git add .; git commit -m "initial commit"; git push --set-upstream origin HEAD
163```
174#+end_src
164175
165If you've successfully created the files with the proper format, you'll see the
166terminal print a message that lets you know where the automatic build is taking
167place. For example, here's what the terminal tells me:
176If you've successfully created the files with the proper format, you'll
177see the terminal print a message that lets you know where the automatic
178build is taking place. For example, here's what the terminal tells me:
168179
169```sh
180#+begin_src sh
170181remote: Build started:
171182remote: https://builds.sr.ht/~user/job/689803 [.build.yml]
172```
183#+end_src
173184
174185Now that you've properly built your Sourcehut page, you can browse to
175your-username.srht.site in a Gemini browser and view the final results. Take a
176look at the image below for my Sourcehut Gemini capsule.
186your-username.srht.site in a Gemini browser and view the final results.
187Take a look at the image below for my Sourcehut Gemini capsule.
177188
178![Gemini page on the amfora browser](https://img.cleberg.net/blog/20210328-launching-a-gemini-capsule/amfora.png)
189#+caption: Gemini page on the amfora browser
190[[https://img.cleberg.net/blog/20210328-launching-a-gemini-capsule/amfora.png]]
blog/2021-03-28-vaporwave-vs-outrun.org +151 −120
@@ -1,120 +1,151 @@
1+++
2date = 2021-03-28
3title = "Vaporwave vs Outrun"
4description = "This post discusses Vaporwave and Outrun, which have become almost synonymous in the minds of those online who aren't hardcore into these genres of media."
5+++
6
7## Overview
8
9When it comes to an aesthetic that originated primarily online, there tends to
10be a lot of confusion around what falls into each specific genre. This post
11discusses Vaporwave and Outrun, which have become almost synonymous in the minds
12of those online who aren't hardcore into these genres of media. More
13specifically, Outrun is largely an unknown term while all aesthetics in these
14two genres are usually attributed to Vaporwave. For example, take a look at the
15image search results for Vaporwave: the results include **a lot** of
16Outrun-themed images. You'll find a similar trend almost everywhere.
17
18![](https://img.cleberg.net/blog/20210328-vaporwave-vs-outrun/vaporwave-search-results.png)
19
20## Vaporwave
21
22![](https://img.cleberg.net/blog/20210328-vaporwave-vs-outrun/macintosh-plus.png)
23
24Okay, so what is Vaporwave? I'm going to just copy-and-paste some general info
25from the Wikipedia article on
26[Vaporwave](https://en.wikipedia.org/wiki/Vaporwave), so that I'm not repeating
27everything you can already search for online:
28
29> Vaporwave is a microgenre of electronic music, a visual art style, and an
30> Internet meme that emerged in the early 2010s. It is defined partly by its
31> slowed-down, chopped and screwed samples of smooth jazz, elevator, R&B, and
32> lounge music from the 1980s and 1990s. The surrounding subculture is sometimes
33> associated with an ambiguous or satirical take on consumer capitalism and pop
34> culture, and tends to be characterized by a nostalgic or surrealist engagement
35> with the popular entertainment, technology and advertising of previous
36> decades. Visually, it incorporates early Internet imagery, late 1990s web
37> design, glitch art, anime, 3D-rendered objects, and cyberpunk tropes in its
38> cover artwork and music videos.
39
40This is an excellent summary, and it helps address my point here: there are
41specific aspects that make Vaporwave unique:
42
43### Time Frame
44
45The time frame for references, logos, etc. focuses mostly on the 1990s in
46Vaporwave. You'll see old school Pepsi logos, Microsoft 95 screens, tropical
47plants, classic marble sculptures, and many references from Japan's influence in
48the 90s.
49
50### Art
51
52The color scheme is generally a soft, light palette that uses pastel colors. The
53backdrop will often be in a light-pink or teal blue.
54
55### Music
56
57The musical genre of Vaporwave incorporates soft tunes, lounge music, and sound
58effects that will make the listener reminisce of the 90s. The sounds of the
59genre are generally slower-paced and calming. The major breakthrough artist for
60Vaporwave was [Macintosh Plus](https://en.wikipedia.org/wiki/Vektroid), who
61released the album
62[Floral Shoppe](https://archive.org/details/MACINTOSHPLUS-FLORALSHOPPE_complete)
63in 2011. Another more recent example is the artist
64[sadbert](https://sadbert.bandcamp.com/), whose latest album incorporates the
65upbeat tones of the 1999 Dilbert TV series.
66
67Notice that Vaporwave doesn't include things like racing cars, futuristic
68technology, chrome, or the deep orange/purple color scheme. Vaporwave is a focus
69on the idyllic state of the world when technology was becoming common in
70households, a reality that we have already experienced. Focus on the most
71aesthetically-pleasing parts of that past is a large part of Vaporwave.
72
73## Outrun
74
75![Outrun](https://img.cleberg.net/blog/20210328-vaporwave-vs-outrun/outrun.png)
76
77Now, let's get to Outrun. This one is a little trickier since the genre has
78largely been lumped under the Vaporwave title for so long. However, it stems
79from the [Synthwave](https://en.wikipedia.org/wiki/Synthwave) music genre and is
80likely named after the 1986 racer game,
81[Out Run](https://en.wikipedia.org/wiki/Out_Run).
82
83### Time Frame
84
85Outrun can be thought of as a retro-futuristic aesthetic born from the 1980s.
86
87### Art
88
89The color scheme uses a very dark color palette with the main colors being deep
90oranges, blues, and purples. Red edges are common around objects in Outrun art.
91The background of the Outrun aesthetic is almost always a neon grid like you'd
92expect to see in Tron or a 1980s arcade machine.
93
94Classic sports cars, chrome robots, computer generated graphics and fonts, and
95the occasional use of rain or palm trees can be found in Outrun art.
96
97### Music
98
99This aesthetic has a more aggressive and fast-paced style of music, which tends
100to match the subject of the art in this aesthetic.
101
102Outrun enthusiasts love what people in the 1980s thought the future would look
103like. Take a look at a common video game discussed in Outrun circles, Far Cry 3:
104Blood Dragon:
105
106![Fry Cry 3: Blood Dragon](https://img.cleberg.net/blog/20210328-vaporwave-vs-outrun/far-cry.png)
107
108Another example that doesn't force the color scheme as hard as some online art
109does is Kung Fury:
110
111![Kung Fury](https://img.cleberg.net/blog/20210328-vaporwave-vs-outrun/kung-fury.png)
112
113![Kung Fury Hacker Scene](https://img.cleberg.net/blog/20210328-vaporwave-vs-outrun/kung-fury-hacker.png)
114
115## Conclusion
116
117While Vaporwave and Outrun share similarities, they are two distinct aesthetics
118with many important distinctions. Someone who enjoys one may not necessarily
119enjoy the other, so it's important to make sure we properly describe the
120aesthetic we're looking for.
1#+title: Vaporwave vs Outrun
2#+date: 2021-03-28
3
4** Overview
5:PROPERTIES:
6:CUSTOM_ID: overview
7:END:
8When it comes to an aesthetic that originated primarily online, there
9tends to be a lot of confusion around what falls into each specific
10genre. This post discusses Vaporwave and Outrun, which have become
11almost synonymous in the minds of those online who aren't hardcore into
12these genres of media. More specifically, Outrun is largely an unknown
13term while all aesthetics in these two genres are usually attributed to
14Vaporwave. For example, take a look at the image search results for
15Vaporwave: the results include *a lot* of Outrun-themed images. You'll
16find a similar trend almost everywhere.
17
18[[https://img.cleberg.net/blog/20210328-vaporwave-vs-outrun/vaporwave-search-results.png]]
19
20** Vaporwave
21:PROPERTIES:
22:CUSTOM_ID: vaporwave
23:END:
24[[https://img.cleberg.net/blog/20210328-vaporwave-vs-outrun/macintosh-plus.png]]
25
26Okay, so what is Vaporwave? I'm going to just copy-and-paste some
27general info from the Wikipedia article on
28[[https://en.wikipedia.org/wiki/Vaporwave][Vaporwave]], so that I'm not
29repeating everything you can already search for online:
30
31#+begin_quote
32Vaporwave is a microgenre of electronic music, a visual art style, and
33an Internet meme that emerged in the early 2010s. It is defined partly
34by its slowed-down, chopped and screwed samples of smooth jazz,
35elevator, R&B, and lounge music from the 1980s and 1990s. The
36surrounding subculture is sometimes associated with an ambiguous or
37satirical take on consumer capitalism and pop culture, and tends to be
38characterized by a nostalgic or surrealist engagement with the popular
39entertainment, technology and advertising of previous decades. Visually,
40it incorporates early Internet imagery, late 1990s web design, glitch
41art, anime, 3D-rendered objects, and cyberpunk tropes in its cover
42artwork and music videos.
43
44#+end_quote
45
46This is an excellent summary, and it helps address my point here: there
47are specific aspects that make Vaporwave unique:
48
49*** Time Frame
50:PROPERTIES:
51:CUSTOM_ID: time-frame
52:END:
53The time frame for references, logos, etc. focuses mostly on the 1990s
54in Vaporwave. You'll see old school Pepsi logos, Microsoft 95 screens,
55tropical plants, classic marble sculptures, and many references from
56Japan's influence in the 90s.
57
58*** Art
59:PROPERTIES:
60:CUSTOM_ID: art
61:END:
62The color scheme is generally a soft, light palette that uses pastel
63colors. The backdrop will often be in a light-pink or teal blue.
64
65*** Music
66:PROPERTIES:
67:CUSTOM_ID: music
68:END:
69The musical genre of Vaporwave incorporates soft tunes, lounge music,
70and sound effects that will make the listener reminisce of the 90s. The
71sounds of the genre are generally slower-paced and calming. The major
72breakthrough artist for Vaporwave was
73[[https://en.wikipedia.org/wiki/Vektroid][Macintosh Plus]], who released
74the album
75[[https://archive.org/details/MACINTOSHPLUS-FLORALSHOPPE_complete][Floral
76Shoppe]] in 2011. Another more recent example is the artist
77[[https://sadbert.bandcamp.com/][sadbert]], whose latest album
78incorporates the upbeat tones of the 1999 Dilbert TV series.
79
80Notice that Vaporwave doesn't include things like racing cars,
81futuristic technology, chrome, or the deep orange/purple color scheme.
82Vaporwave is a focus on the idyllic state of the world when technology
83was becoming common in households, a reality that we have already
84experienced. Focus on the most aesthetically-pleasing parts of that past
85is a large part of Vaporwave.
86
87** Outrun
88:PROPERTIES:
89:CUSTOM_ID: outrun
90:END:
91#+caption: Outrun
92[[https://img.cleberg.net/blog/20210328-vaporwave-vs-outrun/outrun.png]]
93
94Now, let's get to Outrun. This one is a little trickier since the genre
95has largely been lumped under the Vaporwave title for so long. However,
96it stems from the [[https://en.wikipedia.org/wiki/Synthwave][Synthwave]]
97music genre and is likely named after the 1986 racer game,
98[[https://en.wikipedia.org/wiki/Out_Run][Out Run]].
99
100*** Time Frame
101:PROPERTIES:
102:CUSTOM_ID: time-frame-1
103:END:
104Outrun can be thought of as a retro-futuristic aesthetic born from the
1051980s.
106
107*** Art
108:PROPERTIES:
109:CUSTOM_ID: art-1
110:END:
111The color scheme uses a very dark color palette with the main colors
112being deep oranges, blues, and purples. Red edges are common around
113objects in Outrun art. The background of the Outrun aesthetic is almost
114always a neon grid like you'd expect to see in Tron or a 1980s arcade
115machine.
116
117Classic sports cars, chrome robots, computer generated graphics and
118fonts, and the occasional use of rain or palm trees can be found in
119Outrun art.
120
121*** Music
122:PROPERTIES:
123:CUSTOM_ID: music-1
124:END:
125This aesthetic has a more aggressive and fast-paced style of music,
126which tends to match the subject of the art in this aesthetic.
127
128Outrun enthusiasts love what people in the 1980s thought the future
129would look like. Take a look at a common video game discussed in Outrun
130circles, Far Cry 3: Blood Dragon:
131
132#+caption: Fry Cry 3: Blood Dragon
133[[https://img.cleberg.net/blog/20210328-vaporwave-vs-outrun/far-cry.png]]
134
135Another example that doesn't force the color scheme as hard as some
136online art does is Kung Fury:
137
138#+caption: Kung Fury
139[[https://img.cleberg.net/blog/20210328-vaporwave-vs-outrun/kung-fury.png]]
140
141#+caption: Kung Fury Hacker Scene
142[[https://img.cleberg.net/blog/20210328-vaporwave-vs-outrun/kung-fury-hacker.png]]
143
144** Conclusion
145:PROPERTIES:
146:CUSTOM_ID: conclusion
147:END:
148While Vaporwave and Outrun share similarities, they are two distinct
149aesthetics with many important distinctions. Someone who enjoys one may
150not necessarily enjoy the other, so it's important to make sure we
151properly describe the aesthetic we're looking for.
blog/2021-03-30-vps-web-server.org +295 −262
@@ -1,270 +1,293 @@
1+++
2date = 2021-03-30
3title = "How to Set Up a VPS Web Server"
4description = "Choosing a place to host a website is one of the most confusing decisions for beginner web developers. Even for experienced web devs, choosing between different forms of web hosting can be a daunting choice."
5draft = false
6+++
7
8## Shared Hosting vs. VPS
9
10Choosing a place to host a website is one of the most confusing decisions for
11beginner web developers. Even for experienced web devs, choosing between
12different forms of web hosting can be a daunting choice.
1#+title: How to Set Up a VPS Web Server
2#+date: 2021-03-30
3
4** Shared Hosting vs. VPS
5:PROPERTIES:
6:CUSTOM_ID: shared-hosting-vs.-vps
7:END:
8Choosing a place to host a website is one of the most confusing
9decisions for beginner web developers. Even for experienced web devs,
10choosing between different forms of web hosting can be a daunting
11choice.
1312
1413First, let's take a look at
15[shared web hosting](https://en.wikipedia.org/wiki/Shared_web_hosting_service).
16Shared web hosting is a product where you are purchasing a small piece of a web
17server that is being shared between many websites. As a result, the cost of
18shared hosting is extremely low. You won't have access to the server itself,
19which means you can't install your own software on the server, such as Docker.
20Usually, you are simply allowed to connect your domains to the server, set up
21domain security, and other small utilities.
14[[https://en.wikipedia.org/wiki/Shared_web_hosting_service][shared web
15hosting]]. Shared web hosting is a product where you are purchasing a
16small piece of a web server that is being shared between many websites.
17As a result, the cost of shared hosting is extremely low. You won't have
18access to the server itself, which means you can't install your own
19software on the server, such as Docker. Usually, you are simply allowed
20to connect your domains to the server, set up domain security, and other
21small utilities.
2222
2323In contrast, a
24[virtual private server](https://en.wikipedia.org/wiki/Virtual_private_server)
25(VPS) is a virtual machine that replicates the environment of having a dedicated
26server to yourself. You are able to control the virtual server's host names,
27base file system, package manager, etc. Another great upside of a VPS is that
28since it's virtual, the company providing the VPS can dynamically increase the
29disk size, RAM size, or number of CPUs at any time. However, the virtual server
30is still physically located on a server that is shared between multiple virtual
24[[https://en.wikipedia.org/wiki/Virtual_private_server][virtual private
25server]] (VPS) is a virtual machine that replicates the environment of
26having a dedicated server to yourself. You are able to control the
27virtual server's host names, base file system, package manager, etc.
28Another great upside of a VPS is that since it's virtual, the company
29providing the VPS can dynamically increase the disk size, RAM size, or
30number of CPUs at any time. However, the virtual server is still
31physically located on a server that is shared between multiple virtual
3132servers.
3233
33The choice between shared hosting and VPS mostly depends on your skill level
34with system administration. If you're comforting working on a server that is
35mostly left up to you (or you're willing to learn), then a VPS is usually a
36better option. However, shared hosting is a fantastic option for people who
37don't want to have to learn how to manage their server.
38
39## My Situation
34The choice between shared hosting and VPS mostly depends on your skill
35level with system administration. If you're comforting working on a
36server that is mostly left up to you (or you're willing to learn), then
37a VPS is usually a better option. However, shared hosting is a fantastic
38option for people who don't want to have to learn how to manage their
39server.
4040
41I had used shared hosting for approximately 5 years before trying my first VPS.
42I manage a homelab and have had success running a server and performing typical
43sysadmin duties, but I was still hesitant to get a VPS. One fear was that I
44always struggled to properly set up the networking part of a server - DNS and
45hostname configurations were not my friend.
41** My Situation
42:PROPERTIES:
43:CUSTOM_ID: my-situation
44:END:
45I had used shared hosting for approximately 5 years before trying my
46first VPS. I manage a homelab and have had success running a server and
47performing typical sysadmin duties, but I was still hesitant to get a
48VPS. One fear was that I always struggled to properly set up the
49networking part of a server - DNS and hostname configurations were not
50my friend.
4651
4752As a little bit of background, I originally used
48[Siteground](https://www.siteground.com) for my initially shared hosting and
49stayed on that platform for at least a year. However, the UI was clunky, and I
50didn't like how they handled certain technical aspects, so I switched to
51[Namecheap](https://www.namecheap.com). Namecheap was great because it is the
52service I primarily use for purchasing domain names, which made it incredibly
53easy to link them to my hosting service. However, it was still mediocre shared
54hosting, and Namecheap is notorious for not letting you use
55[Let's Encrypt](https://letsencrypt.org) to obtain free SSL/TLS certificates;
56Namecheap wants to make you purchase certificates through their store.
57
58Finally, I settled down with [iWebFusion](https://www.iwebfusion.net) for about
59the last year of my shared hosting. This service was pretty great, came with
60free SSL/TLS, and I never had any complaints.
61
62However, I finally grew tired of not being able to install software on my own
63web server. I wanted to be able to try out things like
64[Postmill](https://postmill.xyz) or [Matrix](https://matrix.org). This is
65possible with a VPS, so I decided to grab a new domain name to try it out.
66
67## Getting Started: Buying a VPS
68
69The first step to moving over to a VPS is (you guessed it): finding a VPS
70provider. For my VPSs, I use [1984](https://1984hosting.com) and prefer their
71services much more than any alternative, due to their location (Iceland), their
72[privacy policy](https://1984hosting.com/GDPR/), their respect for GDPR, and the
73ability to remain anonymous if you pay in Bitcoin or Monero.
74
75[Njalla](https://njal.la) is another good, privacy-oriented option for VPS
76services.
77
78You'll have to decide what specifications you want on your VPS. For me, I only
79build and deploy low-resource HTML, PHP, and Python websites. This means I can
80survive on the smallest VPS: 1 CPU, 1GB of RAM, and 25GB SSD for $5.00 per
81month.
82
83As noted above, the great thing about a VPS is you can request your provider to
84increase the resources at any time.
85
86## Configuring DNS Settings
87
88Okay, so now let's get into some actual work that has to be done to get content
89moved from a shared host to a VPS. At this point, I'm assuming you have a shared
90host with website content that you can still access, and you've purchased a new
91VPS and can SSH into that server.
53[[https://www.siteground.com][Siteground]] for my initially shared
54hosting and stayed on that platform for at least a year. However, the UI
55was clunky, and I didn't like how they handled certain technical
56aspects, so I switched to [[https://www.namecheap.com][Namecheap]].
57Namecheap was great because it is the service I primarily use for
58purchasing domain names, which made it incredibly easy to link them to
59my hosting service. However, it was still mediocre shared hosting, and
60Namecheap is notorious for not letting you use
61[[https://letsencrypt.org][Let's Encrypt]] to obtain free SSL/TLS
62certificates; Namecheap wants to make you purchase certificates through
63their store.
64
65Finally, I settled down with [[https://www.iwebfusion.net][iWebFusion]]
66for about the last year of my shared hosting. This service was pretty
67great, came with free SSL/TLS, and I never had any complaints.
68
69However, I finally grew tired of not being able to install software on
70my own web server. I wanted to be able to try out things like
71[[https://postmill.xyz][Postmill]] or [[https://matrix.org][Matrix]].
72This is possible with a VPS, so I decided to grab a new domain name to
73try it out.
74
75** Getting Started: Buying a VPS
76:PROPERTIES:
77:CUSTOM_ID: getting-started-buying-a-vps
78:END:
79The first step to moving over to a VPS is (you guessed it): finding a
80VPS provider. For my VPSs, I use [[https://1984hosting.com][1984]] and
81prefer their services much more than any alternative, due to their
82location (Iceland), their [[https://1984hosting.com/GDPR/][privacy
83policy]], their respect for GDPR, and the ability to remain anonymous if
84you pay in Bitcoin or Monero.
85
86[[https://njal.la][Njalla]] is another good, privacy-oriented option for
87VPS services.
88
89You'll have to decide what specifications you want on your VPS. For me,
90I only build and deploy low-resource HTML, PHP, and Python websites.
91This means I can survive on the smallest VPS: 1 CPU, 1GB of RAM, and
9225GB SSD for $5.00 per month.
93
94As noted above, the great thing about a VPS is you can request your
95provider to increase the resources at any time.
96
97** Configuring DNS Settings
98:PROPERTIES:
99:CUSTOM_ID: configuring-dns-settings
100:END:
101Okay, so now let's get into some actual work that has to be done to get
102content moved from a shared host to a VPS. At this point, I'm assuming
103you have a shared host with website content that you can still access,
104and you've purchased a new VPS and can SSH into that server.
92105
93106The first change is minor, but it should be done immediately in order to
94get things moving: DNS settings. Go to wherever your DNS settings are handled.
95If your shared host also managed your DNS settings, you'll need to first move
96that DNS over to your new VPS provider. For me, I route my DNS through
97[Gandi](https://www.gandi.net).
107get things moving: DNS settings. Go to wherever your DNS settings are
108handled. If your shared host also managed your DNS settings, you'll need
109to first move that DNS over to your new VPS provider. For me, I route my
110DNS through [[https://www.gandi.net][Gandi]].
98111
99Once you know where your DNS settings are, go ahead and update the `A` records
100to match the public IP address of your VPS. For example:
112Once you know where your DNS settings are, go ahead and update the =A=
113records to match the public IP address of your VPS. For example:
101114
102```txt
115#+begin_src txt
103116A example.com xxx.xxx.xxx.xxx
104117A subdomain xxx.xxx.xxx.xxx
105118CNAME www example.com.
106```
107
108If you have any other records that require updates, such as MX or TXT records
109for a mail server, be sure to update those accordingly. Personally, I don't host
110my own mail server.
111I route all mail on my custom domains to [Migadu](https://www.migadu.com).
112Hosting your own email server can become complex quickly and is not for
113beginners.
114
115DNS changes can take up to 48 hours to propagate, so be sure to give it some
116time before assuming you've made an error.
117
118## Server Updates and Packages
119
120Now that the DNS settings have been changed, let's set up our server while we
121wait for the DNS to propagate.
122First up is to ssh into your server.
123If you've signed up with a service like DigitalOcean, you can add your SSH
124key to your account and to your VPS droplet so that you don't need a
125password in order to SSH.
126
127```sh
119#+end_src
120
121If you have any other records that require updates, such as MX or TXT
122records for a mail server, be sure to update those accordingly.
123Personally, I don't host my own mail server. I route all mail on my
124custom domains to [[https://www.migadu.com][Migadu]]. Hosting your own
125email server can become complex quickly and is not for beginners.
126
127DNS changes can take up to 48 hours to propagate, so be sure to give it
128some time before assuming you've made an error.
129
130** Server Updates and Packages
131:PROPERTIES:
132:CUSTOM_ID: server-updates-and-packages
133:END:
134Now that the DNS settings have been changed, let's set up our server
135while we wait for the DNS to propagate. First up is to ssh into your
136server. If you've signed up with a service like DigitalOcean, you can
137add your SSH key to your account and to your VPS droplet so that you
138don't need a password in order to SSH.
139
140#+begin_src sh
128141ssh root@xxx.xxx.xxx.xxx
129```
142#+end_src
130143
131The VPS that is used in this blog post runs Ubuntu 20.04 with an Apache web
132server.
133If you're working on a different operating system (OS) or want a
134different web server, such as Nginx, you'll have to use different commands
135to set it up.
144The VPS that is used in this blog post runs Ubuntu 20.04 with an Apache
145web server. If you're working on a different operating system (OS) or
146want a different web server, such as Nginx, you'll have to use different
147commands to set it up.
136148
137149First, let's update and upgrade our server.
138150
139**NOTE:** Since we have logged in to the server as `root` for now, we don't need
140to use the `sudo` modifier before our commands.
151*NOTE:* Since we have logged in to the server as =root= for now, we
152don't need to use the =sudo= modifier before our commands.
141153
142```sh
154#+begin_src sh
143155apt update && apt upgrade -y
144```
145
146## Create A User Account
156#+end_src
147157
148While being able to use `root` can be beneficial at times, you shouldn't use
149`root` unless you have to.
158** Create A User Account
159:PROPERTIES:
160:CUSTOM_ID: create-a-user-account
161:END:
162While being able to use =root= can be beneficial at times, you shouldn't
163use =root= unless you have to.
150164
151So let's set up a new user in our system. The `-m` option below tells the OS to
152create a home directory for the new user.
165So let's set up a new user in our system. The =-m= option below tells
166the OS to create a home directory for the new user.
153167
154```sh
168#+begin_src sh
155169adduser USERNAME
156```
170#+end_src
157171
158172Now, create a password for that user.
159173
160```sh
174#+begin_src sh
161175passwd USERNAME
162```
176#+end_src
163177
164Finally, add the user to the sudoers file, so they can perform priveleged
165commands.
178Finally, add the user to the sudoers file, so they can perform
179priveleged commands.
166180
167```sh
181#+begin_src sh
168182usermod -a -G sudo USERNAME
169```
183#+end_src
170184
171If you are using SSH keys and not passwords, you'll need to copy your SSH key
172from your local machine to the VPS. If you haven't disabled password-based SSH
173yet, the easiest way to do this is `ssh-copy-id` from your local computer (not
174from the VPS):
185If you are using SSH keys and not passwords, you'll need to copy your
186SSH key from your local machine to the VPS. If you haven't disabled
187password-based SSH yet, the easiest way to do this is =ssh-copy-id= from
188your local computer (not from the VPS):
175189
176```sh
190#+begin_src sh
177191ssh-copy-id testuser@xxx.xxx.xxx.xxx
178```
192#+end_src
179193
180If you've disabled password-based SSH, you'll need to manually copy your SSH key
181into the `~/.ssh/authorized_keys` file.
194If you've disabled password-based SSH, you'll need to manually copy your
195SSH key into the =~/.ssh/authorized_keys= file.
182196
183## Install Software
197** Install Software
198:PROPERTIES:
199:CUSTOM_ID: install-software
200:END:
201Our goal here is to host a web server, so the next step is to install
202the Apache web server and any other packages we need.
184203
185Our goal here is to host a web server, so the next step is to install the Apache
186web server and any other packages we need.
204From this point on, I will be logged in as a user (not =root=) and will
205need to use the =sudo= modifier for most commands.
187206
188From this point on, I will be logged in as a user (not `root`) and will need to
189use the `sudo` modifier for most commands.
190
191```sh
207#+begin_src sh
192208sudo apt update; sudo apt upgrade -y; sudo apt autoremove -y
193209sudo apt install apache2
194```
210#+end_src
195211
196If you need other language support, such as PHP, you'll need to install that
197too.
212If you need other language support, such as PHP, you'll need to install
213that too.
198214
199```sh
215#+begin_src sh
200216sudo apt install libapache2-mod-php php-dom
201217sudo a2enmod php
202218sudo systemctl restart apache2
203```
204
205## Website Files & Folders
219#+end_src
206220
207Next up is to create the directories for the domain(s) we want to be hosted on
208this web server.
221** Website Files & Folders
222:PROPERTIES:
223:CUSTOM_ID: website-files-folders
224:END:
225Next up is to create the directories for the domain(s) we want to be
226hosted on this web server.
209227
210```sh
228#+begin_src sh
211229cd /var/www
212230sudo mkdir example.com
213```
231#+end_src
214232
215We have a folder for `example.com` now, so let's add an `index.html` file and
216put it within a specific `public_html` folder. You don't need this `public_html`
217if you don't want it, but it helps with organizing items related to
218`example.com` that you don't want to publish to the internet.
233We have a folder for =example.com= now, so let's add an =index.html=
234file and put it within a specific =public_html= folder. You don't need
235this =public_html= if you don't want it, but it helps with organizing
236items related to =example.com= that you don't want to publish to the
237internet.
219238
220```sh
239#+begin_src sh
221240cd example.com
222241sudo mkdir public_html && cd public_html
223242sudo nano index.html
224```
243#+end_src
225244
226You can put anything you want in this `index.html` file. If you can't think of
227anything, paste this in there:
245You can put anything you want in this =index.html= file. If you can't
246think of anything, paste this in there:
228247
229```html
248#+begin_src html
230249<!DOCTYPE html>
231250<html lang="en">
232 <head>
233 <meta charset="utf-8" />
234 <meta name="viewport" content="width=device-width, initial-scale=1" />
235 <title>Hello, world!</title>
236 </head>
237 <body>
238 <h1>Hello, world!</h1>
239 </body>
251 <head>
252 <meta charset="utf-8" />
253 <meta name="viewport" content="width=device-width, initial-scale=1" />
254 <title>Hello, world!</title>
255 </head>
256 <body>
257 <h1>Hello, world!</h1>
258 </body>
240259</html>
241```
260#+end_src
242261
243If you want something to be served at `example.com/page01/file.txt`, you'll have
244to create the `page01` directory under the `example.com` directory. For example:
262If you want something to be served at =example.com/page01/file.txt=,
263you'll have to create the =page01= directory under the =example.com=
264directory. For example:
245265
246```sh
266#+begin_src sh
247267cd /var/www/example.com/public_html
248268sudo mkdir page01
249269sudo nano file.txt
250```
270#+end_src
251271
252## Apache Configuration
272** Apache Configuration
273:PROPERTIES:
274:CUSTOM_ID: apache-configuration
275:END:
276Now, let's set up the files that will tell the server where to find the
277files for =example.com=. We will copy the default configuration file and
278create our own.
253279
254Now, let's set up the files that will tell the server where to find the files
255for `example.com`. We will copy the default configuration file and create our
256own.
257
258```sh
280#+begin_src sh
259281cd /etc/apache2/sites-available
260282sudo cp 000-default.conf example.com.conf
261283sudo nano example.com.conf
262```
284#+end_src
263285
264This configuration file will have a few default lines, but you'll need to edit
265it to look similar to this (settings may change based on your personal needs):
286This configuration file will have a few default lines, but you'll need
287to edit it to look similar to this (settings may change based on your
288personal needs):
266289
267```config
290#+begin_src config
268291<VirtualHost *:80>
269292 ServerAdmin your-email@email-provider.com
270293 ServerName example.com
@@ -273,128 +296,138 @@ it to look similar to this (settings may change based on your personal needs):
273296 ErrorLog ${APACHE_LOG_DIR}/error.log
274297 CustomLog ${APACHE_LOG_DIR}/access.log combined
275298</VirtualHost>
276```
299#+end_src
277300
278301Now, enable the configuration for your new site, disable the default
279302configuration, and reload the web server.
280303
281```sh
304#+begin_src sh
282305sudo a2ensite example.com.conf
283306sudo a2dissite 000-default.conf
284307sudo systemctl reload apache2
285```
308#+end_src
286309
287You can always run a test to make sure no errors or warnings are found in your
288configuration files.
310You can always run a test to make sure no errors or warnings are found
311in your configuration files.
289312
290```sh
313#+begin_src sh
291314sudo apache2ctl configtest
292```
315#+end_src
293316
294Now, restart the web server entirely. After this, you should be able to browse
295to `http://example.com` and see the HTML content you provided earlier. Note that
296SSL/TLS has not been enabled yet, so you won't be able to use the secure version
297yet (`https://example.com`).
317Now, restart the web server entirely. After this, you should be able to
318browse to =http://example.com= and see the HTML content you provided
319earlier. Note that SSL/TLS has not been enabled yet, so you won't be
320able to use the secure version yet (=https://example.com=).
298321
299```sh
322#+begin_src sh
300323sudo systemctl restart apache2
301```
302
303You can repeat this for as many websites as you need. Just create the domain
304folders in `/var/www/`, add the configuration file, enable the configuration,
305and restart `apache2`.
324#+end_src
306325
307## SSL/TLS Certificates: Serve Websites Over HTTPS
326You can repeat this for as many websites as you need. Just create the
327domain folders in =/var/www/=, add the configuration file, enable the
328configuration, and restart =apache2=.
308329
309In order to serve secure content, you'll need to obtain SSL/TLS certificates.
310Luckily, there's a free tool called [Certbot](https://certbot.eff.org) that
311helps us with the process.
330** SSL/TLS Certificates: Serve Websites Over HTTPS
331:PROPERTIES:
332:CUSTOM_ID: ssltls-certificates-serve-websites-over-https
333:END:
334In order to serve secure content, you'll need to obtain SSL/TLS
335certificates. Luckily, there's a free tool called
336[[https://certbot.eff.org][Certbot]] that helps us with the process.
312337
313The first step is to install `snapd` and `core` for Ubuntu.
338The first step is to install =snapd= and =core= for Ubuntu.
314339
315```sh
340#+begin_src sh
316341sudo apt install snapd
317342sudo snap install core
318343sudo snap refresh core
319```
344#+end_src
320345
321Next, install the `certbot` snap package.
346Next, install the =certbot= snap package.
322347
323```sh
348#+begin_src sh
324349sudo snap install --classic certbot
325```
350#+end_src
326351
327Execute the following command to ensure that the `certbot` command can be run.
352Execute the following command to ensure that the =certbot= command can
353be run.
328354
329```sh
355#+begin_src sh
330356sudo ln -s /snap/bin/certbot /usr/bin/certbot
331```
357#+end_src
332358
333Finally, you can run `certbot` one of two ways:
359Finally, you can run =certbot= one of two ways:
334360
3351. run it and let it alter your Apache configuration files automatically to
336 enable HTTPS redirects.
3372. run it and only allow it to create certificates.
338 You'll need to manually alter the config files to enable HTTPS redirects.
3611. run it and let it alter your Apache configuration files automatically
362 to enable HTTPS redirects.
3632. run it and only allow it to create certificates. You'll need to
364 manually alter the config files to enable HTTPS redirects.
339365
340366Run certbot and allow automatic config changes:
341367
342```sh
368#+begin_src sh
343369sudo certbot --apache
344```
370#+end_src
345371
346Run certbot for certificates only and don't allow it to alter config files:
372Run certbot for certificates only and don't allow it to alter config
373files:
347374
348```sh
375#+begin_src sh
349376sudo certbot certonly --apache
350```
377#+end_src
351378
352The Certbot packages on your system come with a cron job or systemd timer that
353will renew your certificates automatically before they expire. You will not need
354to run Certbot again unless you change your configuration. You can test
355automatic renewal for your certificates by running this command:
379The Certbot packages on your system come with a cron job or systemd
380timer that will renew your certificates automatically before they
381expire. You will not need to run Certbot again unless you change your
382configuration. You can test automatic renewal for your certificates by
383running this command:
356384
357```sh
385#+begin_src sh
358386sudo certbot renew --dry-run
359```
387#+end_src
360388
361Now, test your domains by going to `https://example.com`.
362
363## Firewall Security
389Now, test your domains by going to =https://example.com=.
364390
391** Firewall Security
392:PROPERTIES:
393:CUSTOM_ID: firewall-security
394:END:
365395To enable better security on your server, you'll need to enable a basic
366396firewall. For Ubuntu, we'll use
367[the uncomplicated firewall](https://cleberg.net/blog/secure-your-network-with-the-uncomplicated-firewall.html).
397[[https://cleberg.net/blog/secure-your-network-with-the-uncomplicated-firewall.html][the
398uncomplicated firewall]].
368399
369Now, add the following rules to the firewall allow SSH, Apache, and HTTP(S)
370connections. If you need to, you can enable different ports for specifics
371applications, SFTP, etc.
400Now, add the following rules to the firewall allow SSH, Apache, and
401HTTP(S) connections. If you need to, you can enable different ports for
402specifics applications, SFTP, etc.
372403
373```sh
404#+begin_src sh
374405sudo ufw default deny incoming
375406sudo ufw default allow outgoing
376407sudo ufw allow OpenSSH
377408sudo ufw allow Apache
378409sudo ufw allow proto tcp from any to any port 80,443
379```
410#+end_src
380411
381412Once you've added all the rules you need, enable the firewall.
382413
383```sh
414#+begin_src sh
384415sudo ufw enable
385```
386
387## Troubleshooting
416#+end_src
388417
389If you run into any issues during your VPS set-up, be sure to walk back through
390your actions and make sure you didn't miss any steps.
418** Troubleshooting
419:PROPERTIES:
420:CUSTOM_ID: troubleshooting
421:END:
422If you run into any issues during your VPS set-up, be sure to walk back
423through your actions and make sure you didn't miss any steps.
391424
392425Many websites have fantastic guides to setting up various web servers.
393This is one of the areas [where DigitalOcean shines](https://www.digitalocean.
394com/community/tutorials).
395For simpler or more Linux-oriented questions, I suggest using [Linuxize]
396(https://linuxize.com).
397
398If you're getting certain errors (e.g. `500 Internal Server Error`) and need to
399debug locally, you can view the `access.log` and `error.log` files in the
400`/var/log/apache/` directory.
426This is one of the areas
427[[https://www.digitalocean.%20com/community/tutorials][where
428DigitalOcean shines]]. For simpler or more Linux-oriented questions, I
429suggest using [Linuxize] (https://linuxize.com).
430
431If you're getting certain errors (e.g. =500 Internal Server Error=) and
432need to debug locally, you can view the =access.log= and =error.log=
433files in the =/var/log/apache/= directory.
blog/2021-04-17-gemini-server.org +128 −106
@@ -1,159 +1,181 @@
1+++
2date = 2021-04-17
3title = "Hosting a Gemini Server"
4description = "Dive deeper into Gemini by hosting your own Gemini web server."
5draft = false
6+++
7
8## Similar Article Available
9
10To read more about Gemini and ways to test out this new protocol without your
11own server, see my previous post
12[Launching a Gemini Capsule](/blog/launching-a-gemini-capsule/).
13
14## Preparation
15
16This guide assumes you have access to a server accessible to the world through a
17public IP address and that you own a domain name used for this Gemini capsule.
18
19## Getting Started with Agate
20
21We are going to use [Agate](https://github.com/mbrubeck/agate) for this
22tutorial.
23This is a basic Gemini server written in Rust.
24It takes very little time and maintenance to get it running.
25
26## Install Dependencies
27
28First, you will need to install the Rust package for your system. On Ubuntu, use
29the following commands (remember to use `sudo` if you are not the root user).
30The Rust installation will give you options to customize the installation; I
31used the default installation options.
32
33```sh
1#+title: Hosting a Gemini Server
2#+date: 2021-04-17
3
4** Similar Article Available
5:PROPERTIES:
6:CUSTOM_ID: similar-article-available
7:END:
8To read more about Gemini and ways to test out this new protocol without
9your own server, see my previous post
10[[/blog/launching-a-gemini-capsule/][Launching a Gemini Capsule]].
11
12** Preparation
13:PROPERTIES:
14:CUSTOM_ID: preparation
15:END:
16This guide assumes you have access to a server accessible to the world
17through a public IP address and that you own a domain name used for this
18Gemini capsule.
19
20** Getting Started with Agate
21:PROPERTIES:
22:CUSTOM_ID: getting-started-with-agate
23:END:
24We are going to use [[https://github.com/mbrubeck/agate][Agate]] for
25this tutorial. This is a basic Gemini server written in Rust. It takes
26very little time and maintenance to get it running.
27
28** Install Dependencies
29:PROPERTIES:
30:CUSTOM_ID: install-dependencies
31:END:
32First, you will need to install the Rust package for your system. On
33Ubuntu, use the following commands (remember to use =sudo= if you are
34not the root user). The Rust installation will give you options to
35customize the installation; I used the default installation options.
36
37#+begin_src sh
3438sudo apt update && sudo apt upgrade -y
3539curl https://sh.rustup.rs -sSf | sh
36```
40#+end_src
3741
3842Remember to configure your shell with the new configuration:
3943
40```sh
44#+begin_src sh
4145source $HOME/.cargo/env
42```
46#+end_src
4347
44Before we install agate, make sure you have the `gcc` package installed:
48Before we install agate, make sure you have the =gcc= package installed:
4549
46```sh
50#+begin_src sh
4751sudo apt install gcc
48```
52#+end_src
4953
50Next, you'll need to install the agate executable with Rust's Cargo package
51maintainer:
54Next, you'll need to install the agate executable with Rust's Cargo
55package maintainer:
5256
53```sh
57#+begin_src sh
5458cargo install agate
55```
56
57## Create Symlinks
59#+end_src
5860
59Once Cargo has finished installing all the required packages, symlink the
60executable to your \$PATH.
61** Create Symlinks
62:PROPERTIES:
63:CUSTOM_ID: create-symlinks
64:END:
65Once Cargo has finished installing all the required packages, symlink
66the executable to your $PATH.
6167
62```sh
68#+begin_src sh
6369sudo ln -s $HOME/.cargo/bin/agate /usr/local/bin/agate
64```
70#+end_src
6571
66## Using Agate's Built-In Installation Tool
72** Using Agate's Built-In Installation Tool
73:PROPERTIES:
74:CUSTOM_ID: using-agates-built-in-installation-tool
75:END:
76If you're running Ubuntu or Debian, use the Debian installation script
77found in Agate's GitHub repository, under the =tools/debian= folder.
6778
68If you're running Ubuntu or Debian, use the Debian installation script found in
69Agate's GitHub repository, under the `tools/debian` folder.
70
71```sh
79#+begin_src sh
7280git clone https://github.com/mbrubeck/agate
7381cd agate/tools/debian
7482sudo ./install.sh
75```
76
77## Configure the Gemini Service
78
79We have a little more to do, but since this script tries to immediately run the
80service, it will likely fail with an exit code. Let's add our finishing touches.
81Edit the following file and replace the hostname with your desired URL. You can
82also change the directory where content will be served.
83
84```sh
83#+end_src
84
85** Configure the Gemini Service
86:PROPERTIES:
87:CUSTOM_ID: configure-the-gemini-service
88:END:
89We have a little more to do, but since this script tries to immediately
90run the service, it will likely fail with an exit code. Let's add our
91finishing touches. Edit the following file and replace the hostname with
92your desired URL. You can also change the directory where content will
93be served.
94
95#+begin_src sh
8596sudo nano /etc/systemd/system/gemini.service
86```
97#+end_src
8798
88```sh
99#+begin_src sh
89100# Edit these lines to whatever you want - see the next code block for my personal configuration.
90101WorkingDirectory=/srv/gemini
91102ExecStart=agate --hostname $(uname -n) --lang en
92```
103#+end_src
93104
94105This is my personal config:
95106
96```sh
107#+begin_src sh
97108WorkingDirectory=/var/gemini/
98109ExecStart=agate --hostname gemini.example.com --lang en
99```
110#+end_src
100111
101Since we've altered the systemd configuration files, we have to reload the
102daemon. Let's do that, restart our service, and check its status.
112Since we've altered the systemd configuration files, we have to reload
113the daemon. Let's do that, restart our service, and check its status.
103114
104```sh
115#+begin_src sh
105116sudo systemctl daemon-reload
106117sudo systemctl restart gemini.service
107118sudo systemctl status gemini.service
108```
109
110## Fixing Systemd Errors
119#+end_src
111120
112If you're still getting errors, the installation process may not have properly
113enabled the gemini service. Fix it with the following commands.
121** Fixing Systemd Errors
122:PROPERTIES:
123:CUSTOM_ID: fixing-systemd-errors
124:END:
125If you're still getting errors, the installation process may not have
126properly enabled the gemini service. Fix it with the following commands.
114127
115```sh
128#+begin_src sh
116129sudo systemctl enable gemini.service
117130sudo systemctl restart gemini.service
118131sudo systemctl status gemini.service
119```
132#+end_src
120133
121## Firewall Rules
134** Firewall Rules
135:PROPERTIES:
136:CUSTOM_ID: firewall-rules
137:END:
138Great! Our server is now functional and running. The first consideration
139now is that you need to be able to access port 1965 on the server. If
140you have a firewall enabled, you'll need to open that port up.
122141
123Great! Our server is now functional and running. The first consideration now is
124that you need to be able to access port 1965 on the server. If you have a
125firewall enabled, you'll need to open that port up.
126
127```sh
142#+begin_src sh
128143sudo ufw allow 1965
129144sudo ufw reload
130```
131
132## Creating Content
133
134Let's create the Gemini capsule. Note that wherever you set the WorkingDirectory
135variable to earlier, Agate will expect you to put your Gemini capsule contents
136in a sub-folder called "content." So, I place my files in "/var/gmi/content." I'm
137going to create that folder now and put a file in there.
138
139```sh
145#+end_src
146
147** Creating Content
148:PROPERTIES:
149:CUSTOM_ID: creating-content
150:END:
151Let's create the Gemini capsule. Note that wherever you set the
152WorkingDirectory variable to earlier, Agate will expect you to put your
153Gemini capsule contents in a sub-folder called "content." So, I place my
154files in "/var/gmi/content." I'm going to create that folder now and put
155a file in there.
156
157#+begin_src sh
140158sudo mkdir /var/gemini/content
141159sudo nano /var/gemini/content/index.gmi
142```
143
144You can put whatever you want in the "index.gmi" file, just make sure it's valid
145Gemtext.
160#+end_src
146161
147## The Results
162You can put whatever you want in the "index.gmi" file, just make sure
163it's valid Gemtext.
148164
165** The Results
166:PROPERTIES:
167:CUSTOM_ID: the-results
168:END:
149169Here are some screenshots of the Gemini page I just created in the
150[Lagrange](https://gmi.skyjake.fi/lagrange/) browser and the
151[amfora](https://github.com/makeworld-the-better-one/amfora) browser.
170[[https://gmi.skyjake.fi/lagrange/][Lagrange]] browser and the
171[[https://github.com/makeworld-the-better-one/amfora][amfora]] browser.
152172
153![GUI Gemini browser](https://img.cleberg.net/blog/20210417-hosting-a-gemini-server/lagrange.png)
173#+caption: GUI Gemini browser
174[[https://img.cleberg.net/blog/20210417-hosting-a-gemini-server/lagrange.png]]
154175
155_Lagrange_
176/Lagrange/
156177
157![CLI Gemini browser](https://img.cleberg.net/blog/20210417-hosting-a-gemini-server/amfora.png)
178#+caption: CLI Gemini browser
179[[https://img.cleberg.net/blog/20210417-hosting-a-gemini-server/amfora.png]]
158180
159_Amfora_
181/Amfora/
blog/2021-04-23-php-comment-system.org +198 −176
@@ -1,151 +1,161 @@
1+++
2date = 2021-04-23
3title = "Roll Your Own Static Commenting System in PHP"
4description = "Learn how to skip the tedium of finding the proper commenting system by simply rolling your own in PHP."
5draft = false
6+++
1#+title: Roll Your Own Static Commenting System in PHP
2#+date: 2021-04-23
73
8## The Terrible-ness of Commenting Systems
4** The Terrible-ness of Commenting Systems
5:PROPERTIES:
6:CUSTOM_ID: the-terrible-ness-of-commenting-systems
7:END:
8The current state of affairs regarding interactive comment systems is,
9well, terrible. It is especially awful if you're a privacy conscious
10person who does not generally load third-party scripts or frames on the
11websites you visit.
912
10The current state of affairs regarding interactive comment systems is, well,
11terrible. It is especially awful if you're a privacy conscious person who does
12not generally load third-party scripts or frames on the websites you visit.
13
14Even further, many comment systems are charging exorbitant fees for something
15that should be standard.
13Even further, many comment systems are charging exorbitant fees for
14something that should be standard.
1615
1716Of course, there are some really terrible options:
1817
19- Facebook Comments
20- Discourse
21
22There are some options that are better but still use too many scripts, frames,
23or social integrations on your web page that could impact some users:
24
25- Disqus
26- Isso
27- Remark42
28
29Lastly, I looked into a few unique ways of generating blog comments, such as
30using Twitter threads or GitHub issues to automatically post issues. However,
31these both rely on external third-party sites that I don't currently use.
32
33## Stay Static with Server-Side Comments
34
35The main issue for my personal use-case is that my blog is completely, 100%
36static. I use PHP on the back-end but website visitors only see HTML and a
37single CSS file. No external javascript and no embedded frames.
38
39So, how do we keep a site static and still allow users to interact with blog
40posts? The key actually pretty simple - I'm already using PHP, so why not rely
41on the classic HTML `<form>` and a PHP script to save the comments somewhere? As
42it turns out, this was a perfect solution for me.
43
44The second issue for my personal use-case is that I am trying to keep the
45contents of my website accessible over time, as described by @brandur, in his
46post entitled
47[Blog with Markdown + Git, and degrade gracefully through time](https://brandur.org/fragments/graceful-degradation-time)
48.
49
50This means I cannot rely on a database for comments, since I do not rely on a
51database for any other part of my websites.
52
53I blog in plain Markdown files, commit all articles to Git, and ensure that
54future readers will be able to see the source data long after I'm gone, or the
55website has gone offline. However, I still haven't committed any images served
56on my blog to Git, as I'm not entirely sold on Git LFS yet - for now, images can
57be found at [img.cleberg.net](https://img.cleberg.net).
58
59Saving my comments back to the Git repository ensures that another aspect of my
60site will degrade gracefully.
61
62## Create a Comment Form
63
64Okay, let's get started. The first step is to create an HTML form that users can
65see and utilize to submit comments. This is fairly easy and can be changed
66depending on your personal preferences.
67
68Take a look at the code block below for the form I currently use. Note that
69`<current-url>` is replaced automatically in PHP with the current post's URL, so
70that my PHP script used later will know which blog post the comment is related
71to.
18- Facebook Comments
19- Discourse
20
21There are some options that are better but still use too many scripts,
22frames, or social integrations on your web page that could impact some
23users:
24
25- Disqus
26- Isso
27- Remark42
28
29Lastly, I looked into a few unique ways of generating blog comments,
30such as using Twitter threads or GitHub issues to automatically post
31issues. However, these both rely on external third-party sites that I
32don't currently use.
33
34** Stay Static with Server-Side Comments
35:PROPERTIES:
36:CUSTOM_ID: stay-static-with-server-side-comments
37:END:
38The main issue for my personal use-case is that my blog is completely,
39100% static. I use PHP on the back-end but website visitors only see
40HTML and a single CSS file. No external javascript and no embedded
41frames.
42
43So, how do we keep a site static and still allow users to interact with
44blog posts? The key actually pretty simple - I'm already using PHP, so
45why not rely on the classic HTML =<form>= and a PHP script to save the
46comments somewhere? As it turns out, this was a perfect solution for me.
47
48The second issue for my personal use-case is that I am trying to keep
49the contents of my website accessible over time, as described by
50[cite/t:@brandur], in his post entitled
51[[https://brandur.org/fragments/graceful-degradation-time][Blog with
52Markdown + Git, and degrade gracefully through time]] .
53
54This means I cannot rely on a database for comments, since I do not rely
55on a database for any other part of my websites.
56
57I blog in plain Markdown files, commit all articles to Git, and ensure
58that future readers will be able to see the source data long after I'm
59gone, or the website has gone offline. However, I still haven't
60committed any images served on my blog to Git, as I'm not entirely sold
61on Git LFS yet - for now, images can be found at
62[[https://img.cleberg.net][img.cleberg.net]].
63
64Saving my comments back to the Git repository ensures that another
65aspect of my site will degrade gracefully.
66
67** Create a Comment Form
68:PROPERTIES:
69:CUSTOM_ID: create-a-comment-form
70:END:
71Okay, let's get started. The first step is to create an HTML form that
72users can see and utilize to submit comments. This is fairly easy and
73can be changed depending on your personal preferences.
74
75Take a look at the code block below for the form I currently use. Note
76that =<current-url>= is replaced automatically in PHP with the current
77post's URL, so that my PHP script used later will know which blog post
78the comment is related to.
7279
7380The form contains the following structure:
7481
751. `<form>` - This is the form and will determine which PHP script to send the
76 comment to.
772. `<section hidden>` - This section is hidden from the user and is used to
78 ensure that we know which blog post sent the comment.
793. `<section>` Display Name (Optional) - Used to accept a display name, if
80 entered.
814. `<section>` Comment (Required) - Used to accept the user's full comment.
82 Markdown is allowed.
835. `<button>` - A button to submit the form.
84
85```html
821. =<form>= - This is the form and will determine which PHP script to
83 send the comment to.
842. =<section hidden>= - This section is hidden from the user and is used
85 to ensure that we know which blog post sent the comment.
863. =<section>= Display Name (Optional) - Used to accept a display name,
87 if entered.
884. =<section>= Comment (Required) - Used to accept the user's full
89 comment. Markdown is allowed.
905. =<button>= - A button to submit the form.
91
92#+begin_src html
8693<form action="/comment.php" method="POST">
87 <h3>Leave a Comment</h3>
88 <section hidden>
89 <label class="form-label" for="postURL">Post URL</label>
90 <input
91 class="form-control"
92 id="postURL"
93 name="postURL"
94 type="text"
95 value="<current-url>"
96 />
97 </section>
98 <section>
99 <label class="form-label" for="userName">Display Name</label>
100 <input
101 class="form-control"
102 id="userName"
103 name="userName"
104 placeholder="John Doe"
105 type="text"
106 />
107 </section>
108 <section>
109 <label class="form-label" for="userContent">Your Comment</label>
110 <textarea
111 class="form-control"
112 id="userContent"
113 name="userContent"
114 rows="3"
115 placeholder="# Feel free to use Markdown"
116 aria-describedby="commentHelp"
117 required
118 ></textarea>
119 <div id="commentHelp" class="form-text">
120 Comments are saved as Markdown and cannot be edited or deleted.
121 </div>
122 </section>
123 <button type="submit">Submit</button>
94 <h3>Leave a Comment</h3>
95 <section hidden>
96 <label class="form-label" for="postURL">Post URL</label>
97 <input
98 class="form-control"
99 id="postURL"
100 name="postURL"
101 type="text"
102 value="<current-url>"
103 />
104 </section>
105 <section>
106 <label class="form-label" for="userName">Display Name</label>
107 <input
108 class="form-control"
109 id="userName"
110 name="userName"
111 placeholder="John Doe"
112 type="text"
113 />
114 </section>
115 <section>
116 <label class="form-label" for="userContent">Your Comment</label>
117 <textarea
118 class="form-control"
119 id="userContent"
120 name="userContent"
121 rows="3"
122 placeholder="# Feel free to use Markdown"
123 aria-describedby="commentHelp"
124 required
125 ></textarea>
126 <div id="commentHelp" class="form-text">
127 Comments are saved as Markdown and cannot be edited or deleted.
128 </div>
129 </section>
130 <button type="submit">Submit</button>
124131</form>
125```
126
127## Handle Comments via POST
132#+end_src
128133
129Now that we have a form and can submit comments, we need to create a PHP script
130so that the server can fetch the comment data and save it. Make sure your PHP
131script name matches the name you entered in the `action` field in your form.
134** Handle Comments via POST
135:PROPERTIES:
136:CUSTOM_ID: handle-comments-via-post
137:END:
138Now that we have a form and can submit comments, we need to create a PHP
139script so that the server can fetch the comment data and save it. Make
140sure your PHP script name matches the name you entered in the =action=
141field in your form.
132142
133See the code block below for the contents of my `comment.php` script. We perform
134the following tasks in this script:
143See the code block below for the contents of my =comment.php= script. We
144perform the following tasks in this script:
135145
1361461. Grab the POST data from the HTML form.
1372. Sanitize the comment data with `htmlentities`.
1383. Set the display name to `Anonymous` if it was left blank.
1472. Sanitize the comment data with =htmlentities=.
1483. Set the display name to =Anonymous= if it was left blank.
1391494. Create a PHP object that combines all of this data.
1405. Check if our destination file `comments.json` exists.
1505. Check if our destination file =comments.json= exists.
1411516. If so, convert the PHP object to JSON and save it to the file.
1427. If the `comments.json` file does not exist, the script will exit with an
143 error. You can alter this to ensure it creates the script, but my source code
144 includes the file by default, so it will always exist.
1458. Finally, send the user back to the `#comments` section of the blog post they
146 just read.
1527. If the =comments.json= file does not exist, the script will exit with
153 an error. You can alter this to ensure it creates the script, but my
154 source code includes the file by default, so it will always exist.
1558. Finally, send the user back to the =#comments= section of the blog
156 post they just read.
147157
148```php
158#+begin_src php
149159// Get the content sent from the comment form
150160$comment = htmlentities($_POST['userContent']);
151161$post_url = $_POST['postURL'];
@@ -180,30 +190,35 @@ if (file_exists($file_name)) {
180190
181191// Send the user back
182192header('Location: ' . $post_url . '#comments');
183```
193#+end_src
184194
185If you're using Apache, make sure the `www-data` user on your server has the
186correct permissions to your website directory or else it will not be able to
187write to `comments.json`.
195If you're using Apache, make sure the =www-data= user on your server has
196the correct permissions to your website directory or else it will not be
197able to write to =comments.json=.
188198
189```sh
199#+begin_src sh
190200chgrp -R www-data /path/to/website/
191201chmod -R g+w comments.json
192```
193
194## Display User Comments
195
196Now that we can submit comments, and they are saved to the `comments.json` file,
197let's make sure we can show those comments in each blog post.
198
199The code block below shows the function I use to decode my `comments.json` file,
200check if the comments apply to the current post, and then display them.
201
202This piece of code should **really** be inside a function (or at least in an
203organized PHP workflow). Don't just copy-and-paste and expect it to work. You
204need to at least supply a `$query` variable depending on the page visited.
205
206```php
202#+end_src
203
204** Display User Comments
205:PROPERTIES:
206:CUSTOM_ID: display-user-comments
207:END:
208Now that we can submit comments, and they are saved to the
209=comments.json= file, let's make sure we can show those comments in each
210blog post.
211
212The code block below shows the function I use to decode my
213=comments.json= file, check if the comments apply to the current post,
214and then display them.
215
216This piece of code should *really* be inside a function (or at least in
217an organized PHP workflow). Don't just copy-and-paste and expect it to
218work. You need to at least supply a =$query= variable depending on the
219page visited.
220
221#+begin_src php
207222$query = 'your-blog-post.html';
208223
209224// Load saved comments
@@ -235,28 +250,35 @@ foreach ($comments as $comment) {
235250}
236251
237252echo $comment_section;
238```
239
240## Bonus: Create a 'Recent Comments' Page
241
242Finally, the last part of my current system is to create a Recent Comments page
243so that I can easily check-in on my blog and moderate any spam. As an
244alternative, you could use PHP's `mail()` function to email you for each blog
245comment.
246
247The code to do this is literally the same code as the previous section, I just
248make sure it is printed when someone visits `https://example.com/comments/`.
249
250## Possible Enhancements
251
252This comment system is by no means a fully-developed system. I have noted a few
253possible enhancements here that I may implement in the future:
254
255- Create a secure moderator page with user authentication at
256 `https://blog.example.com/mod/`. This page could have the option to edit or
257 delete any comment found in `comments.json`.
258- Create a temporary file, such as `pending_comments.json`, that will store
259 newly-submitted comments and won't display on blog posts until approved by a
260 moderator.
261- Create a `/modlog/` page with a chronological log, showing which moderator
262 approved which comments and why certain comments were rejected.
253#+end_src
254
255** Bonus: Create a 'Recent Comments' Page
256:PROPERTIES:
257:CUSTOM_ID: bonus-create-a-recent-comments-page
258:END:
259Finally, the last part of my current system is to create a Recent
260Comments page so that I can easily check-in on my blog and moderate any
261spam. As an alternative, you could use PHP's =mail()= function to email
262you for each blog comment.
263
264The code to do this is literally the same code as the previous section,
265I just make sure it is printed when someone visits
266=https://example.com/comments/=.
267
268** Possible Enhancements
269:PROPERTIES:
270:CUSTOM_ID: possible-enhancements
271:END:
272This comment system is by no means a fully-developed system. I have
273noted a few possible enhancements here that I may implement in the
274future:
275
276- Create a secure moderator page with user authentication at
277 =https://blog.example.com/mod/=. This page could have the option to
278 edit or delete any comment found in =comments.json=.
279- Create a temporary file, such as =pending_comments.json=, that will
280 store newly-submitted comments and won't display on blog posts until
281 approved by a moderator.
282- Create a =/modlog/= page with a chronological log, showing which
283 moderator approved which comments and why certain comments were
284 rejected.
blog/2021-04-28-photography.org +60 −52
@@ -1,67 +1,75 @@
1+++
2date = 2021-04-28
3title = "Jumping Back Into Photography"
4description = "After a long respite, I have returned to my hobby of photography with a brand-new camera."
5draft = false
6+++
7
8## Why Photography?
1#+title: Jumping Back Into Photography
2#+date: 2021-04-28
93
4** Why Photography?
5:PROPERTIES:
6:CUSTOM_ID: why-photography
7:END:
108I've often wondered why photography is as enticing as it is. You can see
11billions of people around the world taking photographs every single moment of
12the day. New technology often boasts about their photographic capabilities,
13especially smartphones. I would even assume that we live in a world where there
14is never a moment in which a photograph is not being taken somewhere on Earth.
15
16As for myself, I would simply say that I enjoy preserving a memory in physical
17(or digital) form. I've never had the best memory when it comes to recalling
18details of places and people gone by, so it helps to have a frame of reference
19lying around.
20
21Regardless of the reason, I think most people would agree that you simply cannot
22have too many hobbies.
9billions of people around the world taking photographs every single
10moment of the day. New technology often boasts about their photographic
11capabilities, especially smartphones. I would even assume that we live
12in a world where there is never a moment in which a photograph is not
13being taken somewhere on Earth.
2314
24## Older Cameras
15As for myself, I would simply say that I enjoy preserving a memory in
16physical (or digital) form. I've never had the best memory when it comes
17to recalling details of places and people gone by, so it helps to have a
18frame of reference lying around.
2519
26I started playing around with the idea of photography when my family purchased a
27Fujifilm camera for family-specific events. I don't recall the specific model,
28but I do recall it was a point-and-shoot camera without an interchangeable lens.
29However, it was of great value to someone, like myself, who couldn't afford any
30other camera. I took about 10,000 shots with that camera over a 3-5 year span.
31Most notably, all of my trips to California were documented through this camera.
20Regardless of the reason, I think most people would agree that you
21simply cannot have too many hobbies.
3222
33When possible, I would borrow my sister's camera, which is a Sony SLT-A58. This
34camera was great and allowed for some of my best early shots, especially those
35taken in Utah's and Nevada's parks.
23** Older Cameras
24:PROPERTIES:
25:CUSTOM_ID: older-cameras
26:END:
27I started playing around with the idea of photography when my family
28purchased a Fujifilm camera for family-specific events. I don't recall
29the specific model, but I do recall it was a point-and-shoot camera
30without an interchangeable lens. However, it was of great value to
31someone, like myself, who couldn't afford any other camera. I took about
3210,000 shots with that camera over a 3-5 year span. Most notably, all of
33my trips to California were documented through this camera.
3634
37## My Current Kit
35When possible, I would borrow my sister's camera, which is a Sony
36SLT-A58. This camera was great and allowed for some of my best early
37shots, especially those taken in Utah's and Nevada's parks.
3838
39I've finally come to a point in my life where I have the disposable income to
40invest in a solid photography kit. I played around with the idea of a lot of
41different cameras, different types, new vs used, etc. Finally, I settled on the
42[Sony α7 III](https://en.wikipedia.org/wiki/Sony_%CE%B17_III). This camera is
43mirror-less and uses a full-frame image sensor at 24 megapixels. I don't create
44large prints, and I am mostly focused on preserving memories in high quality for
45the next 5-10 years with this camera, so the specifications here are just
46perfect for me.
39** My Current Kit
40:PROPERTIES:
41:CUSTOM_ID: my-current-kit
42:END:
43I've finally come to a point in my life where I have the disposable
44income to invest in a solid photography kit. I played around with the
45idea of a lot of different cameras, different types, new vs used, etc.
46Finally, I settled on the
47[[https://en.wikipedia.org/wiki/Sony_%CE%B17_III][Sony α7 III]]. This
48camera is mirror-less and uses a full-frame image sensor at 24
49megapixels. I don't create large prints, and I am mostly focused on
50preserving memories in high quality for the next 5-10 years with this
51camera, so the specifications here are just perfect for me.
4752
4853For lenses, I decided to buy two lenses that could carry me through most
4954situations:
5055
51- [Vario-Tessar T\* FE 24-70 mm F4 ZA OSS](https://electronics.sony.com/imaging/lenses/full-frame-e-mount/p/sel2470z)
52- [Tamron 70-300mm f4.5-6.3 Di III RXD](https://www.tamron-usa.com/product/lenses/a047.html)
56- [[https://electronics.sony.com/imaging/lenses/full-frame-e-mount/p/sel2470z][Vario-Tessar
57 T* FE 24-70 mm F4 ZA OSS]]
58- [[https://www.tamron-usa.com/product/lenses/a047.html][Tamron 70-300mm
59 f4.5-6.3 Di III RXD]]
5360
5461In addition, I grabbed a couple
55[HGX Prime 67mm](https://www.promaster.com/Product/6725) protection filters for
56the lenses.
62[[https://www.promaster.com/Product/6725][HGX Prime 67mm]] protection
63filters for the lenses.
5764
58As I delve further into photography and pick up more skills, I will most likely
59go back and grab a lens with a higher f-stop value, such as f/1.8. I toyed with
60the idea of grabbing a 50 mm at `f/1.8`, but decided to keep things in a
61reasonable price range instead.
65As I delve further into photography and pick up more skills, I will most
66likely go back and grab a lens with a higher f-stop value, such as
67f/1.8. I toyed with the idea of grabbing a 50 mm at =f/1.8=, but decided
68to keep things in a reasonable price range instead.
6269
63Finally, I made sure to buy a photography-specific backpack with a rain guard,
64and the zipper on the back panel, to protect the equipment while wearing the
65bag. If you've ever had to haul around a DSLR (or camera of similar heft) in a
66bag that only has a shoulder strap, you'll know the pain it can cause. Putting
67all my equipment in a backpack was an easy decision.
70Finally, I made sure to buy a photography-specific backpack with a rain
71guard, and the zipper on the back panel, to protect the equipment while
72wearing the bag. If you've ever had to haul around a DSLR (or camera of
73similar heft) in a bag that only has a shoulder strap, you'll know the
74pain it can cause. Putting all my equipment in a backpack was an easy
75decision.
blog/2021-05-30-changing-git-authors.org +26 −28
@@ -1,33 +1,31 @@
1+++
2date = 2021-05-30
3title = "Changing Git Authors"
4description = "Learn how to haphazardly replace Git authors and/or emails within the Git history."
5+++
6
7## Changing Git Author/Email Based on Previously Committed Email
8
9Here's the dilemma: You've been committing changes to your git repository with
10an incorrect name or email (or multiple repositories), and now you want to fix
11it.
12Luckily, there's a semi-reliable way to fix that.
13While I have never experienced issues with this method, some people have
14warned that it can mess with historical hashes and integrity of commits, so
15use this method only if you're okay accepting that risk.
1#+title: Changing Git Authors
2#+date: 2021-05-30
3
4** Changing Git Author/Email Based on Previously Committed Email
5:PROPERTIES:
6:CUSTOM_ID: changing-git-authoremail-based-on-previously-committed-email
7:END:
8Here's the dilemma: You've been committing changes to your git
9repository with an incorrect name or email (or multiple repositories),
10and now you want to fix it. Luckily, there's a semi-reliable way to fix
11that. While I have never experienced issues with this method, some
12people have warned that it can mess with historical hashes and integrity
13of commits, so use this method only if you're okay accepting that risk.
1614
1715Okay, let's create the bash script:
1816
19```sh
17#+begin_src sh
2018nano change_git_authors.sh
21```
19#+end_src
2220
23The following information can be pasted directly into your bash script. The only
24changes you need to make are to the following variables:
21The following information can be pasted directly into your bash script.
22The only changes you need to make are to the following variables:
2523
26- `OLD_EMAIL`
27- `CORRECT_NAME`
28- `CORRECT_EMAIL`
24- =OLD_EMAIL=
25- =CORRECT_NAME=
26- =CORRECT_EMAIL=
2927
30```sh
28#+begin_src sh
3129#!/bin/sh
3230
3331# List all sub-directories in the current directory
@@ -60,16 +58,16 @@ do
6058
6159 cd ..
6260done
63```
61#+end_src
6462
6563Finally, save the bash script and make it executable.
6664
67```sh
65#+begin_src sh
6866chmod a+x change_git_authors.sh
69```
67#+end_src
7068
7169Now you can run the script and should see the process begin.
7270
73```sh
71#+begin_src sh
7472./change_git_authors.sh
75```
73#+end_src
blog/2021-07-15-delete-gitlab-repos.org +54 −49
@@ -1,53 +1,57 @@
1+++
2date = 2021-07-15
3title = "How to Delete All GitLab Repositories"
4description = "Learn how to delete all GitLab repositories in your user account."
5draft = false
6+++
7
8## Background
9
10Have you ever used GitLab to host your source code, moved to a different host,
11and wanted to delete everything from your GitLab account?
12Well, this post covers any scenario where you would want to delete all
1#+title: How to Delete All GitLab Repositories
2#+date: 2021-07-15
3
4** Background
5:PROPERTIES:
6:CUSTOM_ID: background
7:END:
8Have you ever used GitLab to host your source code, moved to a different
9host, and wanted to delete everything from your GitLab account? Well,
10this post covers any scenario where you would want to delete all
1311repositories from your GitLab account.
1412
15For me, I currently maintain around 30 repositories and don't like to manually
16delete them whenever I switch host.
17GitHub has a few different tools online to delete all repositories for you,
18but I have not found anything similar for GitLab, so I needed an alternative
19solution.
20
21## Use a Python Script
22
23### Requirements
24
25Before we look at the script, make sure you know your GitLab username. Next,
26[create an authorization token](https://gitlab.com/-/profile/personal_access_tokens)
27so that the Python script can delete your repositories. Don't lose this token or
28else you'll need to create a new one.
29
30### Create the Script
31
32To run a Python script, you must first create it. Open a terminal and enter the
33following commands in whichever directory you prefer to store the script. You
34can do the same things in a file manager if you prefer.
35
36```sh
13For me, I currently maintain around 30 repositories and don't like to
14manually delete them whenever I switch host. GitHub has a few different
15tools online to delete all repositories for you, but I have not found
16anything similar for GitLab, so I needed an alternative solution.
17
18** Use a Python Script
19:PROPERTIES:
20:CUSTOM_ID: use-a-python-script
21:END:
22*** Requirements
23:PROPERTIES:
24:CUSTOM_ID: requirements
25:END:
26Before we look at the script, make sure you know your GitLab username.
27Next, [[https://gitlab.com/-/profile/personal_access_tokens][create an
28authorization token]] so that the Python script can delete your
29repositories. Don't lose this token or else you'll need to create a new
30one.
31
32*** Create the Script
33:PROPERTIES:
34:CUSTOM_ID: create-the-script
35:END:
36To run a Python script, you must first create it. Open a terminal and
37enter the following commands in whichever directory you prefer to store
38the script. You can do the same things in a file manager if you prefer.
39
40#+begin_src sh
3741mkdir delete-gitlab
38```
42#+end_src
3943
40```sh
44#+begin_src sh
4145cd delete-gitlab
42```
46#+end_src
4347
44```sh
48#+begin_src sh
4549nano main.py
46```
50#+end_src
4751
48Enter the following code into your `main.py` script.
52Enter the following code into your =main.py= script.
4953
50```python
54#+begin_src python
5155import request
5256import json
5357
@@ -101,15 +105,16 @@ def main():
101105
102106if __name__ == "__main__":
103107 main()
104```
108#+end_src
105109
106Now that you have the proper information, replace `{user-id}` with your GitLab
107username and `{auth-token}` with the authorization token you created earlier.
110Now that you have the proper information, replace ={user-id}= with your
111GitLab username and ={auth-token}= with the authorization token you
112created earlier.
108113
109Finally, simply run the script and watch the output. You can also use PyCharm
110Community Edition to edit and run the Python script if you don't want to work
111in a terminal.
114Finally, simply run the script and watch the output. You can also use
115PyCharm Community Edition to edit and run the Python script if you don't
116want to work in a terminal.
112117
113```sh
118#+begin_src sh
114119python3 main.py
115```
120#+end_src
blog/2021-08-25-audit-sampling.org +154 −139
@@ -1,52 +1,55 @@
1+++
2date = 2021-08-25
3title = "Audit Sampling with Python"
4description = "Learn how to use Python to automate the boring parts of audit sampling."
5draft = false
6+++
7
8## Introduction
1#+title: Audit Sampling with Python
2#+date: 2021-08-25
93
4** Introduction
5:PROPERTIES:
6:CUSTOM_ID: introduction
7:END:
108For anyone who is familiar with internal auditing, external auditing, or
11consulting, you will understand how tedious audit testing can become when you
12are required to test large swaths of data. When we cannot establish an automated
13means of testing an entire population, we generate samples to represent the
14population of data. This helps ensure we can have a small enough data pool to
15test and that our results still represent the population.
16
17However, sampling data within the world of audit still seems to confuse quite a
18lot of people. While some audit-focused tools have introduced sampling
19functionality (e.g. Wdesk), many audit departments and firms cannot use software
20like this due to certain constraints, such as the team's budget or knowledge.
21Here is where this article comes in: we're going to use
22[Python](https://www.python.org), a free and open-source programming language,
23to generate random samples from a dataset in order to suffice numerous audit
24situations.
25
26## Audit Requirements for Sampling
27
28Before we get into the details of how to sample with Python, I want to make sure
29I discuss the different requirements that auditors may have of samples used
30within their projects.
31
32### Randomness
33
34First, let's discuss randomness. When testing out new technology to help assist
35with audit sampling, you need to understand exactly how your samples are being
36generated. For example, if the underlying function is just picking every 57th
37element from a list, that's not truly random; it's a systematic form of
38sampling. Luckily, since Python is open-source, we have access to its codebase.
39Through this blog post, I will be using the [pandas](https://pandas.pydata.org)
40module in order to generate the random samples. More specifically, I will be
41using the
42[pandas.DataFrame.sample](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.sample.html)
9consulting, you will understand how tedious audit testing can become
10when you are required to test large swaths of data. When we cannot
11establish an automated means of testing an entire population, we
12generate samples to represent the population of data. This helps ensure
13we can have a small enough data pool to test and that our results still
14represent the population.
15
16However, sampling data within the world of audit still seems to confuse
17quite a lot of people. While some audit-focused tools have introduced
18sampling functionality (e.g. Wdesk), many audit departments and firms
19cannot use software like this due to certain constraints, such as the
20team's budget or knowledge. Here is where this article comes in: we're
21going to use [[https://www.python.org][Python]], a free and open-source
22programming language, to generate random samples from a dataset in order
23to suffice numerous audit situations.
24
25** Audit Requirements for Sampling
26:PROPERTIES:
27:CUSTOM_ID: audit-requirements-for-sampling
28:END:
29Before we get into the details of how to sample with Python, I want to
30make sure I discuss the different requirements that auditors may have of
31samples used within their projects.
32
33*** Randomness
34:PROPERTIES:
35:CUSTOM_ID: randomness
36:END:
37First, let's discuss randomness. When testing out new technology to help
38assist with audit sampling, you need to understand exactly how your
39samples are being generated. For example, if the underlying function is
40just picking every 57th element from a list, that's not truly random;
41it's a systematic form of sampling. Luckily, since Python is
42open-source, we have access to its codebase. Through this blog post, I
43will be using the [[https://pandas.pydata.org][pandas]] module in order
44to generate the random samples. More specifically, I will be using the
45[[https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.sample.html][pandas.DataFrame.sample]]
4346function provided by Pandas.
4447
45Now that you know what you're using, you can always check out the code behind
46`pandas.DataFrame.sample`. This function does a lot of work, but we really only
47care about the following snippets of code:
48Now that you know what you're using, you can always check out the code
49behind =pandas.DataFrame.sample=. This function does a lot of work, but
50we really only care about the following snippets of code:
4851
49```python
52#+begin_src python
5053# Process random_state argument
5154rs = com.random_state(random_state)
5255
@@ -58,45 +61,45 @@ if ignore_index:
5861result.index = ibase.default_index(len(result))
5962
6063return result
61```
62
63The block of code above shows you that if you assign a `random_state`
64argument when you run the function, that will be used as a seed number in
65the random generation and will allow you to reproduce a sample, given that
66nothing else changes.
67This is critical to the posterity of audit work.
68After all, how can you say your audit process is adequately documented if
69the next person can't run the code and get the same sample?
70The final piece here on randomness is to look at the [choice](https://docs.
71python.org/3/library/random.html#random.choice) function used above.
72This is the crux of the generation and can also be examined for more
73detailed analysis on its reliability.
74As far as auditing goes, we will trust that these functions are
75mathematically random.
76
77### Sample Sizes
78
79As mentioned in the intro, sampling is only an effective method of auditing
80when it truly represents the entire population.
81While some audit departments or firms may consider certain judgmental sample
82sizes to be adequate, you may need to rely on statistically-significant
83confidence levels of sample testing at certain points.
84I will demonstrate both here.
85For statistically-significant confidence levels, most people will assume a
8690% - 99% confidence level.
87In order to actually calculate the correct sample size, it is best to use
88statistical tools due to the tedious math work required.
89For example, for a population of 1000, and a 90% confidence level that no
90more than 5% of the items are nonconforming, you would sample 45 items.
91
92However, in my personal experience, many audit departments and firms do not use
93statistical sampling. Most people use a predetermined, often proprietary, table
94that will instruct auditors which sample sizes to choose. This allows for
95uniform testing and reduces overall workload. See the table below for a common
96implementation of sample sizes:
64#+end_src
65
66The block of code above shows you that if you assign a =random_state=
67argument when you run the function, that will be used as a seed number
68in the random generation and will allow you to reproduce a sample, given
69that nothing else changes. This is critical to the posterity of audit
70work. After all, how can you say your audit process is adequately
71documented if the next person can't run the code and get the same
72sample? The final piece here on randomness is to look at the
73[[https://docs.%20python.org/3/library/random.html#random.choice][choice]]
74function used above. This is the crux of the generation and can also be
75examined for more detailed analysis on its reliability. As far as
76auditing goes, we will trust that these functions are mathematically
77random.
78
79*** Sample Sizes
80:PROPERTIES:
81:CUSTOM_ID: sample-sizes
82:END:
83As mentioned in the intro, sampling is only an effective method of
84auditing when it truly represents the entire population. While some
85audit departments or firms may consider certain judgmental sample sizes
86to be adequate, you may need to rely on statistically-significant
87confidence levels of sample testing at certain points. I will
88demonstrate both here. For statistically-significant confidence levels,
89most people will assume a 90% - 99% confidence level. In order to
90actually calculate the correct sample size, it is best to use
91statistical tools due to the tedious math work required. For example,
92for a population of 1000, and a 90% confidence level that no more than
935% of the items are nonconforming, you would sample 45 items.
94
95However, in my personal experience, many audit departments and firms do
96not use statistical sampling. Most people use a predetermined, often
97proprietary, table that will instruct auditors which sample sizes to
98choose. This allows for uniform testing and reduces overall workload.
99See the table below for a common implementation of sample sizes:
97100
98101| Control Frequency | Sample Size - High Risk | Sample Size - Low Risk |
99|-------------------|-------------------------|------------------------|
102|-------------------+-------------------------+------------------------|
100103| More Than Daily | 40 | 25 |
101104| Daily | 40 | 25 |
102105| Weekly | 12 | 5 |
@@ -106,23 +109,27 @@ implementation of sample sizes:
106109| Annually | 1 | 1 |
107110| Ad-hoc | 1 | 1 |
108111
109## Sampling with Python & Pandas
110
111In this section, I am going to cover a few basic audit situations that require
112sampling. While some situations may require more effort, the syntax,
113organization, and intellect used remain largely the same. If you've never used
114Python before, note that lines starting with a '`#`' symbol are called comments,
115and they will be skipped by Python. I highly recommend taking a quick tutorial
116online to understand the basics of Python if any of the code below is confusing
117to you.
118
119### Simple Random Sample
120
121First, let's look at a simple, random sample. The code block below will import
122the `pandas` module, load a data file, sample the data, and export the sample to
123a file.
124
125```python
112** Sampling with Python & Pandas
113:PROPERTIES:
114:CUSTOM_ID: sampling-with-python-pandas
115:END:
116In this section, I am going to cover a few basic audit situations that
117require sampling. While some situations may require more effort, the
118syntax, organization, and intellect used remain largely the same. If
119you've never used Python before, note that lines starting with a '=#='
120symbol are called comments, and they will be skipped by Python. I highly
121recommend taking a quick tutorial online to understand the basics of
122Python if any of the code below is confusing to you.
123
124*** Simple Random Sample
125:PROPERTIES:
126:CUSTOM_ID: simple-random-sample
127:END:
128First, let's look at a simple, random sample. The code block below will
129import the =pandas= module, load a data file, sample the data, and
130export the sample to a file.
131
132#+begin_src python
126133# Import the Pandas module
127134import pandas
128135
@@ -140,14 +147,16 @@ sample = df.sample(n=25, random_state=0)
140147
141148# Save the sample to Excel
142149sample.to_excel(file_output)
143```
150#+end_src
144151
145### Simple Random Sample: Using Multiple Input Files
152*** Simple Random Sample: Using Multiple Input Files
153:PROPERTIES:
154:CUSTOM_ID: simple-random-sample-using-multiple-input-files
155:END:
156Now that we've created a simple sample, let's create a sample from
157multiple files.
146158
147Now that we've created a simple sample, let's create a sample from multiple
148files.
149
150```python
159#+begin_src python
151160# Import the Pandas module
152161import pandas
153162
@@ -174,15 +183,17 @@ sample = pandas.concat([sample_01, sample_02, sample_03], ignore_index=True)
174183
175184# Save the sample to Excel
176185sample.to_excel(file_output)
177```
178
179### Stratified Random Sample
186#+end_src
180187
181Well, what if you need to sample distinct parts of a single file? For example,
182let's write some code to separate our data by "Region" and sample those regions
183independently.
188*** Stratified Random Sample
189:PROPERTIES:
190:CUSTOM_ID: stratified-random-sample
191:END:
192Well, what if you need to sample distinct parts of a single file? For
193example, let's write some code to separate our data by "Region" and
194sample those regions independently.
184195
185```python
196#+begin_src python
186197# Import the Pandas module
187198import pandas
188199
@@ -208,16 +219,18 @@ sample = pandas.concat([sample_east, sample_west], ignore_index=True)
208219
209220# Save the sample to Excel
210221sample.to_excel(file_output)
211```
212
213### Stratified Systematic Sample
214
215This next example is quite useful if you need audit coverage over a certain time
216period. This code will generate samples for each month in the data and combine
217them all together at the end. Obviously, this code can be modified to stratify
218by something other than months, if needed.
219
220```python
222#+end_src
223
224*** Stratified Systematic Sample
225:PROPERTIES:
226:CUSTOM_ID: stratified-systematic-sample
227:END:
228This next example is quite useful if you need audit coverage over a
229certain time period. This code will generate samples for each month in
230the data and combine them all together at the end. Obviously, this code
231can be modified to stratify by something other than months, if needed.
232
233#+begin_src python
221234# Import the Pandas module
222235import pandas
223236
@@ -257,21 +270,23 @@ def monthly_stratified_sample(df: pandas.DataFrame, date_column: str, num_select
257270sample_size = 3
258271sample = monthly_stratified_sample(df, 'Date of Sale', sample_size)
259272sample.to_excel(file_output)
260```
261
262## Documenting the Results
263
264Once you've generated a proper sample, there are a few things left to do in
265order to properly ensure your process is reproducible.
266
2671. Document the sample. Make sure the resulting file is readable and includes
268 the documentation listed in the next bullet.
2692. Include documentation around the data source, extraction techniques, any
270 modifications made to the data, and be sure to include a copy of the script
271 itself.
2723. Whenever possible, perform a completeness and accuracy test to ensure your
273 sample is coming from a complete and accurate population. To ensure
274 completeness, compare the record count from the data source to the record
275 count loaded into Python. To ensure accuracy, test a small sample against the
276 source data (e.g., test 5 sales against the database to see if the details are
277 accurate).
273#+end_src
274
275** Documenting the Results
276:PROPERTIES:
277:CUSTOM_ID: documenting-the-results
278:END:
279Once you've generated a proper sample, there are a few things left to do
280in order to properly ensure your process is reproducible.
281
2821. Document the sample. Make sure the resulting file is readable and
283 includes the documentation listed in the next bullet.
2842. Include documentation around the data source, extraction techniques,
285 any modifications made to the data, and be sure to include a copy of
286 the script itself.
2873. Whenever possible, perform a completeness and accuracy test to ensure
288 your sample is coming from a complete and accurate population. To
289 ensure completeness, compare the record count from the data source to
290 the record count loaded into Python. To ensure accuracy, test a small
291 sample against the source data (e.g., test 5 sales against the
292 database to see if the details are accurate).
blog/2021-10-09-apache-redirect.org +36 −34
@@ -1,45 +1,47 @@
1+++
2date = 2021-10-10
3title = "Apache Redirect HTML Files to a Directory"
4description = "Learn how to conveniently rewrite certain Apache web file URLs to directories with the Apache web server."
5draft = false
6+++
7
8## The Problem
9
10After recently switching static site generators (SSG), my blog URLs changed with
11no option to preserve the classic `.html` extension at the end of my blog
12post URLs.
13
14I really disliked using my old SSG ([Jekyll](https://jekyllrb.com)) and prefer
15my new tool ([Zola](https://www.getzola.org)) much more, so I was determined to
16figure out a way to get the proper redirect set up so that people who find my
17posts online aren't constantly met by 404 errors.
18
19## The Solution
20
1#+title: Apache Redirect HTML Files to a Directory
2#+date: 2021-10-10
3
4** The Problem
5:PROPERTIES:
6:CUSTOM_ID: the-problem
7:END:
8After recently switching static site generators (SSG), my blog URLs
9changed with no option to preserve the classic =.html= extension at the
10end of my blog post URLs.
11
12I really disliked using my old SSG ([[https://jekyllrb.com][Jekyll]])
13and prefer my new tool ([[https://www.getzola.org][Zola]]) much more, so
14I was determined to figure out a way to get the proper redirect set up
15so that people who find my posts online aren't constantly met by 404
16errors.
17
18** The Solution
19:PROPERTIES:
20:CUSTOM_ID: the-solution
21:END:
2122To solve this problem, I really needed to solve two pieces:
2223
231. Redirect all blog post URL requests from `/blog/some-post.html` to
24 `/blog/some-post/`.
252. Ensure that no other `.html` files are redirected, such as `index.html`.
241. Redirect all blog post URL requests from =/blog/some-post.html= to
25 =/blog/some-post/=.
262. Ensure that no other =.html= files are redirected, such as
27 =index.html=.
2628
27After _a lot_ of tweaking and testing, I believe I have finally found the
28solution. The solution is shown below.
29After /a lot/ of tweaking and testing, I believe I have finally found
30the solution. The solution is shown below.
2931
30```config
32#+begin_src config
3133RewriteEngine On
3234RewriteCond %{REQUEST_URI} !\index.html$ [NC]
3335RewriteRule ^(.*).html$ https://example.com/$1 [R=301,L]
34```
36#+end_src
3537
36This piece of code in the Apache `.conf` or `.htaccess` file will do the
38This piece of code in the Apache =.conf= or =.htaccess= file will do the
3739following:
3840
39411. Turn on the RewriteEngine so that we can modify URLs.
402. Ignore any `index.html` files from the rule we are about to specify.
413. Find any `.html` files within the website directory and redirect it to
42 exclude the file extension.
434. The final piece is adding the trailing slash (`/`) at the end of the URL -
44 you'll notice that I don't have an Apache rule for that since Apache handles
45 that automatically.
422. Ignore any =index.html= files from the rule we are about to specify.
433. Find any =.html= files within the website directory and redirect it
44 to exclude the file extension.
454. The final piece is adding the trailing slash (=/=) at the end of the
46 URL - you'll notice that I don't have an Apache rule for that since
47 Apache handles that automatically.
blog/2021-12-04-cisa.org +209 −182
@@ -1,197 +1,224 @@
1+++
2date = 2021-12-04
3title = "I Passed the CISA!"
4description = "After nearly a year of on-and-off studying, I passed the CISA exam by ISACA."
5draft = false
6+++
7
8## What is the CISA?
1#+title: I Passed the CISA!
2#+date: 2021-12-04
93
4** What is the CISA?
5:PROPERTIES:
6:CUSTOM_ID: what-is-the-cisa
7:END:
108For those of you lucky enough not to be knee-deep in the world of IT/IS
11Auditing, [CISA](https://www.isaca.org/credentialing/cisa) stands for Certified
12Information Systems Auditor. This certification and exam are part of ISACA's
13suite of certifications. As I often explain it to people like my family, it
14basically means you're employed to use your knowledge of information systems,
15regulations, common threats, risks, etc. in order to assess an organization's
16current control of their risk. If a risk isn't controlled (and the company
17doesn't want to accept the risk), an IS auditor will suggest implementing a
18control to address that risk.
19
20Now, the CISA certification itself is, in my opinion, the main certification for
21this career. While certifications such as the CPA or CISSP are beneficial,
22nothing matches the power of the CISA for an IS auditor when it comes to getting
23hired, getting a raise/bonus, or earning respect in the field.
24
25However, to be honest, I am a skeptic of most certifications. I understand the
26value they hold in terms of how much you need to commit to studying or learning
27on the job, as well as the market value for certifications such as the CISA.
28But I also have known some very ~~incompetent~~ _less than stellar_ auditors
29who have CPAs, CISAs, CIAs, etc.
30
31The same goes for most industries: if a person is good at studying, they can
32earn the certification. However, that knowledge means nothing unless you're
33actually able to use it in real life and perform as expected of a certification
34holder. The challenge comes when people are hired or connected strictly because
35of their certifications or resume; you need to see a person work before you can
36assume them having a CISA means they're better than someone without the CISA.
37
38Okay, rant over. Certifications are generally accepted as a measuring stick of
39commitment and quality of an employee, so I am accepting it too.
40
41## Exam Content
42
43The CISA is broken down into five sections, each weighted with a percentage of
44test questions that may appear.
45
46![CISA exam sections](https://img.cleberg.net/blog/20211204-i-passed-the-cisa/cisa-exam-sections.png)
47
48Since the exam contains 150 questions, here's how those sections break down:
49
50| Exam Section | Percentage of Exam | Questions |
51|:---------------:|:------------------:|:---------:|
52| 1 | 21% | 32 |
53| 2 | 17% | 26 |
54| 3 | 12% | 18 |
55| 4 | 23% | 34 |
56| 5 | 27% | 40 |
57| **Grand Total** | **100%** | **150** |
58
59## My Studying Habits
60
61This part is a little hard for me to break down into specific detail due to the
62craziness of the last year. While I officially purchased my studying materials
63in December 2020 and opened them to "start studying" in January 2021, I really
64wasn't able to study much due to the demands of my job and personal life.
9Auditing, [[https://www.isaca.org/credentialing/cisa][CISA]] stands for
10Certified Information Systems Auditor. This certification and exam are
11part of ISACA's suite of certifications. As I often explain it to people
12like my family, it basically means you're employed to use your knowledge
13of information systems, regulations, common threats, risks, etc. in
14order to assess an organization's current control of their risk. If a
15risk isn't controlled (and the company doesn't want to accept the risk),
16an IS auditor will suggest implementing a control to address that risk.
17
18Now, the CISA certification itself is, in my opinion, the main
19certification for this career. While certifications such as the CPA or
20CISSP are beneficial, nothing matches the power of the CISA for an IS
21auditor when it comes to getting hired, getting a raise/bonus, or
22earning respect in the field.
23
24However, to be honest, I am a skeptic of most certifications. I
25understand the value they hold in terms of how much you need to commit
26to studying or learning on the job, as well as the market value for
27certifications such as the CISA. But I also have known some very
28+incompetent+ /less than stellar/ auditors who have CPAs, CISAs, CIAs,
29etc.
30
31The same goes for most industries: if a person is good at studying, they
32can earn the certification. However, that knowledge means nothing unless
33you're actually able to use it in real life and perform as expected of a
34certification holder. The challenge comes when people are hired or
35connected strictly because of their certifications or resume; you need
36to see a person work before you can assume them having a CISA means
37they're better than someone without the CISA.
38
39Okay, rant over. Certifications are generally accepted as a measuring
40stick of commitment and quality of an employee, so I am accepting it
41too.
42
43** Exam Content
44:PROPERTIES:
45:CUSTOM_ID: exam-content
46:END:
47The CISA is broken down into five sections, each weighted with a
48percentage of test questions that may appear.
49
50#+caption: CISA exam sections
51[[https://img.cleberg.net/blog/20211204-i-passed-the-cisa/cisa-exam-sections.png]]
52
53Since the exam contains 150 questions, here's how those sections break
54down:
55
56| Exam Section | Percentage of Exam | Questions |
57|---------------+--------------------+-----------|
58| 1 | 21% | 32 |
59| 2 | 17% | 26 |
60| 3 | 12% | 18 |
61| 4 | 23% | 34 |
62| 5 | 27% | 40 |
63| *Grand Total* | *100%* | *150* |
64
65** My Studying Habits
66:PROPERTIES:
67:CUSTOM_ID: my-studying-habits
68:END:
69This part is a little hard for me to break down into specific detail due
70to the craziness of the last year. While I officially purchased my
71studying materials in December 2020 and opened them to "start studying"
72in January 2021, I really wasn't able to study much due to the demands
73of my job and personal life.
6574
6675Let me approach this from a few different viewpoints.
6776
68### Study Materials
69
70Let's start by discussing the study materials I purchased. I'll be referring to
71#1 as the CRM and #2 as the QAE.
72
731. [CISA Review Manual, 27th Edition | Print](https://store.isaca.org/s/store#/store/browse/detail/a2S4w000004KoCbEAK)
742. [CISA Review Questions, Answers & Explanations Manual, 12th Edition | Print](https://store.isaca.org/s/store#/store/browse/detail/a2S4w000004KoCcEAK)
75
76The CRM is an excellent source of information and could honestly be used as a
77reference for most IS auditors as a learning reference during their daily audit
78responsibilities. However, it is **full** of information and can be overloading
79if you're not good at filtering out useless information while studying.
80
81The QAE is the real star of the show here. This book contains 1000 questions,
82separated by exam section, and a practice exam. My only complaint about the QAE
83is that each question is immediately followed with the correct answer and
84explanations below it, which means I had to use something to constantly cover
85the answers while I was studying.
86
87I didn't use the online database version of the QAE, but I've heard that it's
88easier to use than the printed book. However, it is more expensive ($299
89database vs $129 book) which might be important if you're paying for materials
90yourself.
91
92In terms of question difficulty, I felt that the QAE was a good representation
93of the actual exam. I've seen a lot of people online say it wasn't accurate to
94the exam or that it was much easier/harder, but I disagree with all of those.
95The exam was fairly similar to the QAE, just focusing on whichever topics they
96chose for my version of the exam.
97
98If you understand the concepts, skim the CRM (and read in-depth on topics you
99struggle with), and use the QAE to continue practicing exam-like questions, you
100should be fine. I didn't use any online courses, videos, etc. - the ISACA
101materials are more than enough.
102
103### Studying Process
104
105While I was able to briefly read through sections 1 and 2 in early 2021, I had
106to stop and take a break from February/March to September.
107I switched jobs in September, which allowed me a lot more free time to study.
108
109In September, I studied sections 3-5, took notes, and did a quick review of the
110section topics. Once I felt comfortable with my notes, I took a practice exam
111from the QAE manual and scored 70% (105/150).
77*** Study Materials
78:PROPERTIES:
79:CUSTOM_ID: study-materials
80:END:
81Let's start by discussing the study materials I purchased. I'll be
82referring to #1 as the CRM and #2 as the QAE.
83
841. [[https://store.isaca.org/s/store#/store/browse/detail/a2S4w000004KoCbEAK][CISA
85 Review Manual, 27th Edition | Print]]
862. [[https://store.isaca.org/s/store#/store/browse/detail/a2S4w000004KoCcEAK][CISA
87 Review Questions, Answers & Explanations Manual, 12th Edition |
88 Print]]
89
90The CRM is an excellent source of information and could honestly be used
91as a reference for most IS auditors as a learning reference during their
92daily audit responsibilities. However, it is *full* of information and
93can be overloading if you're not good at filtering out useless
94information while studying.
95
96The QAE is the real star of the show here. This book contains 1000
97questions, separated by exam section, and a practice exam. My only
98complaint about the QAE is that each question is immediately followed
99with the correct answer and explanations below it, which means I had to
100use something to constantly cover the answers while I was studying.
101
102I didn't use the online database version of the QAE, but I've heard that
103it's easier to use than the printed book. However, it is more expensive
104($299 database vs $129 book) which might be important if you're paying
105for materials yourself.
106
107In terms of question difficulty, I felt that the QAE was a good
108representation of the actual exam. I've seen a lot of people online say
109it wasn't accurate to the exam or that it was much easier/harder, but I
110disagree with all of those. The exam was fairly similar to the QAE, just
111focusing on whichever topics they chose for my version of the exam.
112
113If you understand the concepts, skim the CRM (and read in-depth on
114topics you struggle with), and use the QAE to continue practicing
115exam-like questions, you should be fine. I didn't use any online
116courses, videos, etc. - the ISACA materials are more than enough.
117
118*** Studying Process
119:PROPERTIES:
120:CUSTOM_ID: studying-process
121:END:
122While I was able to briefly read through sections 1 and 2 in early 2021,
123I had to stop and take a break from February/March to September. I
124switched jobs in September, which allowed me a lot more free time to
125study.
126
127In September, I studied sections 3-5, took notes, and did a quick review
128of the section topics. Once I felt comfortable with my notes, I took a
129practice exam from the QAE manual and scored 70% (105/150).
112130
113131Here's a breakdown of my initial practice exam:
114132
115| Exam Section | Incorrect | Correct | Grand Total | Percent |
116|:---------------:|:---------:|:-------:|:-----------:|:-------:|
117| 1 | 8 | 25 | 33 | 76% |
118| 2 | 5 | 20 | 25 | 80% |
119| 3 | 6 | 12 | 18 | 67% |
120| 4 | 10 | 23 | 33 | 70% |
121| 5 | 16 | 25 | 41 | 61% |
122| **Grand Total** | **45** | **105** | **150** | **70%** |
133| Exam Section | Incorrect | Correct | Grand Total | Percent |
134|---------------+-----------+---------+-------------+---------|
135| 1 | 8 | 25 | 33 | 76% |
136| 2 | 5 | 20 | 25 | 80% |
137| 3 | 6 | 12 | 18 | 67% |
138| 4 | 10 | 23 | 33 | 70% |
139| 5 | 16 | 25 | 41 | 61% |
140| *Grand Total* | *45* | *105* | *150* | *70%* |
123141
124142As I expected, my toughest sections were related to project management,
125143development, implementation, and security.
126144
127This just leaves October and November. For these months, I tried to practice
128every few days, doing 10 questions for each section, until the exam. This came
129out to 13 practice sessions, ~140 questions per section, and ~700 questions
130total.
131
132While some practice sessions were worse and some were better, the final results
133were similar to my practice exam results. As you can see below, my averages were
134slightly worse than my practice exam. However, I got in over 700 questions of
135practice and, most importantly, **I read through the explanations every time I
136answered incorrectly and learned from my mistakes**.
137
138| Exam Section | Incorrect | Correct | Grand Total | Percent |
139|:---------------:|:---------:|:-------:|:-----------:|:-------:|
140| 1 | 33 | 108 | 141 | 77% |
141| 2 | 33 | 109 | 142 | 77% |
142| 3 | 55 | 89 | 144 | 62% |
143| 4 | 52 | 88 | 140 | 63% |
144| 5 | 55 | 85 | 140 | 61% |
145| **Grand Total** | **228** | **479** | **707** | **68%** |
146
147![CISA practice question results](https://img.cleberg.net/blog/20211204-i-passed-the-cisa/cisa-practice-questions-results.png)
148
149## Results
150
151Now, how do the practice scores reflect my actual results?
152After all, it's hard to tell how good a practice regimen is unless you see
153how it turns out.
154
155| Exam Section | Section Name | Score |
156|:------------:|------------------------------------------------------------------|:-------:|
157| 1 | Information Systems Auditing Process | 678 |
158| 2 | Governance and Management of IT | 590 |
159| 3 | Information Systems Acquisition, Development, and Implementation | 721 |
160| 4 | Information Systems Operations and Business Resilience | 643 |
161| 5 | Protection of Information Assets | 511 |
162| **TOTAL** | | **616** |
163
164Now, in order to pass the CISA, you need at least 450 on a sliding scale of
165200-800. Personally, I really have no clue what an average CISA score is. After
166a _very_ brief look online, I can see that the high end is usually in the low
167700s. In addition, only about 50-60% of people pass the exam.
168
169Given this information, I feel great about my scores.
170616 may not be phenomenal, and I wish I had done better on sections 2 & 5,
171but my practicing seems to have worked very well overall.
172
173However, the practice results do not conform to the actual results. Section 2
174was one of my highest practice sections and was my second-lowest score in the
175exam. Conversely, section 3 was my second-lowest practice section and turned out
176to be my highest actual score!
177
178After reflecting, it is obvious that if you have any background on the CISA
179topics at all, the most important part of studying is doing practice questions.
180You really need to understand how to read the questions critically and pick the
181best answer.
182
183## Looking Forward
184
185I am extremely happy that I was finally able to pass the CISA. Looking to the
186future, I'm not sure what's next in terms of professional learning. My current
187company offers internal learning courses, so I will most likely focus on that if
188I need to gain more knowledge in certain areas.
189
190To be fair, even if you pass the CISA, it's hard to become an expert on any
191specific topic found within.
192My career may take me in a different direction, and I might need to focus
193more on security or networking certifications (or possibly building a better
194analysis/visualization portfolio if I want to go into data analysis/science).
145This just leaves October and November. For these months, I tried to
146practice every few days, doing 10 questions for each section, until the
147exam. This came out to 13 practice sessions, ~140 questions per section,
148and ~700 questions total.
149
150While some practice sessions were worse and some were better, the final
151results were similar to my practice exam results. As you can see below,
152my averages were slightly worse than my practice exam. However, I got in
153over 700 questions of practice and, most importantly, *I read through
154the explanations every time I answered incorrectly and learned from my
155mistakes*.
156
157| Exam Section | Incorrect | Correct | Grand Total | Percent |
158|---------------+-----------+---------+-------------+---------|
159| 1 | 33 | 108 | 141 | 77% |
160| 2 | 33 | 109 | 142 | 77% |
161| 3 | 55 | 89 | 144 | 62% |
162| 4 | 52 | 88 | 140 | 63% |
163| 5 | 55 | 85 | 140 | 61% |
164| *Grand Total* | *228* | *479* | *707* | *68%* |
165
166#+caption: CISA practice question results
167[[https://img.cleberg.net/blog/20211204-i-passed-the-cisa/cisa-practice-questions-results.png]]
168
169** Results
170:PROPERTIES:
171:CUSTOM_ID: results
172:END:
173Now, how do the practice scores reflect my actual results? After all,
174it's hard to tell how good a practice regimen is unless you see how it
175turns out.
176
177| Exam Section | Section Name | Score |
178|--------------+------------------------------------------------------------------+-------|
179| 1 | Information Systems Auditing Process | 678 |
180| 2 | Governance and Management of IT | 590 |
181| 3 | Information Systems Acquisition, Development, and Implementation | 721 |
182| 4 | Information Systems Operations and Business Resilience | 643 |
183| 5 | Protection of Information Assets | 511 |
184| *TOTAL* | | *616* |
185
186Now, in order to pass the CISA, you need at least 450 on a sliding scale
187of 200-800. Personally, I really have no clue what an average CISA score
188is. After a /very/ brief look online, I can see that the high end is
189usually in the low 700s. In addition, only about 50-60% of people pass
190the exam.
191
192Given this information, I feel great about my scores. 616 may not be
193phenomenal, and I wish I had done better on sections 2 & 5, but my
194practicing seems to have worked very well overall.
195
196However, the practice results do not conform to the actual results.
197Section 2 was one of my highest practice sections and was my
198second-lowest score in the exam. Conversely, section 3 was my
199second-lowest practice section and turned out to be my highest actual
200score!
201
202After reflecting, it is obvious that if you have any background on the
203CISA topics at all, the most important part of studying is doing
204practice questions. You really need to understand how to read the
205questions critically and pick the best answer.
206
207** Looking Forward
208:PROPERTIES:
209:CUSTOM_ID: looking-forward
210:END:
211I am extremely happy that I was finally able to pass the CISA. Looking
212to the future, I'm not sure what's next in terms of professional
213learning. My current company offers internal learning courses, so I will
214most likely focus on that if I need to gain more knowledge in certain
215areas.
216
217To be fair, even if you pass the CISA, it's hard to become an expert on
218any specific topic found within. My career may take me in a different
219direction, and I might need to focus more on security or networking
220certifications (or possibly building a better analysis/visualization
221portfolio if I want to go into data analysis/science).
195222
196223All I know is that I am content at the moment and extremely proud of my
197224accomplishment.
blog/2022-02-10-leaving-the-office.org +249 −202
@@ -1,227 +1,274 @@
1+++
2date = 2022-02-10
3title = "Leaving Office-Based Work In the Past"
4description = "As the world moves on from the before-times, I'm taking a look back on how working from different office environments affected my effectiveness and comfort."
5draft = false
6+++
7
8## The Working World is Changing
9
10There has been a trend for the past few years of companies slowly realizing that
11the pandemic is not just a temporary state that will go away eventually and let
12everything return to the way it was before. In terms of business and employment,
13this means that more and more jobs are being offered as permanently remote
14roles.
1#+title: Leaving Office-Based Work In the Past
2#+date: 2022-02-10
3
4** The Working World is Changing
5:PROPERTIES:
6:CUSTOM_ID: the-working-world-is-changing
7:END:
8There has been a trend for the past few years of companies slowly
9realizing that the pandemic is not just a temporary state that will go
10away eventually and let everything return to the way it was before. In
11terms of business and employment, this means that more and more jobs are
12being offered as permanently remote roles.
1513
1614I had always dreamt of working from home but thought of it as a fantasy,
17especially since I did not want to move over into the software development
18field. However, I have found that almost all roles being sent to me via
19recruiters are permanently remote (although most are limited to US citizens or
20even region-locked for companies who only operate in select states).
21
22I decided to take a look back at my relatively short career so far and compare
23the positive and negative effects of the different work environments I've been
24in.
25
26## In-Person Offices
27
28### Retail Internship
29
30I started my first job as a management intern at a busy retail pharmacy, working
31my 40-hour weeks on my feet.
32As these retail stores don't believe in resting or sitting down, you can
33guarantee that you will spend entire shifts standing, walking, or running
34around the store.
35Unfortunately, I worked at a time when our store didn't have enough managers,
36so I spent the majority of my tenure at the store running and breaking a sweat.
37
38Now, things aren't all bad in retail stores like this. It is definitely tiring
39and inefficient to force employees to work constantly, or pretend to work if
40there's nothing to do, and not allow anyone to sit down. However, if you are
41able to operate a retail store with a limited crew and provide enough comfort
42and support, I believe these jobs could be both comfortable and efficient.
43
44### Semi-Private Cubicles
45
46![Semi-Private Cubicles](https://img.cleberg.net/blog/20220210-leaving-office-based-work-in-the-past/private_cubicles.png)
47
48After about a year, I was able to find another internship - this time, it was in
49my field of interest: internal auditing. This was for a life insurance company
50that was well over 100 years old. The age of the company shows if you work
51there, as most people in management are well into their 40s-60s with little to
52no youthful leadership in the company.
53Likewise, they owned a large headquarters in a nice area of town with plenty
54of space, parking, etc.
55
56One upside is that each person gets their own large L-shaped desk, formed into
57cubicles that house 4 desks/employees. These "pods" of 4-person cubicles are
58linked throughout each floor of the headquarters (except the sales
59people, who had that open-floor concept going on). The walls of the cubicle were
60tall and provided a lot of privacy and sound-proofing, except when I used the
61standing desk feature (I'm over 6 feet tall, so probably not an issue for most
62people).
15especially since I did not want to move over into the software
16development field. However, I have found that almost all roles being
17sent to me via recruiters are permanently remote (although most are
18limited to US citizens or even region-locked for companies who only
19operate in select states).
20
21I decided to take a look back at my relatively short career so far and
22compare the positive and negative effects of the different work
23environments I've been in.
24
25** In-Person Offices
26:PROPERTIES:
27:CUSTOM_ID: in-person-offices
28:END:
29*** Retail Internship
30:PROPERTIES:
31:CUSTOM_ID: retail-internship
32:END:
33I started my first job as a management intern at a busy retail pharmacy,
34working my 40-hour weeks on my feet. As these retail stores don't
35believe in resting or sitting down, you can guarantee that you will
36spend entire shifts standing, walking, or running around the store.
37Unfortunately, I worked at a time when our store didn't have enough
38managers, so I spent the majority of my tenure at the store running and
39breaking a sweat.
40
41Now, things aren't all bad in retail stores like this. It is definitely
42tiring and inefficient to force employees to work constantly, or pretend
43to work if there's nothing to do, and not allow anyone to sit down.
44However, if you are able to operate a retail store with a limited crew
45and provide enough comfort and support, I believe these jobs could be
46both comfortable and efficient.
47
48*** Semi-Private Cubicles
49:PROPERTIES:
50:CUSTOM_ID: semi-private-cubicles
51:END:
52#+caption: Semi-Private Cubicles
53[[https://img.cleberg.net/blog/20220210-leaving-office-based-work-in-the-past/private_cubicles.png]]
54
55After about a year, I was able to find another internship - this time,
56it was in my field of interest: internal auditing. This was for a life
57insurance company that was well over 100 years old. The age of the
58company shows if you work there, as most people in management are well
59into their 40s-60s with little to no youthful leadership in the company.
60Likewise, they owned a large headquarters in a nice area of town with
61plenty of space, parking, etc.
62
63One upside is that each person gets their own large L-shaped desk,
64formed into cubicles that house 4 desks/employees. These "pods" of
654-person cubicles are linked throughout each floor of the headquarters
66(except the sales people, who had that open-floor concept going on). The
67walls of the cubicle were tall and provided a lot of privacy and
68sound-proofing, except when I used the standing desk feature (I'm over 6
69feet tall, so probably not an issue for most people).
6370
6471I loved this environment, it allowed me to focus on my work with minimal
65distractions, but also allowed easy access, so I could spin around in my chair
66and chat with my friends without leaving my chair. This is the closest I've been
67to a home office environment (which is my personal favorite, as I'll get to
68later in this post).
69
70### Semi-Open Floor Concept
71
72![Semi-Open Floor Concept](https://img.cleberg.net/blog/20220210-leaving-office-based-work-in-the-past/semi_open_office.png)
73
74When I shifted to my first full-time internal audit job out of college, I was
75working at a company that was headquartered on a floor in a downtown high-rise
76building. The company was only about 20 years old when I worked there and were
77trying a lot of new things to attract young talent, one of which was a
78semi-open floor concept for the office. My department worked just around the
79hallway corner from the executive offices and used that "modern" layout young
80tech companies started using in the 2000s/2010s.
81
82Each desk was brief, and you could look most coworkers in the face without
83moving from your chair, I hated this so much.
84Directly to my left was the Chief Audit Executive (our department's leading
85boss), and his desk was pointed so that his face would stare straight at my
86desk all day.
87I spent more time thinking about who was looking at me or checking on me
88than actually working.
89
90The other annoying part of the open concept they used was that the kitchen area
91and pathways were too close to everyone's desks (since the desks were spread
92out, to provide space or something), so noise and conversation would be constant
93throughout the day while you try to work. For someone like me, who needs silence
94to get work done, that was a non-starter.
95
96### Hotel Office Concept
97
98![Hotel Office Concept](https://img.cleberg.net/blog/20220210-leaving-office-based-work-in-the-past/hotel_desks.png)
99
100I currently work for a company remotely (for now) and travel to the office every
101once in a while for events and to help coach the staff underneath me. The office
102I visit uses the hotel desk concept, where you need to check in at a touch
103screen when you enter the office and "rent" a desk for the day. The same goes
104for offices and meeting rooms.
105
106These desks are flat-top only and do not have any walls at all. In addition,
107they're stacked with one row of 4 desks facing another row of 4 desks. These
108pairs of desk rows are repeated through the office.
109
110This means that when I go, I need to rent a random desk or try to remember the
111unique ID numbers on desks I like. Once I rent it, I have to make sure no one
112sat down in that desk without renting it. Then, I can sit down and work, but
113will probably need to adjust the monitors so that I'm not staring in the face of
114the person across from me all day. Finally, I need to wear headphones as this
115environment does nothing to provide you with peace or quiet.
116
117Luckily, you can rent offices with doors that offer quiet and privacy, which can
118be very nice if you have a lot of meetings or webinars on a certain day.
119
120## Home Office
121
122![Home Office](https://img.cleberg.net/blog/20220210-leaving-office-based-work-in-the-past/home_office.png)
123
124Okay, now let's finally get to the home office concept. I have worked from home
125for a little over two years at this point, across three different
126jobs/employers. Over this time, I have experimented with a plethora of different
127organizational ideas, desks, and room layouts to find what works best for me.
128
129These things might not apply to you, and that's fine.
130Everyone has a different situation, and I really don't think you'll know
131what works until you try.
132
133### Tip #1
134
72distractions, but also allowed easy access, so I could spin around in my
73chair and chat with my friends without leaving my chair. This is the
74closest I've been to a home office environment (which is my personal
75favorite, as I'll get to later in this post).
76
77*** Semi-Open Floor Concept
78:PROPERTIES:
79:CUSTOM_ID: semi-open-floor-concept
80:END:
81#+caption: Semi-Open Floor Concept
82[[https://img.cleberg.net/blog/20220210-leaving-office-based-work-in-the-past/semi_open_office.png]]
83
84When I shifted to my first full-time internal audit job out of college,
85I was working at a company that was headquartered on a floor in a
86downtown high-rise building. The company was only about 20 years old
87when I worked there and were trying a lot of new things to attract young
88talent, one of which was a semi-open floor concept for the office. My
89department worked just around the hallway corner from the executive
90offices and used that "modern" layout young tech companies started using
91in the 2000s/2010s.
92
93Each desk was brief, and you could look most coworkers in the face
94without moving from your chair, I hated this so much. Directly to my
95left was the Chief Audit Executive (our department's leading boss), and
96his desk was pointed so that his face would stare straight at my desk
97all day. I spent more time thinking about who was looking at me or
98checking on me than actually working.
99
100The other annoying part of the open concept they used was that the
101kitchen area and pathways were too close to everyone's desks (since the
102desks were spread out, to provide space or something), so noise and
103conversation would be constant throughout the day while you try to work.
104For someone like me, who needs silence to get work done, that was a
105non-starter.
106
107*** Hotel Office Concept
108:PROPERTIES:
109:CUSTOM_ID: hotel-office-concept
110:END:
111#+caption: Hotel Office Concept
112[[https://img.cleberg.net/blog/20220210-leaving-office-based-work-in-the-past/hotel_desks.png]]
113
114I currently work for a company remotely (for now) and travel to the
115office every once in a while for events and to help coach the staff
116underneath me. The office I visit uses the hotel desk concept, where you
117need to check in at a touch screen when you enter the office and "rent"
118a desk for the day. The same goes for offices and meeting rooms.
119
120These desks are flat-top only and do not have any walls at all. In
121addition, they're stacked with one row of 4 desks facing another row of
1224 desks. These pairs of desk rows are repeated through the office.
123
124This means that when I go, I need to rent a random desk or try to
125remember the unique ID numbers on desks I like. Once I rent it, I have
126to make sure no one sat down in that desk without renting it. Then, I
127can sit down and work, but will probably need to adjust the monitors so
128that I'm not staring in the face of the person across from me all day.
129Finally, I need to wear headphones as this environment does nothing to
130provide you with peace or quiet.
131
132Luckily, you can rent offices with doors that offer quiet and privacy,
133which can be very nice if you have a lot of meetings or webinars on a
134certain day.
135
136** Home Office
137:PROPERTIES:
138:CUSTOM_ID: home-office
139:END:
140#+caption: Home Office
141[[https://img.cleberg.net/blog/20220210-leaving-office-based-work-in-the-past/home_office.png]]
142
143Okay, now let's finally get to the home office concept. I have worked
144from home for a little over two years at this point, across three
145different jobs/employers. Over this time, I have experimented with a
146plethora of different organizational ideas, desks, and room layouts to
147find what works best for me.
148
149These things might not apply to you, and that's fine. Everyone has a
150different situation, and I really don't think you'll know what works
151until you try.
152
153*** Tip #1
154:PROPERTIES:
155:CUSTOM_ID: tip-1
156:END:
135157Let's start with my top rule for a home office:
136158
137> If you live with others, working in a shared space is not effective.
159#+begin_quote
160If you live with others, working in a shared space is not effective.
138161
139It just does not work.
140If you have another person sleeping in your bedroom, it is difficult to
141manage your work schedule with their sleeping/work/school schedule.
142If they wake up after you need to start work, you might wake them up
143or have to suffer the agony of staring at bright screens in a dark room.
162#+end_quote
144163
145In a similar vein, working from a location such as the living room likely won't
146work either.
147Distractions will come far more frequently: televisions, cooking, cleaning,
148deliveries, etc. If you're like me, you'll end up playing a game instead of
149actually doing any work.
164It just does not work. If you have another person sleeping in your
165bedroom, it is difficult to manage your work schedule with their
166sleeping/work/school schedule. If they wake up after you need to start
167work, you might wake them up or have to suffer the agony of staring at
168bright screens in a dark room.
150169
151### Tip #2
170In a similar vein, working from a location such as the living room
171likely won't work either. Distractions will come far more frequently:
172televisions, cooking, cleaning, deliveries, etc. If you're like me,
173you'll end up playing a game instead of actually doing any work.
152174
175*** Tip #2
176:PROPERTIES:
177:CUSTOM_ID: tip-2
178:END:
153179Okay, the second thing I've discovered that works for me:
154180
155> Use the pomodoro method (or something similar) to balance work tasks with
156> personal tasks.
157
158I use a very casual version of the pomodoro method where I will work for 1-2
159hours (usually set in strict intervals like 1, 1.5, 2 hours) and then will allow
160myself 30-60 minutes for personal tasks. This schedule works for me, since my
161work schedule really only comes to 3-6 hours of work per day.
162
163In this case, I'll work through my list of tasks for an hour or two and then
164give myself personal time to get drinks and food, wash dishes, put clothes in
165the washer, get the mail, etc. If you're in a convenient location, this usually
166gives time for things like getting groceries (as long as you're not a slow
167shopper).
168
169### Tip #3
170
171While I listed this one as number three, I don't think I'd accomplish anything
172without it:
173
174> Document everything: even things you didn't before - such as task lists and
175> notes from casual calls or meetings.
176
177I've noticed that staying in an office gave me more constant reminders of
178outstanding tasks or facts I had learned in a conversation. Translating
179everything to a digital world has made me lose a bit of that focus (perhaps
180since I don't have visual reminders?).
181
182Keeping a running task list of all things I have to do - even potential tasks! -
183has helped me keep up without missing anything small. Likewise, keeping notes
184for ALL meetings and calls, no matter how casual/quick, has improved my
185retention immensely. Beyond helping my mental recollection, it has saved me
186numerous times when I need to do a keyword search for some topic that was discussed
1876+ months ago.
188
189### Tip #4
190
181#+begin_quote
182Use the pomodoro method (or something similar) to balance work tasks
183with personal tasks.
184
185#+end_quote
186
187I use a very casual version of the pomodoro method where I will work for
1881-2 hours (usually set in strict intervals like 1, 1.5, 2 hours) and
189then will allow myself 30-60 minutes for personal tasks. This schedule
190works for me, since my work schedule really only comes to 3-6 hours of
191work per day.
192
193In this case, I'll work through my list of tasks for an hour or two and
194then give myself personal time to get drinks and food, wash dishes, put
195clothes in the washer, get the mail, etc. If you're in a convenient
196location, this usually gives time for things like getting groceries (as
197long as you're not a slow shopper).
198
199*** Tip #3
200:PROPERTIES:
201:CUSTOM_ID: tip-3
202:END:
203While I listed this one as number three, I don't think I'd accomplish
204anything without it:
205
206#+begin_quote
207Document everything: even things you didn't before - such as task lists
208and notes from casual calls or meetings.
209
210#+end_quote
211
212I've noticed that staying in an office gave me more constant reminders
213of outstanding tasks or facts I had learned in a conversation.
214Translating everything to a digital world has made me lose a bit of that
215focus (perhaps since I don't have visual reminders?).
216
217Keeping a running task list of all things I have to do - even potential
218tasks! - has helped me keep up without missing anything small. Likewise,
219keeping notes for ALL meetings and calls, no matter how casual/quick,
220has improved my retention immensely. Beyond helping my mental
221recollection, it has saved me numerous times when I need to do a keyword
222search for some topic that was discussed 6+ months ago.
223
224*** Tip #4
225:PROPERTIES:
226:CUSTOM_ID: tip-4
227:END:
191228Okay, last one for now.
192229
193> Keep your work area clean.
230#+begin_quote
231Keep your work area clean.
194232
195This one is straightforward, but I know some people struggle with cleanliness or
196may not believe it makes a difference. Trust me, keeping your desk area clean
197and organized makes a huge difference, both mentally and emotionally.
233#+end_quote
198234
199Just think about it, you walk into your home office and see a clean desk with a
200laptop, dock, monitors, keyboard, mouse, and a notepad with a pen on top.
235This one is straightforward, but I know some people struggle with
236cleanliness or may not believe it makes a difference. Trust me, keeping
237your desk area clean and organized makes a huge difference, both
238mentally and emotionally.
201239
202Now imagine the opposite, there's an office with the same equipment, but there
203are clothes hanging on the chair, empty drink bottles, candy wrappers and dirty
204plates. This can take both a mental and emotional toll by bringing constant
205disarray and stress into your working environment.
240Just think about it, you walk into your home office and see a clean desk
241with a laptop, dock, monitors, keyboard, mouse, and a notepad with a pen
242on top.
206243
207Just keep things clean each day, and you won't need to do any big cleaning days
208to recover.
244Now imagine the opposite, there's an office with the same equipment, but
245there are clothes hanging on the chair, empty drink bottles, candy
246wrappers and dirty plates. This can take both a mental and emotional
247toll by bringing constant disarray and stress into your working
248environment.
209249
210## My Preferences
250Just keep things clean each day, and you won't need to do any big
251cleaning days to recover.
211252
212I've talked about the different environments I've worked in and expressed some
213honest thoughts on pros or cons to each, but what do I prefer? Well, if you're
214reading along, you should be able to tell that I much prefer a home office above
215all else.
253** My Preferences
254:PROPERTIES:
255:CUSTOM_ID: my-preferences
256:END:
257I've talked about the different environments I've worked in and
258expressed some honest thoughts on pros or cons to each, but what do I
259prefer? Well, if you're reading along, you should be able to tell that I
260much prefer a home office above all else.
216261
217Being able to control my own day and allot my time as needed has brought a
218calmness to my life and has allowed me to maximize each day. I feel far more
219effective and efficient in a home office than any other office, especially
220open-office layouts.
262Being able to control my own day and allot my time as needed has brought
263a calmness to my life and has allowed me to maximize each day. I feel
264far more effective and efficient in a home office than any other office,
265especially open-office layouts.
221266
222If I do need to return to an office part-time in the future, I really hope the
223office will have privacy and quietness in order for me to get my work done.
267If I do need to return to an office part-time in the future, I really
268hope the office will have privacy and quietness in order for me to get
269my work done.
224270
225271Cubicles are good! I agree with Alice (from the comic Dilbert):
226272
227![Dilbert comic strip](https://img.cleberg.net/blog/20220210-leaving-office-based-work-in-the-past/dilbert_120109.png)
273#+caption: Dilbert comic strip
274[[https://img.cleberg.net/blog/20220210-leaving-office-based-work-in-the-past/dilbert_120109.png]]
blog/2022-02-16-debian-and-nginx.org +120 −113
@@ -1,76 +1,78 @@
1+++
2date = 2022-02-16
3title = "Migrating to a New Web Server Setup with Debian, Nginx, and Agate"
4description = "I've finally taken the leap of faith on two different technologies for the first time: trying out Debian as my main server OS and Nginx as my web server software."
5draft = false
6+++
7
8## Server OS: Debian
9
10![Debian + neofetch](https://img.cleberg.net/blog/20220216-migrating-to-debian-and-nginx/neofetch.png)
11
12I've used various Linux distributions throughout the years, but I've never used
13anything except Ubuntu for my servers.
14Why?
15I really have no idea, mostly just comfort around the commands and software
16availability.
17
18However, I have always wanted to try Debian as a server OS after testing it out
19in a VM a few years ago (side-note: I'd love to try Alpine too, but I always
20struggle with compatibility). So, I decided to launch a new VPS and use
21[Debian](https://www.debian.org) 11 as the OS. Spoiler alert: it feels identical
22to Ubuntu for my purposes.
23
24I did the normal things when first launching the VPS, such as adding a new user,
25locking down SSH, etc. If you want to see that level of detail, read my other
26post about
27[How to Set Up a VPS Web Server](https://cleberg.net/blog/how-to-set-up-a-vps-web-server/).
28
29All of this has been similar, apart from small things such as the location of
30users' home folders. No complaints at all from me - Debian seems great.
31
32## Web Server: Nginx
33
34![Nginx status](https://img.cleberg.net/blog/20220216-migrating-to-debian-and-nginx/nginx.png)
35
36Once I had the baseline server configuration set-up for Debian, I moved on to
37trying out [Nginx](https://nginx.org) as my web server software. This required
38me to install the `nginx` and `ufw` packages, as well as setting up the initial
39UFW config:
40
41```sh
1#+title: Migrating to a New Web Server Setup with Debian, Nginx, and Agate
2#+date: 2022-02-16
3
4** Server OS: Debian
5:PROPERTIES:
6:CUSTOM_ID: server-os-debian
7:END:
8#+caption: Debian + neofetch
9[[https://img.cleberg.net/blog/20220216-migrating-to-debian-and-nginx/neofetch.png]]
10
11I've used various Linux distributions throughout the years, but I've
12never used anything except Ubuntu for my servers. Why? I really have no
13idea, mostly just comfort around the commands and software availability.
14
15However, I have always wanted to try Debian as a server OS after testing
16it out in a VM a few years ago (side-note: I'd love to try Alpine too,
17but I always struggle with compatibility). So, I decided to launch a new
18VPS and use [[https://www.debian.org][Debian]] 11 as the OS. Spoiler
19alert: it feels identical to Ubuntu for my purposes.
20
21I did the normal things when first launching the VPS, such as adding a
22new user, locking down SSH, etc. If you want to see that level of
23detail, read my other post about
24[[https://cleberg.net/blog/how-to-set-up-a-vps-web-server/][How to Set
25Up a VPS Web Server]].
26
27All of this has been similar, apart from small things such as the
28location of users' home folders. No complaints at all from me - Debian
29seems great.
30
31** Web Server: Nginx
32:PROPERTIES:
33:CUSTOM_ID: web-server-nginx
34:END:
35#+caption: Nginx status
36[[https://img.cleberg.net/blog/20220216-migrating-to-debian-and-nginx/nginx.png]]
37
38Once I had the baseline server configuration set-up for Debian, I moved
39on to trying out [[https://nginx.org][Nginx]] as my web server software.
40This required me to install the =nginx= and =ufw= packages, as well as
41setting up the initial UFW config:
42
43#+begin_src sh
4244sudo apt install nginx ufw
4345sudo ufw allow 'Nginx Full'
4446sudo ufw allow SSH
4547sudo ufw enable
4648sudo ufw status
4749sudo systemctl status nginx
48```
50#+end_src
4951
50Once I had the firewall set, I moved on to creating the directories and files
51for my website. This is very easy and is basically the same as setting up an
52Apache server, so no struggles here.
52Once I had the firewall set, I moved on to creating the directories and
53files for my website. This is very easy and is basically the same as
54setting up an Apache server, so no struggles here.
5355
54```sh
56#+begin_src sh
5557sudo mkdir -p /var/www/your_domain/html
5658sudo chown -R $USER:$USER /var/www/your_domain/html
5759sudo chmod -R 755 /var/www/your_domain
5860nano /var/www/your_domain/html/index.html
59```
61#+end_src
6062
61The next part, creating the Nginx configuration files, is quite a bit different
62from Apache. First, you need to create the files in the `sites-available` folder
63and symlink it the `sites-enabled` folder.
63The next part, creating the Nginx configuration files, is quite a bit
64different from Apache. First, you need to create the files in the
65=sites-available= folder and symlink it the =sites-enabled= folder.
6466
6567Creating the config file for your domain:
6668
67```sh
69#+begin_src sh
6870sudo nano /etc/nginx/sites-available/your_domain
69```
71#+end_src
7072
7173Default content for an Nginx config file:
7274
73```sh
75#+begin_src sh
7476server {
7577 listen 80;
7678 listen [::]:80;
@@ -84,42 +86,43 @@ server {
8486 try_files $uri $uri/ =404;
8587 }
8688}
87```
89#+end_src
8890
8991Finally, symlink it together:
9092
91```sh
93#+begin_src sh
9294sudo ln -s /etc/nginx/sites-available/your_domain /etc/nginx/sites-enabled/
93```
95#+end_src
9496
9597This will make your site available to the public (as long as you have
96`your_domain` DNS records pointed at the server's IP address)!
98=your_domain= DNS records pointed at the server's IP address)!
9799
98Next, I used [certbot](https://certbot.eff.org/) to issue an HTTPS certificate
99for my domains using the following commands:
100Next, I used [[https://certbot.eff.org/][certbot]] to issue an HTTPS
101certificate for my domains using the following commands:
100102
101```sh
103#+begin_src sh
102104sudo apt install snapd; sudo snap install core; sudo snap refresh core
103105sudo snap install --classic certbot
104106sudo ln -s /snap/bin/certbot /usr/bin/certbot
105107sudo certbot --nginx
106```
108#+end_src
107109
108Now that certbot ran successfully and updated my Nginx config files to include a
109`443` server block of code, I went back in and edited the config file to include
110security HTTP headers. This part is optional, but is recommended for security
111purposes; you can even test a website's HTTP header security at
112[Security Headers](https://securityheaders.com/).
110Now that certbot ran successfully and updated my Nginx config files to
111include a =443= server block of code, I went back in and edited the
112config file to include security HTTP headers. This part is optional, but
113is recommended for security purposes; you can even test a website's HTTP
114header security at [[https://securityheaders.com/][Security Headers]].
113115
114The configuration below shows a set-up where you only want your website to serve
115content from its own domain, except for images and scripts, which may come from
116`nullitics.com`. All other content would be blocked from loading in a browser.
116The configuration below shows a set-up where you only want your website
117to serve content from its own domain, except for images and scripts,
118which may come from =nullitics.com=. All other content would be blocked
119from loading in a browser.
117120
118```sh
121#+begin_src sh
119122sudo nano /etc/nginx/sites-available/your_domain
120```
123#+end_src
121124
122```sh
125#+begin_src sh
123126server {
124127 ...
125128 add_header Content-Security-Policy "default-src 'none'; img-src 'self' https://nullitics.com; script-src 'self' https://nullitics.com; style-src 'self'; font-src 'self'";
@@ -130,46 +133,50 @@ server {
130133 add_header Referrer-Policy "no-referrer";
131134 ...
132135}
133```
136#+end_src
134137
135```sh
138#+begin_src sh
136139sudo systemctl restart nginx
137```
138
139### Nginx vs. Apache
140
141As I stated at the beginning, my historical hesitation with trying Nginx was
142that the differences in configuration formats scared me away from leaving
143Apache.
144However, I prefer Nginx to Apache for a few reasons:
145
1461. Nginx uses only one config file (`your_domain`) vs. Apache's two-file
147 approach for HTTP vs. HTTPS (`your_domain.conf` and
148 `your_domain-le-ssl.conf`).
1492. Symlinking new configurations files and reloading Nginx are way easier than
150 Apache's process of having to enable headers with `a2enmod mod_headers`,
151 enable PHP with `a2enmod php` (plus any other mods you need), and then
152 enabling sites with `a2ensite`, and THEN reloading Apache.
1533. The contents of the Nginx config files seem more organized and logical with
154 the curly-bracket approach.
155 This is a minor reason, but everything just felt cleaner while I was
156 installing my sites and that had a big quality of life impact on the
157 installation for me.
158
159They're both great software packages, but Nginx just seems more organized and
160easier to use these days.
161I will certainly be exploring the Nginx docs to see what other fun things I
162can do with all of this.
163
164## Gemini Server: Agate
165
166![Agate status](https://img.cleberg.net/blog/20220216-migrating-to-debian-and-nginx/agate.png)
167
168Finally, I set up the Agate software on this server again to host my Gemini
169server content, using Rust as I have before.
170You can read my other post for more information on installing Agate:
171[Hosting a Gemini Server](https://cleberg.net/blog/hosting-a-gemini-server/).
172
173All in all, Debian + Nginx is very slick and I prefer it over my old combination
174of Ubuntu + Apache (although it's really just Nginx > Apache for me, since
175Debian seems mostly the same as Ubuntu is so far).
140#+end_src
141
142*** Nginx vs. Apache
143:PROPERTIES:
144:CUSTOM_ID: nginx-vs.-apache
145:END:
146As I stated at the beginning, my historical hesitation with trying Nginx
147was that the differences in configuration formats scared me away from
148leaving Apache. However, I prefer Nginx to Apache for a few reasons:
149
1501. Nginx uses only one config file (=your_domain=) vs. Apache's two-file
151 approach for HTTP vs. HTTPS (=your_domain.conf= and
152 =your_domain-le-ssl.conf=).
1532. Symlinking new configurations files and reloading Nginx are way
154 easier than Apache's process of having to enable headers with
155 =a2enmod mod_headers=, enable PHP with =a2enmod php= (plus any other
156 mods you need), and then enabling sites with =a2ensite=, and THEN
157 reloading Apache.
1583. The contents of the Nginx config files seem more organized and
159 logical with the curly-bracket approach. This is a minor reason, but
160 everything just felt cleaner while I was installing my sites and that
161 had a big quality of life impact on the installation for me.
162
163They're both great software packages, but Nginx just seems more
164organized and easier to use these days. I will certainly be exploring
165the Nginx docs to see what other fun things I can do with all of this.
166
167** Gemini Server: Agate
168:PROPERTIES:
169:CUSTOM_ID: gemini-server-agate
170:END:
171#+caption: Agate status
172[[https://img.cleberg.net/blog/20220216-migrating-to-debian-and-nginx/agate.png]]
173
174Finally, I set up the Agate software on this server again to host my
175Gemini server content, using Rust as I have before. You can read my
176other post for more information on installing Agate:
177[[https://cleberg.net/blog/hosting-a-gemini-server/][Hosting a Gemini
178Server]].
179
180All in all, Debian + Nginx is very slick and I prefer it over my old
181combination of Ubuntu + Apache (although it's really just Nginx > Apache
182for me, since Debian seems mostly the same as Ubuntu is so far).
blog/2022-02-17-exiftool.org +57 −53
@@ -1,63 +1,67 @@
1+++
2date = 2022-02-17
3title = "Stripping Image Metadata with exiftool"
4description = "Become a h@ck3r (i.e., just protect your privacy) by using the exiftool command line package to strip metadata from images."
5draft = false
6+++
7
8## Why Strip Metadata?
9
10Okay, so you want to strip metadata from your photos. Perhaps you take pictures
11of very rare birds, and the location metadata is a gold mine for poachers, or
12perhaps you're just privacy-oriented like me and prefer to strip metadata from
13publicly-available images.
14
15There are various components of image metadata that you may want to delete
16before releasing a photo to the public. Here's an incomplete list of things I
17could easily see just by inspecting a photo on my laptop:
18
19- Location (Latitude & Longitude)
20- Dimensions
21- Device Make & Model
22- Color Space
23- Color Profile
24- Focal Length
25- Alpha Channel
26- Red Eye
27- Metering Mode
28- F Number
29
30Regardless of your reasoning, I'm going to explain how I used the `exiftool`
31package in Linux to automatically strip metadata from all images in a directory
32(+ subdirectories).
33
34## Installing `exiftool`
35
36First things first: we need to install the tool. I'm running Debian 11 on my
37server (Ubuntu will work the same), so the command is as simple as:
38
39```sh
1#+title: Stripping Image Metadata with exiftool
2#+date: 2022-02-17
3
4** Why Strip Metadata?
5:PROPERTIES:
6:CUSTOM_ID: why-strip-metadata
7:END:
8Okay, so you want to strip metadata from your photos. Perhaps you take
9pictures of very rare birds, and the location metadata is a gold mine
10for poachers, or perhaps you're just privacy-oriented like me and prefer
11to strip metadata from publicly-available images.
12
13There are various components of image metadata that you may want to
14delete before releasing a photo to the public. Here's an incomplete list
15of things I could easily see just by inspecting a photo on my laptop:
16
17- Location (Latitude & Longitude)
18- Dimensions
19- Device Make & Model
20- Color Space
21- Color Profile
22- Focal Length
23- Alpha Channel
24- Red Eye
25- Metering Mode
26- F Number
27
28Regardless of your reasoning, I'm going to explain how I used the
29=exiftool= package in Linux to automatically strip metadata from all
30images in a directory (+ subdirectories).
31
32** Installing =exiftool=
33:PROPERTIES:
34:CUSTOM_ID: installing-exiftool
35:END:
36First things first: we need to install the tool. I'm running Debian 11
37on my server (Ubuntu will work the same), so the command is as simple
38as:
39
40#+begin_src sh
4041sudo apt install exiftool
41```
42#+end_src
4243
4344There are different tools that can accomplish the same thing across
4445distributions, but I really only care to test out this one package.
4546
46## Recursively Strip Data
47
48I actually use this tool extensively to strip any photos uploaded to the website
49that serves all the images for my blog (`img.cleberg.net`).
47** Recursively Strip Data
48:PROPERTIES:
49:CUSTOM_ID: recursively-strip-data
50:END:
51I actually use this tool extensively to strip any photos uploaded to the
52website that serves all the images for my blog (=img.cleberg.net=).
5053
51The following command is incredibly useful and can be modified to include any
52image extensions that `exiftool` supports:
54The following command is incredibly useful and can be modified to
55include any image extensions that =exiftool= supports:
5356
54```sh
57#+begin_src sh
5558exiftool -r -all= -ext jpg -ext png /path/to/directory/
56```
59#+end_src
5760
58See below for the results of my most recent usage of `exiftool` after I uploaded
59the image for this blog post. You can see that the command will let you know how
60many directories were scanned, how many images were updated, and how many images
61were unchanged.
61See below for the results of my most recent usage of =exiftool= after I
62uploaded the image for this blog post. You can see that the command will
63let you know how many directories were scanned, how many images were
64updated, and how many images were unchanged.
6265
63![exiftool results](https://img.cleberg.net/blog/20220217-stripping-metadata-with-exiftool/exiftool.png)
66#+caption: exiftool results
67[[https://img.cleberg.net/blog/20220217-stripping-metadata-with-exiftool/exiftool.png]]
blog/2022-02-20-nginx-caching.org +65 −57
@@ -1,23 +1,22 @@
1+++
2date = 2022-02-20
3title = "Caching Static Content with Nginx"
4description = "Learn how to cache static content client-side with Nginx configurations."
5draft = false
6+++
7
8## Update Your Nginx Config to Cache Static Files
9
10If you run a website on Nginx that serves static content (i.e., content that is
11not dynamic and changing with interactions from the user), you would likely
12benefit from caching that content on the client-side. If you're used to Apache
13and looking for the Nginx equivalent, this post should help.
14
15Luckily, setting up the cache is as easy as identifying the file types you want
16to cache and determining the expiration length. To include more file types,
17simply use the bar separator (`|`) and type the new file extension you want to
18include.
19
20```config
1#+title: Caching Static Content with Nginx
2#+date: 2022-02-20
3
4** Update Your Nginx Config to Cache Static Files
5:PROPERTIES:
6:CUSTOM_ID: update-your-nginx-config-to-cache-static-files
7:END:
8If you run a website on Nginx that serves static content (i.e., content
9that is not dynamic and changing with interactions from the user), you
10would likely benefit from caching that content on the client-side. If
11you're used to Apache and looking for the Nginx equivalent, this post
12should help.
13
14Luckily, setting up the cache is as easy as identifying the file types
15you want to cache and determining the expiration length. To include more
16file types, simply use the bar separator (=|=) and type the new file
17extension you want to include.
18
19#+begin_src config
2120server {
2221 ...
2322
@@ -27,41 +26,50 @@ server {
2726
2827 ...
2928}
30```
31
32I have seen some people who prefer to set `expires` as `365d` or even `max`, but
33that is only for stable, infrequently changing websites.
34As my site often changes (i.e., I'm never content with my website), I need
35to know that my readers are seeing the new content without waiting too long.
36
37So, I went ahead and set the expiration date at `30d`, which is short enough to
38refresh for readers but long enough that clients/browsers won't be re-requesting
39the static files too often, hopefully resulting in faster loading times, as
40images should be the only thing slowing down my site.
41
42## Testing Results
43
29#+end_src
30
31I have seen some people who prefer to set =expires= as =365d= or even
32=max=, but that is only for stable, infrequently changing websites. As
33my site often changes (i.e., I'm never content with my website), I need
34to know that my readers are seeing the new content without waiting too
35long.
36
37So, I went ahead and set the expiration date at =30d=, which is short
38enough to refresh for readers but long enough that clients/browsers
39won't be re-requesting the static files too often, hopefully resulting
40in faster loading times, as images should be the only thing slowing down
41my site.
42
43** Testing Results
44:PROPERTIES:
45:CUSTOM_ID: testing-results
46:END:
4447To test my changes to the Nginx configuration, I used the
45[HTTP Header Live](https://addons.mozilla.org/en-US/firefox/addon/http-header-live/)
46extension on my Gecko browser and used the sidebar to inspect the headers of a
47recent image from my blog.
48
49In the image below, you can see that the `Cache-Control` header is now present
50and set to 2592000, which is 30 days represented in seconds (30 days _ 24
51hours/day _ 60 minutes/hour \* 60 seconds/minute = 2,592,000 seconds).
52
53The `Expires` field is now showing 22 March 2022, which is 30 days from the day
54of this post, 20 February 2022.
55
56![Image Headers](https://img.cleberg.net/blog/20220220-caching-static-content-with-nginx/image_headers.png)
57
58## Caveats
59
60Remember that this caching system is **client-side**, which means that content
61is only cached for as long as a client allows it. For example, my browser purges
62all caches, data, etc. upon exit, so this caching policy will only work as long
63as my browser remains open and running.
64
65If you need to test updates to your site, you'll need to clear the cache to see
66updates for any file extension you configured. This can often be done with the
67`Shift + F5` or `Ctrl + F5` key combinations in most browsers.
48[[https://addons.mozilla.org/en-US/firefox/addon/http-header-live/][HTTP
49Header Live]] extension on my Gecko browser and used the sidebar to
50inspect the headers of a recent image from my blog.
51
52In the image below, you can see that the =Cache-Control= header is now
53present and set to 2592000, which is 30 days represented in seconds (30
54days _ 24 hours/day _ 60 minutes/hour * 60 seconds/minute = 2,592,000
55seconds).
56
57The =Expires= field is now showing 22 March 2022, which is 30 days from
58the day of this post, 20 February 2022.
59
60#+caption: Image Headers
61[[https://img.cleberg.net/blog/20220220-caching-static-content-with-nginx/image_headers.png]]
62
63** Caveats
64:PROPERTIES:
65:CUSTOM_ID: caveats
66:END:
67Remember that this caching system is *client-side*, which means that
68content is only cached for as long as a client allows it. For example,
69my browser purges all caches, data, etc. upon exit, so this caching
70policy will only work as long as my browser remains open and running.
71
72If you need to test updates to your site, you'll need to clear the cache
73to see updates for any file extension you configured. This can often be
74done with the =Shift + F5= or =Ctrl + F5= key combinations in most
75browsers.
blog/2022-02-22-tuesday.org +30 −27
@@ -1,35 +1,38 @@
1+++
2date = 2022-02-22
3title = "Tuesday"
4description = "Today is Tuesday, February 22nd, 2022 - also a ubiquitous six-digit palindrome date known as Twosday."
5draft = false
6+++
1#+title: Tuesday
2#+date: 2022-02-22
73
8## Tuesday, Twosday
4** Tuesday, Twosday
5:PROPERTIES:
6:CUSTOM_ID: tuesday-twosday
7:END:
8I'm taking a break from my usual technology-related posts and writing
9about something a little more enjoyable today.
910
10I'm taking a break from my usual technology-related posts and writing about
11something a little more enjoyable today.
12
13Today is Tuesday, February 22nd, 2022. Today is 02-22-2022. Today is Twosday.
11Today is Tuesday, February 22nd, 2022. Today is 02-22-2022. Today is
12Twosday.
1413
1514Let's look at everything that fell in place today:
1615
171. Written in the `m-dd-yy` or `dd-m-yy` formats, today is 2-22-22 or 22-2-22,
18 which is a neat little palindrome in either format. (The last ubiquitous
19 six-digit palindrome was 1-11-11.)
202. Today is Tuesday, which is why everyone is using the nickname Twosday to call
21 out these similarities.
161. Written in the =m-dd-yy= or =dd-m-yy= formats, today is 2-22-22 or
17 22-2-22, which is a neat little palindrome in either format. (The
18 last ubiquitous six-digit palindrome was 1-11-11.)
192. Today is Tuesday, which is why everyone is using the nickname Twosday
20 to call out these similarities.
22213. Falling on Tuesday means today is the 2nd day of the week (for most
2322 cultures. For the US, it's the 3rd day of the week since we start on
2423 Sunday).
254. The only culture I could find with a connection to a `2` is that some Slavic
26 languages derived their version of Tuesday from the Old Church Slavonic word
27 `въторъ`, meaning "the second."
285. Written in the classic monospaced, digital font (think of digital clocks from
29 the 80s/90s), there is nice symmetry to the numbers
30 ([view the image here](https://img.cleberg.net/blog/20220222-tuesday/digital_font.png)!).
316. This one isn't naturally-occurring, but it seems people around the world are
32 celebrating the day. For example, a group is putting together
33 [a wedding of 222 couples at the California State Capitol in Sacramento](https://www.eventbrite.com/e/2-22-22-a-collective-wedding-ceremony-at-the-state-capitol-tickets-211434605597),
34 concluding at exactly 2:22 PM. These couples will record their marriage dates
35 as 2-22-22 2:22 PM. Tickets were on sale for $222.22.
244. The only culture I could find with a connection to a =2= is that some
25 Slavic languages derived their version of Tuesday from the Old Church
26 Slavonic word =въторъ=, meaning "the second."
275. Written in the classic monospaced, digital font (think of digital
28 clocks from the 80s/90s), there is nice symmetry to the numbers
29 ([[https://img.cleberg.net/blog/20220222-tuesday/digital_font.png][view
30 the image here]]!).
316. This one isn't naturally-occurring, but it seems people around the
32 world are celebrating the day. For example, a group is putting
33 together
34 [[https://www.eventbrite.com/e/2-22-22-a-collective-wedding-ceremony-at-the-state-capitol-tickets-211434605597][a
35 wedding of 222 couples at the California State Capitol in
36 Sacramento]], concluding at exactly 2:22 PM. These couples will
37 record their marriage dates as 2-22-22 2:22 PM. Tickets were on sale
38 for $222.22.
blog/2022-03-02-note-taking.org +132 −100
@@ -1,125 +1,157 @@
1+++
2date = 2022-03-02
3title = "Easy, Reliable Note-Taking"
4description = "After years of testing, I have finally settled on maintaining my collection of personal notes and writings."
5draft = false
6+++
1#+title: Easy, Reliable Note-Taking
2#+date: 2022-03-02
73
8## Choosing Durable File Formats
4** Choosing Durable File Formats
5:PROPERTIES:
6:CUSTOM_ID: choosing-durable-file-formats
7:END:
98
10> TL;DR: Write in a format that can be easily rendered and read in plain-text
11> mode (e.g., `.txt`, `.md`, etc.).
9#+begin_quote
10TL;DR: Write in a format that can be easily rendered and read in
11plain-text mode (e.g., =.txt=, =.md=, etc.).
12
13#+end_quote
1214
1315As I've written more and more over the years, I've found that my love of
14note-taking is always growing. Everything I learn or need to remember can be
15written down in a note and saved digitally, with no cost to myself. Unlike paper
16copies that need physical storage space, digital files simply need space on your
17local disk or cloud storage, which is fairly abundant these days.
16note-taking is always growing. Everything I learn or need to remember
17can be written down in a note and saved digitally, with no cost to
18myself. Unlike paper copies that need physical storage space, digital
19files simply need space on your local disk or cloud storage, which is
20fairly abundant these days.
1821
19However, I had a historical struggle with migration of notes between different
20apps that require different formats and applied proprietary styling. This meant
21that I had to go through each note during migration and edit the file to look
22presentable again.
22However, I had a historical struggle with migration of notes between
23different apps that require different formats and applied proprietary
24styling. This meant that I had to go through each note during migration
25and edit the file to look presentable again.
2326
2427For the last year or two, I have written everything exclusively in
25[Markdown](https://en.wikipedia.org/wiki/Markdown) format. Small notes,
26long-form writings, and even these blog posts are all written in Markdown.
27
28Why Markdown? While I do appreciate the simplicity of plain-text files without
29any formatting, I often need visual cues such as heading and code blocks to keep
30my thoughts straight. Markdown provides a minimal set of styling indicators for
31me to style my notes without adding any proprietary, embedded data into the
32files. If I want a top-level heading, I simply add a hash (`#`) before the line.
33An added bonus is that even if a system doesn't understand Markdown, it will
34render it as plain-text and I can read it just as easily.
35
36For example, here's how TextEdit on macOS will open and display a Markdown file
37in plain-text, since it does contain any features to preview Markdown as HTML:
38
39![Plain Text Markdown](https://img.cleberg.net/blog/20220302-easy-reliable-note-taking/plain_markdown.png)
40
41## Saving & Syncing Files
42
43In order to read and edit my notes across platforms, I use my personal cloud
44storage through Tresorit due to its native integration with macOS and iOS file
45managers. In addition, Tresorit works well on Debian-based Linux distros, which
46I used before macOS (and will likely switch back to in a few years).
47
48You can use whatever sync software you want - syncing plain-text or markdown
49files is incredibly easy and fast, since the files are generally tiny.
50
51Since the cloud storage syncs files automatically, there is no need for me to
52sync anything manually or kick-off a sync job to update my files. This means
53that I can edit on mobile, and it takes about 5-10 seconds to see the changes on
28[[https://en.wikipedia.org/wiki/Markdown][Markdown]] format. Small
29notes, long-form writings, and even these blog posts are all written in
30Markdown.
31
32Why Markdown? While I do appreciate the simplicity of plain-text files
33without any formatting, I often need visual cues such as heading and
34code blocks to keep my thoughts straight. Markdown provides a minimal
35set of styling indicators for me to style my notes without adding any
36proprietary, embedded data into the files. If I want a top-level
37heading, I simply add a hash (=#=) before the line. An added bonus is
38that even if a system doesn't understand Markdown, it will render it as
39plain-text and I can read it just as easily.
40
41For example, here's how TextEdit on macOS will open and display a
42Markdown file in plain-text, since it does contain any features to
43preview Markdown as HTML:
44
45#+caption: Plain Text Markdown
46[[https://img.cleberg.net/blog/20220302-easy-reliable-note-taking/plain_markdown.png]]
47
48** Saving & Syncing Files
49:PROPERTIES:
50:CUSTOM_ID: saving-syncing-files
51:END:
52In order to read and edit my notes across platforms, I use my personal
53cloud storage through Tresorit due to its native integration with macOS
54and iOS file managers. In addition, Tresorit works well on Debian-based
55Linux distros, which I used before macOS (and will likely switch back to
56in a few years).
57
58You can use whatever sync software you want - syncing plain-text or
59markdown files is incredibly easy and fast, since the files are
60generally tiny.
61
62Since the cloud storage syncs files automatically, there is no need for
63me to sync anything manually or kick-off a sync job to update my files.
64This means that I can edit on mobile, and it takes about 5-10 seconds to
65see the changes on desktop.
66
67*** Version Control with Git
68:PROPERTIES:
69:CUSTOM_ID: version-control-with-git
70:END:
71A different approach I've contemplated is storing my notes and
72attachments is using a hosted Git repository to track changes to the
73files. However, I don't want to rely on an external service that could
74potentially see into my data, even if the repository is private.
75
76I might just do =git init= locally and then commit my changes each time
77I write or update a note, but that seems to be a lot of work just for
78tracking changes - which I don't necessarily care to know.
79
80*** Backups!
81:PROPERTIES:
82:CUSTOM_ID: backups
83:END:
84One small addition to the storage/sync conversation is the idea of
85backups. Personally, I manually create periodic backups of my entire
86cloud storage, compress it into an archive, and store it on my home
87server.
88
89To improve my workflow, I am going to be exploring options to
90automatically compress the mounted cloud directory and send it over to
91my server on a set schedule.
92
93** Writing on Desktop
94:PROPERTIES:
95:CUSTOM_ID: writing-on-desktop
96:END:
97
98#+begin_quote
99*Update (06.14.22)*: Since writing this post, I have reverted to simply
100keeping my =notes= folder open and opening notes individually in
101TextEdit for a more minimal and relaxing writing experience on the
54102desktop.
55103
56### Version Control with Git
57
58A different approach I've contemplated is storing my notes and attachments is
59using a hosted Git repository to track changes to the files. However, I don't
60want to rely on an external service that could potentially see into my data,
61even if the repository is private.
104#+end_quote
62105
63I might just do `git init` locally and then commit my changes each time I write
64or update a note, but that seems to be a lot of work just for tracking changes -
65which I don't necessarily care to know.
106The bulk of my writing occurs in a desktop environment, with a full
107keyboard layout and wide screen. I don't illustrate with a smart pen, I
108rarely use embedded images, and I love being able to see all of my
109notes/directories in a sidebar.
66110
67### Backups!
68
69One small addition to the storage/sync conversation is the idea of backups.
70Personally, I manually create periodic backups of my entire cloud storage,
71compress it into an archive, and store it on my home server.
72
73To improve my workflow, I am going to be exploring options to automatically
74compress the mounted cloud directory and send it over to my server on a set
75schedule.
76
77## Writing on Desktop
78
79> **Update (06.14.22)**: Since writing this post, I have reverted to simply
80> keeping my `notes` folder open and opening notes individually in TextEdit
81> for a more minimal and relaxing writing experience on the desktop.
82
83The bulk of my writing occurs in a desktop environment, with a full keyboard
84layout and wide screen. I don't illustrate with a smart pen, I rarely use
85embedded images, and I love being able to see all of my notes/directories in a
86sidebar.
87
88With this simple set of requirements, I chose [Obsidian](https://obsidian.md) as
89my desktop text editor.
90Obsidian has some in-depth tools like a graph view, command palette,
91mentions, etc., but I've found that using it as a simple Markdown editor is
111With this simple set of requirements, I chose
112[[https://obsidian.md][Obsidian]] as my desktop text editor. Obsidian
113has some in-depth tools like a graph view, command palette, mentions,
114etc., but I've found that using it as a simple Markdown editor is
92115incredibly easy and straightforward.
93116
94Here's an example of how my Markdown notes look when opened in plain-text mode:
95
96![Obsidian Markdown Source Mode](https://img.cleberg.net/blog/20220302-easy-reliable-note-taking/obsidian_source_mode.png)
97
98Here's the "live preview" version, where the Markdown is rendered into its HTML
99format:
117Here's an example of how my Markdown notes look when opened in
118plain-text mode:
100119
101![Obsidian Markdown Live Preview](https://img.cleberg.net/blog/20220302-easy-reliable-note-taking/obsidian_live_preview.png)
120#+caption: Obsidian Markdown Source Mode
121[[https://img.cleberg.net/blog/20220302-easy-reliable-note-taking/obsidian_source_mode.png]]
102122
103### Programming on Desktop
123Here's the "live preview" version, where the Markdown is rendered into
124its HTML format:
104125
105While I was writing this, I realized I should specify that I don't use the same
106editor for writing notes and for writing code. For programming purposes, I use
107[VSCodium](https://vscodium.com) as my development IDE.
126#+caption: Obsidian Markdown Live Preview
127[[https://img.cleberg.net/blog/20220302-easy-reliable-note-taking/obsidian_live_preview.png]]
108128
109## Writing on Mobile
129*** Programming on Desktop
130:PROPERTIES:
131:CUSTOM_ID: programming-on-desktop
132:END:
133While I was writing this, I realized I should specify that I don't use
134the same editor for writing notes and for writing code. For programming
135purposes, I use [[https://vscodium.com][VSCodium]] as my development
136IDE.
110137
138** Writing on Mobile
139:PROPERTIES:
140:CUSTOM_ID: writing-on-mobile
141:END:
111142Personally, I write very little on mobile, except when needing to take
112important notes on-the-go. Any long-form writing, journals, etc. are done at
113home, where I always have my laptop available.
143important notes on-the-go. Any long-form writing, journals, etc. are
144done at home, where I always have my laptop available.
114145
115146I wanted a simple and foolproof editor for iOS, preferably open-source.
116After a long journey of testing the few (& terrible) open-source iOS
147After a long journey of testing the few (& terrible) open-source iOS
117148note-taking apps, I finally found a phenomenal one:
118[Runestone](https://github.com/simonbs/runestone). This app is fantastic
119for note-taking, has plenty of optional features, and integrates natively
120with the iOS file manager.
149[[https://github.com/simonbs/runestone][Runestone]]. This app is
150fantastic for note-taking, has plenty of optional features, and
151integrates natively with the iOS file manager.
121152
122This app opens the iOS file manager and allows you to click any file you want,
123opens it up in an editor, and lets me save and close out of that note.
153This app opens the iOS file manager and allows you to click any file you
154want, opens it up in an editor, and lets me save and close out of that
155note.
124156
125157Quite simple but effective.
blog/2022-03-03-financial-database.org +173 −154
@@ -1,153 +1,166 @@
1+++
2date = 2022-03-03
3title = "Maintaining a Personal Financial Database"
4description = "Detailing my process for creating, maintaining, and utilizing a personal financial database."
5draft = false
6+++
7
8## Personal Financial Tracking
9
10For the last 6-ish years, I've tracked my finances in a spreadsheet. This is
11common practice in the business world, but any good dev will cringe at the
12thought of storing long-term data in a spreadsheet. A spreadsheet is not for
13long-term storage or as a source of data to pull data/reports.
14
15As I wanted to expand the functionality of my financial data (e.g., adding more
16reports), I decided to migrate the data into a database. To run reports, I would
17query the database and use a language like Python or Javascript to process the
18data, perform calculations, and visualize the data.
19
20## SQLite
21
22When choosing the type of database I wanted to use for this project, I was split
23between three options:
24
251. MySQL: The database I have the most experience with and have used for years.
1#+title: Maintaining a Personal Financial Database
2#+date: 2022-03-03
3
4** Personal Financial Tracking
5:PROPERTIES:
6:CUSTOM_ID: personal-financial-tracking
7:END:
8For the last 6-ish years, I've tracked my finances in a spreadsheet.
9This is common practice in the business world, but any good dev will
10cringe at the thought of storing long-term data in a spreadsheet. A
11spreadsheet is not for long-term storage or as a source of data to pull
12data/reports.
13
14As I wanted to expand the functionality of my financial data (e.g.,
15adding more reports), I decided to migrate the data into a database. To
16run reports, I would query the database and use a language like Python
17or Javascript to process the data, perform calculations, and visualize
18the data.
19
20** SQLite
21:PROPERTIES:
22:CUSTOM_ID: sqlite
23:END:
24When choosing the type of database I wanted to use for this project, I
25was split between three options:
26
271. MySQL: The database I have the most experience with and have used for
28 years.
26292. PostgreSQL: A database I'm new to, but want to learn.
273. SQLite: A database that I've used for a couple projects and have moderate
28 experience.
29
30I ended up choosing SQLite since it can be maintained within a single `.sqlite`
31file, which allows me more flexibility for storage and backup. I keep this file
32in my cloud storage and pull it up whenever needed.
33
34### GUI Editing
35
36Since I didn't want to try and import 1000–1500 records into my new database
37via the command line, I opted to use
38[DB Browser for SQLite (DB4S)](https://sqlitebrowser.org/) as a GUI tool. This
39application is excellent, and I don't see myself going back to the CLI
40when working in this database.
303. SQLite: A database that I've used for a couple projects and have
31 moderate experience.
32
33I ended up choosing SQLite since it can be maintained within a single
34=.sqlite= file, which allows me more flexibility for storage and backup.
35I keep this file in my cloud storage and pull it up whenever needed.
36
37*** GUI Editing
38:PROPERTIES:
39:CUSTOM_ID: gui-editing
40:END:
41Since I didn't want to try and import 1000--1500 records into my new
42database via the command line, I opted to use
43[[https://sqlitebrowser.org/][DB Browser for SQLite (DB4S)]] as a GUI
44tool. This application is excellent, and I don't see myself going back
45to the CLI when working in this database.
4146
4247DB4S allows you to copy a range of cells from a spreadsheet and paste it
43straight into the SQL table. I used this process for all 36 accounts, 1290
44account statements, and 126 pay statements. Overall, I'm guessing this took
45anywhere between 4–8 hours. In comparison, it probably took me 2-3 days to
46initially create the spreadsheet.
48straight into the SQL table. I used this process for all 36 accounts,
491290 account statements, and 126 pay statements. Overall, I'm guessing
50this took anywhere between 4--8 hours. In comparison, it probably took
51me 2-3 days to initially create the spreadsheet.
4752
48![DB4S](https://img.cleberg.net/blog/20220303-maintaining-a-personal-financial-database/db4s.png)
53#+caption: DB4S
54[[https://img.cleberg.net/blog/20220303-maintaining-a-personal-financial-database/db4s.png]]
4955
50### Schema
51
52The schema for this database is actually extremely simple and involves only
53three tables (for now):
56*** Schema
57:PROPERTIES:
58:CUSTOM_ID: schema
59:END:
60The schema for this database is actually extremely simple and involves
61only three tables (for now):
5462
55631. Accounts
56642. Statements
57653. Payroll
5866
59**Accounts**
67*Accounts*
6068
61The Accounts table contains summary information about an account, such as a car
62loan or a credit card. By viewing this table, you can find high-level data, such
63as interest rate, credit line, or owner.
69The Accounts table contains summary information about an account, such
70as a car loan or a credit card. By viewing this table, you can find
71high-level data, such as interest rate, credit line, or owner.
6472
65```sql
73#+begin_src sql
6674CREATE TABLE "Accounts" (
67 "AccountID" INTEGER NOT NULL UNIQUE,
68 "AccountType" TEXT,
69 "AccountName" TEXT,
70 "InterestRate" NUMERIC,
71 "CreditLine" NUMERIC,
72 "State" TEXT,
73 "Owner" TEXT,
74 "Co-Owner" TEXT,
75 PRIMARY KEY("AccountID" AUTOINCREMENT)
75 "AccountID" INTEGER NOT NULL UNIQUE,
76 "AccountType" TEXT,
77 "AccountName" TEXT,
78 "InterestRate" NUMERIC,
79 "CreditLine" NUMERIC,
80 "State" TEXT,
81 "Owner" TEXT,
82 "Co-Owner" TEXT,
83 PRIMARY KEY("AccountID" AUTOINCREMENT)
7684)
77```
85#+end_src
7886
79**Statements**
87*Statements*
8088
81The Statements table uses the same unique identifier as the Accounts table,
82meaning you can join the tables to find a monthly statement for any of the
83accounts listed in the Accounts table. Each statement has an account ID,
84statement date, and total balance.
89The Statements table uses the same unique identifier as the Accounts
90table, meaning you can join the tables to find a monthly statement for
91any of the accounts listed in the Accounts table. Each statement has an
92account ID, statement date, and total balance.
8593
86```sql
94#+begin_src sql
8795CREATE TABLE "Statements" (
88 "StatementID" INTEGER NOT NULL UNIQUE,
89 "AccountID" INTEGER,
90 "StatementDate" INTEGER,
91 "Balance" NUMERIC,
92 PRIMARY KEY("StatementID" AUTOINCREMENT),
93 FOREIGN KEY("AccountID") REFERENCES "Accounts"("AccountID")
96 "StatementID" INTEGER NOT NULL UNIQUE,
97 "AccountID" INTEGER,
98 "StatementDate" INTEGER,
99 "Balance" NUMERIC,
100 PRIMARY KEY("StatementID" AUTOINCREMENT),
101 FOREIGN KEY("AccountID") REFERENCES "Accounts"("AccountID")
94102)
95```
103#+end_src
96104
97**Payroll**
105*Payroll*
98106
99The Payroll table is a separate entity, unrelated to the Accounts or Statements
100tables. This table contains all information you would find on a pay statement
101from an employer. As you change employers or obtain new perks/benefits, just add
102new columns to adapt to the new data.
107The Payroll table is a separate entity, unrelated to the Accounts or
108Statements tables. This table contains all information you would find on
109a pay statement from an employer. As you change employers or obtain new
110perks/benefits, just add new columns to adapt to the new data.
103111
104```sql
112#+begin_src sql
105113CREATE TABLE "Payroll" (
106 "PaycheckID" INTEGER NOT NULL UNIQUE,
107 "PayDate" TEXT,
108 "Payee" TEXT,
109 "Employer" TEXT,
110 "JobTitle" TEXT,
111 "IncomeRegular" NUMERIC,
112 "IncomePTO" NUMERIC,
113 "IncomeHoliday" NUMERIC,
114 "IncomeBonus" NUMERIC,
115 "IncomePTOPayout" NUMERIC,
116 "IncomeReimbursements" NUMERIC,
117 "FringeHSA" NUMERIC,
118 "FringeStudentLoan" NUMERIC,
119 "Fringe401k" NUMERIC,
120 "PreTaxMedical" NUMERIC,
121 "PreTaxDental" NUMERIC,
122 "PreTaxVision" NUMERIC,
123 "PreTaxLifeInsurance" NUMERIC,
124 "PreTax401k" NUMERIC,
125 "PreTaxParking" NUMERIC,
126 "PreTaxStudentLoan" NUMERIC,
127 "PreTaxOther" NUMERIC,
128 "TaxFederal" NUMERIC,
129 "TaxSocial" NUMERIC,
130 "TaxMedicare" NUMERIC,
131 "TaxState" NUMERIC,
132 PRIMARY KEY("PaycheckID" AUTOINCREMENT)
114 "PaycheckID" INTEGER NOT NULL UNIQUE,
115 "PayDate" TEXT,
116 "Payee" TEXT,
117 "Employer" TEXT,
118 "JobTitle" TEXT,
119 "IncomeRegular" NUMERIC,
120 "IncomePTO" NUMERIC,
121 "IncomeHoliday" NUMERIC,
122 "IncomeBonus" NUMERIC,
123 "IncomePTOPayout" NUMERIC,
124 "IncomeReimbursements" NUMERIC,
125 "FringeHSA" NUMERIC,
126 "FringeStudentLoan" NUMERIC,
127 "Fringe401k" NUMERIC,
128 "PreTaxMedical" NUMERIC,
129 "PreTaxDental" NUMERIC,
130 "PreTaxVision" NUMERIC,
131 "PreTaxLifeInsurance" NUMERIC,
132 "PreTax401k" NUMERIC,
133 "PreTaxParking" NUMERIC,
134 "PreTaxStudentLoan" NUMERIC,
135 "PreTaxOther" NUMERIC,
136 "TaxFederal" NUMERIC,
137 "TaxSocial" NUMERIC,
138 "TaxMedicare" NUMERIC,
139 "TaxState" NUMERIC,
140 PRIMARY KEY("PaycheckID" AUTOINCREMENT)
133141)
134```
135
136### Python Reporting
137
138Once I created the database tables and imported all my data, the only step left
139was to create a process to report and visualize on various aspects of the data.
140
141In order to explore and create the reports I'm interested in, I utilized a
142two-part process involving Jupyter Notebooks and Python scripts.
143
144#### Step 1: Jupyter Notebooks
145
142#+end_src
143
144*** Python Reporting
145:PROPERTIES:
146:CUSTOM_ID: python-reporting
147:END:
148Once I created the database tables and imported all my data, the only
149step left was to create a process to report and visualize on various
150aspects of the data.
151
152In order to explore and create the reports I'm interested in, I utilized
153a two-part process involving Jupyter Notebooks and Python scripts.
154
155**** Step 1: Jupyter Notebooks
156:PROPERTIES:
157:CUSTOM_ID: step-1-jupyter-notebooks
158:END:
146159When I need to explore data, try different things, and re-run my code
147cell-by-cell, I use Jupyter Notebooks. For example, I explored the `Accounts`
148table until I found the following useful information:
160cell-by-cell, I use Jupyter Notebooks. For example, I explored the
161=Accounts= table until I found the following useful information:
149162
150```python
163#+begin_src python
151164import sqlite3
152165import pandas as pd
153166import matplotlib
@@ -167,14 +180,17 @@ matplotlib.rcParams['legend.labelcolor'] = 'black'
167180
168181# Display graph
169182df.groupby(['AccountType']).sum().plot.pie(title='Credit Line by Account Type', y='CreditLine', figsize=(5,5), autopct='%1.1f%%')
170```
171
172#### Step 2: Python Scripts
183#+end_src
173184
174Once I explored enough through the notebooks and had a list of reports I wanted,
175I moved on to create a Python project with the following structure:
185**** Step 2: Python Scripts
186:PROPERTIES:
187:CUSTOM_ID: step-2-python-scripts
188:END:
189Once I explored enough through the notebooks and had a list of reports I
190wanted, I moved on to create a Python project with the following
191structure:
176192
177```
193#+begin_example
178194finance/
179195├── notebooks/
180196│ │ ├── account_summary.ipynb
@@ -191,23 +207,24 @@ finance/
191207├── process.py
192208├── requirements.txt
193209└── README.md
194```
210#+end_example
195211
196212This structure allows me to:
197213
1981. Compile all required python packages into `requirements.txt` for easy
2141. Compile all required python packages into =requirements.txt= for easy
199215 installation if I move to a new machine.
2002. Activate a virtual environment in `venv/` so I don't need to maintain a
201 system-wide Python environment just for this project.
2023. Keep my `notebooks/` folder to continuously explore the data as I see fit.
2034. Maintain a local copy of the database in `src/` for easy access.
2045. Export reports, images, HTML files, etc. to `public/`.
205
206Now, onto the differences between the code in a Jupyter Notebook and the actual
207Python files. To create the report in the Notebook snippet above, I created the
208following function inside `process.py`:
209
210```python
2162. Activate a virtual environment in =venv/= so I don't need to maintain
217 a system-wide Python environment just for this project.
2183. Keep my =notebooks/= folder to continuously explore the data as I see
219 fit.
2204. Maintain a local copy of the database in =src/= for easy access.
2215. Export reports, images, HTML files, etc. to =public/=.
222
223Now, onto the differences between the code in a Jupyter Notebook and the
224actual Python files. To create the report in the Notebook snippet above,
225I created the following function inside =process.py=:
226
227#+begin_src python
211228# Create summary pie chart
212229def summary_data(accounts: pandas.DataFrame) -> None:
213230 accounts_01 = accounts[accounts["Owner"] == "Person01"]
@@ -233,21 +250,23 @@ def summary_data(accounts: pandas.DataFrame) -> None:
233250 )
234251 )
235252 summary_chart.figure.savefig(f"public/summary_chart_{x}.png", dpi=1200)
236```
253#+end_src
237254
238255The result? A high-quality pie chart that is read directly by the
239`public/index.html` template I use.
256=public/index.html= template I use.
240257
241![Summary Pie Chart](https://img.cleberg.net/blog/20220303-maintaining-a-personal-financial-database/summary_chart.png)
258#+caption: Summary Pie Chart
259[[https://img.cleberg.net/blog/20220303-maintaining-a-personal-financial-database/summary_chart.png]]
242260
243261Other charts generated by this project include:
244262
245- Charts of account balances over time.
246- Line chart of effective tax rate (taxes divided by taxable income).
247- Salary projections and error limits using past income and inflation rates.
248- Multi-line chart of gross income, taxable income, and net income.
263- Charts of account balances over time.
264- Line chart of effective tax rate (taxes divided by taxable income).
265- Salary projections and error limits using past income and inflation
266 rates.
267- Multi-line chart of gross income, taxable income, and net income.
249268
250The best thing about this project? I can improve it at any given time, shaping
251it into whatever helps me the most for that time. I imagine that I will be
252introducing an asset tracking table soon to track the depreciating value of
253cars, houses, etc. Who knows what's next?
269The best thing about this project? I can improve it at any given time,
270shaping it into whatever helps me the most for that time. I imagine that
271I will be introducing an asset tracking table soon to track the
272depreciating value of cars, houses, etc. Who knows what's next?
blog/2022-03-08-plex-migration.org +199 −162
@@ -1,233 +1,270 @@
1+++
2date = 2022-03-08
3title = "Migrating Plex to New Server (+ Nvidia Transcoding)"
4description = "A quick instructional guide on how to migrate Plex Media Server to a new server, including servers with Nvidia GPUs."
5draft = false
6+++
7
8## Migration Phases
9
10I recently decided to migrate my server from an old OptiPlex desktop machine to
11a custom-built tower with better hardware in every category. In order to do
12this, I would need to properly migrate a full Plex installation.
13
14The second part of this migration is that the new server uses an Nvidia GPU and
15does not have any integrated graphics, which requires extra work for
16installation, but provides much better hardware transcoding options for Plex.
1#+title: Migrating Plex to New Server (+ Nvidia Transcoding)
2#+date: 2022-03-08
3
4** Migration Phases
5:PROPERTIES:
6:CUSTOM_ID: migration-phases
7:END:
8I recently decided to migrate my server from an old OptiPlex desktop
9machine to a custom-built tower with better hardware in every category.
10In order to do this, I would need to properly migrate a full Plex
11installation.
12
13The second part of this migration is that the new server uses an Nvidia
14GPU and does not have any integrated graphics, which requires extra work
15for installation, but provides much better hardware transcoding options
16for Plex.
1717
1818Therefore, I have broken this migration down into three phases:
1919
201. [Configure the New Server](#phase-1-configure-the-new-server)
212. [Migrate Plex Data & Devices](#phase-2-migrate-plex-data-devices)
223. [Configure GPU Transcoding](#phase-3-configure-gpu-transcoding)
23
24---
201. [[#phase-1-configure-the-new-server][Configure the New Server]]
212. [[#phase-2-migrate-plex-data-devices][Migrate Plex Data & Devices]]
223. [[#phase-3-configure-gpu-transcoding][Configure GPU Transcoding]]
2523
26## Phase 1: Configure the New Server
27
28### Choosing an OS
24--------------
2925
26** Phase 1: Configure the New Server
27:PROPERTIES:
28:CUSTOM_ID: phase-1-configure-the-new-server
29:END:
30*** Choosing an OS
31:PROPERTIES:
32:CUSTOM_ID: choosing-an-os
33:END:
3034In order to migrate Plex to my new server, I first needed to choose an
31appropriate operating system (OS) and install it on the machine. Given that I
32have encountered numerous issues installing other Linux distributions
33properly with Nvidia graphics, I chose
34[Ubuntu Server](https://ubuntu.com/download/server).
35
36The first step is to create a bootable USB with Ubuntu Server. This is easy with
37[Etcher](https://www.balena.io/etcher/), an app that runs on many different
38platforms. Just download the Ubuntu Server `.iso` image, launch Etcher, and
39install the `.iso` on the USB.
40
41Once the USB is created, insert it into my server, reboot, and click `Esc` (or
42any of the `F1-12` keys) until the BIOS menu appears. Finally, launch the USB
43boot drive.
44
45### Booting with Nvidia
46
35appropriate operating system (OS) and install it on the machine. Given
36that I have encountered numerous issues installing other Linux
37distributions properly with Nvidia graphics, I chose
38[[https://ubuntu.com/download/server][Ubuntu Server]].
39
40The first step is to create a bootable USB with Ubuntu Server. This is
41easy with [[https://www.balena.io/etcher/][Etcher]], an app that runs on
42many different platforms. Just download the Ubuntu Server =.iso= image,
43launch Etcher, and install the =.iso= on the USB.
44
45Once the USB is created, insert it into my server, reboot, and click
46=Esc= (or any of the =F1-12= keys) until the BIOS menu appears. Finally,
47launch the USB boot drive.
48
49*** Booting with Nvidia
50:PROPERTIES:
51:CUSTOM_ID: booting-with-nvidia
52:END:
4753In order to install Ubuntu Server with an Nvidia Graphics card (and no
48integrated graphics on this device for some reason), you'll have to configure
49the boot menu to allow different graphics drivers to be loaded.
54integrated graphics on this device for some reason), you'll have to
55configure the boot menu to allow different graphics drivers to be
56loaded.
5057
51When booting from the USB, the machine will launch the initial installation
52menu. From this menu, type `e` to view the default command options that come
53with the device - it's a good idea to take a photo of this screen, so you can
54enter these commands on the next screen (along with adding support for Nvidia).
58When booting from the USB, the machine will launch the initial
59installation menu. From this menu, type =e= to view the default command
60options that come with the device - it's a good idea to take a photo of
61this screen, so you can enter these commands on the next screen (along
62with adding support for Nvidia).
5563
56Finally, type `Ctrl + C` to enter the command line. From this command line,
57enter the commands found on the `e` screen. **Remember to add `nomodeset` to the
58`linux ...` line so that your Nvidia device will display the installation
59screens properly!**
64Finally, type =Ctrl + C= to enter the command line. From this command
65line, enter the commands found on the =e= screen. *Remember to add
66=nomodeset= to the =linux ...= line so that your Nvidia device will
67display the installation screens properly!*
6068
61Here's an example of the commands I pulled from the `e` screen and entered on
62the command line.
69Here's an example of the commands I pulled from the =e= screen and
70entered on the command line.
6371
64```sh
72#+begin_src sh
6573setparams 'Install Ubuntu Server'
6674setgfxpayload=keep
6775linux /casper/vmlinuz quiet nomodeset ---
6876initrd /casper/initrd
6977boot
70```
78#+end_src
7179
72![Ubuntu Server Installation 01](https://img.cleberg.net/blog/20220308-plex-media-server-migration/ubuntu_server_installation_01.png)
80#+caption: Ubuntu Server Installation 01
81[[https://img.cleberg.net/blog/20220308-plex-media-server-migration/ubuntu_server_installation_01.png]]
7382
74![Ubuntu Server Installation 02](https://img.cleberg.net/blog/20220308-plex-media-server-migration/ubuntu_server_installation_02.png)
83#+caption: Ubuntu Server Installation 02
84[[https://img.cleberg.net/blog/20220308-plex-media-server-migration/ubuntu_server_installation_02.png]]
7585
76Once the machine is rebooted, enter the `e` screen again and add `nomodeset` to
77the `linux ...` line again and press `Ctrl + X` to save the boot options.
86Once the machine is rebooted, enter the =e= screen again and add
87=nomodeset= to the =linux ...= line again and press =Ctrl + X= to save
88the boot options.
7889
79The machine is now fully installed and can properly display on an external
80display using the Nvidia GPU.
90The machine is now fully installed and can properly display on an
91external display using the Nvidia GPU.
8192
8293Always remember to update and upgrade on a new installation:
8394
84```sh
95#+begin_src sh
8596sudo apt update; sudo apt upgrade -y; sudo apt autoremove -y
86```
97#+end_src
8798
88---
89
90## Phase 2: Migrate Plex Data & Devices
99--------------
91100
101** Phase 2: Migrate Plex Data & Devices
102:PROPERTIES:
103:CUSTOM_ID: phase-2-migrate-plex-data-devices
104:END:
92105This phase uses the great Plex article on migrations
93([Move an Installation to Another System](https://support.plex.tv/articles/201370363-move-an-install-to-another-system/))
94and adds a bit more information to help with commands and context.
95
96### Terminology
97
98**Source:** The original server that is being replaced.
99**Destination:** The new server.
100**Client:** Any application that can be used to modify settings for both
106([[https://support.plex.tv/articles/201370363-move-an-install-to-another-system/][Move
107an Installation to Another System]]) and adds a bit more information to
108help with commands and context.
109
110*** Terminology
111:PROPERTIES:
112:CUSTOM_ID: terminology
113:END:
114*Source:* The original server that is being replaced.\\
115*Destination:* The new server.\\
116*Client:* Any application that can be used to modify settings for both
101117source/destination.
102118
103### Step 01: [Client] Update Settings
104
105Open up a Plex app and _disable_ the `Account` > `Library` >
106`Empty trash automatically after every scan` preference for the source server.
107
108### Step 02: [Destination] Install Plex
109
110Open up the
111[Plex Media Server download page](https://www.plex.tv/media-server-downloads/)
112and copy the link for the appropriate platform.
113
114Execute the following commands on the destination server to install Plex:
115
116```sh
119*** Step 01: [Client] Update Settings
120:PROPERTIES:
121:CUSTOM_ID: step-01-client-update-settings
122:END:
123Open up a Plex app and /disable/ the =Account= > =Library= >
124=Empty trash automatically after every scan= preference for the source
125server.
126
127*** Step 02: [Destination] Install Plex
128:PROPERTIES:
129:CUSTOM_ID: step-02-destination-install-plex
130:END:
131Open up the [[https://www.plex.tv/media-server-downloads/][Plex Media
132Server download page]] and copy the link for the appropriate platform.
133
134Execute the following commands on the destination server to install
135Plex:
136
137#+begin_src sh
117138wget <url>
118139sudo dpkg -i <filename>
119140sudo systemctl stop plexmediaserver.service
120```
121
122### Step 03: [Source] Stop Plex & Migrate Data
141#+end_src
123142
124First, stop the Plex service so that no data is created or modified during the
125migration.
143*** Step 03: [Source] Stop Plex & Migrate Data
144:PROPERTIES:
145:CUSTOM_ID: step-03-source-stop-plex-migrate-data
146:END:
147First, stop the Plex service so that no data is created or modified
148during the migration.
126149
127```sh
150#+begin_src sh
128151sudo systemctl stop plexmediaserver.service
129```
152#+end_src
130153
131Next, copy the data to the new server. To find where the Plex data directory is
132located, Plex has another excellent article available:
133[Where is the Plex Media Server data directory located?](https://support.plex.tv/articles/202915258-where-is-the-plex-media-server-data-directory-located/).
154Next, copy the data to the new server. To find where the Plex data
155directory is located, Plex has another excellent article available:
156[[https://support.plex.tv/articles/202915258-where-is-the-plex-media-server-data-directory-located/][Where
157is the Plex Media Server data directory located?]].
134158
135There are many ways to copy the data to the new server and will largely depend
136on the size of the folder being copied. Personally, my data folder was ~23GB and
137I opted to simply use the `scp` command to copy the files over SSH.
159There are many ways to copy the data to the new server and will largely
160depend on the size of the folder being copied. Personally, my data
161folder was ~23GB and I opted to simply use the =scp= command to copy the
162files over SSH.
138163
139This process was throttled by the old server's slow HDD and ports and took
140approximately 90 minutes to complete. In comparison, moving the data from the
141new server's `home/user/` directory to the `/var/.../Plex Media Server`
142directory took 2-3 minutes.
164This process was throttled by the old server's slow HDD and ports and
165took approximately 90 minutes to complete. In comparison, moving the
166data from the new server's =home/user/= directory to the
167=/var/.../Plex Media Server= directory took 2-3 minutes.
143168
144```sh
169#+begin_src sh
145170scp -r "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server" your_user@xxx.xxx.xxx.xxx:"'/path/to/destination/'"
146```
171#+end_src
147172
148### Step 04: [Destination] Update File Permissions
173*** Step 04: [Destination] Update File Permissions
174:PROPERTIES:
175:CUSTOM_ID: step-04-destination-update-file-permissions
176:END:
177In case you move the data directory to a common area on the new server,
178it will have to be moved to the proper location before Plex can function
179properly:
149180
150In case you move the data directory to a common area on the new server, it will
151have to be moved to the proper location before Plex can function properly:
152
153```sh
181#+begin_src sh
154182mv "Plex Media Server" /var/lib/plexmediaserver/Library/Application Support/
155```
183#+end_src
156184
157To ensure permissions were retained properly, the server will need to show that
158all files and folders in the data directory are owned by `plex:plex` (or
159whichever user is running the Plex application).
185To ensure permissions were retained properly, the server will need to
186show that all files and folders in the data directory are owned by
187=plex:plex= (or whichever user is running the Plex application).
160188
161```sh
189#+begin_src sh
162190sudo chown -R plex:plex "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server"
163```
191#+end_src
164192
165193Finally, start the service and check the status.
166194
167```sh
195#+begin_src sh
168196sudo systemctl start plexmediaserver.service
169197sudo systemctl status plexmediaserver.service
170```
171
172### Step 05: [Client] Update Libraries & Metadata
173
174The first step - now that the new server is up and running - is to sign out of
175the client and sign back in. Once this is done, update any library locations, if
176necessary. This was unnecessary in my case since I simply moved my storage
177drives from the source server to the destination server.
198#+end_src
199
200*** Step 05: [Client] Update Libraries & Metadata
201:PROPERTIES:
202:CUSTOM_ID: step-05-client-update-libraries-metadata
203:END:
204The first step - now that the new server is up and running - is to sign
205out of the client and sign back in. Once this is done, update any
206library locations, if necessary. This was unnecessary in my case since I
207simply moved my storage drives from the source server to the destination
208server.
178209
179210Next, perform the following actions in the client:
180211
1811. On the left sidebar, click `More` > Three-Dot Menu > `Scan Library Files`
1822. _Enable_ the `Account` > `Library` >
183 `Empty trash automatically after every scan` preference for the source
184 server.
1853. On the left sidebar, click `More` > Three-Dot Menu > `Manage Server` >
186 `Empty Trash`
1874. On the left sidebar, click `More` > Three-Dot Menu > `Manage Server` >
188 `Clean Bundles`
1895. On the left sidebar, click `More` > Three-Dot Menu > `Manage Server` >
190 `Optimize Database`
191
192Finally, double-check the Remote Access settings to make sure no changes have
193caused issues with accessing the server from outside the network.
194
195In my case, I use a single port forwarding rule in my router and needed to
196update the Local LAN IP Address to the new server IP address.
197
198![Router port forwarding](https://img.cleberg.net/blog/20220308-plex-media-server-migration/port_forwarding.png)
199
200---
201
202## Phase 3: Configure GPU Transcoding
203
204The final piece to the migration is enabling hardware transcoding so that Plex
205can fully utilize the new Nvidia GPU available in the server. The first step is
206to install Nvidia graphics drivers. This process may take a few minutes, but the
207commands are pretty simple:
208
209```sh
2121. On the left sidebar, click =More= > Three-Dot Menu >
213 =Scan Library Files=
2142. /Enable/ the =Account= > =Library= >
215 =Empty trash automatically after every scan= preference for the
216 source server.
2173. On the left sidebar, click =More= > Three-Dot Menu > =Manage Server=
218 > =Empty Trash=
2194. On the left sidebar, click =More= > Three-Dot Menu > =Manage Server=
220 > =Clean Bundles=
2215. On the left sidebar, click =More= > Three-Dot Menu > =Manage Server=
222 > =Optimize Database=
223
224Finally, double-check the Remote Access settings to make sure no changes
225have caused issues with accessing the server from outside the network.
226
227In my case, I use a single port forwarding rule in my router and needed
228to update the Local LAN IP Address to the new server IP address.
229
230#+caption: Router port forwarding
231[[https://img.cleberg.net/blog/20220308-plex-media-server-migration/port_forwarding.png]]
232
233--------------
234
235** Phase 3: Configure GPU Transcoding
236:PROPERTIES:
237:CUSTOM_ID: phase-3-configure-gpu-transcoding
238:END:
239The final piece to the migration is enabling hardware transcoding so
240that Plex can fully utilize the new Nvidia GPU available in the server.
241The first step is to install Nvidia graphics drivers. This process may
242take a few minutes, but the commands are pretty simple:
243
244#+begin_src sh
210245sudo add-apt-repository ppa:graphics-drivers/ppa
211246sudo apt update
212247sudo apt-get install ubuntu-drivers-common
213248sudo ubuntu-drivers autoinstall
214```
249#+end_src
215250
216251Finally, reboot so that the changes are loaded:
217252
218```sh
253#+begin_src sh
219254sudo reboot now
220```
255#+end_src
221256
222257To ensure that the Nvidia graphics drivers are working properly, run the
223258following command to view the available GPUs, statistics, and processes:
224259
225```sh
260#+begin_src sh
226261sudo nvidia-smi
227```
262#+end_src
228263
229![nvidia-smi](https://img.cleberg.net/blog/20220308-plex-media-server-migration/nvidia_smi.png)
264#+caption: nvidia-smi
265[[https://img.cleberg.net/blog/20220308-plex-media-server-migration/nvidia_smi.png]]
230266
231267Finally, enable hardware transcoding settings in the Plex application:
232268
233![Plex transcoding settings](https://img.cleberg.net/blog/20220308-plex-media-server-migration/plex_transcoding.png)
269#+caption: Plex transcoding settings
270[[https://img.cleberg.net/blog/20220308-plex-media-server-migration/plex_transcoding.png]]
blog/2022-03-23-cloudflare-dns-api.org +50 −49
@@ -1,39 +1,40 @@
1+++
2date = 2022-03-23
3title = "Dynamic DNS with Cloudflare API"
4description = "Learn how to update Cloudflare DNS records automatically with a simple bash script."
5draft = false
6+++
7
8## DDNS: Dynamic DNS
9
10If you're hosting a service from a location with dynamic DNS (where your IP may
11change at any time), you must have a solution to update the DNS so that you can
12access your service even when the IP of the server changes.
13
14The process below uses the [Cloudflare API](https://api.cloudflare.com/) to
15update DNS `A` and `AAAA` records with the server's current IP. If you use
16another DNS provider, you will have to find a way to update your DNS (or find a
17way to get a static IP).
18
19First, install `jq` since we will use it in the next script:
20
21```sh
1#+title: Dynamic DNS with Cloudflare API
2#+date: 2022-03-23
3
4** DDNS: Dynamic DNS
5:PROPERTIES:
6:CUSTOM_ID: ddns-dynamic-dns
7:END:
8If you're hosting a service from a location with dynamic DNS (where your
9IP may change at any time), you must have a solution to update the DNS
10so that you can access your service even when the IP of the server
11changes.
12
13The process below uses the [[https://api.cloudflare.com/][Cloudflare
14API]] to update DNS =A= and =AAAA= records with the server's current IP.
15If you use another DNS provider, you will have to find a way to update
16your DNS (or find a way to get a static IP).
17
18First, install =jq= since we will use it in the next script:
19
20#+begin_src sh
2221sudo apt install jq
23```
22#+end_src
2423
25Next, create a location for your DDNS update scripts and open the first script:
24Next, create a location for your DDNS update scripts and open the first
25script:
2626
27```sh
27#+begin_src sh
2828mkdir ~/ddns
2929nano ~/ddns/update.sh
30```
30#+end_src
3131
32The following `update.sh` script will take all of your domains and subdomains
33and check Cloudflare to see if the current `A` and `AAAA` records match your
34server's IP address. If not, it will update the records.
32The following =update.sh= script will take all of your domains and
33subdomains and check Cloudflare to see if the current =A= and =AAAA=
34records match your server's IP address. If not, it will update the
35records.
3536
36```sh
37#+begin_src sh
3738# file: update.sh
3839#!/bin/bash
3940
@@ -55,20 +56,20 @@ do
5556 echo -e "\nUpdating $subdomain..."
5657 zone_name=$domain dns_record=$subdomain /home/<your-username>/ddns/ddns.sh
5758done
58```
59#+end_src
5960
60Next, open up the `ddns.sh` script. Paste the following into the script and
61update the `api_token` and `email` variables.
61Next, open up the =ddns.sh= script. Paste the following into the script
62and update the =api_token= and =email= variables.
6263
63```sh
64#+begin_src sh
6465nano ~/ddns/ddns.sh
65```
66#+end_src
6667
67:warning: **Note**: If you want your DNS records to be proxied through
68Cloudflare, find and update the following snippet: `\"proxied\":false}"` to say
69`true` instead of `false`.
68:warning: *Note*: If you want your DNS records to be proxied through
69Cloudflare, find and update the following snippet: =\"proxied\":false}"=
70to say =true= instead of =false=.
7071
71```sh
72#+begin_src sh
7273# file: ddns.sh
7374#!/bin/bash
7475# based on https://gist.github.com/Tras2/cba88201b17d765ec065ccbedfb16d9a
@@ -161,30 +162,30 @@ then
161162else
162163 echo "There is a problem with either the email or the password"
163164fi
164```
165#+end_src
165166
166167Once the script is saved and closed, make the scripts executable:
167168
168```sh
169#+begin_src sh
169170chmod +x ~/ddns/ddns.sh
170171chmod +x ~/ddns/update.sh
171```
172#+end_src
172173
173174You can test the script by running it manually:
174175
175```sh
176#+begin_src sh
176177./update.sh
177```
178#+end_src
178179
179To make sure the scripts run automatically, add it to the `cron` file so that it
180will run on a schedule. To do this, open the cron file:
180To make sure the scripts run automatically, add it to the =cron= file so
181that it will run on a schedule. To do this, open the cron file:
181182
182```sh
183#+begin_src sh
183184crontab -e
184```
185#+end_src
185186
186187In the cron file, paste the following at the bottom of the editor:
187188
188```sh
189#+begin_src sh
189190*/5 * * * * bash /home/<your_username>/ddns/update.sh
190```
191#+end_src
blog/2022-03-23-nextcloud-on-ubuntu.org +95 −75
@@ -1,80 +1,90 @@
1+++
2date = 2022-03-23
3title = "Installing Nextcloud on Ubuntu"
4description = "Learn how to install the self-hosted cloud storage solution, Nextcloud, on Ubuntu."
5draft = false
6+++
1#+title: Installing Nextcloud on Ubuntu
2#+date: 2022-03-23
73
8## What is Nextcloud?
9
10[Nextcloud](https://nextcloud.com/) is a self-hosted solution for storage,
11communications, editing, calendar, contacts, and more.
4** What is Nextcloud?
5:PROPERTIES:
6:CUSTOM_ID: what-is-nextcloud
7:END:
8[[https://nextcloud.com/][Nextcloud]] is a self-hosted solution for
9storage, communications, editing, calendar, contacts, and more.
1210
1311This tutorial assumes that you have an Ubuntu server and a domain name
1412configured to point toward the server.
1513
16## Install Dependencies
17
14** Install Dependencies
15:PROPERTIES:
16:CUSTOM_ID: install-dependencies
17:END:
1818To start, you will need to install the packages that Nextcloud requires:
1919
20```sh
20#+begin_src sh
2121sudo apt install apache2 mariadb-server libapache2-mod-php7.4
2222sudo apt install php7.4-gd php7.4-mysql php7.4-curl php7.4-mbstring php7.4-intl
2323sudo apt install php7.4-gmp php7.4-bcmath php-imagick php7.4-xml php7.4-zip
24```
24#+end_src
2525
26## Set Up MySQL
26** Set Up MySQL
27:PROPERTIES:
28:CUSTOM_ID: set-up-mysql
29:END:
30Next, you will need to log in to MySQL as the =root= user of the
31machine.
2732
28Next, you will need to log in to MySQL as the `root` user of the machine.
29
30```sh
33#+begin_src sh
3134sudo mysql -uroot -p
32```
35#+end_src
3336
34Once you've logged in, you must create a new user so that Nextcloud can manage
35the database. You will also create a `nextcloud` database and assign privileges:
37Once you've logged in, you must create a new user so that Nextcloud can
38manage the database. You will also create a =nextcloud= database and
39assign privileges:
3640
37```sql
41#+begin_src sql
3842CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
3943CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
4044GRANT ALL PRIVILEGES ON nextcloud.* TO 'username'@'localhost';
4145FLUSH PRIVILEGES;
4246quit;
43```
44
45## Download & Install Nextcloud
47#+end_src
4648
49** Download & Install Nextcloud
50:PROPERTIES:
51:CUSTOM_ID: download-install-nextcloud
52:END:
4753To download Nextcloud, go the
48[Nextcloud downloads page](https://nextcloud.com/install/#instructions-server),
49click on `Archive File` and right-click the big blue button to copy the link.
54[[https://nextcloud.com/install/#instructions-server][Nextcloud
55downloads page]], click on =Archive File= and right-click the big blue
56button to copy the link.
5057
51Then, go to your server and enter the following commands to download, unzip, and
52move the files to your destination directory. This example uses `example.com` as
53the destination, but you can put it wherever you want to server your files from.
58Then, go to your server and enter the following commands to download,
59unzip, and move the files to your destination directory. This example
60uses =example.com= as the destination, but you can put it wherever you
61want to server your files from.
5462
55```sh
63#+begin_src sh
5664wget https://download.nextcloud.com/server/releases/nextcloud-23.0.3.zip
5765sudo apt install unzip
5866unzip nextcloud-23.0.3.zip
5967sudo cp -r nextcloud /var/www/example.com
60```
68#+end_src
6169
62## Configure the Apache Web Server
63
64Now that the database is set up and Nextcloud is installed, you need to set up
65the Apache configuration files to tell the server how to handle requests for
66`example.com/nextcloud`.
70** Configure the Apache Web Server
71:PROPERTIES:
72:CUSTOM_ID: configure-the-apache-web-server
73:END:
74Now that the database is set up and Nextcloud is installed, you need to
75set up the Apache configuration files to tell the server how to handle
76requests for =example.com/nextcloud=.
6777
6878First, open the following file in the editor:
6979
70```sh
80#+begin_src sh
7181sudo nano /etc/apache2/sites-available/nextcloud.conf
72```
82#+end_src
7383
74Once the editor is open, paste the following information in. Then, save and
75close the file.
84Once the editor is open, paste the following information in. Then, save
85and close the file.
7686
77```config
87#+begin_src config
7888<VirtualHost *:80>
7989 DocumentRoot /var/www/example.com
8090 ServerName example.com
@@ -93,69 +103,79 @@ close the file.
93103 </IfModule>
94104 </Directory>
95105</VirtualHost>
96```
106#+end_src
97107
98108Once the file is saved, enable it with Apache:
99109
100```sh
110#+begin_src sh
101111sudo a2ensite nextcloud.conf
102```
112#+end_src
103113
104114Next, enable the Apache mods required by Nextcloud:
105115
106```sh
116#+begin_src sh
107117sudo a2enmod rewrite headers env dir mime
108```
118#+end_src
109119
110Finally, restart Apache. If any errors arise, you must solve those before
111continuing.
120Finally, restart Apache. If any errors arise, you must solve those
121before continuing.
112122
113```sh
123#+begin_src sh
114124sudo systemctl restart apache2
115```
125#+end_src
116126
117127For the app to work, you must have the correct file permissions on your
118`nextcloud` directory. Set the owner to be `www-data`:
128=nextcloud= directory. Set the owner to be =www-data=:
119129
120```sh
130#+begin_src sh
121131sudo chown -R www-data:www-data /var/www/example.com/nextcloud/
122```
123
124## DNS
132#+end_src
125133
134** DNS
135:PROPERTIES:
136:CUSTOM_ID: dns
137:END:
126138If you do not have a static IP address, you will need to update your DNS
127settings (at your DNS provider) whenever your dynamic IP address changes.
139settings (at your DNS provider) whenever your dynamic IP address
140changes.
128141
129142For an example on how I do that with Cloudflare, see my other post:
130[Updating Dynamic DNS with Cloudflare API](/blog/updating-dynamic-dns-with-cloudflare-api/)
143[[/blog/updating-dynamic-dns-with-cloudflare-api/][Updating Dynamic DNS
144with Cloudflare API]]
131145
132## Certbot
146** Certbot
147:PROPERTIES:
148:CUSTOM_ID: certbot
149:END:
150If you want to serve Nextcloud from HTTPS rather than plain HTTP, use
151the following commands to issue Let's Encrypt SSL certificates:
133152
134If you want to serve Nextcloud from HTTPS rather than plain HTTP, use the
135following commands to issue Let's Encrypt SSL certificates:
136
137```sh
153#+begin_src sh
138154sudo apt install snapd
139155sudo snap install core
140156sudo snap refresh core
141157sudo snap install --classic certbot
142158sudo ln -s /snap/bin/certbot /usr/bin/certbot
143159sudo certbot --apache
144```
145
146## Results
160#+end_src
147161
148Voilà!
149You're all done and should be able to access Nextcloud from your domain or
150IP address.
162** Results
163:PROPERTIES:
164:CUSTOM_ID: results
165:END:
166Voilà! You're all done and should be able to access Nextcloud from your
167domain or IP address.
151168
152See the screenshots below for the dashboard and a settings page on my instance
153of Nextcloud, using the `Breeze Dark` theme I installed from the Apps page.
169See the screenshots below for the dashboard and a settings page on my
170instance of Nextcloud, using the =Breeze Dark= theme I installed from
171the Apps page.
154172
155![Nextcloud Dashboard](https://img.cleberg.net/blog/20220323-installing-nextcloud-on-ubuntu/nextcloud_dashboard.png)
173#+caption: Nextcloud Dashboard
174[[https://img.cleberg.net/blog/20220323-installing-nextcloud-on-ubuntu/nextcloud_dashboard.png]]
156175
157_Figure 01: Nextcloud Dashboard_
176/Figure 01: Nextcloud Dashboard/
158177
159![Nextcloud Settings](https://img.cleberg.net/blog/20220323-installing-nextcloud-on-ubuntu/nextcloud_settings.png)
178#+caption: Nextcloud Settings
179[[https://img.cleberg.net/blog/20220323-installing-nextcloud-on-ubuntu/nextcloud_settings.png]]
160180
161_Figure 02: Nextcloud Security Settings_
181/Figure 02: Nextcloud Security Settings/
blog/2022-03-24-server-hardening.org +339 −299
@@ -1,23 +1,28 @@
1+++
2date = 2022-03-24
3title = "Hardening a Public-Facing Home Server"
4description = "My personal reflection on the steps it took to get a home server ready to be publicly-accessible."
5draft = false
6+++
7
8## Post Updates
9
10> After reviewing this post today (2022-10-04), I noticed quite a few gaps in my
11> write-up and wanted to add a few things, even though this blog is really
12> just a retrospective and knowledge dump for myself.
13> I left things intact and simply crossed them out (~~like this~~) for
14> posterity.
15
16## Planning Data Flows & Security
17
18### My Personal Data Flow
19
20```txt
1#+title: Hardening a Public-Facing Home Server
2#+date: 2022-03-24
3
4** Post Updates
5:PROPERTIES:
6:CUSTOM_ID: post-updates
7:END:
8
9#+begin_quote
10After reviewing this post today (2022-10-04), I noticed quite a few gaps
11in my write-up and wanted to add a few things, even though this blog is
12really just a retrospective and knowledge dump for myself. I left things
13intact and simply crossed them out (+like this+) for posterity.
14
15#+end_quote
16
17** Planning Data Flows & Security
18:PROPERTIES:
19:CUSTOM_ID: planning-data-flows-security
20:END:
21*** My Personal Data Flow
22:PROPERTIES:
23:CUSTOM_ID: my-personal-data-flow
24:END:
25#+begin_src txt
2126 ┌───────┐ ┌─────────────────┐
2227 ┌──► VLAN1 ├───► Private Devices │
2328 │ └───────┘ └─────────────────┘
@@ -27,320 +32,355 @@ draft = false
2732 │ ┌───────┐ ┌───────────────┐
2833 └──► VLAN2 ├───► Public Server │
2934 └───────┘ └───────────────┘
30```
31
32### Thought Process
35#+end_src
3336
34To serve content from your home server and harden your security posture, you
35have to think about the transport of data from `server` to `client`.
37*** Thought Process
38:PROPERTIES:
39:CUSTOM_ID: thought-process
40:END:
41To serve content from your home server and harden your security posture,
42you have to think about the transport of data from =server= to =client=.
3643
3744Let's start with the actual server itself. Think about the following:
3845
39- Do I have a firewall enabled? Do I need to update this to allow new ports or
40 IPs?
41- Do I have an IPS/IDS that may prevent outside traffic?
42- Do I have any other security software installed?
43- Are the services hosted inside Docker containers, behind a reverse proxy, or
44 virtualized? If so, are they configured to allow outside traffic?
45
46Once the data leaves the server, where does it go? In my case, it goes to a
47managed switch. In this case, I asked the following:
48
49- What configurations is the switch using?
50- Am I using VLANs?
51 - Yes, I am using 802.1Q VLANs.
52- Are the VLANs configured properly?
53 - Yes, as shown in the [Switch](#switch) section below, I have a separate
54 VLAN to allow outside traffic to and from the server alone. No other
55 devices, except for a service port, and in that VLAN.
56
57At this point, the data has been processed through the switch. Where does it go
58next? In my case, it's pretty simple: it goes to the router/modem device.
59
60- Does my ISP block any ports that I need?
61 - This is an important step that a lot of people run into when
62 self-hosting at home.
63 Use an online port-checker tool for your IP or call your ISP if you
64 think ports are blocked.
65- Is there a router firewall?
66 - Yes, I checked that it's configured to allow the ports I need to run my
67 services publicly. Common web servers and reverse proxies require ports
68 80 and 443, but other services like media servers or games can require
69 unique ports, so be sure to check the documentation for your service(s).
70- Are there any other settings affecting inbound/outbound traffic?
71 - Schedules or access blocks
72 - Static Routing
73 - QoS
74 - Port Forwarding
75 - DMZ Hosting
76 - Remote Management (this can sometimes mess with services that also
77 require the use of ports 80 and 443)
78
79Once the data leaves my router, it goes to the upstream ISP and can be accessed
80publicly.
81
82## Server
83
84~~The services I run on my server are installed straight into the OS, without
85any use of Docker or VMs, so I don't need any extra application configuration to
86make them accessible to the outside world.~~
87
88As of 2022-10-04, the paragraph above is no longer true as I now run a reverse
89proxy with Nginx and host many services inside Docker. However, it doesn't
90change anything regarding this post as I still just need to open ports 80 & 443
91and create the necessary website configuration files.
92
93When creating new services - either installed directly on bare metal or within
94something like Docker - I ensure that I read through the documentation
95thoroughly to understand a few key things:
96 - What network activities should this app perform (if any)? Using which ports
97 and protocols?
98 - Does this app require any commands/services to be run as `root`?
99 - Does this app log errors, authentication failures/successes, or anything
100 else that would be useful for an investigation?
101
102For extra security, I use limit all incoming connections to SSH connections
103through my server firewall (`ufw`) and disable common SSH settings. After all of
104that, I use `fail2ban` as a preventative measure against brute-force login
105attempts.
106
107As another piece of security, you can randomize your SSH port to ensure that
108random scanners or attackers can't easily try to force their way into your
109network. For example, you can edit the port rules in your server to block all
110connection requests to port `22` but forward all remote connections from port
111`12345` to your server's port `22`. Then you just need to SSH to your network
112via your randomized port.
113
114### `ufw`
115
116To see how to configure `ufw`, see my other post:
117[Secure Your Network with the Uncomplicated Firewall](/blog/secure-your-network-with-the-uncomplicated-firewall/).
118
119The general notion with an on-device firewall is that you want to deny all
120incoming connections by default and then selectively open certain ports for
121services or users that you know need access.
122
123If you know that you will only be logging into this server from a certain set or
124list of IPs, you can always set the firewall to only allow connections to port
12522 from those IPs.
46- Do I have a firewall enabled? Do I need to update this to allow new
47 ports or IPs?
48- Do I have an IPS/IDS that may prevent outside traffic?
49- Do I have any other security software installed?
50- Are the services hosted inside Docker containers, behind a reverse
51 proxy, or virtualized? If so, are they configured to allow outside
52 traffic?
53
54Once the data leaves the server, where does it go? In my case, it goes
55to a managed switch. In this case, I asked the following:
56
57- What configurations is the switch using?
58- Am I using VLANs?
59 - Yes, I am using 802.1Q VLANs.
60- Are the VLANs configured properly?
61 - Yes, as shown in the [[#switch][Switch]] section below, I have a
62 separate VLAN to allow outside traffic to and from the server alone.
63 No other devices, except for a service port, and in that VLAN.
64
65At this point, the data has been processed through the switch. Where
66does it go next? In my case, it's pretty simple: it goes to the
67router/modem device.
68
69- Does my ISP block any ports that I need?
70 - This is an important step that a lot of people run into when
71 self-hosting at home. Use an online port-checker tool for your IP or
72 call your ISP if you think ports are blocked.
73- Is there a router firewall?
74 - Yes, I checked that it's configured to allow the ports I need to run
75 my services publicly. Common web servers and reverse proxies require
76 ports 80 and 443, but other services like media servers or games can
77 require unique ports, so be sure to check the documentation for your
78 service(s).
79- Are there any other settings affecting inbound/outbound traffic?
80 - Schedules or access blocks
81 - Static Routing
82 - QoS
83 - Port Forwarding
84 - DMZ Hosting
85 - Remote Management (this can sometimes mess with services that also
86 require the use of ports 80 and 443)
87
88Once the data leaves my router, it goes to the upstream ISP and can be
89accessed publicly.
90
91** Server
92:PROPERTIES:
93:CUSTOM_ID: server
94:END:
95+The services I run on my server are installed straight into the OS,
96without any use of Docker or VMs, so I don't need any extra application
97configuration to make them accessible to the outside world.+
98
99As of 2022-10-04, the paragraph above is no longer true as I now run a
100reverse proxy with Nginx and host many services inside Docker. However,
101it doesn't change anything regarding this post as I still just need to
102open ports 80 & 443 and create the necessary website configuration
103files.
104
105When creating new services - either installed directly on bare metal or
106within something like Docker - I ensure that I read through the
107documentation thoroughly to understand a few key things: - What network
108activities should this app perform (if any)? Using which ports and
109protocols? - Does this app require any commands/services to be run as
110=root=? - Does this app log errors, authentication failures/successes,
111or anything else that would be useful for an investigation?
112
113For extra security, I use limit all incoming connections to SSH
114connections through my server firewall (=ufw=) and disable common SSH
115settings. After all of that, I use =fail2ban= as a preventative measure
116against brute-force login attempts.
117
118As another piece of security, you can randomize your SSH port to ensure
119that random scanners or attackers can't easily try to force their way
120into your network. For example, you can edit the port rules in your
121server to block all connection requests to port =22= but forward all
122remote connections from port =12345= to your server's port =22=. Then
123you just need to SSH to your network via your randomized port.
124
125*** =ufw=
126:PROPERTIES:
127:CUSTOM_ID: ufw
128:END:
129To see how to configure =ufw=, see my other post:
130[[/blog/secure-your-network-with-the-uncomplicated-firewall/][Secure
131Your Network with the Uncomplicated Firewall]].
132
133The general notion with an on-device firewall is that you want to deny
134all incoming connections by default and then selectively open certain
135ports for services or users that you know need access.
136
137If you know that you will only be logging into this server from a
138certain set or list of IPs, you can always set the firewall to only
139allow connections to port 22 from those IPs.
126140
127141For a quick start to only allow SSH connections to the server, use this:
128142
129```sh
143#+begin_src sh
130144sudo ufw default deny incoming
131145sudo ufw default allow outgoing
132146sudo ufw allow 22
133147sudo ufw enable
134```
135
136![ufw](https://img.cleberg.net/blog/20220324-hardening-a-public-facing-home-server/ufw.png)
137
138### `ssh`
139
140#### Using SSH Keys
141
142First, make sure you have an SSH keypair generated on the device(s) that you'll
143be using to log in to the server. If you don't have an SSH key, run this
144command:
145
146```sh
148#+end_src
149
150#+caption: ufw
151[[https://img.cleberg.net/blog/20220324-hardening-a-public-facing-home-server/ufw.png]]
152
153*** =ssh=
154:PROPERTIES:
155:CUSTOM_ID: ssh
156:END:
157**** Using SSH Keys
158:PROPERTIES:
159:CUSTOM_ID: using-ssh-keys
160:END:
161First, make sure you have an SSH keypair generated on the device(s) that
162you'll be using to log in to the server. If you don't have an SSH key,
163run this command:
164
165#+begin_src sh
147166ssh-keygen
148```
167#+end_src
149168
150Now that we have an SSH key, copy it to the server with the following command,
151which will ask for the user's password before accepting the key:
169Now that we have an SSH key, copy it to the server with the following
170command, which will ask for the user's password before accepting the
171key:
152172
153```sh
173#+begin_src sh
154174ssh-copy-id my_user@my_server
155```
175#+end_src
156176
157If you have multiple keys, you'll need to specify which to use. After it's
158complete, `ssh` back into the server as that user and make sure it doesn't ask
159for a password.
177If you have multiple keys, you'll need to specify which to use. After
178it's complete, =ssh= back into the server as that user and make sure it
179doesn't ask for a password.
160180
161#### Disable Password & Root Authentication
181**** Disable Password & Root Authentication
182:PROPERTIES:
183:CUSTOM_ID: disable-password-root-authentication
184:END:
185Now that we can access the server without a password, we will disable
186password authentication and disable anyone from using =ssh= to login as
187=root=.
162188
163Now that we can access the server without a password, we will disable password
164authentication and disable anyone from using `ssh` to login as `root`.
189To do this, open the =sshd_config= file:
165190
166To do this, open the `sshd_config` file:
167
168```sh
191#+begin_src sh
169192sudo nano /etc/ssh/sshd_config
170```
193#+end_src
171194
172You'll need to update the parameters to the values below. If one of these rules
173is commented-out or doesn't exist, create the rule at the bottom of the file.
195You'll need to update the parameters to the values below. If one of
196these rules is commented-out or doesn't exist, create the rule at the
197bottom of the file.
174198
175```config
199#+begin_src config
176200PermitRootLogin no
177201PasswordAuthentication no
178202PubkeyAuthentication yes
179```
203#+end_src
180204
181Finally, restart the `ssh` service:
205Finally, restart the =ssh= service:
182206
183```sh
207#+begin_src sh
184208sudo systemctl restart sshd.service
185```
186
187To test that everything’s working so far, open ANOTHER terminal and try logging
188in as `root` over SSH. It is very important that you keep your current SSH
189session open and test with an additional session, or you will lock yourself out
190at some point and will need to use a recovery method (e.g., hooking monitor up
191to home server) to get yourself back in.
192
193#### Enable MFA for `ssh`
194
195This part is optional, but I highly recommend it.
196So far, we've ensured that no one can log into our user on the server
197without using our secret key, and we've ensured that no one can log in
198remotely as `root`.
199Next, you can enable MFA authentication for `ssh` connections.
200
201This process involves editing a couple files and installing an MFA package, so I
202will not include all the details in this post. To see how to configure MFA for
203`ssh`, see my other post:
204[Enabling MFA for SSH](/blog/enable-totp-mfa-for-ssh/).
205
206![SSH MFA](https://img.cleberg.net/blog/20220324-hardening-a-public-facing-home-server/ssh_mfa.png)
207
208### `fail2ban`
209
210I haven't written a post on how I use `fail2ban`, but it's quite simple. I use
211the default `sshd` jail, but you can always create new jails for respective
212applications or ports. For example, if you use Nginx as your web server, you can
213use the `nginx-http-auth` jail.
209#+end_src
210
211To test that everything's working so far, open ANOTHER terminal and try
212logging in as =root= over SSH. It is very important that you keep your
213current SSH session open and test with an additional session, or you
214will lock yourself out at some point and will need to use a recovery
215method (e.g., hooking monitor up to home server) to get yourself back
216in.
217
218**** Enable MFA for =ssh=
219:PROPERTIES:
220:CUSTOM_ID: enable-mfa-for-ssh
221:END:
222This part is optional, but I highly recommend it. So far, we've ensured
223that no one can log into our user on the server without using our secret
224key, and we've ensured that no one can log in remotely as =root=. Next,
225you can enable MFA authentication for =ssh= connections.
226
227This process involves editing a couple files and installing an MFA
228package, so I will not include all the details in this post. To see how
229to configure MFA for =ssh=, see my other post:
230[[/blog/enable-totp-mfa-for-ssh/][Enabling MFA for SSH]].
231
232#+caption: SSH MFA
233[[https://img.cleberg.net/blog/20220324-hardening-a-public-facing-home-server/ssh_mfa.png]]
234
235*** =fail2ban=
236:PROPERTIES:
237:CUSTOM_ID: fail2ban
238:END:
239I haven't written a post on how I use =fail2ban=, but it's quite simple.
240I use the default =sshd= jail, but you can always create new jails for
241respective applications or ports. For example, if you use Nginx as your
242web server, you can use the =nginx-http-auth= jail.
214243
215244In order to get it up and running, use the following commands:
216245
217```sh
246#+begin_src sh
218247sudo apt install fail2ban
219248sudo fail2ban-client start sshd
220249sudo fail2ban-client status sshd
221```
222
223This should be used as a last-resort defense and shouldn't be a replacement for
224the security measures mentioned above.
225
226![fail2ban](https://img.cleberg.net/blog/20220324-hardening-a-public-facing-home-server/fail2ban.png)
227
228## Switch
229
230Between the router and any local devices is my managed switch, which is used to
231create VLANs. The example below shows how I would isolate the VLANs if I were
232starting to host a single service at home.
233
234### 802.1Q VLAN Configuration
235
236In this configuration, port 8 is the public server that needs to be accessed
237from the outside. Port 23 is my 'dedicated service port' for this server. In
238order to SSH to this server, I need to plug my laptop into port 23 or else I
239cannot SSH. Otherwise, I'd need to hook up a monitor and keyboard directly to
240the server to manage it.
250#+end_src
251
252This should be used as a last-resort defense and shouldn't be a
253replacement for the security measures mentioned above.
254
255#+caption: fail2ban
256[[https://img.cleberg.net/blog/20220324-hardening-a-public-facing-home-server/fail2ban.png]]
257
258** Switch
259:PROPERTIES:
260:CUSTOM_ID: switch
261:END:
262Between the router and any local devices is my managed switch, which is
263used to create VLANs. The example below shows how I would isolate the
264VLANs if I were starting to host a single service at home.
265
266*** 802.1Q VLAN Configuration
267:PROPERTIES:
268:CUSTOM_ID: q-vlan-configuration
269:END:
270In this configuration, port 8 is the public server that needs to be
271accessed from the outside. Port 23 is my 'dedicated service port' for
272this server. In order to SSH to this server, I need to plug my laptop
273into port 23 or else I cannot SSH. Otherwise, I'd need to hook up a
274monitor and keyboard directly to the server to manage it.
241275
242276| VLAN ID | VLAN Name | Member Ports | Tagged Ports | Untagged Ports |
243|:-------:|:---------:|:------------:|:------------:|:--------------:|
244| 1 | Default | 1-24 | | 1-24 |
245| 2 | Server | 1,8,23 | | 1,8,23 |
246
247### 802.1Q VLAN PVID Setting
248
249Once the VLAN is created, I simply add the `VLAN ID` of `2` as the `PVID` for
250any related ports (in this case, see that ports `8` and `23` have a PVID of
251`2`).
277|---------+-----------+--------------+--------------+----------------|
278| 1 | Default | 1-24 | | 1-24 |
279| 2 | Server | 1,8,23 | | 1,8,23 |
280
281*** 802.1Q VLAN PVID Setting
282:PROPERTIES:
283:CUSTOM_ID: q-vlan-pvid-setting
284:END:
285Once the VLAN is created, I simply add the =VLAN ID= of =2= as the
286=PVID= for any related ports (in this case, see that ports =8= and =23=
287have a PVID of =2=).
252288
253289| Port | PVID |
254|:----:|:----:|
255| 1 | 1 |
256| 2 | 1 |
257| 3 | 1 |
258| 4 | 1 |
259| 5 | 1 |
260| 6 | 1 |
261| 7 | 1 |
262| 8 | 2 |
263| 9 | 1 |
264| 10 | 1 |
265| 11 | 1 |
266| 12 | 1 |
267| 13 | 1 |
268| 14 | 1 |
269| 15 | 1 |
270| 16 | 1 |
271| 17 | 1 |
272| 18 | 1 |
273| 19 | 1 |
274| 20 | 1 |
275| 21 | 1 |
276| 22 | 1 |
277| 23 | 2 |
278| 24 | 1 |
279
280## Router
281
282On my router, the configuration was as easy as opening the firewall settings and
283unblocking the ports I needed for my services (e.g., HTTP/S, Plex, SSH, MySQL,
284etc.).
285
286~~Since I'm relying on an ISP-provided modem/router combo for now (not by
287choice), I do not use any other advanced settings on my router that would
288inhibit any valid traffic to these services.~~
289
290The paragraph above regarding the ISP-owned router is no longer accurate as I
291now use the Ubiquiti Unifi Dream Machine Pro as my router.
292Within this router, I enabled port forwarding/firewall rules, segregate the
293network based on the device, and enable traffic restrictions (e.g., silently
294drop traffic from certain countries and threat categories).
295
296If you have the option with your ISP, I recommend using a personal router with
297software that you are familiar with so that you can explore all the options
298available to you.
299
300## Physical Security
301
302One large piece of self-hosting that people generally don't discuss online is
303physical security. However, physical security is very important for everyone who
304hosts a server like this. Exactly *how* important it is depends on the server
305use/purpose.
306
307If you self-host customer applications that hold protected data (HIPAA, GDPR,
308COPPA, etc.), then physical security is extremely important and cannot be
309ignored. If you simply host a blog and some hobby sites, then it's a relatively
310minor consideration, but one you still need to think about.
311
312### Location
313
314The first consideration is quite simple: location.
315 - Is the server within a property you own or housed on someone else's property?
316 - Is it nearby (in your house, in your work office, in your neighbor's garage,
317 in a storage unit, etc.)?
318 - Do you have 24/7 access to the server?
319 - Are there climate considerations, such as humidity, fires, tornadoes,
320 monsoons?
321 - Do you have emergency equipment nearby in case of emergency?
322
323### Hardware Ownership
324
325Secondly, consider the hardware itself:
326 - Do you own the server in its entirety?
327 - Are any other users able to access the server, even if your data/space is
328 segregated?
329 - If you're utilizing a third party, do they have any documentation to show
330 responsibility? This could be a SOC 1/2/3 report, ISO compliance report,
331 internal security/safety documentation.
332
333### Physical Controls
334
335Regardless of who owns the hardware, ensure that there are adequate safeguards
336in place, if necessary. These usually don't apply to small home servers and are
337usually covered already if you're utilizing a third party.
338
339These can include:
340 - Server bezel locks
341 - Server room locks - physical, digital, or biometric authentication
342 - Security cameras
343 - Raised floors/lowered ceilings with proper guards/gates in-place within the
344 floors or ceilings
345 - Security personnel
346 - Log sheets and/or guest badges
290|------+------|
291| 1 | 1 |
292| 2 | 1 |
293| 3 | 1 |
294| 4 | 1 |
295| 5 | 1 |
296| 6 | 1 |
297| 7 | 1 |
298| 8 | 2 |
299| 9 | 1 |
300| 10 | 1 |
301| 11 | 1 |
302| 12 | 1 |
303| 13 | 1 |
304| 14 | 1 |
305| 15 | 1 |
306| 16 | 1 |
307| 17 | 1 |
308| 18 | 1 |
309| 19 | 1 |
310| 20 | 1 |
311| 21 | 1 |
312| 22 | 1 |
313| 23 | 2 |
314| 24 | 1 |
315
316** Router
317:PROPERTIES:
318:CUSTOM_ID: router
319:END:
320On my router, the configuration was as easy as opening the firewall
321settings and unblocking the ports I needed for my services (e.g.,
322HTTP/S, Plex, SSH, MySQL, etc.).
323
324+Since I'm relying on an ISP-provided modem/router combo for now (not by
325choice), I do not use any other advanced settings on my router that
326would inhibit any valid traffic to these services.+
327
328The paragraph above regarding the ISP-owned router is no longer accurate
329as I now use the Ubiquiti Unifi Dream Machine Pro as my router. Within
330this router, I enabled port forwarding/firewall rules, segregate the
331network based on the device, and enable traffic restrictions (e.g.,
332silently drop traffic from certain countries and threat categories).
333
334If you have the option with your ISP, I recommend using a personal
335router with software that you are familiar with so that you can explore
336all the options available to you.
337
338** Physical Security
339:PROPERTIES:
340:CUSTOM_ID: physical-security
341:END:
342One large piece of self-hosting that people generally don't discuss
343online is physical security. However, physical security is very
344important for everyone who hosts a server like this. Exactly /how/
345important it is depends on the server use/purpose.
346
347If you self-host customer applications that hold protected data (HIPAA,
348GDPR, COPPA, etc.), then physical security is extremely important and
349cannot be ignored. If you simply host a blog and some hobby sites, then
350it's a relatively minor consideration, but one you still need to think
351about.
352
353*** Location
354:PROPERTIES:
355:CUSTOM_ID: location
356:END:
357The first consideration is quite simple: location. - Is the server
358within a property you own or housed on someone else's property? - Is it
359nearby (in your house, in your work office, in your neighbor's garage,
360in a storage unit, etc.)? - Do you have 24/7 access to the server? - Are
361there climate considerations, such as humidity, fires, tornadoes,
362monsoons? - Do you have emergency equipment nearby in case of emergency?
363
364*** Hardware Ownership
365:PROPERTIES:
366:CUSTOM_ID: hardware-ownership
367:END:
368Secondly, consider the hardware itself: - Do you own the server in its
369entirety? - Are any other users able to access the server, even if your
370data/space is segregated? - If you're utilizing a third party, do they
371have any documentation to show responsibility? This could be a SOC 1/2/3
372report, ISO compliance report, internal security/safety documentation.
373
374*** Physical Controls
375:PROPERTIES:
376:CUSTOM_ID: physical-controls
377:END:
378Regardless of who owns the hardware, ensure that there are adequate
379safeguards in place, if necessary. These usually don't apply to small
380home servers and are usually covered already if you're utilizing a third
381party.
382
383These can include: - Server bezel locks - Server room locks - physical,
384digital, or biometric authentication - Security cameras - Raised
385floors/lowered ceilings with proper guards/gates in-place within the
386floors or ceilings - Security personnel - Log sheets and/or guest badges
blog/2022-03-26-ssh-mfa.org +115 −103
@@ -1,82 +1,88 @@
1+++
2date = 2022-03-26
3title = "Enable TOTP MFA for SSH"
4description = "Harden your SSH target with user-enabled MFA options, such as TOTP."
5draft = false
6+++
7
8## Why Do I Need MFA for SSH?
9
10If you are a sysadmin of a server anywhere (that includes at home!), you may
11want an added layer of protection against intruders. This is not a replacement
12for other security measures, such as:
13
14- Disable root SSH
15- Disable SSH password authentication
16- Allow only certain users to login via SSH
17- Allow SSH only from certain IPs
18
19However, MFA can be added as an additional security measure to ensure that your
20server is protected. This is especially important if you need to allow password
21authentication for SSH.
1#+title: Enable TOTP MFA for SSH
2#+date: 2022-03-26
3
4** Why Do I Need MFA for SSH?
5:PROPERTIES:
6:CUSTOM_ID: why-do-i-need-mfa-for-ssh
7:END:
8If you are a sysadmin of a server anywhere (that includes at home!), you
9may want an added layer of protection against intruders. This is not a
10replacement for other security measures, such as:
11
12- Disable root SSH
13- Disable SSH password authentication
14- Allow only certain users to login via SSH
15- Allow SSH only from certain IPs
16
17However, MFA can be added as an additional security measure to ensure
18that your server is protected. This is especially important if you need
19to allow password authentication for SSH.
2220
2321For more guidance on server security measures, see my other post:
24[Hardening a Public-Facing Home Server](/blog/hardening-a-public-facing-home-server/).
25
26## Install MFA PAM Module
27
28PAM, which stands for Pluggable Authentication Module, is an authentication
29infrastructure used on Linux systems to authenticate a user. In order to use
30this technology, let's install the `libpam-google-authenticator` package:
31
32```sh
22[[/blog/hardening-a-public-facing-home-server/][Hardening a
23Public-Facing Home Server]].
24
25** Install MFA PAM Module
26:PROPERTIES:
27:CUSTOM_ID: install-mfa-pam-module
28:END:
29PAM, which stands for Pluggable Authentication Module, is an
30authentication infrastructure used on Linux systems to authenticate a
31user. In order to use this technology, let's install the
32=libpam-google-authenticator= package:
33
34#+begin_src sh
3335sudo apt-get update
34```
36#+end_src
3537
36```sh
38#+begin_src sh
3739sudo apt-get install libpam-google-authenticator
38```
39
40## Initialize the PAM Module
41
42### Interactive Method
43
44Once the package is installed, initialize it and following the interactive
45prompts to generate your OTP or TOTP:
46
47```sh
40#+end_src
41
42** Initialize the PAM Module
43:PROPERTIES:
44:CUSTOM_ID: initialize-the-pam-module
45:END:
46*** Interactive Method
47:PROPERTIES:
48:CUSTOM_ID: interactive-method
49:END:
50Once the package is installed, initialize it and following the
51interactive prompts to generate your OTP or TOTP:
52
53#+begin_src sh
4854google-authenticator
49```
55#+end_src
5056
51If you are not sure how to answer, read the prompts carefully and think about
52having to how each situation would affect your normal login attempts. If you are
53still not sure, use my default responses below.
57If you are not sure how to answer, read the prompts carefully and think
58about having to how each situation would affect your normal login
59attempts. If you are still not sure, use my default responses below.
5460
55```txt
61#+begin_src txt
5662OUTPUT
5763
5864Do you want authentication tokens to be time-based (y/n) y
59```
65#+end_src
6066
61At this point, use an authenticator app somewhere one of your devices to scan
62the QR code. Any future login attempts after our upcoming configuration changes
63will require that TOTP.
67At this point, use an authenticator app somewhere one of your devices to
68scan the QR code. Any future login attempts after our upcoming
69configuration changes will require that TOTP.
6470
65```txt
71#+begin_src txt
6672OUTPUT
6773
6874Do you want me to update your "/home/user/.google_authenticator" file? (y/n) y
69```
75#+end_src
7076
71```txt
77#+begin_src txt
7278OUTPUT
7379
7480Do you want to disallow multiple uses of the same authentication
7581token? This restricts you to one login about every 30s, but it increases
7682your chances to notice or even prevent man-in-the-middle attacks (y/n) y
77```
83#+end_src
7884
79```txt
85#+begin_src txt
8086OUTPUT
8187
8288By default, a new token is generated every 30 seconds by the mobile app.
@@ -89,30 +95,32 @@ code, the next code) to 17 permitted codes (the 8 previous codes, the current
8995code, and the 8 next codes). This will permit for a time skew of up to 4 minutes
9096between client and server.
9197Do you want to do so? (y/n) n
92```
98#+end_src
9399
94```txt
100#+begin_src txt
95101OUTPUT
96102
97103If the computer that you are logging into isn't hardened against brute-force
98104login attempts, you can enable rate-limiting for the authentication module.
99105By default, this limits attackers to no more than 3 login attempts every 30s.
100106Do you want to enable rate-limiting? (y/n) y
101```
107#+end_src
102108
103### Non-Interactive Method
109*** Non-Interactive Method
110:PROPERTIES:
111:CUSTOM_ID: non-interactive-method
112:END:
113If you need to do this quickly, know your responses to the prompts, or
114are setting this up for numerous users, the non-interactive method can
115be much faster:
104116
105If you need to do this quickly, know your responses to the prompts, or are
106setting this up for numerous users, the non-interactive method can be much
107faster:
108
109```sh
117#+begin_src sh
110118google-authenticator -t -d -f -r 3 -R 30 -w 3
111```
119#+end_src
112120
113121The options referenced above are as follows:
114122
115```txt
123#+begin_src txt
116124google-authenticator [<options>]
117125 -h, --help Print this message
118126 -c, --counter-based Set up counter-based (HOTP) verification
@@ -132,65 +140,69 @@ google-authenticator [<options>]
132140 -w, --window-size=W Set window of concurrently valid codes
133141 -W, --minimal-window Disable window of concurrently valid codes
134142 -e, --emergency-codes=N Number of emergency codes to generate
135```
136
137This fully configures the authenticator, saves it to a file, and then outputs
138the secret key, QR code, and recovery codes. (If you add the flag `-q`, then
139there won’t be any output). If you use this command in an automated fashion,
140make sure your script captures the secret key and/or recovery codes and makes
141them available to the user.
142
143## PAM Configuration Settings
144
145Once you've enabled the T/OTP and have it saved to an MFA app on your phone or
146other device, open the PAM `sshd` file:
147
148```sh
143#+end_src
144
145This fully configures the authenticator, saves it to a file, and then
146outputs the secret key, QR code, and recovery codes. (If you add the
147flag =-q=, then there won't be any output). If you use this command in
148an automated fashion, make sure your script captures the secret key
149and/or recovery codes and makes them available to the user.
150
151** PAM Configuration Settings
152:PROPERTIES:
153:CUSTOM_ID: pam-configuration-settings
154:END:
155Once you've enabled the T/OTP and have it saved to an MFA app on your
156phone or other device, open the PAM =sshd= file:
157
158#+begin_src sh
149159sudo nano /etc/pam.d/sshd
150```
160#+end_src
151161
152You need to do two things in this file. First, add the following lines to the
153bottom of the file:
162You need to do two things in this file. First, add the following lines
163to the bottom of the file:
154164
155```config
165#+begin_src config
156166auth required pam_google_authenticator.so nullok
157167auth required pam_permit.so
158```
168#+end_src
159169
160170Second, comment-out the following line near the top of the file.
161171
162If you leave this line uncommented, every SSH login attempt will ask for the
163following three authentication factors:
172If you leave this line uncommented, every SSH login attempt will ask for
173the following three authentication factors:
164174
1651751. Publickey
1661762. Password
1671773. T/OTP code
168178
169```config
179#+begin_src config
170180#@include common-auth
171```
172
173## SSH Configuration Settings
181#+end_src
174182
175Finally, edit the `sshd_config` file again:
183** SSH Configuration Settings
184:PROPERTIES:
185:CUSTOM_ID: ssh-configuration-settings
186:END:
187Finally, edit the =sshd_config= file again:
176188
177```sh
189#+begin_src sh
178190sudo nano /etc/ssh/sshd_config
179```
191#+end_src
180192
181You'll need to change `ChallengeResponseAuthentication` to yes and add the
182`AuthenticationMethods` line to the bottom of the file.
193You'll need to change =ChallengeResponseAuthentication= to yes and add
194the =AuthenticationMethods= line to the bottom of the file.
183195
184```config
196#+begin_src config
185197ChallengeResponseAuthentication yes
186198AuthenticationMethods publickey,password publickey,keyboard-interactive
187```
199#+end_src
188200
189Finally, restart the `ssh` service:
201Finally, restart the =ssh= service:
190202
191```sh
203#+begin_src sh
192204sudo systemctl restart sshd.service
193```
205#+end_src
194206
195The next time you log in, you should be greeted with a verification code
207The next time you log in, you should be greeted with a verification code
196208request!
blog/2022-04-02-nginx-reverse-proxy.org +163 −142
@@ -1,42 +1,43 @@
1+++
2date = 2022-04-02
3title = "Set-Up a Reverse Proxy with Nginx"
4description = "Learn how to set-up a reverse proxy server with Nginx on Ubuntu."
5draft = false
6+++
7
8## What is a Reverse Proxy?
9
10A reverse proxy is a server that is placed between local servers or services and
11clients/users (e.g., the internet). The reverse proxy intercepts all requests
12from clients at the network edge and uses its configuration files to determine
13where each request should be sent.
14
15### A Brief Example
16
1#+title: Set-Up a Reverse Proxy with Nginx
2#+date: 2022-04-02
3
4** What is a Reverse Proxy?
5:PROPERTIES:
6:CUSTOM_ID: what-is-a-reverse-proxy
7:END:
8A reverse proxy is a server that is placed between local servers or
9services and clients/users (e.g., the internet). The reverse proxy
10intercepts all requests from clients at the network edge and uses its
11configuration files to determine where each request should be sent.
12
13*** A Brief Example
14:PROPERTIES:
15:CUSTOM_ID: a-brief-example
16:END:
1717For example, let's say that I run three servers in my home:
1818
19- Server_01 (`example.com`)
20- Server_02 (`service01.example.com`)
21- Server_03 (`service02.example.com`)
19- Server_01 (=example.com=)
20- Server_02 (=service01.example.com=)
21- Server_03 (=service02.example.com=)
2222
23I also run a reverse proxy in my home that intercepts all public traffic:
23I also run a reverse proxy in my home that intercepts all public
24traffic:
2425
25- Reverse Proxy
26- Reverse Proxy
2627
27Assume that I have a domain name (`example.com`) that allows clients to request
28websites or services from my home servers.
28Assume that I have a domain name (=example.com=) that allows clients to
29request websites or services from my home servers.
2930
30In this case, the reverse proxy will intercept all traffic from `example.com`
31that enters my network and determine if the client is requesting valid data,
32based on my configuration.
31In this case, the reverse proxy will intercept all traffic from
32=example.com= that enters my network and determine if the client is
33requesting valid data, based on my configuration.
3334
34If the user is requesting `example.com` and my configuration files say that
35Server_01 holds that data, Nginx will send the user to Server_01. If I were to
36change the configuration so that `example.com` is routed to Server_02, that same
37user would be sent to Server_02 instead.
35If the user is requesting =example.com= and my configuration files say
36that Server_01 holds that data, Nginx will send the user to Server_01.
37If I were to change the configuration so that =example.com= is routed to
38Server_02, that same user would be sent to Server_02 instead.
3839
39```txt
40#+begin_src txt
4041┌──────┐ ┌───────────┐
4142│ User │─┐ ┌──► Server_01 │
4243└──────┘ │ │ └───────────┘
@@ -46,133 +47,151 @@ user would be sent to Server_02 instead.
4647┌──────┐ │ │ ┌───────────┐
4748│ User │─┘ └──► Server_03 │
4849└──────┘ └───────────┘
49```
50
51## Reverse Proxy Options
52
53There are a lot of options when it comes to reverse proxy servers, so I'm just
54going to list a few of the options I've heard recommended over the last few
55years:
56
57- [Nginx](https://nginx.com)
58- [Caddy](https://caddyserver.com)
59- [Traefik](https://traefik.io/)
60- [HAProxy](https://www.haproxy.org/)
61- [Squid](https://ubuntu.com/server/docs/proxy-servers-squid)
62
63In this post, we will be using Nginx as our reverse proxy, running on Ubuntu
64Server 20.04.4 LTS.
65
66## Nginx Reverse Proxy Example
67
68### Local Applications
69
70You may be like me and have a lot of applications running on your local network
71that you'd like to expose publicly with a domain.
72
73In my case, I have services running in multiple Docker containers within a
74single server and want a way to visit those services from anywhere with a URL.
75For example, on my local network, [Dashy](https://dashy.to) runs through port
764000 (`localhost:4000`) and
77[Uptime Kuma](https://github.com/louislam/uptime-kuma) runs through port 3001
78(`localhost:3001`).
50#+end_src
51
52** Reverse Proxy Options
53:PROPERTIES:
54:CUSTOM_ID: reverse-proxy-options
55:END:
56There are a lot of options when it comes to reverse proxy servers, so
57I'm just going to list a few of the options I've heard recommended over
58the last few years:
59
60- [[https://nginx.com][Nginx]]
61- [[https://caddyserver.com][Caddy]]
62- [[https://traefik.io/][Traefik]]
63- [[https://www.haproxy.org/][HAProxy]]
64- [[https://ubuntu.com/server/docs/proxy-servers-squid][Squid]]
65
66In this post, we will be using Nginx as our reverse proxy, running on
67Ubuntu Server 20.04.4 LTS.
68
69** Nginx Reverse Proxy Example
70:PROPERTIES:
71:CUSTOM_ID: nginx-reverse-proxy-example
72:END:
73*** Local Applications
74:PROPERTIES:
75:CUSTOM_ID: local-applications
76:END:
77You may be like me and have a lot of applications running on your local
78network that you'd like to expose publicly with a domain.
79
80In my case, I have services running in multiple Docker containers within
81a single server and want a way to visit those services from anywhere
82with a URL. For example, on my local network,
83[[https://dashy.to][Dashy]] runs through port 4000 (=localhost:4000=)
84and [[https://github.com/louislam/uptime-kuma][Uptime Kuma]] runs
85through port 3001 (=localhost:3001=).
7986
8087In order to expose these services to the public, I will need to do the
8188following:
8289
831. Set up DNS records for a domain or subdomain (one per service) to point
84 toward the IP address of the server.
852. Open up the server network's HTTP and HTTPS ports (80 & 443) so that the
86 reverse proxy can accept traffic and determine where to send it.
901. Set up DNS records for a domain or subdomain (one per service) to
91 point toward the IP address of the server.
922. Open up the server network's HTTP and HTTPS ports (80 & 443) so that
93 the reverse proxy can accept traffic and determine where to send it.
87943. Install the reverse proxy software.
884. Configure the reverse proxy to recognize which service should get traffic
89 from any of the domains or subdomains.
954. Configure the reverse proxy to recognize which service should get
96 traffic from any of the domains or subdomains.
9097
91### Step 1: DNS Configuration
98*** Step 1: DNS Configuration
99:PROPERTIES:
100:CUSTOM_ID: step-1-dns-configuration
101:END:
102To start, update your DNS configuration so that you have an =A= record
103for each domain or subdomain.
92104
93To start, update your DNS configuration so that you have an `A` record for each
94domain or subdomain.
105The =A= records should point toward the public IP address of the server.
106If you don't know the public IP address, log in to the server and run
107the following command:
95108
96The `A` records should point toward the public IP address of the server. If you
97don't know the public IP address, log in to the server and run the following
98command:
99
100```sh
109#+begin_src sh
101110curl ifconfig.co
102```
111#+end_src
103112
104In the DNS example below, `xxx.xxx.xxx.xxx` is the public IP address of the
105server.
113In the DNS example below, =xxx.xxx.xxx.xxx= is the public IP address of
114the server.
106115
107```config
116#+begin_src config
108117example.com A xxx.xxx.xxx.xxx
109118uptime.example.com A xxx.xxx.xxx.xxx
110119dashy.example.com A xxx.xxx.xxx.xxx
111120www CNAME example.com
112```
121#+end_src
113122
114123Finally, ensure the DNS has propagated correctly with
115[DNS Checker](https://dnschecker.org) by entering your domains or subdomains in
116the search box and ensuring the results are showing the correct IP address.
117
118### Step 2: Open Network Ports
119
120This step will be different depending on which router you have in your home. If
121you're not sure, try to visit [192.168.1.1](http://192.168.1.1) in your browser.
122Login credentials are usually written on a sticker somewhere on your
123modem/router.
124
125Once you're able to log in to your router, find the Port Forwarding settings.
126You will need to forward ports `80` and `443` to whichever machine is
127running the reverse proxy.
128
129In my case, the table below shows the port-forwarding rules I've created.
130In this table, `xxx.xxx.xxx.xxx` is the local device IP of the reverse proxy
131server, it will probably be an IP between `192.168.1.1` and `192.168.1.255`.
132
133| NAME | FROM | PORT | DEST PORT/IP | ENABLED |
134|:-----:|:----:|:----:|:---------------:|:-------:|
135| HTTP | \* | 80 | xxx.xxx.xxx.xxx | TRUE |
136| HTTPS | \* | 443 | xxx.xxx.xxx.xxx | TRUE |
137
138Once configured, these rules will direct all web traffic to your reverse proxy.
139
140### Step 3: Nginx Installation
141
124[[https://dnschecker.org][DNS Checker]] by entering your domains or
125subdomains in the search box and ensuring the results are showing the
126correct IP address.
127
128*** Step 2: Open Network Ports
129:PROPERTIES:
130:CUSTOM_ID: step-2-open-network-ports
131:END:
132This step will be different depending on which router you have in your
133home. If you're not sure, try to visit
134[[http://192.168.1.1][192.168.1.1]] in your browser. Login credentials
135are usually written on a sticker somewhere on your modem/router.
136
137Once you're able to log in to your router, find the Port Forwarding
138settings. You will need to forward ports =80= and =443= to whichever
139machine is running the reverse proxy.
140
141In my case, the table below shows the port-forwarding rules I've
142created. In this table, =xxx.xxx.xxx.xxx= is the local device IP of the
143reverse proxy server, it will probably be an IP between =192.168.1.1=
144and =192.168.1.255=.
145
146| NAME | FROM | PORT | DEST PORT/IP | ENABLED |
147|-------+------+------+-----------------+---------|
148| HTTP | ​* | 80 | xxx.xxx.xxx.xxx | TRUE |
149| HTTPS | ​* | 443 | xxx.xxx.xxx.xxx | TRUE |
150
151Once configured, these rules will direct all web traffic to your reverse
152proxy.
153
154*** Step 3: Nginx Installation
155:PROPERTIES:
156:CUSTOM_ID: step-3-nginx-installation
157:END:
142158To install Nginx, simply run the following command:
143159
144```sh
160#+begin_src sh
145161sudo apt install nginx
146```
162#+end_src
147163
148If you have a firewall enabled, open up ports `80` and `443` on your server so
149that Nginx can accept web traffic from the router.
164If you have a firewall enabled, open up ports =80= and =443= on your
165server so that Nginx can accept web traffic from the router.
150166
151For example, if you want to use `ufw` for web traffic and SSH, run the following
152commands:
167For example, if you want to use =ufw= for web traffic and SSH, run the
168following commands:
153169
154```sh
170#+begin_src sh
155171sudo ufw allow 'Nginx Full'
156172sudo ufw allow SSH
157173sudo ufw enable
158```
174#+end_src
159175
160### Step 4: Nginx Configuration
161
162Now that we have domains pointing toward the server, the only step left is to
163configure the reverse proxy to direct traffic from domains to local services.
176*** Step 4: Nginx Configuration
177:PROPERTIES:
178:CUSTOM_ID: step-4-nginx-configuration
179:END:
180Now that we have domains pointing toward the server, the only step left
181is to configure the reverse proxy to direct traffic from domains to
182local services.
164183
165184To start, you'll need to create a configuration file for each domain in
166`/etc/nginx/sites-available/`. They will look identical except for the
167`server_name` variable and the `proxy_pass` port.
185=/etc/nginx/sites-available/=. They will look identical except for the
186=server_name= variable and the =proxy_pass= port.
168187
169188Dashy:
170189
171```sh
190#+begin_src sh
172191nano /etc/nginx/sites-available/dashy.example.com
173```
192#+end_src
174193
175```config
194#+begin_src config
176195server {
177196 listen 80;
178197 server_name dashy.example.com;
@@ -181,15 +200,15 @@ server {
181200 proxy_pass http://localhost:4000;
182201 }
183202}
184```
203#+end_src
185204
186205Uptime:
187206
188```sh
207#+begin_src sh
189208nano /etc/nginx/sites-available/uptime.example.com
190```
209#+end_src
191210
192```config
211#+begin_src config
193212server {
194213 listen 80;
195214 server_name uptime.example.com;
@@ -198,29 +217,31 @@ server {
198217 proxy_pass http://localhost:3001;
199218 }
200219}
201```
220#+end_src
202221
203Once the configuration files are created, you will need to enable them with the
204`symlink` command:
222Once the configuration files are created, you will need to enable them
223with the =symlink= command:
205224
206```sh
225#+begin_src sh
207226sudo ln -s /etc/nginx/sites-available/dashy.example.com /etc/nginx/sites-enabled/
208```
227#+end_src
209228
210229Voilà! Your local services should now be available through their URLs.
211230
212## HTTPS with Certbot
213
214If you've followed along, you'll notice that your services are only available
215via HTTP (not HTTPS).
231** HTTPS with Certbot
232:PROPERTIES:
233:CUSTOM_ID: https-with-certbot
234:END:
235If you've followed along, you'll notice that your services are only
236available via HTTP (not HTTPS).
216237
217If you want to enable HTTPS for your new domains, you will need to generate
218SSL/TLS certificates for them. The easiest way to generate certificates on Nginx
219is [Certbot](https://certbot.eff.org):
238If you want to enable HTTPS for your new domains, you will need to
239generate SSL/TLS certificates for them. The easiest way to generate
240certificates on Nginx is [[https://certbot.eff.org][Certbot]]:
220241
221```sh
242#+begin_src sh
222243sudo apt install snapd; sudo snap install core; sudo snap refresh core
223244sudo snap install --classic certbot
224245sudo ln -s /snap/bin/certbot /usr/bin/certbot
225246sudo certbot --nginx
226```
247#+end_src
blog/2022-04-09-pinetime.org +160 −130
@@ -1,148 +1,178 @@
1+++
2date = 2022-04-09
3title = "PineTime: An Open-Source SmartWatch"
4description = "Exploring the PineTime, an open-source smartwatch created by PINE64."
5draft = false
6+++
7
8## PineTime Product Information
9
10### Overview
11
12The [PineTime](https://www.pine64.org/pinetime/) is an open-source smartwatch,
13created by [PINE64](https://www.pine64.org). Originally announced in September
142019, this ARM-based watch is a fantastic option for users who want the benefits
15of a modern smartwatch with the backing of open-source components and software.
16
17### Product Specifications
18
1#+title: PineTime: An Open-Source SmartWatch
2#+date: 2022-04-09
3
4** PineTime Product Information
5:PROPERTIES:
6:CUSTOM_ID: pinetime-product-information
7:END:
8*** Overview
9:PROPERTIES:
10:CUSTOM_ID: overview
11:END:
12The [[https://www.pine64.org/pinetime/][PineTime]] is an open-source
13smartwatch, created by [[https://www.pine64.org][PINE64]]. Originally
14announced in September 2019, this ARM-based watch is a fantastic option
15for users who want the benefits of a modern smartwatch with the backing
16of open-source components and software.
17
18*** Product Specifications
19:PROPERTIES:
20:CUSTOM_ID: product-specifications
21:END:
1922I won't dive into too many details that you can find on
20[the product page](https://www.pine64.org/pinetime/), but I wanted to point out
21the prices for each watch and the primary functions:
22
23#### Price:
24
25- $26.99 (Sealed)
26- $24.99 (Dev Kit)
27- $51.98 (One Sealed + One Dev Kit)
28
29#### Primary Functionality:
30
31- Clock (+ Smartphone Sync)
32- Pedometer
33- Heart Rate Monitor
34- Sleep Monitor
35- Calories burned
36- Messaging
37- Smartphone Notifications
38- Media Controls
39
40## Unboxing
41
42Now, my PineTime was ordered on 2022-02-17, shipped on 2022-02-22, and was
43delivered on 2022-03-23.
44With the current delays on shipping times around the world (and the
45semiconductor shortage), a month for delivery from China seems reasonable to me.
46
47The packaging is simple, and the watch comes with instructions, technical
48information, the watch, and a charger (it does not include a USB wall adapter).
49
50The watch itself was able to turn on immediately when I pulled it out of the
51box, but the battery was depleted and required charging right away.
52
53![PineTime Box Contents](https://img.cleberg.net/blog/20220409-pinetime-smart-watch/pinetime_box_contents.png)
54
55## Software
56
57### Watch OS: InfiniTime
58
59While turning on the watch for the first time, some of the main design choices
60you can see in the watch OS,
61[InfiniTime](https://wiki.pine64.org/wiki/InfiniTime), are:
62
63- A square bezel, not too thin against the sides of the watch.
64- A simple, rubber band.
65- Basic font and screen pixel design.
66- Swipe gestures to access other screens.
67
68![PineTime Screens](https://img.cleberg.net/blog/20220409-pinetime-smart-watch/pinetime.png)
69
70The OS itself is fantastic in terms of functionality for me. It does exactly
71what a smartwatch should do - track time, steps, heart rates, and connect to
72another smart device, without being overly burdensome to the user.
73
74My only gripe so far is that it's _really_ difficult to swipe to different
75screens, such as pulling down the notification tray. I'm not sure if this is an
76OS or hardware issue, but it makes it quite hard to quickly move around the
77screens.
78
79However, my absolute favorite design choice is that the button the side turns
80the screen on and off and tilting/waving my wrist doesn't accidentally turn on
81the screen. With other watches, I absolutely hated not being able to turn off
82the raise-to-wake or wave features (i.e., blinding myself while wearing a watch
83at night because I moved my arm).
84
85### iOS App: InfiniLink
86
23[[https://www.pine64.org/pinetime/][the product page]], but I wanted to
24point out the prices for each watch and the primary functions:
25
26**** Price:
27:PROPERTIES:
28:CUSTOM_ID: price
29:END:
30- $26.99 (Sealed)
31- $24.99 (Dev Kit)
32- $51.98 (One Sealed + One Dev Kit)
33
34**** Primary Functionality:
35:PROPERTIES:
36:CUSTOM_ID: primary-functionality
37:END:
38- Clock (+ Smartphone Sync)
39- Pedometer
40- Heart Rate Monitor
41- Sleep Monitor
42- Calories burned
43- Messaging
44- Smartphone Notifications
45- Media Controls
46
47** Unboxing
48:PROPERTIES:
49:CUSTOM_ID: unboxing
50:END:
51Now, my PineTime was ordered on 2022-02-17, shipped on 2022-02-22, and
52was delivered on 2022-03-23. With the current delays on shipping times
53around the world (and the semiconductor shortage), a month for delivery
54from China seems reasonable to me.
55
56The packaging is simple, and the watch comes with instructions,
57technical information, the watch, and a charger (it does not include a
58USB wall adapter).
59
60The watch itself was able to turn on immediately when I pulled it out of
61the box, but the battery was depleted and required charging right away.
62
63#+caption: PineTime Box Contents
64[[https://img.cleberg.net/blog/20220409-pinetime-smart-watch/pinetime_box_contents.png]]
65
66** Software
67:PROPERTIES:
68:CUSTOM_ID: software
69:END:
70*** Watch OS: InfiniTime
71:PROPERTIES:
72:CUSTOM_ID: watch-os-infinitime
73:END:
74While turning on the watch for the first time, some of the main design
75choices you can see in the watch OS,
76[[https://wiki.pine64.org/wiki/InfiniTime][InfiniTime]], are:
77
78- A square bezel, not too thin against the sides of the watch.
79- A simple, rubber band.
80- Basic font and screen pixel design.
81- Swipe gestures to access other screens.
82
83#+caption: PineTime Screens
84[[https://img.cleberg.net/blog/20220409-pinetime-smart-watch/pinetime.png]]
85
86The OS itself is fantastic in terms of functionality for me. It does
87exactly what a smartwatch should do - track time, steps, heart rates,
88and connect to another smart device, without being overly burdensome to
89the user.
90
91My only gripe so far is that it's /really/ difficult to swipe to
92different screens, such as pulling down the notification tray. I'm not
93sure if this is an OS or hardware issue, but it makes it quite hard to
94quickly move around the screens.
95
96However, my absolute favorite design choice is that the button the side
97turns the screen on and off and tilting/waving my wrist doesn't
98accidentally turn on the screen. With other watches, I absolutely hated
99not being able to turn off the raise-to-wake or wave features (i.e.,
100blinding myself while wearing a watch at night because I moved my arm).
101
102*** iOS App: InfiniLink
103:PROPERTIES:
104:CUSTOM_ID: ios-app-infinilink
105:END:
87106Since I am using iOS as my primary mobile device OS, I am using the
88[InfiniLink](https://github.com/xan-m/InfiniLink) app to connect my watch.
107[[https://github.com/xan-m/InfiniLink][InfiniLink]] app to connect my
108watch.
89109
90110This app provides the following for PineTime owners:
91111
92- Firmware updates
93- Steps
94- Charts
95- Notifications
112- Firmware updates
113- Steps
114- Charts
115- Notifications
96116
97I mashed up a few screenshots to show off the home page, menu, firmware update,
98and notification test screens:
117I mashed up a few screenshots to show off the home page, menu, firmware
118update, and notification test screens:
99119
100![InfiniLink Home](https://img.cleberg.net/blog/20220409-pinetime-smart-watch/infinilink_home.png)
120#+caption: InfiniLink Home
121[[https://img.cleberg.net/blog/20220409-pinetime-smart-watch/infinilink_home.png]]
101122
102Another big feature of InfiniLink is the ability to track pedometer steps in a
103collection of beautiful graphs, with the option to change your step goal and
104add in manual steps.
123Another big feature of InfiniLink is the ability to track pedometer
124steps in a collection of beautiful graphs, with the option to change
125your step goal and add in manual steps.
105126
106![InfiniLink Steps](https://img.cleberg.net/blog/20220409-pinetime-smart-watch/infinilink_steps.png)
127#+caption: InfiniLink Steps
128[[https://img.cleberg.net/blog/20220409-pinetime-smart-watch/infinilink_steps.png]]
107129
108Finally, there are charts to display the battery percentage and heart rates over
109time. This area also comes with an option to clear data.
130Finally, there are charts to display the battery percentage and heart
131rates over time. This area also comes with an option to clear data.
110132
111![InfiniLink Charts](https://img.cleberg.net/blog/20220409-pinetime-smart-watch/infinilink_charts.png)
133#+caption: InfiniLink Charts
134[[https://img.cleberg.net/blog/20220409-pinetime-smart-watch/infinilink_charts.png]]
112135
113## Final Thoughts
114
115### Pros
116
117After wearing my watch for a few weeks, I have mostly positive thoughts about
118the watch so far.
119In the past, I have owned smartwatches by FitBit, Fossil, Apple, etc. -
120**but I prefer the PineTime over all of those watches**.
136** Final Thoughts
137:PROPERTIES:
138:CUSTOM_ID: final-thoughts
139:END:
140*** Pros
141:PROPERTIES:
142:CUSTOM_ID: pros
143:END:
144After wearing my watch for a few weeks, I have mostly positive thoughts
145about the watch so far. In the past, I have owned smartwatches by
146FitBit, Fossil, Apple, etc. - *but I prefer the PineTime over all of
147those watches*.
121148
122149The PineTime strips out all the unnecessary features and performs the
123150functions that it provides effectively and efficiently.
124151
125The battery life is amazing on this device. By default, the watch seems to last
126anywhere from a few days to a week before dying.
152The battery life is amazing on this device. By default, the watch seems
153to last anywhere from a few days to a week before dying.
127154
128155And of course, it's open source and backed by some of the most dedicated
129enthusiasts and developers I've seen. Watching the Matrix channel, forums, and
130website have been exciting to see.
131
132### Cons
133
134If I had to complain about anything, it would simply be the small bugs in some
135features that can be contributed to the companion apps more than the watch
136itself.
137
138A regular user would want native notification support out-of-the-box, which is
139the biggest item not working for me at the moment.
140
141My only other complaint is that the battery indicator on the watch doesn't seem
142accurate when it's nearing depletion - it seems that there's a bit of battery
143life left and then my watch is dead very suddenly after. This could just be me
144misinterpreting the battery level icons, but it has fooled me a few times into
145thinking I had more battery left than I actually did.
146
147Other than those small items, I really do love this watch and am glad I replaced
148my Apple Watch with the PineTime.
156enthusiasts and developers I've seen. Watching the Matrix channel,
157forums, and website have been exciting to see.
158
159*** Cons
160:PROPERTIES:
161:CUSTOM_ID: cons
162:END:
163If I had to complain about anything, it would simply be the small bugs
164in some features that can be contributed to the companion apps more than
165the watch itself.
166
167A regular user would want native notification support out-of-the-box,
168which is the biggest item not working for me at the moment.
169
170My only other complaint is that the battery indicator on the watch
171doesn't seem accurate when it's nearing depletion - it seems that
172there's a bit of battery life left and then my watch is dead very
173suddenly after. This could just be me misinterpreting the battery level
174icons, but it has fooled me a few times into thinking I had more battery
175left than I actually did.
176
177Other than those small items, I really do love this watch and am glad I
178replaced my Apple Watch with the PineTime.
blog/2022-06-01-ditching-cloudflare.org +103 −87
@@ -1,89 +1,105 @@
1+++
2date = 2022-06-01
3title = "Ditching Cloudflare for Njalla"
4description = "After spending a few years jumping around to different DNS hosts, I'm finally ditching Cloudflare for good."
5draft = false
6+++
7
8## Registrar
9
10After spending a year or so using Cloudflare for DNS only - no proxying or
11applications - I spent the last few months using Cloudflare Tunnels and
12Cloudflare Access to protect my self-hosted websites and applications via their
13proxy traffic model.
14
15However, I have never liked using Cloudflare due to their increasingly large
16share of control over web traffic, as well as their business model of being a
17MITM for all of your traffic.
18
19So, as of today, I have switched over to [Njalla](https://njal.la) as my
20registrar and DNS manager. I was able to easily transfer my domains over
21rapidly, with only one domain taking more than 15-30 minutes to propagate.
22
23~~I do still have two domains sitting at Cloudflare for the moment while I
24decide if they're worth the higher rates (one domain is 30€ and the other is
2545€).~~
26
27> **Update (2022.06.03)**: I ended up transferring my final two domains over to
28> Njalla, clearing my Cloudflare account of personal data, and deleting the
29> Cloudflare account entirely. _I actually feel relieved to have moved on to a
30> provider I trust._
31
32## DNS
33
34As noted above, I'm using Njalla exclusively for DNS configurations on my
35domains.
36
37However, the transfer process was not ideal. As soon as the domains transferred
38over, I switched the nameservers from Cloudflare to Njalla and lost most of the
39associated DNS records. So, the majority of the time spent during the migration
40was simply re-typing all the DNS records back in one-by-one.
41
42This would be much simpler if I were able to edit the plain-text format of the
43DNS configuration. I was able to do that at a past registrar (perhaps it was
44[Gandi.net](https://gandi.net/)?) and it made life a lot easier.
45
46### Dynamic DNS Updates
47
48I have built an easy Python script to run (or set-up in `cron` to run
49automatically) that will check my server's IPv4 and IPv6, compare it to Njalla,
50and update the DNS records if they don't match. You can see the full script and
51process in my other post:
52[Updating Dynamic DNS with Njalla API](/blog/njalla-dns-api/).
53
54I haven't used this other method, but I do know that you can create `Dynamic`
55DNS records with Njalla that
56[work for updating dynamic subdomains](https://njal.la/docs/ddns/).
57
58### Njalla's DNS Tool
59
1#+title: Ditching Cloudflare for Njalla
2#+date: 2022-06-01
3
4** Registrar
5:PROPERTIES:
6:CUSTOM_ID: registrar
7:END:
8After spending a year or so using Cloudflare for DNS only - no proxying
9or applications - I spent the last few months using Cloudflare Tunnels
10and Cloudflare Access to protect my self-hosted websites and
11applications via their proxy traffic model.
12
13However, I have never liked using Cloudflare due to their increasingly
14large share of control over web traffic, as well as their business model
15of being a MITM for all of your traffic.
16
17So, as of today, I have switched over to [[https://njal.la][Njalla]] as
18my registrar and DNS manager. I was able to easily transfer my domains
19over rapidly, with only one domain taking more than 15-30 minutes to
20propagate.
21
22+I do still have two domains sitting at Cloudflare for the moment while
23I decide if they're worth the higher rates (one domain is 30€ and the
24other is 45€).+
25
26#+begin_quote
27*Update (2022.06.03)*: I ended up transferring my final two domains over
28to Njalla, clearing my Cloudflare account of personal data, and deleting
29the Cloudflare account entirely. /I actually feel relieved to have moved
30on to a provider I trust./
31
32#+end_quote
33
34** DNS
35:PROPERTIES:
36:CUSTOM_ID: dns
37:END:
38As noted above, I'm using Njalla exclusively for DNS configurations on
39my domains.
40
41However, the transfer process was not ideal. As soon as the domains
42transferred over, I switched the nameservers from Cloudflare to Njalla
43and lost most of the associated DNS records. So, the majority of the
44time spent during the migration was simply re-typing all the DNS records
45back in one-by-one.
46
47This would be much simpler if I were able to edit the plain-text format
48of the DNS configuration. I was able to do that at a past registrar
49(perhaps it was [[https://gandi.net/][Gandi.net]]?) and it made life a
50lot easier.
51
52*** Dynamic DNS Updates
53:PROPERTIES:
54:CUSTOM_ID: dynamic-dns-updates
55:END:
56I have built an easy Python script to run (or set-up in =cron= to run
57automatically) that will check my server's IPv4 and IPv6, compare it to
58Njalla, and update the DNS records if they don't match. You can see the
59full script and process in my other post:
60[[/blog/njalla-dns-api/][Updating Dynamic DNS with Njalla API]].
61
62I haven't used this other method, but I do know that you can create
63=Dynamic= DNS records with Njalla that
64[[https://njal.la/docs/ddns/][work for updating dynamic subdomains]].
65
66*** Njalla's DNS Tool
67:PROPERTIES:
68:CUSTOM_ID: njallas-dns-tool
69:END:
6070One neat upside to Njalla is that they have a
61[DNS lookup tool](https://check.njal.la/dns/) that provides a lot of great
62information for those of you (AKA: me) who hate using the `dig` command.
63
64This was very useful for monitoring a couple of my transferred domains to see
65when the changes in nameservers, records, and DNSSEC went into effect.
66
67## Tunnel
68
71[[https://check.njal.la/dns/][DNS lookup tool]] that provides a lot of
72great information for those of you (AKA: me) who hate using the =dig=
73command.
74
75This was very useful for monitoring a couple of my transferred domains
76to see when the changes in nameservers, records, and DNSSEC went into
77effect.
78
79** Tunnel
80:PROPERTIES:
81:CUSTOM_ID: tunnel
82:END:
6983Cloudflare Tunnel is a service that acts as a reverse-proxy (hosted on
70Cloudflare's servers) and allowed me to mask the private IP address of the
71server hosting my various websites and apps.
72
73However, as I was moving away from Cloudflare, I was not able to find a suitable
74replacement that was both inexpensive and simple. So, I simply went back to
75hosting [my own reverse proxy with Nginx](/blog/set-up-nginx-reverse-proxy/).
76With the recent additions of Unifi hardware in my server/network rack, I am much
77more protected against spam and malicious attacks at the network edge than I was
78before I switched to Cloudflare.
79
80## Access
81
82Cloudflare Access, another app I used in combination with Cloudflare Tunnel,
83provided an authentication screen that required you to enter valid credentials
84before Cloudflare would forward you to the actual website or app (if the
85website/app has their own authentication, you'd then have to authenticate a
86second time).
87
88I did not replace this service with anything since I only host a handful of
89non-sensitive apps that don't require duplicate authentication.
84Cloudflare's servers) and allowed me to mask the private IP address of
85the server hosting my various websites and apps.
86
87However, as I was moving away from Cloudflare, I was not able to find a
88suitable replacement that was both inexpensive and simple. So, I simply
89went back to hosting [[/blog/set-up-nginx-reverse-proxy/][my own reverse
90proxy with Nginx]]. With the recent additions of Unifi hardware in my
91server/network rack, I am much more protected against spam and malicious
92attacks at the network edge than I was before I switched to Cloudflare.
93
94** Access
95:PROPERTIES:
96:CUSTOM_ID: access
97:END:
98Cloudflare Access, another app I used in combination with Cloudflare
99Tunnel, provided an authentication screen that required you to enter
100valid credentials before Cloudflare would forward you to the actual
101website or app (if the website/app has their own authentication, you'd
102then have to authenticate a second time).
103
104I did not replace this service with anything since I only host a handful
105of non-sensitive apps that don't require duplicate authentication.
blog/2022-06-04-njalla-dns-api.org +112 −99
@@ -1,104 +1,113 @@
1+++
2date = 2022-06-04
3title = "Dynamic DNS with Njalla API"
4description = "Learn how to update Njalla DNS records automatically with a simple Python script."
5draft = false
6+++
7
8## Njalla's API
9
10As noted in my recent post about
11[switching to Njalla from Cloudflare](/blog/ditching-cloudflare/), I was
12searching for a way to replace my very easy-to-use bash script to
13[update Cloudflare's DNS via their API](/blog/cloudflare-dns-api/).
14
15To reiterate what I said in those posts, this is a common necessity for those of
16us who have non-static IP addresses that can change at any moment due to ISP
17policy.
18
19In order to keep a home server running smoothly, the server admin needs to have
20a process to constantly monitor their public IP address and update their
21domain's DNS records if it changes.
22
23This post explains how to use Python to update Njalla's DNS records whenever a
24machine's public IP address changes.
25
26### Creating a Token
27
28To use Njalla's API, you will first need to create a token that will be used to
29authenticate you every time you call the API. Luckily, this is very easy to do
30if you have an account with Njalla.
31
32Simply go the [API Settings](https://njal.la/settings/api/) page and click the
33`Add Token` button. Next, enter a name for the token and click `Add`.
34
35Finally, click the `Manage` button next to your newly created token and copy the
36`API Token` field.
37
38### Finding the Correct API Request
39
40Once you have a token, you're ready to call the Njalla API for any number of
41requests. For a full listing of available requests, see the
42[Njalla API Documentation](https://njal.la/api/).
43
44For this demo, we are using the `list-records` and `edit-record` requests.
45
46The `list-records` request requires the following payload to be sent when
47calling the API:
48
49```txt
1#+title: Dynamic DNS with Njalla API
2#+date: 2022-06-04
3
4** Njalla's API
5:PROPERTIES:
6:CUSTOM_ID: njallas-api
7:END:
8As noted in my recent post about [[/blog/ditching-cloudflare/][switching
9to Njalla from Cloudflare]], I was searching for a way to replace my
10very easy-to-use bash script to [[/blog/cloudflare-dns-api/][update
11Cloudflare's DNS via their API]].
12
13To reiterate what I said in those posts, this is a common necessity for
14those of us who have non-static IP addresses that can change at any
15moment due to ISP policy.
16
17In order to keep a home server running smoothly, the server admin needs
18to have a process to constantly monitor their public IP address and
19update their domain's DNS records if it changes.
20
21This post explains how to use Python to update Njalla's DNS records
22whenever a machine's public IP address changes.
23
24*** Creating a Token
25:PROPERTIES:
26:CUSTOM_ID: creating-a-token
27:END:
28To use Njalla's API, you will first need to create a token that will be
29used to authenticate you every time you call the API. Luckily, this is
30very easy to do if you have an account with Njalla.
31
32Simply go the [[https://njal.la/settings/api/][API Settings]] page and
33click the =Add Token= button. Next, enter a name for the token and click
34=Add=.
35
36Finally, click the =Manage= button next to your newly created token and
37copy the =API Token= field.
38
39*** Finding the Correct API Request
40:PROPERTIES:
41:CUSTOM_ID: finding-the-correct-api-request
42:END:
43Once you have a token, you're ready to call the Njalla API for any
44number of requests. For a full listing of available requests, see the
45[[https://njal.la/api/][Njalla API Documentation]].
46
47For this demo, we are using the =list-records= and =edit-record=
48requests.
49
50The =list-records= request requires the following payload to be sent
51when calling the API:
52
53#+begin_src txt
5054params: {
5155 domain: string
5256}
53```
57#+end_src
5458
55The `edit-record` request requires the following payload to be sent when calling
56the API:
59The =edit-record= request requires the following payload to be sent when
60calling the API:
5761
58```txt
62#+begin_src txt
5963params: {
6064 domain: string
6165 id: int
6266 content: string
6367}
64```
65
66## Server Set-Up
67
68To create this script, we will be using Python. By default, I use Python 3 on my
69servers, so please note that I did not test this in Python 2, and I do not know
70if Python 2 will work for this.
71
72### Creating the Script
73
74First, find a suitable place to create your script. Personally, I just create a
75directory called `ddns` in my home directory:
76
77```sh
68#+end_src
69
70** Server Set-Up
71:PROPERTIES:
72:CUSTOM_ID: server-set-up
73:END:
74To create this script, we will be using Python. By default, I use Python
753 on my servers, so please note that I did not test this in Python 2,
76and I do not know if Python 2 will work for this.
77
78*** Creating the Script
79:PROPERTIES:
80:CUSTOM_ID: creating-the-script
81:END:
82First, find a suitable place to create your script. Personally, I just
83create a directory called =ddns= in my home directory:
84
85#+begin_src sh
7886mkdir ~/ddns
79```
87#+end_src
8088
8189Next, create a Python script file:
8290
83```sh
91#+begin_src sh
8492nano ~/ddns/ddns.py
85```
93#+end_src
8694
87The following code snippet is quite long, so I won't go into depth on each part.
88However, I suggest you read through the entire script before running it; it is
89quite simple and contains comments to help explain each code block.
95The following code snippet is quite long, so I won't go into depth on
96each part. However, I suggest you read through the entire script before
97running it; it is quite simple and contains comments to help explain
98each code block.
9099
91:warning: **Note**: You will need to update the following variables for this to
92work:
100:warning: *Note*: You will need to update the following variables for
101this to work:
93102
94- `token`: This is the Njalla API token you created earlier.
95- `user_domain`: This is the top-level domain you want to modify.
96- `include_subdomains`: Set this to `True` if you also want to modify
97 subdomains found under the TLD.
98- `subdomains`: If `include_subdomains` = `True`, you can include your list of
99 subdomains to be modified here.
103- =token=: This is the Njalla API token you created earlier.
104- =user_domain=: This is the top-level domain you want to modify.
105- =include_subdomains=: Set this to =True= if you also want to modify
106 subdomains found under the TLD.
107- =subdomains=: If =include_subdomains= = =True=, you can include your
108 list of subdomains to be modified here.
100109
101```python
110#+begin_src python
102111#!/usr/bin/python
103112# -*- coding: utf-8 -*-
104113# Import Python modules
@@ -177,29 +186,33 @@ for record in data['records']:
177186 'does not match Njalla\'s value of',
178187 record['content'], '. Updating...')
179188 update_record(user_domain, record['id'], ipv6)
180```
189#+end_src
181190
182### Running the Script
191*** Running the Script
192:PROPERTIES:
193:CUSTOM_ID: running-the-script
194:END:
195Once you've created the script and are ready to test it, run the
196following command:
183197
184Once you've created the script and are ready to test it, run the following
185command:
186
187```sh
198#+begin_src sh
188199python3 ~/ddns/ddns.py
189```
190
191### Setting the Script to Run Automatically
200#+end_src
192201
193To make sure the scripts run automatically, add it to the `cron` file so that it
194will run on a schedule. To do this, open the `cron` file:
202*** Setting the Script to Run Automatically
203:PROPERTIES:
204:CUSTOM_ID: setting-the-script-to-run-automatically
205:END:
206To make sure the scripts run automatically, add it to the =cron= file so
207that it will run on a schedule. To do this, open the =cron= file:
195208
196```sh
209#+begin_src sh
197210crontab -e
198```
211#+end_src
199212
200In the cron file, paste the following at the bottom of the editor in order to
201check the IP every five minutes:
213In the cron file, paste the following at the bottom of the editor in
214order to check the IP every five minutes:
202215
203```sh
216#+begin_src sh
204217*/5 * * * * python3 /home/<your_username>/ddns/ddns.py
205```
218#+end_src
blog/2022-06-07-freshrss.org +175 −152
@@ -1,67 +1,75 @@
1+++
2date = 2022-06-07
3title = "Self-Hosting FreshRSS"
4description = "A detailed description of my process to self-host FreshRSS on Ubuntu."
5draft = false
6+++
7
8## Why RSS?
9
10After noticing that I have collected 50+ blogs as bookmarks, I decided to
11migrate back to using RSS feeds to stay up-to-date with my favorite websites.
12Using RSS allows me to read all of these posts in a single app (on both mobile &
13desktop) and allows me to be notified when new posts are available.
14
15However, I ran into one issue: syncing subscriptions and read/unread posts
16across devices. Since I want to be able to easily read on both mobile and
17desktop, I decided to look for a self-hosted RSS solution.
18
19Thus, I found [FreshRSS](https://www.freshrss.org/) and was able to successfully
20install it on my server in about 30 minutes.
21
22## Documentation
23
1#+title: Self-Hosting FreshRSS
2#+date: 2022-06-07
3
4** Why RSS?
5:PROPERTIES:
6:CUSTOM_ID: why-rss
7:END:
8After noticing that I have collected 50+ blogs as bookmarks, I decided
9to migrate back to using RSS feeds to stay up-to-date with my favorite
10websites. Using RSS allows me to read all of these posts in a single app
11(on both mobile & desktop) and allows me to be notified when new posts
12are available.
13
14However, I ran into one issue: syncing subscriptions and read/unread
15posts across devices. Since I want to be able to easily read on both
16mobile and desktop, I decided to look for a self-hosted RSS solution.
17
18Thus, I found [[https://www.freshrss.org/][FreshRSS]] and was able to
19successfully install it on my server in about 30 minutes.
20
21** Documentation
22:PROPERTIES:
23:CUSTOM_ID: documentation
24:END:
2425While it's certainly not robust, the
25[FreshRSS documentation](https://freshrss.github.io/FreshRSS/) is helpful for
26figuring out basic information about the service.
27
28However, I wanted to install this service as a Docker container and stumbled
29across the
30[Docker README](https://github.com/FreshRSS/FreshRSS/tree/edge/Docker) within
31the GitHub repository.
32
33This README was the documentation I actually needed. However, as you'll see
34below, I still had to manually edit one file (`config.php`) to access the API
35externally via my RSS apps.
36
37## Installation
38
39### DNS
40
41The first step, as required by any external web service, was assigning a domain
42name to use. I chose to use a subdomain, like `rss.example.com`.
43
44To assign this, I created an `A` record in my DNS settings with the IPv4 address
45of the server and an `AAAA` record with the IPv6 address of the server. Note:
46assigning an IPv6 (`AAAA`) record is optional, but I like to enable IPV6 for my
47services.
48
49```config
26[[https://freshrss.github.io/FreshRSS/][FreshRSS documentation]] is
27helpful for figuring out basic information about the service.
28
29However, I wanted to install this service as a Docker container and
30stumbled across the
31[[https://github.com/FreshRSS/FreshRSS/tree/edge/Docker][Docker README]]
32within the GitHub repository.
33
34This README was the documentation I actually needed. However, as you'll
35see below, I still had to manually edit one file (=config.php=) to
36access the API externally via my RSS apps.
37
38** Installation
39:PROPERTIES:
40:CUSTOM_ID: installation
41:END:
42*** DNS
43:PROPERTIES:
44:CUSTOM_ID: dns
45:END:
46The first step, as required by any external web service, was assigning a
47domain name to use. I chose to use a subdomain, like =rss.example.com=.
48
49To assign this, I created an =A= record in my DNS settings with the IPv4
50address of the server and an =AAAA= record with the IPv6 address of the
51server. Note: assigning an IPv6 (=AAAA=) record is optional, but I like
52to enable IPV6 for my services.
53
54#+begin_src config
5055rss.example.com A xxx.xxx.xxx.xxx
5156rss.example.com AAAA xxxx:xxxx: ... :xxxx
52```
53
54### Docker
55
56I initially tried to set up a `docker-compose.yml` file with a `.env` file
57because I prefer to have a file I can look back at later to see how I initially
58started the container, but it simply wouldn't work for me. I'm not sure why, but
59I assume I wasn't telling `docker-compose` where the `.env` file was.
60
61Regardless, I chose to simply run the service with `docker run`. See the
62following command for my `docker run` configuration:
63
64```sh
57#+end_src
58
59*** Docker
60:PROPERTIES:
61:CUSTOM_ID: docker
62:END:
63I initially tried to set up a =docker-compose.yml= file with a =.env=
64file because I prefer to have a file I can look back at later to see how
65I initially started the container, but it simply wouldn't work for me.
66I'm not sure why, but I assume I wasn't telling =docker-compose= where
67the =.env= file was.
68
69Regardless, I chose to simply run the service with =docker run=. See the
70following command for my =docker run= configuration:
71
72#+begin_src sh
6573sudo docker run -d --restart unless-stopped --log-opt max-size=10m \
6674 -p 8080:80 \
6775 -e TZ=America/Chicago \
@@ -70,42 +78,46 @@ sudo docker run -d --restart unless-stopped --log-opt max-size=10m \
7078 -v freshrss_extensions:/var/www/FreshRSS/extensions \
7179 --name freshrss \
7280 freshrss/freshrss
73```
74
75This started the container successfully and allowed me to visit the FreshRSS
76instance at `localhost:8080`.
77
78### Fresh RSS Set-Up
79
80I **HIGHLY** suggest that you set up your user account prior to
81exposing this service to the public. It's unlikely that someone is trying to
82access the exact domain or IP/port you're assigning here, but as soon as you
83expose this service, the first person to open the URL will be able to create the
84admin user.
85
86In order to set up your FreshRSS service, open the `localhost:8080` URL in your
87browser (you may need to use a local IP instead of `localhost` if you're
88accessing the page from a different machine on the network - e.g.,
89`192.168.1.20:8080`).
81#+end_src
82
83This started the container successfully and allowed me to visit the
84FreshRSS instance at =localhost:8080=.
85
86*** Fresh RSS Set-Up
87:PROPERTIES:
88:CUSTOM_ID: fresh-rss-set-up
89:END:
90I *HIGHLY* suggest that you set up your user account prior to exposing
91this service to the public. It's unlikely that someone is trying to
92access the exact domain or IP/port you're assigning here, but as soon as
93you expose this service, the first person to open the URL will be able
94to create the admin user.
95
96In order to set up your FreshRSS service, open the =localhost:8080= URL
97in your browser (you may need to use a local IP instead of =localhost=
98if you're accessing the page from a different machine on the network -
99e.g., =192.168.1.20:8080=).
90100
91101Once the page loads, set up your default user with a strong username and
92password. You may also choose to configure other settings prior to exposing this
93service.
94
95### Nginx Reverse-Proxy
102password. You may also choose to configure other settings prior to
103exposing this service.
96104
105*** Nginx Reverse-Proxy
106:PROPERTIES:
107:CUSTOM_ID: nginx-reverse-proxy
108:END:
97109In order to access this service outside my home, I needed to set up a
98reverse-proxy to connect `localhost:8080` to `rss.example.com`.
110reverse-proxy to connect =localhost:8080= to =rss.example.com=.
99111
100112First, I created a new Nginx configuration file:
101113
102```sh
114#+begin_src sh
103115sudo nano /etc/nginx/sites-available/rss.example.com
104```
116#+end_src
105117
106118Within the config file, I pasted the following code:
107119
108```config
120#+begin_src config
109121upstream freshrss {
110122 server 127.0.0.1:8080;
111123 keepalive 64;
@@ -134,80 +146,91 @@ server {
134146 proxy_pass_header Authorization;
135147 }
136148}
137```
149#+end_src
138150
139Finally, restart Nginx and you will be able to access your service via HTTP:
151Finally, restart Nginx and you will be able to access your service via
152HTTP:
140153
141```sh
154#+begin_src sh
142155sudo systemctl restart nginx.service
143```
144
145### HTTPS
146
147However, I don't want to access my RSS feeds via HTTP. I want it available only
148via HTTPS. In order to do this, I ran the [certbot](https://certbot.eff.org/)
149program to generate SSL certificates for me:
150
151```sh
156#+end_src
157
158*** HTTPS
159:PROPERTIES:
160:CUSTOM_ID: https
161:END:
162However, I don't want to access my RSS feeds via HTTP. I want it
163available only via HTTPS. In order to do this, I ran the
164[[https://certbot.eff.org/][certbot]] program to generate SSL
165certificates for me:
166
167#+begin_src sh
152168sudo certbot --nginx
153```
154
155This process will automatically generate an SSL certificate for you and modify
156the Nginx configuration file to include a redirect from HTTP to HTTPS.
157
158## Post-Installation Fixes
159
160At this point, we have a functional FreshRSS website, available from anywhere
161and secured with HTTPS. However, attempting to connect this service to an RSS
162app resulted in many errors regarding unavailable URLs and incorrect
163credentials.
164
165### API Set-Up
166
167First, you need to open your user profile in FreshRSS (`Settings` > `Profile`)
168and set an API password in the field at the bottom. This is the password you
169will need to provide to your RSS apps.
170
171Once that is set and saved, click the link below the API password field to open
172the API check tool. It should look something like `https://localhost:8080/api/`
173or `https://rss.example.com/api/`.
174
175Within this page, you _should_ see your correct external URL and "PASS" at the
176bottom of each API type.
177This would mean everything is set up correctly, and you can now move on and
178login to any RSS apps that support self-hosted options.
169#+end_src
170
171This process will automatically generate an SSL certificate for you and
172modify the Nginx configuration file to include a redirect from HTTP to
173HTTPS.
174
175** Post-Installation Fixes
176:PROPERTIES:
177:CUSTOM_ID: post-installation-fixes
178:END:
179At this point, we have a functional FreshRSS website, available from
180anywhere and secured with HTTPS. However, attempting to connect this
181service to an RSS app resulted in many errors regarding unavailable URLs
182and incorrect credentials.
183
184*** API Set-Up
185:PROPERTIES:
186:CUSTOM_ID: api-set-up
187:END:
188First, you need to open your user profile in FreshRSS (=Settings= >
189=Profile=) and set an API password in the field at the bottom. This is
190the password you will need to provide to your RSS apps.
191
192Once that is set and saved, click the link below the API password field
193to open the API check tool. It should look something like
194=https://localhost:8080/api/= or =https://rss.example.com/api/=.
195
196Within this page, you /should/ see your correct external URL and "PASS"
197at the bottom of each API type. This would mean everything is set up
198correctly, and you can now move on and login to any RSS apps that
199support self-hosted options.
179200
180201In my case, the URL showed an internal URL and I had a warning that the
181`base_url` variable may be misconfigured. If this is the case, see the next
182section for a fix.
183
184### Base URL Fix
202=base_url= variable may be misconfigured. If this is the case, see the
203next section for a fix.
185204
186In order to fix the `base_url` for the API, I opened up my docker container with
187the following command:
205*** Base URL Fix
206:PROPERTIES:
207:CUSTOM_ID: base-url-fix
208:END:
209In order to fix the =base_url= for the API, I opened up my docker
210container with the following command:
188211
189```sh
212#+begin_src sh
190213sudo docker exec -it freshrss bash
191```
214#+end_src
192215
193216Within this container, update the packages and install an editor:
194217
195```sh
218#+begin_src sh
196219apt-get update
197220apt-get install nano
198```
221#+end_src
199222
200Finally, open up `config.php` in the `data` directory:
223Finally, open up =config.php= in the =data= directory:
201224
202```sh
225#+begin_src sh
203226nano data/config.php
204```
227#+end_src
205228
206Within `config.php`, you will need to update the `base_url` variable and update
207it to match your external URL. In my case, I simply commented-out the incorrect
208URL with `//` and added the correct one on a new line:
229Within =config.php=, you will need to update the =base_url= variable and
230update it to match your external URL. In my case, I simply commented-out
231the incorrect URL with =//= and added the correct one on a new line:
209232
210```php
233#+begin_src php
211234<?php
212235 return array (
213236 ...
@@ -216,25 +239,25 @@ URL with `//` and added the correct one on a new line:
216239 ...
217240 )
218241>
219```
242#+end_src
220243
221You can now exit the file with `Ctrl + x`, press `y` to save the file, and then
222click `Enter` to keep the same file name.
244You can now exit the file with =Ctrl + x=, press =y= to save the file,
245and then click =Enter= to keep the same file name.
223246
224247Finally, just exit out of the docker container:
225248
226```sh
249#+begin_src sh
227250exit
228```
251#+end_src
229252
230253Next, just restart the container:
231254
232```sh
255#+begin_src sh
233256sudo docker restart freshrss
234```
257#+end_src
235258
236Voilà! Your API check should now "PASS" and you should be able to use one of the
237API URLs in your RSS apps.
259Voilà! Your API check should now "PASS" and you should be able to use
260one of the API URLs in your RSS apps.
238261
239In my case, I use [NetNewsWire](https://netnewswire.com) on my desktop and
240phone.
262In my case, I use [[https://netnewswire.com][NetNewsWire]] on my desktop
263and phone.
blog/2022-06-16-terminal-lifestyle.org +188 −160
@@ -1,43 +1,48 @@
1+++
2date = 2022-06-16
3title = "A Terminal Lifestyle"
4description = "A detailed description on how I'm living my digital life in the terminal."
5+++
6
7## Text-Based Simplicity
8
9I've detailed my views on web-based minimalism and related topics in other
10posts throughout the years; e.g., JavaScript/CSS bloat slowing down websites
11that are essentially a text document. However, I have never really expanded
12beyond talking about the web and describing how I focus on minimizing
13distractions in other digital environments.
14
15This post is going to set the baseline for how I *try* to live my digital life.
16It does not necessarily get into my physical life, which is often harder to
17control and contain all the noise in our modern world.
18
19While there are new things to do every day in our digital world, I find that
20keeping a core set of values and interests can ground you and keep you mindful
21of *why* you are participating in the digital world. For example, if - at your
22core - you have no interest in what strangers think about random topics, it
23would be unwise to start participating in social media. However, I am someone
24who has been dragged in by effective advertising to participate in communities
25that I realize I do not care for.
26
27I won't dive much further into explaining the philosophy of all this, but I will
28link a few helpful articles that may pique your interest if you're in search of
29more meaningful experiences:
30
31- [Mindfulness](https://en.wikipedia.org/wiki/Mindfulness)
32- [Minimalism](https://en.wikipedia.org/wiki/Minimalism)
33- [Stoicism](https://en.wikipedia.org/wiki/Stoicism)
34
35## Living Life in the Terminal
36
37My personal approach to reducing digital distractions and increasing my focus on
38the task at hand is to use a terminal for as much as I possibly can.
39
40Most days, this means that I have a few tabs open constantly in my terminal:
1#+title: A Terminal Lifestyle
2#+date: 2022-06-16
3
4** Text-Based Simplicity
5:PROPERTIES:
6:CUSTOM_ID: text-based-simplicity
7:END:
8I've detailed my views on web-based minimalism and related topics in
9other posts throughout the years; e.g., JavaScript/CSS bloat slowing
10down websites that are essentially a text document. However, I have
11never really expanded beyond talking about the web and describing how I
12focus on minimizing distractions in other digital environments.
13
14This post is going to set the baseline for how I /try/ to live my
15digital life. It does not necessarily get into my physical life, which
16is often harder to control and contain all the noise in our modern
17world.
18
19While there are new things to do every day in our digital world, I find
20that keeping a core set of values and interests can ground you and keep
21you mindful of /why/ you are participating in the digital world. For
22example, if - at your core - you have no interest in what strangers
23think about random topics, it would be unwise to start participating in
24social media. However, I am someone who has been dragged in by effective
25advertising to participate in communities that I realize I do not care
26for.
27
28I won't dive much further into explaining the philosophy of all this,
29but I will link a few helpful articles that may pique your interest if
30you're in search of more meaningful experiences:
31
32- [[https://en.wikipedia.org/wiki/Mindfulness][Mindfulness]]
33- [[https://en.wikipedia.org/wiki/Minimalism][Minimalism]]
34- [[https://en.wikipedia.org/wiki/Stoicism][Stoicism]]
35
36** Living Life in the Terminal
37:PROPERTIES:
38:CUSTOM_ID: living-life-in-the-terminal
39:END:
40My personal approach to reducing digital distractions and increasing my
41focus on the task at hand is to use a terminal for as much as I possibly
42can.
43
44Most days, this means that I have a few tabs open constantly in my
45terminal:
4146
42471. A web browser
43482. A chat client
@@ -46,157 +51,180 @@ Most days, this means that I have a few tabs open constantly in my terminal:
46515. A local shell for navigating my computer's files
47526. A remote shell for managing servers and other machines
4853
49Beyond this, I rarely open other tabs or GUI applications, unless absolutely
50necessary. If you look, you may be surprised what can be accomplished in the
51terminal.
54Beyond this, I rarely open other tabs or GUI applications, unless
55absolutely necessary. If you look, you may be surprised what can be
56accomplished in the terminal.
5257
53For example, I have moved my music and entertainment downloads to the
54terminal, along with my device VPN connections. I am exploring options for
55moving my RSS subscriptions to something like [Newsboat](https://newsboat.org/),
56so that I can read my daily articles without all the fuss.
58For example, I have moved my music and entertainment downloads to the
59terminal, along with my device VPN connections. I am exploring options
60for moving my RSS subscriptions to something like
61[[https://newsboat.org/][Newsboat]], so that I can read my daily
62articles without all the fuss.
5763
58Now that we have some examples out of the way, let's dive into the
64Now that we have some examples out of the way, let's dive into the
5965specifics.
6066
61### Browsing the Web
62
63I'm going to start off with a hard topic for those who prefer to live in the
64terminal: web browsing. This task is made hard mostly by websites and web apps
65that require JavaScript to run. The other difficult part is that if you're using
66a text-based browser, that means images won't load (hopefully that's obvious).
67
68I am using [Lynx](https://lynx.invisible-island.net), a text-based browser that
69runs quickly and easily in the terminal. Lynx allows me to browser most websites
70by simply typing `g` and then typing in the URL I want.
71
72![Lynx](https://img.cleberg.net/blog/20220616-terminal-lifestyle/lynx.png)
73
74If you need a search engine while in Lynx, I recommend [DuckDuckGo
75(Lite)](https://lite.duckduckgo.com/lite/), which allows you to search the web
76using their text-only interface.
77
78![DuckDuckGo
79!Lite](https://img.cleberg.net/blog/20220616-terminal-lifestyle/ddg.png)
80
81Eventually, you will run into websites that don't work (or are just too ugly
82and messy) in a text-only mode, and you'll be forced to switch over to a GUI
83browser to look at that site. Personally, I don't mind this as it doesn't happen
84as often as I thought it would.
85
86The only time I need to do this is when I want to browse an image/video-focused
87webpage or if I need to log in to a site, and it doesn't support a text-only
88login page.
89For example, I am able to easily log in to [Sourcehut](https://sr.ht) in lynx.
90
91### Chatting with Friends
92
93After web browsing activities, my main form of terminal communication is Matrix.
94I use the [gomuks](https://docs.mau.fi/gomuks/) client currently.
95
96This was incredibly easy to install on macOS (but I will need to see if it'll
97be just as easy on Linux when my new laptop arrives):
98
99```sh
67*** Browsing the Web
68:PROPERTIES:
69:CUSTOM_ID: browsing-the-web
70:END:
71I'm going to start off with a hard topic for those who prefer to live in
72the terminal: web browsing. This task is made hard mostly by websites
73and web apps that require JavaScript to run. The other difficult part is
74that if you're using a text-based browser, that means images won't load
75(hopefully that's obvious).
76
77I am using [[https://lynx.invisible-island.net][Lynx]], a text-based
78browser that runs quickly and easily in the terminal. Lynx allows me to
79browser most websites by simply typing =g= and then typing in the URL I
80want.
81
82#+caption: Lynx
83[[https://img.cleberg.net/blog/20220616-terminal-lifestyle/lynx.png]]
84
85If you need a search engine while in Lynx, I recommend
86[[https://lite.duckduckgo.com/lite/][DuckDuckGo (Lite)]], which allows
87you to search the web using their text-only interface.
88
89#+caption: DuckDuckGo !Lite
90[[https://img.cleberg.net/blog/20220616-terminal-lifestyle/ddg.png]]
91
92Eventually, you will run into websites that don't work (or are just too
93ugly and messy) in a text-only mode, and you'll be forced to switch over
94to a GUI browser to look at that site. Personally, I don't mind this as
95it doesn't happen as often as I thought it would.
96
97The only time I need to do this is when I want to browse an
98image/video-focused webpage or if I need to log in to a site, and it
99doesn't support a text-only login page. For example, I am able to easily
100log in to [[https://sr.ht][Sourcehut]] in lynx.
101
102*** Chatting with Friends
103:PROPERTIES:
104:CUSTOM_ID: chatting-with-friends
105:END:
106After web browsing activities, my main form of terminal communication is
107Matrix. I use the [[https://docs.mau.fi/gomuks/][gomuks]] client
108currently.
109
110This was incredibly easy to install on macOS (but I will need to see if
111it'll be just as easy on Linux when my new laptop arrives):
112
113#+begin_src sh
100114brew install gomuks
101```
115#+end_src
102116
103Once you launch gomuks, it will sync and require your username and password to
104login. After doing so, the only problem I ran into was verifying my gomuks
105client so that I could participate in rooms with E2EE.
117Once you launch gomuks, it will sync and require your username and
118password to login. After doing so, the only problem I ran into was
119verifying my gomuks client so that I could participate in rooms with
120E2EE.
106121
107Finally, I was able to verify the session by opening the Element desktop app (I
108assume you can do this in the browser and mobile app too, but I'm not sure) and
109manually verifying myself with this process:
122Finally, I was able to verify the session by opening the Element desktop
123app (I assume you can do this in the browser and mobile app too, but I'm
124not sure) and manually verifying myself with this process:
110125
1111261. Open the Element desktop app
1121272. Open a room I was a member of
1133. Open the `Room Info` pane
1144. Open the `People` menu and search for myself
1283. Open the =Room Info= pane
1294. Open the =People= menu and search for myself
1151305. Click on my profile name
1166. Click on the session link under the `Security` section and follow the
117prompts to manually verify the session
118
119Overall, I like gomuks and am able to enjoy all the features I was using in
120Element. The only hiccup I have occurred is manually downloading images to view
121them, which can be annoying.
122
123![gomuks](https://img.cleberg.net/blog/20220616-terminal-lifestyle/gomuks.png)
124
125### Email
126
127Moving email to the terminal has been the hardest of the tasks for me. Unlike
128web browsing, where I can simply decide to not look at a website that does not
129work in the terminal, I cannot simply ignore emails sent to me.
130
131Personally, I am experimenting with [neomutt](https://neomutt.org/) as a
132potential email client.
133
134However, this requires a **TON** of configuration and tweaking to get right.
135Even when I was able to set up neomutt, configure my email account, and
136customize a few personal preferences, a lot of emails still do not display
137correctly (mostly due to HTML and images).
138
139I won't get into the details of configuring `neomutt`; I mostly followed this
140blog post: [Email in the Terminal: Configuring
141Neomutt](https://gideonwolfe.com/posts/workflow/neomutt/intro/).
142
143Finally, I have yet to figure out how to connect my GPG keys to `neomutt`, but
144that's a problem for another day.
145
146### RSS Feed Reader
147
148I have just started using [Newsboat](https://newsboat.org/) to read articles in
149my terminal and have found quick success with it.
1316. Click on the session link under the =Security= section and follow the
132 prompts to manually verify the session
133
134Overall, I like gomuks and am able to enjoy all the features I was using
135in Element. The only hiccup I have occurred is manually downloading
136images to view them, which can be annoying.
137
138#+caption: gomuks
139[[https://img.cleberg.net/blog/20220616-terminal-lifestyle/gomuks.png]]
140
141*** Email
142:PROPERTIES:
143:CUSTOM_ID: email
144:END:
145Moving email to the terminal has been the hardest of the tasks for me.
146Unlike web browsing, where I can simply decide to not look at a website
147that does not work in the terminal, I cannot simply ignore emails sent
148to me.
149
150Personally, I am experimenting with [[https://neomutt.org/][neomutt]] as
151a potential email client.
152
153However, this requires a *TON* of configuration and tweaking to get
154right. Even when I was able to set up neomutt, configure my email
155account, and customize a few personal preferences, a lot of emails still
156do not display correctly (mostly due to HTML and images).
157
158I won't get into the details of configuring =neomutt=; I mostly followed
159this blog post:
160[[https://gideonwolfe.com/posts/workflow/neomutt/intro/][Email in the
161Terminal: Configuring Neomutt]].
162
163Finally, I have yet to figure out how to connect my GPG keys to
164=neomutt=, but that's a problem for another day.
165
166*** RSS Feed Reader
167:PROPERTIES:
168:CUSTOM_ID: rss-feed-reader
169:END:
170I have just started using [[https://newsboat.org/][Newsboat]] to read
171articles in my terminal and have found quick success with it.
150172
151173I'll show you a quick screenshot first:
152174
153![Newsboat](https://img.cleberg.net/blog/20220616-terminal-lifestyle/newsboat.png)
175#+caption: Newsboat
176[[https://img.cleberg.net/blog/20220616-terminal-lifestyle/newsboat.png]]
154177
155The configuration was super easy for this app; I simply installed the app,
156created a file for URLs, and imported my OPML subscriptions that I had exported
157out of my old feed reader:
178The configuration was super easy for this app; I simply installed the
179app, created a file for URLs, and imported my OPML subscriptions that I
180had exported out of my old feed reader:
158181
159```sh
182#+begin_src sh
160183brew install newsboat
161```
184#+end_src
162185
163```sh
186#+begin_src sh
164187touch ~/.newsboat/urls
165```
188#+end_src
166189
167```sh
190#+begin_src sh
168191newsboat -i=my_subscriptions.opml
169```
170
171### Writing & Programming
192#+end_src
172193
173Unfortunately, the weak link in my terminal-based environment right now is my
174grasp of the possibilities of editing files within a shell.
194*** Writing & Programming
195:PROPERTIES:
196:CUSTOM_ID: writing-programming
197:END:
198Unfortunately, the weak link in my terminal-based environment right now
199is my grasp of the possibilities of editing files within a shell.
175200
176I am used to the easy extensions found in VSCodium and Kate, so I am slowly
177learning how to mold the default editing tools to my needs. Currently, this
178means I am using `nano` with the following configuration:
201I am used to the easy extensions found in VSCodium and Kate, so I am
202slowly learning how to mold the default editing tools to my needs.
203Currently, this means I am using =nano= with the following
204configuration:
179205
180```config
206#+begin_src config
181207set breaklonglines
182208set autoindent
183209set linenumbers
184210set tabstospaces
185211set tabsize 2
186212set fill 80
187```
213#+end_src
188214
189This configuration allows nano to automatically hard-wrap lines at 80
190characters, autoindent the wrapped lines (if the previous line was indented),
191use 2 spaces per tab, and display line numbers within each file I open.
215This configuration allows nano to automatically hard-wrap lines at 80
216characters, autoindent the wrapped lines (if the previous line was
217indented), use 2 spaces per tab, and display line numbers within each
218file I open.
192219
193I am currently looking to see if `vim` or `emacs` would be more useful for my
194current needs, but I'm not in any rush, so I don't expect to find an answer
195anytime soon.
220I am currently looking to see if =vim= or =emacs= would be more useful
221for my current needs, but I'm not in any rush, so I don't expect to find
222an answer anytime soon.
196223
197With my current life demands, I am not programming at the moment and have not
198explored the best terminal set-up for programming. However, I have seen many
199peers find success configuring `vim` and `emacs`, so that's where I will start
200when I pick my projects back up.
224With my current life demands, I am not programming at the moment and
225have not explored the best terminal set-up for programming. However, I
226have seen many peers find success configuring =vim= and =emacs=, so
227that's where I will start when I pick my projects back up.
201228
202![nano](https://img.cleberg.net/blog/20220616-terminal-lifestyle/nano.png)
229#+caption: nano
230[[https://img.cleberg.net/blog/20220616-terminal-lifestyle/nano.png]]
blog/2022-06-22-daily-poetry.org +140 −114
@@ -1,71 +1,80 @@
1+++
2date = 2022-06-22
3title = "Daily Plaintext Poetry via Email"
4description = "A quick tutorial showing how to use Python and the PoetryDB API to email daily poetry."
5draft = false
6+++
7
8## Source Code
9
10I don't want to bury the lede here, so if you'd like to see the full source
11code I use to email myself plaintext poems daily, visit the repository:
12[daily-poem](https://git.sr.ht/~cmc/daily-poem/).
13
14## My Daily Dose of Poetry
15
16Most of my programming projects are small, random projects that are made
1#+title: Daily Plaintext Poetry via Email
2#+date: 2022-06-22
3
4** Source Code
5:PROPERTIES:
6:CUSTOM_ID: source-code
7:END:
8I don't want to bury the lede here, so if you'd like to see the full
9source code I use to email myself plaintext poems daily, visit the
10repository: [[https://git.sr.ht/~cmc/daily-poem/][daily-poem]].
11
12** My Daily Dose of Poetry
13:PROPERTIES:
14:CUSTOM_ID: my-daily-dose-of-poetry
15:END:
16Most of my programming projects are small, random projects that are made
1717strictly to fix some small problem I have or enhance my quality of life.
1818
19In this case, I was looking for a simply and easy way to get a daily dose of
20literature or poetry to read in the mornings.
21
22However, I don't want to sign up for a random mailing list on just any website.
23I also don't want to have to work to find the reading content each morning, as I
24know I would simply give up and stop reading daily.
19In this case, I was looking for a simply and easy way to get a daily
20dose of literature or poetry to read in the mornings.
2521
26Thus, I found a way to deliver poetry to myself in plain-text format, on a daily
27basis, and scheduled to deliver automatically.
22However, I don't want to sign up for a random mailing list on just any
23website. I also don't want to have to work to find the reading content
24each morning, as I know I would simply give up and stop reading daily.
2825
29## Prerequisites
26Thus, I found a way to deliver poetry to myself in plain-text format, on
27a daily basis, and scheduled to deliver automatically.
3028
31This solution uses Python and email, so the following process requires the
32following to be installed:
29** Prerequisites
30:PROPERTIES:
31:CUSTOM_ID: prerequisites
32:END:
33This solution uses Python and email, so the following process requires
34the following to be installed:
3335
341. An SMTP server, which can be as easy as installing `mailutils` if you're on
35a Debian-based distro.
361. An SMTP server, which can be as easy as installing =mailutils= if
37 you're on a Debian-based distro.
36382. Python (& pip!)
373. The following Python packages: `email`, `smtplib`, `json`, and `requests`
38
39## Breaking Down the Logic
40
41I want to break down the logic for this program, as it's quite simple and
42informational.
43
44### Required Packages
45
46This program starts with a simple import of the required packages, so I wanted
47to explain why each package is used:
48
49```py
393. The following Python packages: =email=, =smtplib=, =json=, and
40 =requests=
41
42** Breaking Down the Logic
43:PROPERTIES:
44:CUSTOM_ID: breaking-down-the-logic
45:END:
46I want to break down the logic for this program, as it's quite simple
47and informational.
48
49*** Required Packages
50:PROPERTIES:
51:CUSTOM_ID: required-packages
52:END:
53This program starts with a simple import of the required packages, so I
54wanted to explain why each package is used:
55
56#+begin_src py
5057from email.mime.text import MIMEText # Required for translating MIMEText
5158import smtplib # Required to process the SMTP mail delivery
5259import json # Required to parse the poetry API results
5360import requests # Required to send out a request to the API
54```
55
56### Sending the API Request
61#+end_src
5762
58Next, we need to actually send the API request. In my case, I'm calling a random
59poem from the entire API. If you want, you can call specific poems or authors
60from this API.
63*** Sending the API Request
64:PROPERTIES:
65:CUSTOM_ID: sending-the-api-request
66:END:
67Next, we need to actually send the API request. In my case, I'm calling
68a random poem from the entire API. If you want, you can call specific
69poems or authors from this API.
6170
62```py
71#+begin_src py
6372json_data = requests.get('https://poetrydb.org/random').json()
64```
73#+end_src
6574
6675This gives us the following result in JSON:
6776
68```json
77#+begin_src json
6978[
7079 {
7180 "title": "Sonnet XXII: With Fools and Children",
@@ -91,80 +100,95 @@ This gives us the following result in JSON:
91100 "linecount": "15"
92101 }
93102]
94```
95
96### Parsing the API Results
97
98In order to parse this into a readable format, we need to use the `json` package
99and extract the fields we want. In the example below, I am grabbing every field
100presented by the API.
101
102For the actual poem content, we need to loop over each line in the `lines`
103variable since each line is a separate string by default.
104
105> You *could* also extract the title or author and make another call out to the
106> API to avoid having to build the plaintext poem with a loop, but it just
107> doesn't make sense to me to send multiple requests when we can create a simple
108> loop on our local machine to work with the data we already have.
109>
110> For
111> [example](https://poetrydb.org/title/Sonnet%20XXII:%20With%20Fools%20and%20Children/lines.text),
112> look at the raw data response of this link to see the poem's lines returned
113> in plaintext.
114
115```py
103#+end_src
104
105*** Parsing the API Results
106:PROPERTIES:
107:CUSTOM_ID: parsing-the-api-results
108:END:
109In order to parse this into a readable format, we need to use the =json=
110package and extract the fields we want. In the example below, I am
111grabbing every field presented by the API.
112
113For the actual poem content, we need to loop over each line in the
114=lines= variable since each line is a separate string by default.
115
116#+begin_quote
117You /could/ also extract the title or author and make another call out
118to the API to avoid having to build the plaintext poem with a loop, but
119it just doesn't make sense to me to send multiple requests when we can
120create a simple loop on our local machine to work with the data we
121already have.
122
123For
124[[https://poetrydb.org/title/Sonnet%20XXII:%20With%20Fools%20and%20Children/lines.text][example]],
125look at the raw data response of this link to see the poem's lines
126returned in plaintext.
127
128#+end_quote
129
130#+begin_src py
116131title = json_data[0]['title']
117132author = json_data[0]['author']
118133line_count = json_data[0]['linecount']
119134lines = ''
120135for line in json_data[0]['lines']:
121136 lines = lines + line + "\n"
122```
123
124### Composing the Email
137#+end_src
125138
126Now that I have all the data I need, I just need to compose it into a message
127and prepare the message metadata.
139*** Composing the Email
140:PROPERTIES:
141:CUSTOM_ID: composing-the-email
142:END:
143Now that I have all the data I need, I just need to compose it into a
144message and prepare the message metadata.
128145
129For my daily email, I want to see the title of the poem first, followed by the
130author, then a blank line, and finally the full poem. This code snippet combines
131that data and packages it into a MIMEText container, ready to be emailed.
146For my daily email, I want to see the title of the poem first, followed
147by the author, then a blank line, and finally the full poem. This code
148snippet combines that data and packages it into a MIMEText container,
149ready to be emailed.
132150
133```py
151#+begin_src py
134152msg_body = title + "\n" + author + "\n\n" + lines
135153msg = MIMEText(msg_body)
136```
154#+end_src
137155
138Before we send the email, we need to prepare the metadata (subject, from, to,
139etc.):
156Before we send the email, we need to prepare the metadata (subject,
157from, to, etc.):
140158
141```py
159#+begin_src py
142160sender_email = 'example@server.local'
143161recipient_emails = ['user@example.com']
144162msg['Subject'] = 'Your Daily Poem (' + line_count + ' lines)'
145163msg['From'] = sender_email
146164msg['To'] = recipient_email
147```
148
149### Sending the Email
150
151Now that I have everything ready to be emailed, the last step is to simply
152connect to an SMTP server and send the email out to the recipients. In my case,
153I installed `mailutils` on Ubuntu and let my SMTP server be `localhost`.
154
155```py
165#+end_src
166
167*** Sending the Email
168:PROPERTIES:
169:CUSTOM_ID: sending-the-email
170:END:
171Now that I have everything ready to be emailed, the last step is to
172simply connect to an SMTP server and send the email out to the
173recipients. In my case, I installed =mailutils= on Ubuntu and let my
174SMTP server be =localhost=.
175
176#+begin_src py
156177smtp_server = 'localhost'
157178s = smtplib.SMTP(smtp_server)
158179s.sendmail(sender_email, recipient_emails, msg.as_string())
159180s.quit()
160```
181#+end_src
161182
162## The Result!
183** The Result!
184:PROPERTIES:
185:CUSTOM_ID: the-result
186:END:
187Instead of including a screenshot, I've copied the contents of the email
188that was delivered to my inbox below since I set this process up in
189plaintext format.
163190
164Instead of including a screenshot, I've copied the contents of the email that
165was delivered to my inbox below since I set this process up in plaintext format.
166
167```txt
191#+begin_src txt
168192Date: Wed, 22 Jun 2022 14:37:19 +0000 (UTC)
169193From: REDACTED
170194To: REDACTED
@@ -190,24 +214,26 @@ You that behold us, laugh us not to scorn;
190214Give Nature thanks you are not such as we.
191215Yet fools and children sometimes tell in play
192216Some, wise in show, more fools indeed than they.
193```
194
195## Scheduling the Daily Email
217#+end_src
196218
197Last, but not least, is scheduling this Python script with `crontab`. To
198schedule a script to run daily, you can add it to the `crontab` file. To do
199this, open `crontab` in editing mode:
219** Scheduling the Daily Email
220:PROPERTIES:
221:CUSTOM_ID: scheduling-the-daily-email
222:END:
223Last, but not least, is scheduling this Python script with =crontab=. To
224schedule a script to run daily, you can add it to the =crontab= file. To
225do this, open =crontab= in editing mode:
200226
201```sh
227#+begin_src sh
202228crontab -e
203```
229#+end_src
204230
205In the file, simply paste the following snippet at the bottom of the file and
206ensure that the file path is correctly pointing to wherever you saved your
207Python script:
231In the file, simply paste the following snippet at the bottom of the
232file and ensure that the file path is correctly pointing to wherever you
233saved your Python script:
208234
209```config
235#+begin_src config
2102360 8 * * * python3 /home/<your_user>/dailypoem/main.py
211```
237#+end_src
212238
213239We have now set up the script and scheduled it to run daily at 08:00!
blog/2022-06-24-fedora-i3.org +118 −101
@@ -1,78 +1,86 @@
1+++
2date = 2022-06-24
3title = "Rebooting My Love Affair with Linux"
4description = "A quick recap on my migration from macOS to Fedora i3."
5draft = false
6+++
7
8## Leaving macOS
9
10As I noted [in a recent post](/blog/foss-macos-apps), I have been planning on
11migrating from macOS back to a Linux-based OS. I am happy to say that I have
12finally completed my migration and am now stuck in the wonderful world of Linux
13again.
14
15My decision to leave macOS really came down to just a few important things:
16
17- Apple Security (Gatekeeper) restricting me from running any software I want.
18Even if you disable Gatekeeper and allow software to bypass the rest of the
19device installation security, you still have to repeat that process every time
20the allowed software is updated.
21- macOS sends out nearly constant connections, pings, telemetry, etc. to a
22myriad of mysterious Apple services. I'm not even going to dive into how many
23macOS apps have constant telemetry on, as well.
24- Lastly, I just *really* missed the customization and freedom that comes with
25Linux. Being able to switch to entirely new kernel, OS, or desktop within
26minutes is a freedom I took for granted when I switched to macOS.
27
28Now that I've covered macOS, I'm going to move on to more exciting topics: my
29personal choice of OS, DE, and various customizations I'm using.
30
31## Fedora
32
33After trying a ton of distros (I think I booted and tested around 20-25
34distros), I finally landed on [Fedora Linux](https://getfedora.org/). I have
35quite a bit of experience with Fedora and enjoy the `dnf` package manager.
36Fedora allows me to keep up-to-date with recent software (I'm looking at you,
37Debian), but still provides a level of stability you don't find in every distro.
38
39In a very close second place was Arch Linux, as well as its spin-off: Garuda
40Linux (Garuda w/ sway is *beautiful*). Arch is great for compatibility and the
41massive community it has, but I have just never had the time to properly sit
42down and learn the methodology behind their packaging systems.
43
44Basically, everything else I tested was unacceptable in at least one way or
45another.
46Void (`glibc`) was great, but doesn't support all the software I need.
47Slackware worked well as a tui, but I wasn't skilled enough to get a tiling
48window manager (WM) working on it.
49
50### i3
51
52One of the reasons I settled on Fedora is that it comes with an official i3
53spin. Being able to use a tiling WM, such as i3 or sway, is one of the biggest
54things I wanted to do as soon as I adopted Linux again.
55
56I will probably set up a dotfile repository soon, so that I don't lose any
57of my configurations, but nothing big has been configured thus far.
58
59The two main things I have updated in i3wm are natural scrolling and binding my
60brightness keys to the `brightnessctl` program.
61
62#### Natural Scrolling
63
1#+title: Rebooting My Love Affair with Linux
2#+date: 2022-06-24
3
4** Leaving macOS
5:PROPERTIES:
6:CUSTOM_ID: leaving-macos
7:END:
8As I noted [[/blog/foss-macos-apps][in a recent post]], I have been
9planning on migrating from macOS back to a Linux-based OS. I am happy to
10say that I have finally completed my migration and am now stuck in the
11wonderful world of Linux again.
12
13My decision to leave macOS really came down to just a few important
14things:
15
16- Apple Security (Gatekeeper) restricting me from running any software I
17 want. Even if you disable Gatekeeper and allow software to bypass the
18 rest of the device installation security, you still have to repeat
19 that process every time the allowed software is updated.
20- macOS sends out nearly constant connections, pings, telemetry, etc. to
21 a myriad of mysterious Apple services. I'm not even going to dive into
22 how many macOS apps have constant telemetry on, as well.
23- Lastly, I just /really/ missed the customization and freedom that
24 comes with Linux. Being able to switch to entirely new kernel, OS, or
25 desktop within minutes is a freedom I took for granted when I switched
26 to macOS.
27
28Now that I've covered macOS, I'm going to move on to more exciting
29topics: my personal choice of OS, DE, and various customizations I'm
30using.
31
32** Fedora
33:PROPERTIES:
34:CUSTOM_ID: fedora
35:END:
36After trying a ton of distros (I think I booted and tested around 20-25
37distros), I finally landed on [[https://getfedora.org/][Fedora Linux]].
38I have quite a bit of experience with Fedora and enjoy the =dnf= package
39manager. Fedora allows me to keep up-to-date with recent software (I'm
40looking at you, Debian), but still provides a level of stability you
41don't find in every distro.
42
43In a very close second place was Arch Linux, as well as its spin-off:
44Garuda Linux (Garuda w/ sway is /beautiful/). Arch is great for
45compatibility and the massive community it has, but I have just never
46had the time to properly sit down and learn the methodology behind their
47packaging systems.
48
49Basically, everything else I tested was unacceptable in at least one way
50or another. Void (=glibc=) was great, but doesn't support all the
51software I need. Slackware worked well as a tui, but I wasn't skilled
52enough to get a tiling window manager (WM) working on it.
53
54*** i3
55:PROPERTIES:
56:CUSTOM_ID: i3
57:END:
58One of the reasons I settled on Fedora is that it comes with an official
59i3 spin. Being able to use a tiling WM, such as i3 or sway, is one of
60the biggest things I wanted to do as soon as I adopted Linux again.
61
62I will probably set up a dotfile repository soon, so that I don't lose
63any of my configurations, but nothing big has been configured thus far.
64
65The two main things I have updated in i3wm are natural scrolling and
66binding my brightness keys to the =brightnessctl= program.
67
68**** Natural Scrolling
69:PROPERTIES:
70:CUSTOM_ID: natural-scrolling
71:END:
6472You can enable natural scrolling by opening the following file:
6573
66```sh
74#+begin_src sh
6775sudo nano /usr/share/X11/xorg.conf.d/40-libinput.conf
68```
76#+end_src
6977
70Within the `40-libinput.conf` file, find the following input sections and enable
71the natural scrolling option.
78Within the =40-libinput.conf= file, find the following input sections
79and enable the natural scrolling option.
7280
73This is the `pointer` section:
81This is the =pointer= section:
7482
75```conf
83#+begin_src conf
7684Section "InputClass"
7785 Identifier "libinput pointer catchall"
7886 MatchIsPointer "on"
@@ -80,11 +88,11 @@ Section "InputClass"
8088 Driver "libinput"
8189 Option "NaturalScrolling" "True"
8290EndSection
83```
91#+end_src
8492
85This is the `touchpad` section:
93This is the =touchpad= section:
8694
87```conf
95#+begin_src conf
8896Section "InputClass"
8997 Identifier "libinput touchpad catchall"
9098 MatchIsTouchpad "on"
@@ -92,44 +100,53 @@ Section "InputClass"
92100 Driver "libinput"
93101 Option "NaturalScrolling" "True"
94102EndSection
95```
103#+end_src
96104
97#### Enabling Brightness Keys
98
99Likewise, enabling brightness key functionality is as simple as binding the keys
100to the `brightnessctl` program.
105**** Enabling Brightness Keys
106:PROPERTIES:
107:CUSTOM_ID: enabling-brightness-keys
108:END:
109Likewise, enabling brightness key functionality is as simple as binding
110the keys to the =brightnessctl= program.
101111
102112To do this, open up your i3 config file. Mine is located here:
103113
104```sh
114#+begin_src sh
105115nano /home/<my-user>/.config/i3/config
106```
116#+end_src
107117
108```conf
118#+begin_src conf
109119# Use brightnessctl to adjust brightness.
110120bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl --min-val=2 -q set 3%-
111121bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl -q set 3%+
112```
113
114#### `polybar`
115
116Instead of using the default `i3status` bar, I have opted to use `polybar`
117instead (as you can also see in the screenshot above).
118
119My config for this menu bar is basically just the default settings with modified
120colors and an added battery block to quickly show me the machine's battery info.
121
122#### `alacritty`
123
124Not much to say on this part yet, as I haven't configured it much, but I
125installed `alacritty` as my default terminal, and I am using `zsh` and the
126shell.
127
128## Software Choices
129
130Again, I'm not going to say much that I haven't said yet in other blog
131posts, so I'll just do a quick rundown of the apps I installed immediately after
132I set up the environment.
122#+end_src
123
124**** =polybar=
125:PROPERTIES:
126:CUSTOM_ID: polybar
127:END:
128Instead of using the default =i3status= bar, I have opted to use
129=polybar= instead (as you can also see in the screenshot above).
130
131My config for this menu bar is basically just the default settings with
132modified colors and an added battery block to quickly show me the
133machine's battery info.
134
135**** =alacritty=
136:PROPERTIES:
137:CUSTOM_ID: alacritty
138:END:
139Not much to say on this part yet, as I haven't configured it much, but I
140installed =alacritty= as my default terminal, and I am using =zsh= and
141the shell.
142
143** Software Choices
144:PROPERTIES:
145:CUSTOM_ID: software-choices
146:END:
147Again, I'm not going to say much that I haven't said yet in other blog
148posts, so I'll just do a quick rundown of the apps I installed
149immediately after I set up the environment.
133150
134151Flatpak Apps:
135152
blog/2022-07-01-git-server.org +357 −305
@@ -1,244 +1,271 @@
1+++
2date = 2022-07-01
3title = "Self-Hosting a Personal Git Server"
4description = "My retrospective on successfully setting up a personal git server at home."
5+++
1#+title: Self-Hosting a Personal Git Server
2#+date: 2022-07-01
63
7## My Approach to Self-Hosting Git
4** My Approach to Self-Hosting Git
5:PROPERTIES:
6:CUSTOM_ID: my-approach-to-self-hosting-git
7:END:
8I have often tried to self-host my Git repositories, but have always
9fallen short when I tried to find a suitable web interface to show on
10the front-end.
811
9I have often tried to self-host my Git repositories, but have always fallen
10short when I tried to find a suitable web interface to show on the front-end.
12After a few years, I have finally found a combination of methods that
13allow me to easily self-host my projects, view them on the web, and
14access them from anywhere.
1115
12After a few years, I have finally found a combination of methods that allow me
13to easily self-host my projects, view them on the web, and access them from
14anywhere.
16Before I dive into the details, I want to state a high-level summary of
17my self-hosted Git approach:
1518
16Before I dive into the details, I want to state a high-level summary of my
17self-hosted Git approach:
18
19- This method uses the `ssh://` (read & write) and `git://` (read-only)
19- This method uses the =ssh://= (read & write) and =git://= (read-only)
2020 protocols for push and pull access.
21 - For the `git://` protocol, I create a `git-daemon-export-ok` file in any
22 repository that I want to be cloneable by anyone.
23 - The web interface I am using (`cgit`) allows simple HTTP cloning by
24 default.
25 I do not disable this setting as I want beginners to be able to
26 clone one of my repositories even if they don't know the proper method.
27- I am not enabling Smart HTTPS for any repositories. Updates to repositories
28 must be pushed via SSH.
29- Beyond the actual repository management, I am using `cgit` for the front-end
30 web interface.
31 - If you use the `scan-path=<path>` configuration in the `cgitrc`
32 configuration file to automatically find repositories, you can't exclude a
33 repository from `cgit` if it's stored within the path that `cgit` reads. To
34 host private repositories, you'd need to set up another directory that `cgit`
35 can't read.
36
37## Assumptions
38
21 - For the =git://= protocol, I create a =git-daemon-export-ok= file in
22 any repository that I want to be cloneable by anyone.
23 - The web interface I am using (=cgit=) allows simple HTTP cloning by
24 default. I do not disable this setting as I want beginners to be
25 able to clone one of my repositories even if they don't know the
26 proper method.
27- I am not enabling Smart HTTPS for any repositories. Updates to
28 repositories must be pushed via SSH.
29- Beyond the actual repository management, I am using =cgit= for the
30 front-end web interface.
31 - If you use the =scan-path=<path>= configuration in the =cgitrc=
32 configuration file to automatically find repositories, you can't
33 exclude a repository from =cgit= if it's stored within the path that
34 =cgit= reads. To host private repositories, you'd need to set up
35 another directory that =cgit= can't read.
36
37** Assumptions
38:PROPERTIES:
39:CUSTOM_ID: assumptions
40:END:
3941For the purposes of this walkthrough, I am assuming you have a URL
40(`git.example.com`) or IP address (`207.84.26.991`) addressed to the server that
41you will be using to host your git repositories.
42
43## Adding a Git User
44
45In order to use the SSH method associated with git, we will need to add a
46user named `git`. If you have used the SSH method for other git hosting sites,
47you are probably used to the following syntax:
48
49```sh
42(=git.example.com=) or IP address (=207.84.26.991=) addressed to the
43server that you will be using to host your git repositories.
44
45** Adding a Git User
46:PROPERTIES:
47:CUSTOM_ID: adding-a-git-user
48:END:
49In order to use the SSH method associated with git, we will need to add
50a user named =git=. If you have used the SSH method for other git
51hosting sites, you are probably used to the following syntax:
52
53#+begin_src sh
5054git clone [user@]server:project.git
51```
55#+end_src
5256
53The syntax above is an `scp`-like syntax for using SSH on the `git` user on the
54server to access your repository.
57The syntax above is an =scp=-like syntax for using SSH on the =git= user
58on the server to access your repository.
5559
56Let's delete any remnants of an old `git` user, if any, and create the new user
57account:
60Let's delete any remnants of an old =git= user, if any, and create the
61new user account:
5862
59```sh
63#+begin_src sh
6064sudo deluser --remove-home git
6165sudo adduser git
62```
66#+end_src
6367
64### Import Your SSH Keys to the Git User
65
66Once the `git` user is created, you will need to copy your public SSH key on
67your local development machine to the `git` user on the server.
68*** Import Your SSH Keys to the Git User
69:PROPERTIES:
70:CUSTOM_ID: import-your-ssh-keys-to-the-git-user
71:END:
72Once the =git= user is created, you will need to copy your public SSH
73key on your local development machine to the =git= user on the server.
6874
6975If you don't have an SSH key yet, create one with this command:
7076
71```sh
77#+begin_src sh
7278ssh-keygen
73```
79#+end_src
7480
75Once you create the key pair, the public should be saved to `~/.ssh/id_rsa.pub`.
81Once you create the key pair, the public should be saved to
82=~/.ssh/id_rsa.pub=.
7683
77If your server still has password-based authentication available, you can copy
78it over to your user's home directory like this:
84If your server still has password-based authentication available, you
85can copy it over to your user's home directory like this:
7986
80```sh
87#+begin_src sh
8188ssh-copy-id git@server
82```
89#+end_src
8390
8491Otherwise, copy it over to any user that you can access.
8592
86```sh
93#+begin_src sh
8794scp ~/.ssh/id_rsa.pub your_user@your_server:
88```
95#+end_src
8996
90Once on the server, you will need to copy the contents into the `git` user's
91`authorized_keys` file:
97Once on the server, you will need to copy the contents into the =git=
98user's =authorized_keys= file:
9299
93```sh
100#+begin_src sh
94101cat id_rsa.pub > /home/git/.ssh/authorized_keys
95```
96
97### (Optional) Disable Password-Based SSH
102#+end_src
98103
99If you want to lock down your server and ensure that no one can authenticate in
100via SSH with a password, you will need to edit your SSH configuration.
104*** (Optional) Disable Password-Based SSH
105:PROPERTIES:
106:CUSTOM_ID: optional-disable-password-based-ssh
107:END:
108If you want to lock down your server and ensure that no one can
109authenticate in via SSH with a password, you will need to edit your SSH
110configuration.
101111
102```sh
112#+begin_src sh
103113sudo nano /etc/ssh/sshd_config
104```
114#+end_src
105115
106Within this file, find the following settings and set them to the values I am
107showing below:
116Within this file, find the following settings and set them to the values
117I am showing below:
108118
109```conf
119#+begin_src conf
110120PermitRootLogin no
111121PasswordAuthentication no
112122AuthenticationMethods publickey
113```
123#+end_src
114124
115You may have other Authentication Methods required in your personal set-up, so
116the key here is just to ensure that `AuthenticationMethods` does not allow
117passwords.
125You may have other Authentication Methods required in your personal
126set-up, so the key here is just to ensure that =AuthenticationMethods=
127does not allow passwords.
118128
119## Setting up the Base Directory
129** Setting up the Base Directory
130:PROPERTIES:
131:CUSTOM_ID: setting-up-the-base-directory
132:END:
133Now that we have set up a =git= user to handle all transport methods, we
134need to set up the directory that we will be using as our base of all
135repositories.
120136
121Now that we have set up a `git` user to handle all transport methods, we need
122to set up the directory that we will be using as our base of all repositories.
137In my case, I am using =/git= as my source folder. To create this folder
138and assign it to the user we created, execute the following commands:
123139
124In my case, I am using `/git` as my source folder. To create this folder and
125assign it to the user we created, execute the following commands:
126
127```sh
140#+begin_src sh
128141sudo mkdir /git
129142sudo chown -R git:git /git
130```
131
132## Creating a Test Repository
143#+end_src
133144
134On your server, switch over to the `git` user in order to start managing git
135files.
145** Creating a Test Repository
146:PROPERTIES:
147:CUSTOM_ID: creating-a-test-repository
148:END:
149On your server, switch over to the =git= user in order to start managing
150git files.
136151
137```sh
152#+begin_src sh
138153su git
139```
154#+end_src
140155
141Once logged-in as the `git` user, go to your base directory and create a test
142repository.
156Once logged-in as the =git= user, go to your base directory and create a
157test repository.
143158
144```sh
159#+begin_src sh
145160cd /git
146161mkdir test.git && cd test.git
147162git init --bare
148```
163#+end_src
149164
150If you want to make this repo viewable/cloneable to the public via the `git://`
151protocol, you need to create a `git-daemon-export-ok` file inside the
152repository.
165If you want to make this repo viewable/cloneable to the public via the
166=git://= protocol, you need to create a =git-daemon-export-ok= file
167inside the repository.
153168
154```sh
169#+begin_src sh
155170touch git-daemon-export-ok
156```
171#+end_src
157172
158## Change the Login Shell for `git`
173** Change the Login Shell for =git=
174:PROPERTIES:
175:CUSTOM_ID: change-the-login-shell-for-git
176:END:
177To make sure that the =git= user is only used for git operations and
178nothing else, you need to change the user's login shell. To do this,
179simply use the =chsh= command:
159180
160To make sure that the `git` user is only used for git operations and nothing
161else, you need to change the user's login shell. To do this, simply use the
162`chsh` command:
163
164```sh
181#+begin_src sh
165182sudo chsh git
166```
183#+end_src
167184
168The interactive prompt will ask which shell you want the `git` user to use. You
169must use the following value:
185The interactive prompt will ask which shell you want the =git= user to
186use. You must use the following value:
170187
171```sh
188#+begin_src sh
172189/usr/bin/git-shell
173```
174
175Once done, no one will be able to SSH to the `git` user or execute commands
176other than the standard git commands.
190#+end_src
177191
178## Opening the Firewall
192Once done, no one will be able to SSH to the =git= user or execute
193commands other than the standard git commands.
179194
180Don't forget to open up ports on the device firewall and network firewall if
181you want to access these repositories publicly. If you're using default ports,
182forward ports `22` (ssh) and `9418` (git) from your router to your server's IP
183address.
195** Opening the Firewall
196:PROPERTIES:
197:CUSTOM_ID: opening-the-firewall
198:END:
199Don't forget to open up ports on the device firewall and network
200firewall if you want to access these repositories publicly. If you're
201using default ports, forward ports =22= (ssh) and =9418= (git) from your
202router to your server's IP address.
184203
185If your server also has a firewall, ensure that the firewall allows the same
186ports that are forwarded from the router. For example, if you use `ufw`:
204If your server also has a firewall, ensure that the firewall allows the
205same ports that are forwarded from the router. For example, if you use
206=ufw=:
187207
188```sh
208#+begin_src sh
189209sudo ufw allow 22
190210sudo ufw allow 9418
191```
192
193### Non-Standard SSH Ports
211#+end_src
194212
195If you use a non-standard port for SSH, such as `9876`, you will need to create
196an SSH configuration file on your local development machine in order to connect
197to your server's git repositories.
213*** Non-Standard SSH Ports
214:PROPERTIES:
215:CUSTOM_ID: non-standard-ssh-ports
216:END:
217If you use a non-standard port for SSH, such as =9876=, you will need to
218create an SSH configuration file on your local development machine in
219order to connect to your server's git repositories.
198220
199To do this, you'll need to define your custom port on your client machine in
200your `~/.ssh/config` file:
221To do this, you'll need to define your custom port on your client
222machine in your =~/.ssh/config= file:
201223
202```sh
224#+begin_src sh
203225nano ~/.ssh/config
204```
226#+end_src
205227
206```conf
228#+begin_src conf
207229Host git.example.com
208230 # HostName can be a URL or an IP address
209231 HostName git.example.com
210232 Port 9876
211233 User git
212```
213
214### Testing SSH
234#+end_src
215235
236*** Testing SSH
237:PROPERTIES:
238:CUSTOM_ID: testing-ssh
239:END:
216240There are two main syntaxes you can use to manage git over SSH:
217241
218- `git clone [user@]server:project.git`
219- `git clone ssh://[user@]server/project.git`
242- =git clone [user@]server:project.git=
243- =git clone ssh://[user@]server/project.git=
220244
221I prefer the first, which is an `scp`-like syntax. To test it, try to clone the
222test repository you set up on the server:
245I prefer the first, which is an =scp=-like syntax. To test it, try to
246clone the test repository you set up on the server:
223247
224```sh
248#+begin_src sh
225249git clone git@git.example.com:/git/test.git
226```
227
228## Enabling Read-Only Access
250#+end_src
229251
230If you want people to be able to clone any repository where you've placed a
231`git-daemon-export-ok` file, you will need to start the git daemon.
252** Enabling Read-Only Access
253:PROPERTIES:
254:CUSTOM_ID: enabling-read-only-access
255:END:
256If you want people to be able to clone any repository where you've
257placed a =git-daemon-export-ok= file, you will need to start the git
258daemon.
232259
233To do this on a system with `systemd`, create a service file:
260To do this on a system with =systemd=, create a service file:
234261
235```sh
262#+begin_src sh
236263sudo nano /etc/systemd/system/git-daemon.service
237```
264#+end_src
238265
239Inside the `git-daemon.service` file, paste the following:
266Inside the =git-daemon.service= file, paste the following:
240267
241```conf
268#+begin_src conf
242269[Unit]
243270Description=Start Git Daemon
244271
@@ -257,72 +284,79 @@ Group=git
257284
258285[Install]
259286WantedBy=multi-user.target
260```
287#+end_src
261288
262289Once created, enable and start the service:
263290
264```sh
291#+begin_src sh
265292sudo systemctl enable git-daemon.service
266293sudo systemctl start git-daemon.service
267```
294#+end_src
268295
269To clone read-only via the `git://` protocol, you can use the following syntax:
296To clone read-only via the =git://= protocol, you can use the following
297syntax:
270298
271```sh
299#+begin_src sh
272300git clone git://git.example.com/test.git
273```
274
275## Migrating Repositories
301#+end_src
276302
303** Migrating Repositories
304:PROPERTIES:
305:CUSTOM_ID: migrating-repositories
306:END:
277307At this point, we have a working git server that works with both SSH and
278308read-only access.
279309
280For each of the repositories I had hosted a different provider, I executed the
281following commands in order to place a copy on my server as my new source of
282truth:
310For each of the repositories I had hosted a different provider, I
311executed the following commands in order to place a copy on my server as
312my new source of truth:
283313
284314Server:
285315
286```sh
316#+begin_src sh
287317su git
288318mkdir /git/<REPOSITORY_NAME>.git && cd /git/<REPOSITORY_NAME>.git
289319git init --bare
290320
291321# If you want to make this repo viewable/cloneable to the public
292322touch git-daemon-export-ok
293```
323#+end_src
294324
295325Client:
296326
297```sh
327#+begin_src sh
298328git clone git@<PREVIOUS_HOST>:<REPOSITORY_NAME>
299329git remote set-url origin git@git.EXAMPLE.COM:/git/<REPOSITORY_NAME>.git
300330git push
301```
302
303## Optional Web View: `cgit`
304
305If you want a web viewer for your repositories, you can use various tools, such
306as `gitweb`, `cgit`, or `klaus`. I chose `cgit` due to its simple interface and
307fairly easy set-up (compared to others). Not to mention that the
308[Linux kernel uses `cgit`](https://git.kernel.org/).
309
310### Docker Compose
311
312Instead of using my previous method of using a `docker run` command, I've
313updated this section to use `docker-compose` instead for an easier installation
314and simpler management and configuration.
315
316In order to use Docker Compose, you will set up a `docker-compose.yml` file to
317automatically connect resources like the repositories, `cgitrc`, and various
318files or folders to the `cgit` container you're creating:
319
320```sh
331#+end_src
332
333** Optional Web View: =cgit=
334:PROPERTIES:
335:CUSTOM_ID: optional-web-view-cgit
336:END:
337If you want a web viewer for your repositories, you can use various
338tools, such as =gitweb=, =cgit=, or =klaus=. I chose =cgit= due to its
339simple interface and fairly easy set-up (compared to others). Not to
340mention that the [[https://git.kernel.org/][Linux kernel uses =cgit=]].
341
342*** Docker Compose
343:PROPERTIES:
344:CUSTOM_ID: docker-compose
345:END:
346Instead of using my previous method of using a =docker run= command,
347I've updated this section to use =docker-compose= instead for an easier
348installation and simpler management and configuration.
349
350In order to use Docker Compose, you will set up a =docker-compose.yml=
351file to automatically connect resources like the repositories, =cgitrc=,
352and various files or folders to the =cgit= container you're creating:
353
354#+begin_src sh
321355mkdir ~/cgit && cd ~/cgit
322356nano docker-compose.yml
323```
357#+end_src
324358
325```conf
359#+begin_src conf
326360# docker-compose.yml
327361version: '3'
328362
@@ -338,39 +372,41 @@ services:
338372 ports:
339373 - "8763:80"
340374 restart: always
341```
375#+end_src
342376
343377Then, just start the container:
344378
345```sh
379#+begin_src sh
346380sudo docker-compose up -d
347```
348
349Once it's finished installing, you can access the site at `<SERVER_IP>:8763` or
350use a reverse-proxy service to forward `cgit` to a URL, such as
351`git.example.com`. See the next section for more details on reverse proxying a
352URL to a local port.
353
354### Nginx Reverse Proxy
355
356I am using Nginx as my reverse proxy so that the `cgit` Docker container can use
357`git.example.com` as its URL. To do so, I simply created the following
358configuration file:
359
360```sh
381#+end_src
382
383Once it's finished installing, you can access the site at
384=<SERVER_IP>:8763= or use a reverse-proxy service to forward =cgit= to a
385URL, such as =git.example.com=. See the next section for more details on
386reverse proxying a URL to a local port.
387
388*** Nginx Reverse Proxy
389:PROPERTIES:
390:CUSTOM_ID: nginx-reverse-proxy
391:END:
392I am using Nginx as my reverse proxy so that the =cgit= Docker container
393can use =git.example.com= as its URL. To do so, I simply created the
394following configuration file:
395
396#+begin_src sh
361397sudo nano /etc/nginx/sites-available/git.example.com
362```
398#+end_src
363399
364```conf
400#+begin_src conf
365401server {
366402 listen 80;
367 server_name git.example.com;
403 server_name git.example.com;
368404
369 if ($host = git.example.com) {
370 return 301 https://$host$request_uri;
371 }
405 if ($host = git.example.com) {
406 return 301 https://$host$request_uri;
407 }
372408
373 return 404;
409 return 404;
374410}
375411
376412server {
@@ -379,7 +415,7 @@ server {
379415
380416 location / {
381417 # The final `/` is important.
382 proxy_pass http://localhost:8763/;
418 proxy_pass http://localhost:8763/;
383419 add_header X-Frame-Options SAMEORIGIN;
384420 add_header X-XSS-Protection "1; mode=block";
385421 proxy_redirect off;
@@ -395,64 +431,71 @@ server {
395431 include /etc/letsencrypt/options-ssl-nginx.conf;
396432 ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
397433}
398
399```
434#+end_src
400435
401436Once created, symlink it and restart the web server.
402437
403```sh
438#+begin_src sh
404439sudo ln -s /etc/nginx/sites-available/git.example.com /etc/nginx/sites-enabled/
405440sudo systemctl restart nginx.service
406```
407
408As we can see below, my site at `git.example.com` is available and running:
441#+end_src
409442
410### Settings Up Git Details
443As we can see below, my site at =git.example.com= is available and
444running:
411445
412Once you have `cgit` running, you can add some small details, such as repository
413owners and descriptions by editing the following files within each repository.
446*** Settings Up Git Details
447:PROPERTIES:
448:CUSTOM_ID: settings-up-git-details
449:END:
450Once you have =cgit= running, you can add some small details, such as
451repository owners and descriptions by editing the following files within
452each repository.
414453
415Alternatively, you can use the `cgitrc` file to edit these details if you only
416care to edit them for the purpose of seeing them on your website.
454Alternatively, you can use the =cgitrc= file to edit these details if
455you only care to edit them for the purpose of seeing them on your
456website.
417457
418The `description` file within the repository on your server will display the
419description online.
458The =description= file within the repository on your server will display
459the description online.
420460
421```sh
461#+begin_src sh
422462cd /git/example.git
423463nano description
424```
464#+end_src
425465
426You can add a `[gitweb]` block to the `config` file in order to display the
427owner of the repository.
466You can add a =[gitweb]= block to the =config= file in order to display
467the owner of the repository.
428468
429```sh
469#+begin_src sh
430470cd /git/example.git
431471nano config
432```
472#+end_src
433473
434```conf
474#+begin_src conf
435475[gitweb]
436 owner = "YourName"
437```
476 owner = "YourName"
477#+end_src
438478
439Note that you can ignore the configuration within each repository and simply set
440up this information in the `cgitrc` file, if you want to do it that way.
479Note that you can ignore the configuration within each repository and
480simply set up this information in the =cgitrc= file, if you want to do
481it that way.
441482
442### Editing `cgit`
483*** Editing =cgit=
484:PROPERTIES:
485:CUSTOM_ID: editing-cgit
486:END:
487In order to edit certain items within =cgit=, you need to edit the
488=cgitrc= file.
443489
444In order to edit certain items within `cgit`, you need to edit the `cgitrc`
445file.
446
447```sh
490#+begin_src sh
448491nano ~/cgit/cgitrc
449```
492#+end_src
450493
451Below is an example configuration for `cgitrc`.
452You can find all the configuration options within the [configuration manual]
494Below is an example configuration for =cgitrc=. You can find all the
495configuration options within the [configuration manual]
453496(https://git.zx2c4.com/cgit/plain/cgitrc.5.txt).
454497
455```conf
498#+begin_src conf
456499css=/cgit.css
457500logo=/logo.png
458501favicon=/favicon.png
@@ -524,103 +567,112 @@ repo.path=/git/test.git
524567repo.readme=:README.md
525568repo.owner=John Doe
526569repo.desc=An example repository!
527```
528
529### Final Fixes: Syntax Highlighting & README Rendering
570#+end_src
530571
531After completing my initial install and playing around with it for a few days, I
532noticed two issues:
572*** Final Fixes: Syntax Highlighting & README Rendering
573:PROPERTIES:
574:CUSTOM_ID: final-fixes-syntax-highlighting-readme-rendering
575:END:
576After completing my initial install and playing around with it for a few
577days, I noticed two issues:
533578
5341. Syntax highlighting did not work when viewing the source code within a file.
5352. The `about` tab within a repository was not rendered to HTML.
5791. Syntax highlighting did not work when viewing the source code within
580 a file.
5812. The =about= tab within a repository was not rendered to HTML.
536582
537The following process fixes these issues.
538To start, let's go to the `cgit` directory where we were editing our
539configuration file earlier.
583The following process fixes these issues. To start, let's go to the
584=cgit= directory where we were editing our configuration file earlier.
540585
541```sh
586#+begin_src sh
542587cd ~/cgit
543```
588#+end_src
544589
545590In here, create two folders that will hold our syntax files:
546591
547```sh
592#+begin_src sh
548593mkdir filters && mkdir filters/html-converters && cd filters
549```
594#+end_src
550595
551596Next, download the default filters:
552597
553```sh
598#+begin_src sh
554599curl https://git.zx2c4.com/cgit/plain/filters/about-formatting.sh > about-formatting.sh
555600chmod 755 about-formatting.sh
556601curl https://git.zx2c4.com/cgit/plain/filters/syntax-highlighting.py > syntax-highlighting.py
557602chmod 755 syntax-highlighting.py
558```
603#+end_src
559604
560Finally, download the HTML conversion files you need.
561The example below downloads the Markdown converter:
605Finally, download the HTML conversion files you need. The example below
606downloads the Markdown converter:
562607
563```sh
608#+begin_src sh
564609cd html-converters
565610curl https://git.zx2c4.com/cgit/plain/filters/html-converters/md2html > md2html
566611chmod 755 md2html
567```
612#+end_src
568613
569If you need other filters or html-converters found within [the cgit project
570files](https://git.zx2c4.com/cgit/tree/filters), repeat the `curl` and `chmod`
571process above for whichever files you need.
614If you need other filters or html-converters found within
615[[https://git.zx2c4.com/cgit/tree/filters][the cgit project files]],
616repeat the =curl= and =chmod= process above for whichever files you
617need.
572618
573However, formatting will not work quite yet since the Docker cgit container
574we're using doesn't have the formatting package installed. You can install this
575easily by install Python 3+ and the `pygments` package:
619However, formatting will not work quite yet since the Docker cgit
620container we're using doesn't have the formatting package installed. You
621can install this easily by install Python 3+ and the =pygments= package:
576622
577```sh
623#+begin_src sh
578624# Enter the container's command line
579625sudo docker exec -it cgit bash
580```
626#+end_src
581627
582```sh
628#+begin_src sh
583629# Install the necessary packages and then exit
584630yum update -y && \
585631yum upgrade -y && \
586632yum install python3 python3-pip -y && \
587633pip3 install markdown pygments && \
588634exit
589```
635#+end_src
590636
591**You will need to enter the cgit docker container and re-run these `yum`
592commands every time you kill and restart the container!**
637*You will need to enter the cgit docker container and re-run these =yum=
638commands every time you kill and restart the container!*
593639
594If not done already, we need to add the following variables to our
595`cgitrc` file in order for `cgit` to know where our filtering files are:
640If not done already, we need to add the following variables to our
641=cgitrc= file in order for =cgit= to know where our filtering files are:
596642
597```conf
643#+begin_src conf
598644# Highlight source code with python pygments-based highlighter
599645source-filter=/var/www/htdocs/cgit/filters/syntax-highlighting.py
600646
601647# Format markdown, restructuredtext, manpages, text files, and html files
602648# through the right converters
603649about-filter=/var/www/htdocs/cgit/filters/about-formatting.sh
604```
605
606Now you should see that syntax highlighting and README rendering to the `about`
607tab is fixed.
608
609### Theming
610
611I won't go into much detail in this section, but you can fully theme your
612installation of `cgit` since you have access to the `cgit.css` file in your web
613root. This is another file you can add as a volume to the `docker-compose.yml`
614file if you want to edit this without entering the container's command line.
615
616## :warning: Remember to Back Up Your Data!
617
618The last thing to note is that running services on your own equipment means that
619you're assuming a level of risk that exists regarding data loss, catastrophes,
620etc. In order to reduce the impact of any such occurrence, I suggest backing up
621your data regularly.
622
623Backups can be automated via `cron`, by hooking your base directory up to a
624cloud provider, or even setting up hooks to push all repository info to git
625mirrors on other git hosts. Whatever the method, make sure that your data
626doesn't vanish in the event that your drives or servers fail.
650#+end_src
651
652Now you should see that syntax highlighting and README rendering to the
653=about= tab is fixed.
654
655*** Theming
656:PROPERTIES:
657:CUSTOM_ID: theming
658:END:
659I won't go into much detail in this section, but you can fully theme
660your installation of =cgit= since you have access to the =cgit.css= file
661in your web root. This is another file you can add as a volume to the
662=docker-compose.yml= file if you want to edit this without entering the
663container's command line.
664
665** :warning: Remember to Back Up Your Data!
666:PROPERTIES:
667:CUSTOM_ID: warning-remember-to-back-up-your-data
668:END:
669The last thing to note is that running services on your own equipment
670means that you're assuming a level of risk that exists regarding data
671loss, catastrophes, etc. In order to reduce the impact of any such
672occurrence, I suggest backing up your data regularly.
673
674Backups can be automated via =cron=, by hooking your base directory up
675to a cloud provider, or even setting up hooks to push all repository
676info to git mirrors on other git hosts. Whatever the method, make sure
677that your data doesn't vanish in the event that your drives or servers
678fail.
blog/2022-07-14-gnupg.org +220 −197
@@ -1,39 +1,41 @@
1+++
2date = 2022-07-14
3title = "GNU Privacy Guard (GPG)"
4description = "An overview of the GPG encryption program and its uses."
5draft = false
6+++
7
8## The History of GPG
9
10[GNU Privacy Guard](https://gnupg.org/), also known as GnuPG and GPG, is a free
11("free" as in both speech and beer) software that fully implements the OpenPGP
12Message Format documented in [RFC 4880](https://www.rfc-editor.org/rfc/rfc4880).
13
14I won't go in-depth on the full history of the software in this post, but it is
15important to understand that GPG is not the same as PGP (Pretty Good Privacy),
16which is a different implementation of RFC 4880. However, GPG was designed to
17interoperate with PGP.
18
19GPG was originally developed in the late 1990s by [Werner
20Koch](https://en.wikipedia.org/wiki/Werner_Koch) and has historically been
21funded generously by the German government.
22
23Now that we have all the high-level info out of the way, let's dive into the
24different aspects of GPG and its uses.
25
26## Encryption Algorithms
27
28GPG supports a wide range of different encryption algorithms, including
29public-key, cipher, hash, and compression algorithms. The support for these
30algorithms has grown since the adoption of the Libgcrypt library in the 2.x
31versions of GPG.
32
33As you will be able to see below in an example of a full key generation with the
34GPG command line tool, GPG recommends the following algorithms to new users:
35
36```sh
1#+title: GNU Privacy Guard (GPG)
2#+date: 2022-07-14
3
4** The History of GPG
5:PROPERTIES:
6:CUSTOM_ID: the-history-of-gpg
7:END:
8[[https://gnupg.org/][GNU Privacy Guard]], also known as GnuPG and GPG,
9is a free ("free" as in both speech and beer) software that fully
10implements the OpenPGP Message Format documented in
11[[https://www.rfc-editor.org/rfc/rfc4880][RFC 4880]].
12
13I won't go in-depth on the full history of the software in this post,
14but it is important to understand that GPG is not the same as PGP
15(Pretty Good Privacy), which is a different implementation of RFC 4880.
16However, GPG was designed to interoperate with PGP.
17
18GPG was originally developed in the late 1990s by
19[[https://en.wikipedia.org/wiki/Werner_Koch][Werner Koch]] and has
20historically been funded generously by the German government.
21
22Now that we have all the high-level info out of the way, let's dive into
23the different aspects of GPG and its uses.
24
25** Encryption Algorithms
26:PROPERTIES:
27:CUSTOM_ID: encryption-algorithms
28:END:
29GPG supports a wide range of different encryption algorithms, including
30public-key, cipher, hash, and compression algorithms. The support for
31these algorithms has grown since the adoption of the Libgcrypt library
32in the 2.x versions of GPG.
33
34As you will be able to see below in an example of a full key generation
35with the GPG command line tool, GPG recommends the following algorithms
36to new users:
37
38#+begin_src sh
3739Please select what kind of key you want:
3840 (1) RSA and RSA
3941 (2) DSA and Elgamal
@@ -41,80 +43,84 @@ Please select what kind of key you want:
4143 (4) RSA (sign only)
4244 (9) ECC (sign and encrypt) *default*
4345 (10) ECC (sign only)
44```
45
46I am not doing an in-depth explanation here in order to keep the focus on GPG
47and not encryption algorithms. If you want a deep dive into cryptography
48or encryption algorithms, please read my other posts:
49
50- [AES Encryption](/blog/aes-encryption/) (2018)
51- [Cryptography Basics](/blog/cryptography-basics/) (2020)
52
53### Vulnerabilities
54
55As of 2022-07-14, there are a few different vulnerabilities associated with
56GPG or the libraries it uses:
57
58- GPG versions 1.0.2–1.2.3 contains a bug where "as soon as one
59 (GPG-generated) ElGamal signature of an arbitrary message is released, one
60 can recover the signer's private key in less than a second on a PC."
61 ([Source](https://www.di.ens.fr/~pnguyen/pub_Ng04.htm))
62- GPG versions prior to 1.4.2.1 contain a false positive signature
46#+end_src
47
48I am not doing an in-depth explanation here in order to keep the focus
49on GPG and not encryption algorithms. If you want a deep dive into
50cryptography or encryption algorithms, please read my other posts:
51
52- [[/blog/aes-encryption/][AES Encryption]] (2018)
53- [[/blog/cryptography-basics/][Cryptography Basics]] (2020)
54
55*** Vulnerabilities
56:PROPERTIES:
57:CUSTOM_ID: vulnerabilities
58:END:
59As of 2022-07-14, there are a few different vulnerabilities associated
60with GPG or the libraries it uses:
61
62- GPG versions 1.0.2--1.2.3 contains a bug where "as soon as one
63 (GPG-generated) ElGamal signature of an arbitrary message is released,
64 one can recover the signer's private key in less than a second on a
65 PC." ([[https://www.di.ens.fr/~pnguyen/pub_Ng04.htm][Source]])
66- GPG versions prior to 1.4.2.1 contain a false positive signature
6367 verification bug.
64 ([Source](https://lists.gnupg.
65 org/pipermail/gnupg-announce/2006q1/000211.html))
66- GPG versions prior to 1.4.2.2 cannot detect injection of unsigned data.
67 (
68 [Source](https://lists.gnupg.org/pipermail/gnupg-announce/2006q1/000218.html))
69- Libgcrypt, a library used by GPG, contained a bug which enabled full key
70 recovery for RSA-1024 and some RSA-2048 keys.
71 This was resolved in a GPG update in 2017.
72 ([Source](https://lwn.net/Articles/727179/))
73- The [ROCA Vulnerability](https://en.wikipedia.org/wiki/ROCA_vulnerability)
74 affects RSA keys generated by YubiKey 4 tokens.
75 ([Source](https://crocs.fi.
76 muni.cz/_media/public/papers/nemec_roca_ccs17_preprint.pdf))
77- The [SigSpoof Attack](https://en.wikipedia.org/wiki/SigSpoof) allows an
78 attacker to spoof digital signatures.
79 ([Source](https://arstechnica.
80 com/information-technology/2018/06/decades-old-pgp-bug-allowed-hackers-to-spoof-just-about-anyones-signature/))
81- Libgcrypt 1.9.0 contains a severe flaw related to a heap buffer overflow,
82 fixed in Libgcrypt 1.9.1 ([Source](https://web.archive.
83 org/web/20210221012505/https://www.theregister.com/2021/01/29/severe_libgcrypt_bug/))
84
85## Platforms
86
87Originally developed as a command-line program for *nix systems, GPG now has a
88wealth of front-end applications and libraries available for end-users. However,
89the most recommended programs remain the same:
90
91- [GnuPG](https://gnupg.org) for Linux (depending on distro)
92- [Gpg4win](https://gpg4win.org) for Windows
93- [GPGTools](https://gpgtools.org) for macOS
94
95## Creating a Key Pair
96
97In order to create a GPG key pair, a user would first need to install GPG on
98their system. If we're assuming that the user is on Fedora Linux, they would
99execute the following:
100
101```sh
68 ([[https://lists.gnupg.%20org/pipermail/gnupg-announce/2006q1/000211.html][Source]])
69- GPG versions prior to 1.4.2.2 cannot detect injection of unsigned
70 data. (
71 [[https://lists.gnupg.org/pipermail/gnupg-announce/2006q1/000218.html][Source]])
72- Libgcrypt, a library used by GPG, contained a bug which enabled full
73 key recovery for RSA-1024 and some RSA-2048 keys. This was resolved in
74 a GPG update in 2017. ([[https://lwn.net/Articles/727179/][Source]])
75- The [[https://en.wikipedia.org/wiki/ROCA_vulnerability][ROCA
76 Vulnerability]] affects RSA keys generated by YubiKey 4 tokens.
77 ([[https://crocs.fi.%20muni.cz/_media/public/papers/nemec_roca_ccs17_preprint.pdf][Source]])
78- The [[https://en.wikipedia.org/wiki/SigSpoof][SigSpoof Attack]] allows
79 an attacker to spoof digital signatures.
80 ([[https://arstechnica.%20com/information-technology/2018/06/decades-old-pgp-bug-allowed-hackers-to-spoof-just-about-anyones-signature/][Source]])
81- Libgcrypt 1.9.0 contains a severe flaw related to a heap buffer
82 overflow, fixed in Libgcrypt 1.9.1
83 ([[https://web.archive.%20org/web/20210221012505/https://www.theregister.com/2021/01/29/severe_libgcrypt_bug/][Source]])
84
85** Platforms
86:PROPERTIES:
87:CUSTOM_ID: platforms
88:END:
89Originally developed as a command-line program for *nix systems, GPG now
90has a wealth of front-end applications and libraries available for
91end-users. However, the most recommended programs remain the same:
92
93- [[https://gnupg.org][GnuPG]] for Linux (depending on distro)
94- [[https://gpg4win.org][Gpg4win]] for Windows
95- [[https://gpgtools.org][GPGTools]] for macOS
96
97** Creating a Key Pair
98:PROPERTIES:
99:CUSTOM_ID: creating-a-key-pair
100:END:
101In order to create a GPG key pair, a user would first need to install
102GPG on their system. If we're assuming that the user is on Fedora Linux,
103they would execute the following:
104
105#+begin_src sh
102106sudo dnf install gpg
103```
107#+end_src
104108
105Once installed, a user can create a new key pair with the following command(s):
109Once installed, a user can create a new key pair with the following
110command(s):
106111
107```sh
112#+begin_src sh
108113gpg --full-generate-key
109```
114#+end_src
110115
111GPG will walk the user through an interactive setup that asks for an algorithm
112preference, expiration date, name, and email to associate with this key.
116GPG will walk the user through an interactive setup that asks for an
117algorithm preference, expiration date, name, and email to associate with
118this key.
113119
114See the following example key set-up for a default key generation using the
115GnuPG command-line interface:
120See the following example key set-up for a default key generation using
121the GnuPG command-line interface:
116122
117```sh
123#+begin_src sh
118124gpg (GnuPG) 2.3.6; Copyright (C) 2021 Free Software Foundation, Inc.
119125This is free software: you are free to change and redistribute it.
120126There is NO WARRANTY, to the extent permitted by law.
@@ -166,13 +172,15 @@ pub ed25519 2022-07-14 [SC]
166172 E955B7700FFC11EF51C2BA1FE096AACDD4C32E9C
167173uid John Doe (test key) <johndoe@example.com>
168174sub cv25519 2022-07-14 [E]
169```
175#+end_src
170176
171Please note that GUI apps may differ slightly from the GPG command-line
177Please note that GUI apps may differ slightly from the GPG command-line
172178interface.
173179
174## Common Usage
175
180** Common Usage
181:PROPERTIES:
182:CUSTOM_ID: common-usage
183:END:
176184As noted in RFC 4880, the general functions of OpenPGP are as follows:
177185
178186- digital signatures
@@ -181,98 +189,110 @@ As noted in RFC 4880, the general functions of OpenPGP are as follows:
181189- Radix-64 conversion
182190- key management and certificate services
183191
184From this, you can probably gather that the main use of GPG is for encrypting
185data and/or signing the data with a key. The purpose of encrypting data with GPG
186is to ensure that no one except the intended recipient(s) can access the data.
192From this, you can probably gather that the main use of GPG is for
193encrypting data and/or signing the data with a key. The purpose of
194encrypting data with GPG is to ensure that no one except the intended
195recipient(s) can access the data.
187196
188197Let's explore some specific GPG use-cases.
189198
190### Email
191
192One of the more popular uses of GPG is to sign and/or encrypt emails. With the
193use of a GPG keypair, you can encrypt a message, its subject, and even the
194attachments within.
195
196The first process, regarding the signing of a message without any encryption, is
197generally used to provide assurance that an email is truly coming from the
198sender that the message claims. When I send an email, and it's signed with my
199public key, the recipient(s) of the message can verify that the message was
200signed with my personal key.
201
202The second process, regarding the actual encryption of the message and its
203contents, works by using a combination of the sender's keys and the recipient's
204keys. This process may vary slightly by implementation, but it most commonly
205uses asymmetric cryptography, also known as public-key cryptography. In this
206version of encryption, the sender's private key to sign the message and a
207combination of the sender's keys and the recipient's public key to encrypt the
208message.
209
210If two people each have their own private keys and exchange their public keys,
211they can send encrypted messages back and forth with GPG. This is also possible
212with symmetric cryptography, but the process differs since there are no key
213pairs.
214
215Implementation of email encryption varies greatly between email clients, so you
216will need to reference your email client's documentation to ensure you are
217setting it up correctly for that specific client.
218
219### File Encryption
220
221As noted in the section above regarding emails, GPG enables users to be able to
222send a message to each other if they are both set-up with GPG keys.
223In this example, I am going to show how a user could send a file called
224`example_file.txt` to another user via the recipient's email.
225
226The sender would find the file they want to send and execute the following
227command:
228
229```sh
199*** Email
200:PROPERTIES:
201:CUSTOM_ID: email
202:END:
203One of the more popular uses of GPG is to sign and/or encrypt emails.
204With the use of a GPG keypair, you can encrypt a message, its subject,
205and even the attachments within.
206
207The first process, regarding the signing of a message without any
208encryption, is generally used to provide assurance that an email is
209truly coming from the sender that the message claims. When I send an
210email, and it's signed with my public key, the recipient(s) of the
211message can verify that the message was signed with my personal key.
212
213The second process, regarding the actual encryption of the message and
214its contents, works by using a combination of the sender's keys and the
215recipient's keys. This process may vary slightly by implementation, but
216it most commonly uses asymmetric cryptography, also known as public-key
217cryptography. In this version of encryption, the sender's private key to
218sign the message and a combination of the sender's keys and the
219recipient's public key to encrypt the message.
220
221If two people each have their own private keys and exchange their public
222keys, they can send encrypted messages back and forth with GPG. This is
223also possible with symmetric cryptography, but the process differs since
224there are no key pairs.
225
226Implementation of email encryption varies greatly between email clients,
227so you will need to reference your email client's documentation to
228ensure you are setting it up correctly for that specific client.
229
230*** File Encryption
231:PROPERTIES:
232:CUSTOM_ID: file-encryption
233:END:
234As noted in the section above regarding emails, GPG enables users to be
235able to send a message to each other if they are both set-up with GPG
236keys. In this example, I am going to show how a user could send a file
237called =example_file.txt= to another user via the recipient's email.
238
239The sender would find the file they want to send and execute the
240following command:
241
242#+begin_src sh
230243gpg --encrypt --output example_file.txt.gpg --recipient \
231244recipient@example.com example_file.txt
232```
245#+end_src
233246
234Once received, the recipient can decrypt the file with the following command:
247Once received, the recipient can decrypt the file with the following
248command:
235249
236```sh
250#+begin_src sh
237251gpg --decrypt --output example_file.txt example_file.txt.gpg
238```
239
240### Ownership Signatures
241
242One important aspect of GPG, especially for developers, is the ability to sign
243data without encrypting it. For example, developers often sign code changes when
244they commit the changes back to a central repository, in order to display
245ownership of who made the changes. This allows other users to look at a code
246change and determine that the change was valid.
247
248In order to do this using [Git](https://git-scm.com), the developer simply needs
249to alter the `git commit` command to include the `-S` flag. Here's an example:
250
251```sh
252#+end_src
253
254*** Ownership Signatures
255:PROPERTIES:
256:CUSTOM_ID: ownership-signatures
257:END:
258One important aspect of GPG, especially for developers, is the ability
259to sign data without encrypting it. For example, developers often sign
260code changes when they commit the changes back to a central repository,
261in order to display ownership of who made the changes. This allows other
262users to look at a code change and determine that the change was valid.
263
264In order to do this using [[https://git-scm.com][Git]], the developer
265simply needs to alter the =git commit= command to include the =-S= flag.
266Here's an example:
267
268#+begin_src sh
252269git commit -S -m "my commit message"
253```
270#+end_src
254271
255As an expansion of the example above, Git users can configure their environment
256with a default key to use by adding their GPG signature:
272As an expansion of the example above, Git users can configure their
273environment with a default key to use by adding their GPG signature:
257274
258```sh
275#+begin_src sh
259276git config --global user.signingkey XXXXXXXXXXXXXXXX
260```
277#+end_src
261278
262If you're not sure what your signature is, you can find it titled `sig` in the
263output of this command:
279If you're not sure what your signature is, you can find it titled =sig=
280in the output of this command:
264281
265```sh
282#+begin_src sh
266283gpg --list-signatures
267```
268
269### File Integrity
270
271When a person generates a signature for data, they are allowing users the
272ability to verify the signature on that data in the future to ensure the data
273has not been corrupted. This is most common with software applications hosted on
274the internet - developers provide signatures so that users can verify a website
275was not hijacked and download links replaced with dangerous software.
284#+end_src
285
286*** File Integrity
287:PROPERTIES:
288:CUSTOM_ID: file-integrity
289:END:
290When a person generates a signature for data, they are allowing users
291the ability to verify the signature on that data in the future to ensure
292the data has not been corrupted. This is most common with software
293applications hosted on the internet - developers provide signatures so
294that users can verify a website was not hijacked and download links
295replaced with dangerous software.
276296
277297In order to verify signed data, a user needs to have:
278298
@@ -280,26 +300,29 @@ In order to verify signed data, a user needs to have:
2803002. A signature file
2813013. The public GPG key of the signer
282302
283Once the signer's public key is imported on the user's system, and they have
284the data and signature, they can verify the data with the following commands:
303Once the signer's public key is imported on the user's system, and they
304have the data and signature, they can verify the data with the following
305commands:
285306
286```sh
307#+begin_src sh
287308# If the signature is attached to the data
288309gpg --verify [signature-file]
289310
290311# If the signature is detached as a separate file from the data
291312gpg --verify [signature-file] [original-file]
292```
293
294## Finding Public Keys
295
296In order to use GPG with others, a user needs to know the other user(s) keys.
297This is easy to do if the user knows the other user(s) in person, but may be
298hard if the relationship is strictly digital. Luckily, there are a few options.
299The first option is to look at a user's web page or social pages if they have
300them.
313#+end_src
314
315** Finding Public Keys
316:PROPERTIES:
317:CUSTOM_ID: finding-public-keys
318:END:
319In order to use GPG with others, a user needs to know the other user(s)
320keys. This is easy to do if the user knows the other user(s) in person,
321but may be hard if the relationship is strictly digital. Luckily, there
322are a few options. The first option is to look at a user's web page or
323social pages if they have them.
301324
302325Otherwise, the best option is to use a keyserver, such as:
303326
304- [pgp.mit.edu](https://pgp.mit.edu)
305- [keys.openpgp.org](https://keys.openpgp.org)
327- [[https://pgp.mit.edu][pgp.mit.edu]]
328- [[https://keys.openpgp.org][keys.openpgp.org]]
blog/2022-07-25-curseradio.org +94 −79
@@ -1,99 +1,114 @@
1+++
2date = 2022-07-25
3title = "CurseRadio: Listening to the Radio on the Command Line"
4description = "A quick and easy installation for CurseRadio on Fedora Linux."
5+++
6
7## Overview
8
9While exploring some interesting Linux applications, I stumbled across
10[curseradio](https://github.com/chronitis/curseradio), a command-line radio
11player based on Python.
12
13This application is fantastic and incredibly easy to install, so I wanted to
14dedicate a post today to this app. Let's look at the features within the app and
15then walk through the installation process I took to get `curseradio` working.
16
17## Features
18
19![curseradio](https://img.cleberg.net/blog/20220725-curseradio/curseradio.png "curseradio")
20
21The radio player itself is quite minimal. As you can see in the screenshot
22above, it contains a simple plaintext list of all available categories, which
23can be broken down further and further. In addition, radio shows are available
24for listening, alongside regular radio stations.
25
26For example, the `Sports` > `Pro Basketball` > `Shows` category contains a
27number of specific shows related to Professional Basketball.
28
29Aside from being able to play any of the listed stations/shows, you can make
30a channel your favorite by pressing `f`.
31It will now show up at the top of the radio player in the `Favourites` category.
32
33### Commands/Shortcuts
34
35| Key(s) | Command |
36|:----------:|:-------------------------------:|
37| ↑, ↓ | navigate |
38| PgUp, PgDn | navigate quickly |
39| Home, End | to top/bottom |
40| Enter | open/close folders, play stream |
41| k | stop playing stream |
42| q | quit |
43| f | toggle favourite |
44
45## Installation
46
47### Dependencies
48
49Before installing `curseradio`, a handful of system and Python packages are
50required. To get started, install `python3`, `pip3`, and `mpv` on your system.
51In this example, I'm using Fedora Linux, which uses the `dnf` package manager.
52You may need to adjust this if you're using a different system.
53
54```sh
1#+title: CurseRadio: Listening to the Radio on the Command Line
2#+date: 2022-07-25
3
4** Overview
5:PROPERTIES:
6:CUSTOM_ID: overview
7:END:
8While exploring some interesting Linux applications, I stumbled across
9[[https://github.com/chronitis/curseradio][curseradio]], a command-line
10radio player based on Python.
11
12This application is fantastic and incredibly easy to install, so I
13wanted to dedicate a post today to this app. Let's look at the features
14within the app and then walk through the installation process I took to
15get =curseradio= working.
16
17** Features
18:PROPERTIES:
19:CUSTOM_ID: features
20:END:
21#+caption: curseradio
22[[https://img.cleberg.net/blog/20220725-curseradio/curseradio.png]]
23
24The radio player itself is quite minimal. As you can see in the
25screenshot above, it contains a simple plaintext list of all available
26categories, which can be broken down further and further. In addition,
27radio shows are available for listening, alongside regular radio
28stations.
29
30For example, the =Sports= > =Pro Basketball= > =Shows= category contains
31a number of specific shows related to Professional Basketball.
32
33Aside from being able to play any of the listed stations/shows, you can
34make a channel your favorite by pressing =f=. It will now show up at the
35top of the radio player in the =Favourites= category.
36
37*** Commands/Shortcuts
38:PROPERTIES:
39:CUSTOM_ID: commandsshortcuts
40:END:
41| Key(s) | Command |
42|------------+---------------------------------|
43| ↑, ↓ | navigate |
44| PgUp, PgDn | navigate quickly |
45| Home, End | to top/bottom |
46| Enter | open/close folders, play stream |
47| k | stop playing stream |
48| q | quit |
49| f | toggle favourite |
50
51** Installation
52:PROPERTIES:
53:CUSTOM_ID: installation
54:END:
55*** Dependencies
56:PROPERTIES:
57:CUSTOM_ID: dependencies
58:END:
59Before installing =curseradio=, a handful of system and Python packages
60are required. To get started, install =python3=, =pip3=, and =mpv= on
61your system. In this example, I'm using Fedora Linux, which uses the
62=dnf= package manager. You may need to adjust this if you're using a
63different system.
64
65#+begin_src sh
5566sudo dnf install python3 pip3 mpv
56```
67#+end_src
5768
58Next, use `pip3` to install `requests`, `xdg`, and `lxml`:
69Next, use =pip3= to install =requests=, =xdg=, and =lxml=:
5970
60```sh
71#+begin_src sh
6172pip3 install requests xdg lxml
62```
73#+end_src
6374
64### Repository Source Installation
75*** Repository Source Installation
76:PROPERTIES:
77:CUSTOM_ID: repository-source-installation
78:END:
79Once all the dependencies are installed, we can clone the source code
80and enter that directory:
6581
66Once all the dependencies are installed, we can clone the source code and enter
67that directory:
68
69```sh
82#+begin_src sh
7083git clone https://github.com/chronitis/curseradio && cd curseradio
71```
84#+end_src
7285
73Once you're within the `curseradio` directory, you can install the application
74with the provided `setup.py` script.
86Once you're within the =curseradio= directory, you can install the
87application with the provided =setup.py= script.
7588
76```sh
89#+begin_src sh
7790sudo python3 setup.py install
78```
91#+end_src
7992
80In my case, I ran into a few errors and needed to create the folders that
81curseradio wanted to use for its installation. If you don't get any errors, you
82can skip this and run the app.
93In my case, I ran into a few errors and needed to create the folders
94that curseradio wanted to use for its installation. If you don't get any
95errors, you can skip this and run the app.
8396
84```sh
97#+begin_src sh
8598sudo mkdir /usr/local/lib/python3.10/
8699sudo mkdir /usr/local/lib/python3.10/site-packages/
87```
100#+end_src
88101
89```sh
102#+begin_src sh
90103sudo chown -R $USER:$USER /usr/local/lib/python3.10/
91```
92
93## Run the Application
104#+end_src
94105
106** Run the Application
107:PROPERTIES:
108:CUSTOM_ID: run-the-application
109:END:
95110Once fully installed without errors, you can run the application!
96111
97```sh
112#+begin_src sh
98113python3 /usr/local/bin/curseradio
99```
114#+end_src
blog/2022-07-30-flac-to-opus.org +89 −81
@@ -1,67 +1,72 @@
1+++
2date = 2022-07-30
3title = "Recursive Command-Line FLAC to Opus Conversion"
4description = "A retrospective on how I recursively converting my FLAC file music library to OPUS with opusenc."
5+++
6
7## Converting FLAC to OPUS
8
9I am currently rebuilding my music library from scratch so that I can
10effectively archive all the music I own in the [FLAC file
11format](https://en.wikipedia.org/wiki/FLAC), a lossless audio codec.
12
13However, streaming FLAC files outside the home can be difficult due to the
14size of the files, especially if you're using a weak connection.
15
16So, in order to archive the music in a lossless format and still be able to
17stream it easily, I opted to create a copy of my FLAC files in the [Opus audio
18codec](https://en.wikipedia.org/wiki/Opus_(audio_format)). This allows me to
19archive a quality, lossless version of the music and then point my streaming
20service to the smaller, stream-ready version.
21
22### Dependencies
23
24The process I follow utilizes the `opus-tools` package in Ubuntu. Before
1#+title: Recursive Command-Line FLAC to Opus Conversion
2#+date: 2022-07-30
3
4** Converting FLAC to OPUS
5:PROPERTIES:
6:CUSTOM_ID: converting-flac-to-opus
7:END:
8I am currently rebuilding my music library from scratch so that I can
9effectively archive all the music I own in the
10[[https://en.wikipedia.org/wiki/FLAC][FLAC file format]], a lossless
11audio codec.
12
13However, streaming FLAC files outside the home can be difficult due to
14the size of the files, especially if you're using a weak connection.
15
16So, in order to archive the music in a lossless format and still be able
17to stream it easily, I opted to create a copy of my FLAC files in the
18[[https://en.wikipedia.org/wiki/Opus_(audio_format)][Opus audio codec]].
19This allows me to archive a quality, lossless version of the music and
20then point my streaming service to the smaller, stream-ready version.
21
22*** Dependencies
23:PROPERTIES:
24:CUSTOM_ID: dependencies
25:END:
26The process I follow utilizes the =opus-tools= package in Ubuntu. Before
2527proceeding, install the package:
2628
27```sh
29#+begin_src sh
2830sudo apt install opus-tools
29```
31#+end_src
3032
31If you want to use a different conversion method, such as `ffmpeg` or `avconv`,
32simply install that package instead.
33If you want to use a different conversion method, such as =ffmpeg= or
34=avconv=, simply install that package instead.
3335
34### Conversion Process
36*** Conversion Process
37:PROPERTIES:
38:CUSTOM_ID: conversion-process
39:END:
40The script I'm using is stored in my home directory, but feel free to
41create it wherever you want. It does not need to be in the same
42directory as your music files.
3543
36The script I'm using is stored in my home directory, but feel free to create it
37wherever you want. It does not need to be in the same directory as your music
38files.
39
40```sh
44#+begin_src sh
4145cd ~ && nano transform.sh
42```
46#+end_src
4347
44Once you have your new bash script opened in an editor, go ahead and paste the
45following logic into the script.
48Once you have your new bash script opened in an editor, go ahead and
49paste the following logic into the script.
4650
47You **MUST** edit the following variables in order for it to work:
51You *MUST* edit the following variables in order for it to work:
4852
49- `source`: The source directory where your FLAC files are stored.
50- `dest`: The destination directory where you want the resulting Opus files to
51be stored.
53- =source=: The source directory where your FLAC files are stored.
54- =dest=: The destination directory where you want the resulting Opus
55 files to be stored.
5256
53You **MAY** want to edit the following variables to suit your needs:
57You *MAY* want to edit the following variables to suit your needs:
5458
55- `filename`: If you are converting to a file format other than Opus, you'll
56need to edit this so that your resulting files have the correct filename
57extension.
58- `reldir`: This variable can be edited to strip out more leading directories in
59the file path. As you'll see later, I ignore this for now and simply clean it up
60afterward.
61- `opusenc`: This is the actual conversion process. You may want to edit the
62bitrate to suit your needs. I set mine at 128 but some prefer 160 or higher.
59- =filename=: If you are converting to a file format other than Opus,
60 you'll need to edit this so that your resulting files have the correct
61 filename extension.
62- =reldir=: This variable can be edited to strip out more leading
63 directories in the file path. As you'll see later, I ignore this for
64 now and simply clean it up afterward.
65- =opusenc=: This is the actual conversion process. You may want to edit
66 the bitrate to suit your needs. I set mine at 128 but some prefer 160
67 or higher.
6368
64```sh
69#+begin_src sh
6570#!/bin/bash
6671## - The IFS takes care of spaces in file and dirnames
6772## - your folders may vary
@@ -123,52 +128,55 @@ opusenc --vbr --bitrate 128 --date "$DATE" \
123128## just for testing
124129# sleep 1
125130done
126```
131#+end_src
127132
128Once you're done, simply save the file and exit your editor. Don't forget to
129enable execution of the script:
133Once you're done, simply save the file and exit your editor. Don't
134forget to enable execution of the script:
130135
131```sh
136#+begin_src sh
132137chmod +x transform.sh
133```
138#+end_src
134139
135140Finally, you may now run the script:
136141
137```sh
142#+begin_src sh
138143./transform.sh
139```
140
141If you used `opusenc`, you'll see the conversions happen within the terminal as
142it progresses.
143You will also see variables printed if you uncommented any of the bash
144script's comments.
145
146### Cleanup
147
148As I noted above, I didn't customize my `reldir` variable in the script, which
149caused my output directory to be `/mnt/music/library/archives` instead of
150`/mnt/music/library`. So, I moved the output up one level and deleted the
151accidental directory.
152
153```sh
144#+end_src
145
146If you used =opusenc=, you'll see the conversions happen within the
147terminal as it progresses. You will also see variables printed if you
148uncommented any of the bash script's comments.
149
150*** Cleanup
151:PROPERTIES:
152:CUSTOM_ID: cleanup
153:END:
154As I noted above, I didn't customize my =reldir= variable in the script,
155which caused my output directory to be =/mnt/music/library/archives=
156instead of =/mnt/music/library=. So, I moved the output up one level and
157deleted the accidental directory.
158
159#+begin_src sh
154160cd /mnt/music/library
155161mv archives/* .
156162rm -rf archives
157```
158
159### Check the Resulting Size
163#+end_src
160164
161If you want to see what kind of file size savings you've gained, you can always
162use the `du` command to check:
165*** Check the Resulting Size
166:PROPERTIES:
167:CUSTOM_ID: check-the-resulting-size
168:END:
169If you want to see what kind of file size savings you've gained, you can
170always use the =du= command to check:
163171
164```sh
172#+begin_src sh
165173cd /mnt/music
166174du -h --max-depth=1 .
167```
175#+end_src
168176
169177In my case, my small library went from 78GB to 6.3GB!
170178
171```txt
179#+begin_src txt
17218078G ./archives
1731816.3G ./library
174```
182#+end_src
blog/2022-07-31-bash-it.org +161 −140
@@ -1,116 +1,126 @@
1+++
2date = 2022-07-31
3title = "Upgrade Bash with Bash-It & Ble.sh"
4description = "In this post, I walk through the Bash-It and Ble.sh projects, their features, and how they help users power-up their bash shell."
5+++
6
7## Bash
8
9For those who are not familiar,
10[Bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell)) is a Unix shell that is
11used as the default login shell for most Linux distributions. This shell and
12command processor should be familiar if you've used Linux (or older version of
13macOS) before.
14
15However, bash is not the only option.
16There are numerous other shells that exist.
17Here are some popular examples:
18
19- [zsh](https://en.wikipedia.org/wiki/Z_shell)
20- [fish](https://en.wikipedia.org/wiki/Fish_(Unix_shell))
21- [oksh](https://github.com/ibara/oksh)
22- [mksh](https://wiki.gentoo.org/wiki/Mksh)
23- [dash](https://en.wikipedia.org/wiki/Debian_Almquist_shell)
24
25While each shell has its differences, bash is POSIX compliant and the default
26for many Linux users. Because of this, I am going to explore a program called
27`bash-it` below that helps bash users increase the utility of their shell
28without installing a completely new shell.
29
30### Installation
31
32First, if bash is not already installed on your system, you can [download bash
33from GNU](https://www.gnu.org/software/bash/) or use your package manager to
34install it.
1#+title: Upgrade Bash with Bash-It & Ble.sh
2#+date: 2022-07-31
3
4** Bash
5:PROPERTIES:
6:CUSTOM_ID: bash
7:END:
8For those who are not familiar,
9[[https://en.wikipedia.org/wiki/Bash_(Unix_shell)][Bash]] is a Unix
10shell that is used as the default login shell for most Linux
11distributions. This shell and command processor should be familiar if
12you've used Linux (or older version of macOS) before.
13
14However, bash is not the only option. There are numerous other shells
15that exist. Here are some popular examples:
16
17- [[https://en.wikipedia.org/wiki/Z_shell][zsh]]
18- [[https://en.wikipedia.org/wiki/Fish_(Unix_shell)][fish]]
19- [[https://github.com/ibara/oksh][oksh]]
20- [[https://wiki.gentoo.org/wiki/Mksh][mksh]]
21- [[https://en.wikipedia.org/wiki/Debian_Almquist_shell][dash]]
22
23While each shell has its differences, bash is POSIX compliant and the
24default for many Linux users. Because of this, I am going to explore a
25program called =bash-it= below that helps bash users increase the
26utility of their shell without installing a completely new shell.
27
28*** Installation
29:PROPERTIES:
30:CUSTOM_ID: installation
31:END:
32First, if bash is not already installed on your system, you can
33[[https://www.gnu.org/software/bash/][download bash from GNU]] or use
34your package manager to install it.
3535
3636For example, this is how you can install bash on Fedora Linux:
3737
38```sh
38#+begin_src sh
3939sudo dnf install bash
40```
40#+end_src
4141
42If you are not using bash as your default shell, use the `chsh` command to
43change your shell:
42If you are not using bash as your default shell, use the =chsh= command
43to change your shell:
4444
45```sh
45#+begin_src sh
4646chsh
47```
47#+end_src
4848
49You should see a prompt like the one below. If the brackets (`[]`) contain
50`bash` already, you're done, and you can simply continue by hitting the Enter
51key.
49You should see a prompt like the one below. If the brackets (=[]=)
50contain =bash= already, you're done, and you can simply continue by
51hitting the Enter key.
5252
53If the brackets contain another shell path (e.g. `/usr/bin/zsh`), enter the path
54to the bash program on your system (it's most likely located at
55`/usr/bin/bash`).
53If the brackets contain another shell path (e.g. =/usr/bin/zsh=), enter
54the path to the bash program on your system (it's most likely located at
55=/usr/bin/bash=).
5656
57```sh
57#+begin_src sh
5858Changing shell for <user>.
5959New shell [/usr/bin/bash]:
60```
60#+end_src
6161
62You must log out or restart the machine in order for the login shell to be
63refreshed. You can do it now or wait until you're finished customizing the
64shell.
62You must log out or restart the machine in order for the login shell to
63be refreshed. You can do it now or wait until you're finished
64customizing the shell.
6565
66```sh
66#+begin_src sh
6767sudo reboot now
68```
68#+end_src
6969
70## Bash-it
70** Bash-it
71:PROPERTIES:
72:CUSTOM_ID: bash-it
73:END:
74As noted on the [[https://github.com/Bash-it/bash-it][Bash-it]]
75repository:
7176
72As noted on the [Bash-it](https://github.com/Bash-it/bash-it) repository:
77#+begin_quote
78Bash-it is a collection of community Bash commands and scripts for Bash
793.2+. (And a shameless ripoff of oh-my-zsh 😃)
7380
74> Bash-it is a collection of community Bash commands and scripts for Bash 3.2+.
75> (And a shameless ripoff of oh-my-zsh 😃)
81#+end_quote
7682
77Bash-it makes it easy to install plugins, set up aliases for common commands,
78and easily change the visual theme of your shell.
83Bash-it makes it easy to install plugins, set up aliases for common
84commands, and easily change the visual theme of your shell.
7985
80### Installation
86*** Installation
87:PROPERTIES:
88:CUSTOM_ID: installation-1
89:END:
90To install the framework, simply copy the repository files and use the
91=install.sh= script provided. If you want, you can (and should!) inspect
92the contents of the installation script before you run it.
8193
82To install the framework, simply copy the repository files and use the
83`install.sh` script provided. If you want, you can (and should!) inspect the
84contents of the installation script before you run it.
85
86```sh
94#+begin_src sh
8795git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it
8896~/.bash_it/install.sh
89```
97#+end_src
9098
91If you didn't restart your session after making bash the default, and are
92currently working within another shell, be sure to enter a bash session before
93using `bash-it`:
99If you didn't restart your session after making bash the default, and
100are currently working within another shell, be sure to enter a bash
101session before using =bash-it=:
94102
95```sh
103#+begin_src sh
96104bash
97```
98
99### Aliases
105#+end_src
100106
101Bash-it contains a number of aliases for common commands to help improve
102efficiency in the terminal. To list all available options, use the following
103command:
107*** Aliases
108:PROPERTIES:
109:CUSTOM_ID: aliases
110:END:
111Bash-it contains a number of aliases for common commands to help improve
112efficiency in the terminal. To list all available options, use the
113following command:
104114
105```sh
115#+begin_src sh
106116bash-it show aliases
107```
117#+end_src
108118
109119This will provide you a list that looks like the following text block.
110Within this screen, you will be able to see all available options and which
111ones are currently enabled.
120Within this screen, you will be able to see all available options and
121which ones are currently enabled.
112122
113```txt
123#+begin_src txt
114124Alias Enabled? Description
115125ag [ ] the silver searcher (ag) aliases
116126ansible [ ] ansible abbreviations
@@ -123,32 +133,35 @@ clipboard [ ] xclip shortcuts
123133composer [ ] common composer abbreviations
124134curl [x] Curl aliases for convenience.
125135...
126```
136#+end_src
127137
128138To enable an alias, do:
129139
130```sh
140#+begin_src sh
131141bash-it enable alias <alias name> [alias name]... -or- $ bash-it enable alias all
132```
142#+end_src
133143
134144To disable an alias, do:
135145
136```sh
146#+begin_src sh
137147bash-it disable alias <alias name> [alias name]... -or- $ bash-it disable alias all
138```
148#+end_src
139149
140### Plugins
150*** Plugins
151:PROPERTIES:
152:CUSTOM_ID: plugins
153:END:
154Similar to aliases, plugins are available with bash-it. You can find a
155complete list of plugins in the same way as aliases. Simply execute the
156following:
141157
142Similar to aliases, plugins are available with bash-it. You can find a complete
143list of plugins in the same way as aliases. Simply execute the following:
144
145```sh
158#+begin_src sh
146159bash-it show plugins
147```
160#+end_src
148161
149162You will see the following output showing enabled and disabled plugins:
150163
151```txt
164#+begin_src txt
152165Plugin Enabled? Description
153166alias-completion [ ]
154167autojump [ ] Autojump configuration, see https://github.com/wting/autojump for more details
@@ -159,79 +172,87 @@ battery [x] display info about your battery charge level
159172blesh [ ] load ble.sh, the Bash line editor!
160173boot2docker [ ] Helpers to get Docker setup correctly for boot2docker
161174browser [ ] render commandline output in your browser
162```
175#+end_src
163176
164177To enable a plugin, do:
165178
166```sh
179#+begin_src sh
167180bash-it enable plugin <plugin name> [plugin name]... -or- $ bash-it enable plugin all
168```
181#+end_src
169182
170183To disable a plugin, do:
171184
172```sh
185#+begin_src sh
173186bash-it disable plugin <plugin name> [plugin name]... -or- $ bash-it disable plugin all
174```
175
176### Themes
177
178There are quite a few pre-defined
179[themes](https://bash-it.readthedocs.io/en/latest/themes-list/#list-of-themes)
187#+end_src
188
189*** Themes
190:PROPERTIES:
191:CUSTOM_ID: themes
192:END:
193There are quite a few pre-defined
194[[https://bash-it.readthedocs.io/en/latest/themes-list/#list-of-themes][themes]]
180195available with bash-it.
181196
182197To list all themes:
183198
184```sh
199#+begin_src sh
185200ls ~/.bash_it/themes/
186```
201#+end_src
187202
188To use a new theme, you'll need to edit `.bashrc` and alter the `BASH_IT_THEME`
189variable to your desired theme. For example, I am using the `zork` theme.
203To use a new theme, you'll need to edit =.bashrc= and alter the
204=BASH_IT_THEME= variable to your desired theme. For example, I am using
205the =zork= theme.
190206
191```sh
207#+begin_src sh
192208nano ~/.bashrc
193```
209#+end_src
194210
195```sh
211#+begin_src sh
196212export BASH_IT_THEME='zork'
197```
198
199Once you save your changes, you just need to exit your terminal and create a new
200one in order to see your changes to the `.bashrc` file. You can also `source`
201the file to see changes, but I recommend starting a completely new shell
202instead.
203
204## ble.sh
205
206One big feature I was missing in Bash that both `zsh` and `fish` have is an
207autosuggestion feature. To explain: as you type, an autosuggestion feature in
208the shell will offer suggestions in a lighter font color beyond the characters
209already typed. Once you see the command you want, you can click the right arrow
210and have the shell auto-complete that line for you.
211
212Luckily, the [Bash Line Editor](https://github.com/akinomyoga/ble.sh) (ble.sh)
213exists! This program provides a wonderful autosuggestions feature perfectly,
214among other features that I haven't tested yet.
213#+end_src
214
215Once you save your changes, you just need to exit your terminal and
216create a new one in order to see your changes to the =.bashrc= file. You
217can also =source= the file to see changes, but I recommend starting a
218completely new shell instead.
219
220** ble.sh
221:PROPERTIES:
222:CUSTOM_ID: ble.sh
223:END:
224One big feature I was missing in Bash that both =zsh= and =fish= have is
225an autosuggestion feature. To explain: as you type, an autosuggestion
226feature in the shell will offer suggestions in a lighter font color
227beyond the characters already typed. Once you see the command you want,
228you can click the right arrow and have the shell auto-complete that line
229for you.
230
231Luckily, the [[https://github.com/akinomyoga/ble.sh][Bash Line Editor]]
232(ble.sh) exists! This program provides a wonderful autosuggestions
233feature perfectly, among other features that I haven't tested yet.
215234
216235In order to install ble.sh, execute the following:
217236
218```sh
237#+begin_src sh
219238git clone --recursive https://github.com/akinomyoga/ble.sh.git
220239make -C ble.sh install PREFIX=~/.local
221240echo 'source ~/.local/share/blesh/ble.sh' >> ~/.bashrc
222```
223
224Again, exit the terminal and open a new one in order to see the newly-configured
225shell.
241#+end_src
226242
227## Restart the Session
243Again, exit the terminal and open a new one in order to see the
244newly-configured shell.
228245
229Finally, as mentioned above, you'll need to restart the session to ensure that
230your user is using bash by default.
246** Restart the Session
247:PROPERTIES:
248:CUSTOM_ID: restart-the-session
249:END:
250Finally, as mentioned above, you'll need to restart the session to
251ensure that your user is using bash by default.
231252
232You will also need to exit and re-open a shell (e.g., terminal or terminal tab)
233any time you make changes to the `.bashrc` file.
253You will also need to exit and re-open a shell (e.g., terminal or
254terminal tab) any time you make changes to the =.bashrc= file.
234255
235```sh
256#+begin_src sh
236257sudo reboot now
237```
258#+end_src
blog/2022-08-31-privacy.com-changes.org +103 −85
@@ -1,92 +1,110 @@
1+++
2date = 2022-08-31
3title = "Concerning Changes on Privacy.com"
4description = "A quick description of the recent changes of Privacy.com toward a credit card model."
5+++
6
7## Privacy.com Changes Their Terms
8
9Recently, Privacy.com reached out to their customers regarding a change in their
10terms of use. Further, all customers are required to agree to the changes in
11order to continue using their accounts.
12
13[You can view the new cardholder agreement
14here](https://privacy.com/commercial-cardholder-agreement).
15
16When you log in, you'll be greeted with a pop-up window asking you to review
17and agree to the new terms of use.
18You will also not be able to open any new cards until the terms are agreed to.
19
20### Changing from a "Prepaid Debit" Model to a "Charge Card" Model
21
22The actual content of the changes is interesting. While the historical model of
23using Privacy.com was akin to prepaid debit cards, the new model is very similar
24to a credit card (they use the term "charge card").
25
26I have used Privacy.com for 1-2 years, and the process was always that you
27would create a single-use or merchant-locked card.
28This card could be used for any dollar limit you set and would immediately
29draw the funds from whatever funding source you connected, e.g. PayPal
30account or a bank account.
31
32The benefit this service provides with a premium account is masking the merchant
33names from your funding source. If you have a concern that your bank account
34uses merchant data from your account, you could direct all charges through
35Privacy.com and set the merchant as one of their pre-set options, such as
36"Smiley's Corner Store" or "NSA Gift Shop."
37
38The new model still works with a bank account as a funding source, but the model
39is changed so that you get a "line of credit" set according to a 14-day billing
40cycle. It seems that Privacy.com will now allow charges to be incurred without
41being immediately paid.
42
43### Daily Payments and Available Credit
44
45Instead of paying as charges are incurred, you must make a "Daily Payment" and
46your "Available Credit" will be locked until you make that payment. There are
47also "End of Billing Cycle Payments" that are assigned a due date.
48
49Further, Privacy.com will decline charges that would cause you to exceed your
50Available Credit or Credit Limit.
1#+title: Concerning Changes on Privacy.com
2#+date: 2022-08-31
3
4** Privacy.com Changes Their Terms
5:PROPERTIES:
6:CUSTOM_ID: privacy.com-changes-their-terms
7:END:
8Recently, Privacy.com reached out to their customers regarding a change
9in their terms of use. Further, all customers are required to agree to
10the changes in order to continue using their accounts.
11
12[[https://privacy.com/commercial-cardholder-agreement][You can view the
13new cardholder agreement here]].
14
15When you log in, you'll be greeted with a pop-up window asking you to
16review and agree to the new terms of use. You will also not be able to
17open any new cards until the terms are agreed to.
18
19*** Changing from a "Prepaid Debit" Model to a "Charge Card" Model
20:PROPERTIES:
21:CUSTOM_ID: changing-from-a-prepaid-debit-model-to-a-charge-card-model
22:END:
23The actual content of the changes is interesting. While the historical
24model of using Privacy.com was akin to prepaid debit cards, the new
25model is very similar to a credit card (they use the term "charge
26card").
27
28I have used Privacy.com for 1-2 years, and the process was always that
29you would create a single-use or merchant-locked card. This card could
30be used for any dollar limit you set and would immediately draw the
31funds from whatever funding source you connected, e.g. PayPal account or
32a bank account.
33
34The benefit this service provides with a premium account is masking the
35merchant names from your funding source. If you have a concern that your
36bank account uses merchant data from your account, you could direct all
37charges through Privacy.com and set the merchant as one of their pre-set
38options, such as "Smiley's Corner Store" or "NSA Gift Shop."
39
40The new model still works with a bank account as a funding source, but
41the model is changed so that you get a "line of credit" set according to
42a 14-day billing cycle. It seems that Privacy.com will now allow charges
43to be incurred without being immediately paid.
44
45*** Daily Payments and Available Credit
46:PROPERTIES:
47:CUSTOM_ID: daily-payments-and-available-credit
48:END:
49Instead of paying as charges are incurred, you must make a "Daily
50Payment" and your "Available Credit" will be locked until you make that
51payment. There are also "End of Billing Cycle Payments" that are
52assigned a due date.
53
54Further, Privacy.com will decline charges that would cause you to exceed
55your Available Credit or Credit Limit.
5156
5257One particular interesting section states the following:
5358
54> YOUR OBLIGATION TO PAY US BACK FOR ALL CARD TRANSACTIONS AND OTHER OBLIGATIONS
55> YOU INCUR IS SECURED BY THE SECURED ACCOUNT. IF YOU DO NOT PAY US BACK FOR ANY
56> AMOUNT YOU OWE US WHEN YOUR PAYMENTS ARE DUE, WE WILL EXERCISE OUR INTEREST
57> AND DEBIT THE SECURED ACCOUNT, AND YOU WILL LOSE THE MONEY IN THE SECURED
58> ACCOUNT. SEE SECTION 8: SECURITY AGREEMENT FOR MORE INFORMATION.
59
60### Personal Information
61
62Now that Privacy.com is more of a financial institution, they are obligated to
63comply with the [know your
64customer](https://en.wikipedia.org/wiki/Know_your_customer) guidelines/laws.
65
66I did not proceed with the change to my Privacy.com account, but I have heard
67from some peers that the changes require more personal information to be
68submitted, such as SSN. I am not aware of all new personal information required
69or if the funding source is now required to only be a bank account.
70
71### Fees
72
73Luckily, the fees section did not change much. The subscription fees for a
74premium account are still the only fees.
75
76## My Thoughts
77
78Personally, I wiped my personal information from my account and then permanently
79deleted it when I heard about these changes. I have no interest in yet another
80method of credit lending offered by private companies. While I accepted that
81they would have access to my bank account information for the purposes of paying
82off my prepaid debit payments, I have no interest in incurring charges that will
83need to be paid back at a later date. I also have no interest in submitting
59#+begin_quote
60YOUR OBLIGATION TO PAY US BACK FOR ALL CARD TRANSACTIONS AND OTHER
61OBLIGATIONS YOU INCUR IS SECURED BY THE SECURED ACCOUNT. IF YOU DO NOT
62PAY US BACK FOR ANY AMOUNT YOU OWE US WHEN YOUR PAYMENTS ARE DUE, WE
63WILL EXERCISE OUR INTEREST AND DEBIT THE SECURED ACCOUNT, AND YOU WILL
64LOSE THE MONEY IN THE SECURED ACCOUNT. SEE SECTION 8: SECURITY AGREEMENT
65FOR MORE INFORMATION.
66
67#+end_quote
68
69*** Personal Information
70:PROPERTIES:
71:CUSTOM_ID: personal-information
72:END:
73Now that Privacy.com is more of a financial institution, they are
74obligated to comply with the
75[[https://en.wikipedia.org/wiki/Know_your_customer][know your customer]]
76guidelines/laws.
77
78I did not proceed with the change to my Privacy.com account, but I have
79heard from some peers that the changes require more personal information
80to be submitted, such as SSN. I am not aware of all new personal
81information required or if the funding source is now required to only be
82a bank account.
83
84*** Fees
85:PROPERTIES:
86:CUSTOM_ID: fees
87:END:
88Luckily, the fees section did not change much. The subscription fees for
89a premium account are still the only fees.
90
91** My Thoughts
92:PROPERTIES:
93:CUSTOM_ID: my-thoughts
94:END:
95Personally, I wiped my personal information from my account and then
96permanently deleted it when I heard about these changes. I have no
97interest in yet another method of credit lending offered by private
98companies. While I accepted that they would have access to my bank
99account information for the purposes of paying off my prepaid debit
100payments, I have no interest in incurring charges that will need to be
101paid back at a later date. I also have no interest in submitting
84102personal information to Privacy.com.
85103
86This type of change toward a "buy it now, pay us later" model is concerning,
87and I will be watching Privacy.com to see if they further their interests in
88the credit model as time goes on.
104This type of change toward a "buy it now, pay us later" model is
105concerning, and I will be watching Privacy.com to see if they further
106their interests in the credit model as time goes on.
89107
90Could we see them start charging interest, fees, etc.? I'm not sure, but
91this change does not inspire confidence in their mission as a
108Could we see them start charging interest, fees, etc.? I'm not sure, but
109this change does not inspire confidence in their mission as a
92110privacy-focused company.
blog/2022-09-17-serenity-os.org +96 −81
@@ -1,113 +1,128 @@
1+++
2date = 2022-09-17
3title = "Serenity OS: Testing Out a Unique System"
4description = "Walking through my exploration of Serenity OS, a unique 90s-esque system."
5+++
1#+title: Serenity OS: Testing Out a Unique System
2#+date: 2022-09-17
63
7## Overview
4** Overview
5:PROPERTIES:
6:CUSTOM_ID: overview
7:END:
8[[https://serenityos.org][SerenityOS]] is a unique operating system (OS)
9that I have seen pop up in my news feed a few times over the last few
10years, but I have never had time to test it out until now.
811
9[SerenityOS](https://serenityos.org) is a unique operating system (OS) that I
10have seen pop up in my news feed a few times over the last few years, but I have
11never had time to test it out until now.
12
13Testing out this system brought back fond memories of yellowed,
14modem-screeching, 100-pound computers that brought so many fond memories to my
15youth.
12Testing out this system brought back fond memories of yellowed,
13modem-screeching, 100-pound computers that brought so many fond memories
14to my youth.
1615
1716Per their website:
1817
19> A graphical Unix-like operating system for desktop computers!
20>
21> SerenityOS is a love letter to '90s user interfaces with a custom Unix-like
22> core.
23> It flatters with sincerity by stealing beautiful ideas from various
24> other systems.
25>
26> Roughly speaking, the goal is a marriage between the aesthetic of late-1990s
27> productivity software and the power-user accessibility of late-2000s *nix.
28>
29> This is a system by us, for us, based on the things we like.
30
31## Building
32
33Your first question may be "Where's the iso?" and the answer is... there are
34none. SerenityOS does not provide pre-built images for testing. You must build
35the images yourself. This seems intentionally to limit participation to only
36those who are truly interested enough to learn how to build the OS.
18#+begin_quote
19A graphical Unix-like operating system for desktop computers!
3720
38### Clone
39
40In order to get started, you'll need to clone the source repository:
21SerenityOS is a love letter to '90s user interfaces with a custom
22Unix-like core. It flatters with sincerity by stealing beautiful ideas
23from various other systems.
4124
42```sh
43git clone https://github.com/SerenityOS/serenity && cd serenity
44```
25Roughly speaking, the goal is a marriage between the aesthetic of
26late-1990s productivity software and the power-user accessibility of
27late-2000s *nix.
4528
46### Build
29This is a system by us, for us, based on the things we like.
4730
48Note that I followed the [Build
49Instructions](https://github.com/SerenityOS/serenity/blob/master/Documentation/BuildInstructions.md)
50in the SerenityOS repository as of commit
51`660d2b53b1206e868d5470eee80b5e62d7e30da7`.
52Things may have changed since my installation, and you should double-check
53the instructions first.
31#+end_quote
5432
55Regardless, I want to repeat my steps here to illustrate any errors or differing
56commands I needed to run in order to build and run SerenityOS.
33** Building
34:PROPERTIES:
35:CUSTOM_ID: building
36:END:
37Your first question may be "Where's the iso?" and the answer is... there
38are none. SerenityOS does not provide pre-built images for testing. You
39must build the images yourself. This seems intentionally to limit
40participation to only those who are truly interested enough to learn how
41to build the OS.
5742
58Since I am running Fedora, I needed to install these packages in order to build
59the OS images:
43*** Clone
44:PROPERTIES:
45:CUSTOM_ID: clone
46:END:
47In order to get started, you'll need to clone the source repository:
6048
61```sh
49#+begin_src sh
50git clone https://github.com/SerenityOS/serenity && cd serenity
51#+end_src
52
53*** Build
54:PROPERTIES:
55:CUSTOM_ID: build
56:END:
57Note that I followed the
58[[https://github.com/SerenityOS/serenity/blob/master/Documentation/BuildInstructions.md][Build
59Instructions]] in the SerenityOS repository as of commit
60=660d2b53b1206e868d5470eee80b5e62d7e30da7=. Things may have changed
61since my installation, and you should double-check the instructions
62first.
63
64Regardless, I want to repeat my steps here to illustrate any errors or
65differing commands I needed to run in order to build and run SerenityOS.
66
67Since I am running Fedora, I needed to install these packages in order
68to build the OS images:
69
70#+begin_src sh
6271sudo dnf install texinfo binutils-devel curl cmake mpfr-devel libmpc-devel gmp-devel e2fsprogs ninja-build patch ccache rsync @"C Development Tools and Libraries" @Virtualization
63```
72#+end_src
6473
65Next, make sure you're inside the `serenity` directory created earlier
74Next, make sure you're inside the =serenity= directory created earlier
6675during the git cloning process and process to build the toolchain:
6776
68```sh
77#+begin_src sh
6978Meta/serenity.sh rebuild-toolchain
70```
79#+end_src
7180
7281Once the toolchain is built, you can Build and run the OS!
7382
74```sh
83#+begin_src sh
7584Meta/serenity.sh run
76```
77
78After this process is completed, the image should run automatically and launch.
79
80## Issues
85#+end_src
8186
82I played around in SerenityOS for an hour or two in order to see what I could do
83and had a lot of fun with it. The only issue I ran into was a lack of working
84internet. I didn't try very hard, but I could tell that the main network link
85wasn't connecting to my Fedora host properly.
87After this process is completed, the image should run automatically and
88launch.
8689
87## Screenshots
90** Issues
91:PROPERTIES:
92:CUSTOM_ID: issues
93:END:
94I played around in SerenityOS for an hour or two in order to see what I
95could do and had a lot of fun with it. The only issue I ran into was a
96lack of working internet. I didn't try very hard, but I could tell that
97the main network link wasn't connecting to my Fedora host properly.
8898
89The initial launch of the image displays the SerenityOS desktop, with a simple
90terminal already launched:
99** Screenshots
100:PROPERTIES:
101:CUSTOM_ID: screenshots
102:END:
103The initial launch of the image displays the SerenityOS desktop, with a
104simple terminal already launched:
91105
92![](https://img.cleberg.net/blog/20220917-serenityos/initial_launch.png)
106[[https://img.cleberg.net/blog/20220917-serenityos/initial_launch.png]]
93107
94Here you can see the Fire application (literally just shows fire burning), a
95browser with the local Serenity Browser page loaded, and a text editor.
108Here you can see the Fire application (literally just shows fire
109burning), a browser with the local Serenity Browser page loaded, and a
110text editor.
96111
97![](https://img.cleberg.net/blog/20220917-serenityos/basic_apps.png)
112[[https://img.cleberg.net/blog/20220917-serenityos/basic_apps.png]]
98113
99I also poked around the system utilities and found most tools you'd expect to
100find within a standard desktop.
114I also poked around the system utilities and found most tools you'd
115expect to find within a standard desktop.
101116
102![](https://img.cleberg.net/blog/20220917-serenityos/system_monitor.png)
117[[https://img.cleberg.net/blog/20220917-serenityos/system_monitor.png]]
103118
104Lastly, I noted that the default desktop contains numerous pre-defined themes to
105choose from. This is a small piece, but it's actually wonderful to see desktop
106developers consider theming directly out of the box rather than using an
107addon-based mentality.
119Lastly, I noted that the default desktop contains numerous pre-defined
120themes to choose from. This is a small piece, but it's actually
121wonderful to see desktop developers consider theming directly out of the
122box rather than using an addon-based mentality.
108123
109![](https://img.cleberg.net/blog/20220917-serenityos/themes.png)
124[[https://img.cleberg.net/blog/20220917-serenityos/themes.png]]
110125
111I didn't take a screenshot of the other pre-installed games, but I did spend
112nearly 30 minutes playing Solitaire before remembering that I was supposed to be
113writing a post about the OS.
126I didn't take a screenshot of the other pre-installed games, but I did
127spend nearly 30 minutes playing Solitaire before remembering that I was
128supposed to be writing a post about the OS.
blog/2022-09-21-graphene-os.org +142 −116
@@ -1,160 +1,186 @@
1+++
2date = 2022-09-21
3title = "Installing Graphene OS on the Pixel 6 Pro"
4description = "A walkthrough tutorial on how to install GrapheneOS on the Pixel 6 Pro with Fedora Linux."
5+++
6
7## Introduction
8
9After using iOS for a couple of years, I finally took the plunge and
1#+title: Installing Graphene OS on the Pixel 6 Pro
2#+date: 2022-09-21
3
4** Introduction
5:PROPERTIES:
6:CUSTOM_ID: introduction
7:END:
8After using iOS for a couple of years, I finally took the plunge and
109purchased a Pixel 6 Pro in order to test and use [GrapheneOS]
1110(https://grapheneos.org).
1211
13The installation process was rather quick once you have the tools and files you
14need. Overall, it can be done in just a few minutes.
15
16## Gathering Tools & Files
17
18### Android Tools
19
20First, in order to interact with the device, we will need the [Android
21platform
22tools](https://developer.android.com/studio/releases/platform-tools.html). Find
23the Linux download and save the ZIP folder to your preferred location.
24
25Once we've downloaded the files, we will need to unzip them, enter the
26directory, and move the necessary executables to a central location, such as
27`/usr/bin/`. For this installation, we only need the `fastboot` and `adb`
28executables.
29
30```sh
12The installation process was rather quick once you have the tools and
13files you need. Overall, it can be done in just a few minutes.
14
15** Gathering Tools & Files
16:PROPERTIES:
17:CUSTOM_ID: gathering-tools-files
18:END:
19*** Android Tools
20:PROPERTIES:
21:CUSTOM_ID: android-tools
22:END:
23First, in order to interact with the device, we will need the
24[[https://developer.android.com/studio/releases/platform-tools.html][Android
25platform tools]]. Find the Linux download and save the ZIP folder to
26your preferred location.
27
28Once we've downloaded the files, we will need to unzip them, enter the
29directory, and move the necessary executables to a central location,
30such as =/usr/bin/=. For this installation, we only need the =fastboot=
31and =adb= executables.
32
33#+begin_src sh
3134cd ~/Downloads
32```
35#+end_src
3336
34```sh
37#+begin_src sh
3538unzip platform-tools_r33.0.3-linux.zip
3639cd platform-tools
3740sudo mv fastboot /usr/bin/
3841sudo mv adb /usr/bin
39```
40
41### GrapheneOS Files
42#+end_src
4243
43Next, we need the [GrapheneOS files](https://grapheneos.org/releases) for
44our device and model. For example, the Pixel 6 Pro is codenamed `raven` on the
45release page.
44*** GrapheneOS Files
45:PROPERTIES:
46:CUSTOM_ID: grapheneos-files
47:END:
48Next, we need the [[https://grapheneos.org/releases][GrapheneOS files]]
49for our device and model. For example, the Pixel 6 Pro is codenamed
50=raven= on the release page.
4651
4752Once we have the links, let's download them to our working directory:
4853
49```sh
54#+begin_src sh
5055curl -O https://releases.grapheneos.org/factory.pub
5156curl -0 https://releases.grapheneos.org/raven-factory-2022091400.zip
5257curl -0 https://releases.grapheneos.org/raven-factory-2022091400.zip.sig
53```
54
55#### Validate Integrity
58#+end_src
5659
57In order to validate the integrity of the downloaded files, we will need the
58`signify` package and Graphene's `factory.pub` file.
60**** Validate Integrity
61:PROPERTIES:
62:CUSTOM_ID: validate-integrity
63:END:
64In order to validate the integrity of the downloaded files, we will need
65the =signify= package and Graphene's =factory.pub= file.
5966
60```sh
67#+begin_src sh
6168sudo dnf install signify
62```
69#+end_src
6370
64```sh
71#+begin_src sh
6572curl -O https://releases.grapheneos.org/factory.pub
66```
73#+end_src
6774
68Then we can validate the files and ensure that no data was corrupted or
75Then we can validate the files and ensure that no data was corrupted or
6976modified before it was saved to our device.
7077
71```sh
78#+begin_src sh
7279signify -Cqp factory.pub -x raven-factory-2022091400.zip.sig && echo verified
73```
80#+end_src
7481
75#### Unzip Files
82**** Unzip Files
83:PROPERTIES:
84:CUSTOM_ID: unzip-files
85:END:
86Once the files are verified, we can unzip the Graphene image and enter
87the directory:
7688
77Once the files are verified, we can unzip the Graphene image and enter the
78directory:
79
80```sh
89#+begin_src sh
8190unzip raven-factory-2022091400.zip && cd raven-factory-2022091400
82```
83
84## Installation Process
85
86### Enable Developer Debugging & OEM Unlock
87
88Before we can actually flash anything to the phone, we will need to enable
89OEM Unlocking, as well as either USB Debugging or Wireless Debugging, depending on
90which method we will be using.
91
92To start, enable developer mode by going to `Settings` > `About` and tapping
93`Build Number` seven (7) times. You may need to enter your PIN to enable this
94mode.
95
96Once developer mode is enabled, go to `Settings` > `System` > `Devloper
97Options` and enable OEM Unlocking, as well as USB or Wireless Debugging. In my
98case, I chose USB Debugging and performed all actions via USB cable.
99
100Once these options are enabled, plug the phone into the computer and execute the
101following command:
102
103```sh
91#+end_src
92
93** Installation Process
94:PROPERTIES:
95:CUSTOM_ID: installation-process
96:END:
97*** Enable Developer Debugging & OEM Unlock
98:PROPERTIES:
99:CUSTOM_ID: enable-developer-debugging-oem-unlock
100:END:
101Before we can actually flash anything to the phone, we will need to
102enable OEM Unlocking, as well as either USB Debugging or Wireless
103Debugging, depending on which method we will be using.
104
105To start, enable developer mode by going to =Settings= > =About= and
106tapping =Build Number= seven (7) times. You may need to enter your PIN
107to enable this mode.
108
109Once developer mode is enabled, go to =Settings= > =System= >
110=Devloper Options= and enable OEM Unlocking, as well as USB or Wireless
111Debugging. In my case, I chose USB Debugging and performed all actions
112via USB cable.
113
114Once these options are enabled, plug the phone into the computer and
115execute the following command:
116
117#+begin_src sh
104118adb devices
105```
106
107If an unauthorized error occurs, make sure the USB mode on the phone is
108changed from charging to something like "File Transfer" or "PTP."
109You can find the USB mode in the notification tray.
119#+end_src
110120
111### Reboot Device
121If an unauthorized error occurs, make sure the USB mode on the phone is
122changed from charging to something like "File Transfer" or "PTP." You
123can find the USB mode in the notification tray.
112124
113Once we have found the device via `adb`, we can either boot into the
114bootloader interface by holding the volume down button while the phone reboots
115or by executing the following command:
125*** Reboot Device
126:PROPERTIES:
127:CUSTOM_ID: reboot-device
128:END:
129Once we have found the device via =adb=, we can either boot into the
130bootloader interface by holding the volume down button while the phone
131reboots or by executing the following command:
116132
117```sh
133#+begin_src sh
118134adb reboot bootloader
119```
135#+end_src
120136
121### Unlock the Bootloader
137*** Unlock the Bootloader
138:PROPERTIES:
139:CUSTOM_ID: unlock-the-bootloader
140:END:
141The phone will reboot and load the bootloader screen upon startup. At
142this point, we are ready to start the actual flashing of GrapheneOS onto
143the device.
122144
123The phone will reboot and load the bootloader screen upon startup. At this
124point, we are ready to start the actual flashing of GrapheneOS onto the device.
145*NOTE*: In my situation, I needed to use =sudo= with every =fastboot=
146command, but not with =adb= commands. I am not sure if this is standard
147or a Fedora quirk, but I'm documenting my commands verbatim in this
148post.
125149
126**NOTE**: In my situation, I needed to use `sudo` with every `fastboot`
127command, but not with `adb` commands. I am not sure if this is standard or a
128Fedora quirk, but I'm documenting my commands verbatim in this post.
150First, we start by unlocking the bootloader so that we can load other
151ROMs:
129152
130First, we start by unlocking the bootloader so that we can load other ROMs:
131
132```sh
153#+begin_src sh
133154sudo fastboot flashing unlock
134```
135
136### Flashing Factory Images
155#+end_src
137156
138Once the phone is unlocked, we can flash it with the `flash-all.sh` script found
139inside the `raven-factory-2022091400` folder we entered earlier:
157*** Flashing Factory Images
158:PROPERTIES:
159:CUSTOM_ID: flashing-factory-images
160:END:
161Once the phone is unlocked, we can flash it with the =flash-all.sh=
162script found inside the =raven-factory-2022091400= folder we entered
163earlier:
140164
141```sh
165#+begin_src sh
142166sudo ./flash-all.sh
143```
144
145This process should take a few minutes and will print informational messages as
146things progress. Avoid doing anything on the phone while this process is
147operating.
148
149### Lock the Bootloader
150
151If everything was successful, the phone should reboot a few times and finally
152land back on the bootloader screen. At this point, we can re-lock the
153bootloader to enable full verified boot and protect the device from unwanted
154flashing or erasure of data.
155
156```sh
167#+end_src
168
169This process should take a few minutes and will print informational
170messages as things progress. Avoid doing anything on the phone while
171this process is operating.
172
173*** Lock the Bootloader
174:PROPERTIES:
175:CUSTOM_ID: lock-the-bootloader
176:END:
177If everything was successful, the phone should reboot a few times and
178finally land back on the bootloader screen. At this point, we can
179re-lock the bootloader to enable full verified boot and protect the
180device from unwanted flashing or erasure of data.
181
182#+begin_src sh
157183sudo fastboot flashing lock
158```
184#+end_src
159185
160186Once done, the device will be wiped and ready for a fresh set-up!
blog/2022-10-04-mtp-linux.org +61 −55
@@ -1,79 +1,85 @@
1+++
2date = 2022-10-04
3title = "How to Mount an MTP Mobile Device on Linux"
4description = "Learn how to easily mount Android MTP smartphones on Linux using the command line."
5+++
6
7I recently ran into trouble attempting to mount my GrapheneOS phone to my laptop
8running Fedora Linux via the [Media Transfer
9Protocol](https://en.wikipedia.org/wiki/Media_transfer_protocol) (MTP) and
10discovered a simple and effective solution.
11
12## Use a USB 3.0 Port
13
14First, ensure that the device was plugged in to the laptop through a
15USB 3.0 port, if possible. From a brief glance online, it seems that USB 2.0
16ports may cause issues with dropped connections over MTP. This is purely
17anecdotal since I don't have any evidence to link showing that USB 2.0 causes
18issues, but I can confirm that switching to a USB 3.0 port seemed to cut out
19most
20of my issues.
21
22## Switch USB Preferences to MTP
23
24Secondly, you need to ensure that the phone's USB preferences/mode is
25changed to MTP or File Transfer once the phone is plugged in. Other modes will
26not allow you to access the phone's file system.
27
28## Install `jmtpfs`
29
30Next, I used the `jmtpfs` package to mount my phone to my laptop. There are
31other packages that exist, but this one worked perfectly for me. On Fedora
32Linux, you can install it like this:
33
34```sh
1#+title: How to Mount an MTP Mobile Device on Linux
2#+date: 2022-10-04
3
4I recently ran into trouble attempting to mount my GrapheneOS phone to my laptop
5running Fedora Linux via the [[https://en.wikipedia.org/wiki/Media_transfer_protocol][Media Transfer Protocol]] (MTP) and discovered a
6simple and effective solution.
7
8** Use a USB 3.0 Port
9:PROPERTIES:
10:CUSTOM_ID: use-a-usb-3.0-port
11:END:
12First, ensure that the device was plugged in to the laptop through a USB
133.0 port, if possible. From a brief glance online, it seems that USB 2.0
14ports may cause issues with dropped connections over MTP. This is purely
15anecdotal since I don't have any evidence to link showing that USB 2.0
16causes issues, but I can confirm that switching to a USB 3.0 port seemed
17to cut out most of my issues.
18
19** Switch USB Preferences to MTP
20:PROPERTIES:
21:CUSTOM_ID: switch-usb-preferences-to-mtp
22:END:
23Secondly, you need to ensure that the phone's USB preferences/mode is
24changed to MTP or File Transfer once the phone is plugged in. Other
25modes will not allow you to access the phone's file system.
26
27** Install =jmtpfs=
28:PROPERTIES:
29:CUSTOM_ID: install-jmtpfs
30:END:
31Next, I used the =jmtpfs= package to mount my phone to my laptop. There
32are other packages that exist, but this one worked perfectly for me. On
33Fedora Linux, you can install it like this:
34
35#+begin_src sh
3536sudo dnf install jmtpfs -y
36```
37#+end_src
3738
38## Create a Mount Point
39** Create a Mount Point
40:PROPERTIES:
41:CUSTOM_ID: create-a-mount-point
42:END:
43Once you have the package installed, you just need to create a folder
44for the device to use as a mount point. In my case, I used =/mnt/pixel=:
3945
40Once you have the package installed, you just need to create a folder for the
41device to use as a mount point. In my case, I used `/mnt/pixel`:
42
43```sh
46#+begin_src sh
4447sudo mkdir /mnt/pixel
4548sudo chown -R $USER:$USER /mnt/pixel
46```
47
48## Mount & Access the Phone's File System
49#+end_src
4950
50Finally, plug-in and mount the device, and you should be able to see all
51** Mount & Access the Phone's File System
52:PROPERTIES:
53:CUSTOM_ID: mount-access-the-phones-file-system
54:END:
55Finally, plug-in and mount the device, and you should be able to see all
5156storage (internal and external) inside your new folder!
5257
53```sh
58#+begin_src sh
5459jmtpfs /mnt/pixel
55```
60#+end_src
5661
5762The output should look something like this:
5863
59```sh
64#+begin_src sh
6065Device 0 (VID=18d1 and PID=4ee1) is a Google Inc Nexus/Pixel (MTP).
6166Android device detected, assigning default bug flags
62```
67#+end_src
6368
64Now you are mounted and can do anything you'd like with the device's files:
69Now you are mounted and can do anything you'd like with the device's
70files:
6571
66```sh
72#+begin_src sh
6773cd /mnt/pixel
6874ls -lha
69```
75#+end_src
7076
71From here, you will be able to see any internal or external storage available on
72the device:
77From here, you will be able to see any internal or external storage
78available on the device:
7379
74```sh
80#+begin_src sh
7581total 0
7682drwxr-xr-x. 3 user user 0 Jan 1 1970 .
7783drwxr-xr-x. 1 root root 10 Oct 4 13:29 ..
7884drwxr-xr-x. 16 user user 0 Apr 21 4426383 'Internal shared storage'
79```
85#+end_src
blog/2022-10-20-syncthing.org +176 −144
@@ -1,166 +1,198 @@
1+++
2date = 2022-10-20
3title = "Syncthing: A Minimal Self-Hosted Cloud Storage Solution"
4description = "In this post, I walk through the Syncthing software and how to set it up on multiple devices."
5+++
6
7## An Overview of Syncthing
8
9If you've been looking around the self-hosted cloud storage space for a while,
10you've undoubtedly run into someone suggesting
11[Syncthing](https://syncthing.net) as an option. However, it is an unusual
12alternative for those users out there who are used to having a centralized cloud
13server that serves as the "controller" of the data and interacts with clients on
14devices to fetch files.
15
16This post is a walkthrough of the Syncthing software, how I set up my personal
17storage, and some pros and cons of using the software.
18
19## Installing Syncthing
20
21To install Syncthing, visit the [Downloads](https://syncthing.net/downloads/)
22page or install via your device's package manager.
23
24### Server & Desktop
25
26You can install Syncthing on servers and desktops via the Downloads page linked
27above or via the command-line.
1#+title: Syncthing: A Minimal Self-Hosted Cloud Storage Solution
2#+date: 2022-10-20
3
4** An Overview of Syncthing
5:PROPERTIES:
6:CUSTOM_ID: an-overview-of-syncthing
7:END:
8If you've been looking around the self-hosted cloud storage space for a
9while, you've undoubtedly run into someone suggesting
10[[https://syncthing.net][Syncthing]] as an option. However, it is an
11unusual alternative for those users out there who are used to having a
12centralized cloud server that serves as the "controller" of the data and
13interacts with clients on devices to fetch files.
14
15This post is a walkthrough of the Syncthing software, how I set up my
16personal storage, and some pros and cons of using the software.
17
18** Installing Syncthing
19:PROPERTIES:
20:CUSTOM_ID: installing-syncthing
21:END:
22To install Syncthing, visit the
23[[https://syncthing.net/downloads/][Downloads]] page or install via your
24device's package manager.
25
26*** Server & Desktop
27:PROPERTIES:
28:CUSTOM_ID: server-desktop
29:END:
30You can install Syncthing on servers and desktops via the Downloads page
31linked above or via the command-line.
2832
2933For Debian-based distros:
3034
31```sh
35#+begin_src sh
3236sudo apt install syncthing
33```
37#+end_src
3438
3539For Fedora-based distros:
3640
37```sh
41#+begin_src sh
3842sudo dnf install syncthing
39```
40
41### Mobile
42
43Syncthing for Android is available on
44[F-Droid](https://f-droid.org/packages/com.nutomic.syncthingandroid/) and
45[Google Play](https://play.google.com/store/apps/details?id=com.nutomic.syncthingandroid).
46Syncthing does not have an official iOS client, but there is a third-party
47client called [Möbius
48Sync](https://apps.apple.com/us/app/m%C3%B6bius-sync/id1539203216).
49
50## How Does Syncthing Work?
51
52To start, I wanted to include the main marketing blurb from their website:
53
54> Syncthing is a continuous file synchronization program. It synchronizes files
55> between two or more computers in real time, safely protected from prying eyes.
56> Your data is your data alone, and you deserve to choose where it is stored,
57> whether it is shared with some third party, and how it's transmitted over the
58> internet.
59
60Let's break this apart and add in some other details to help explain what
61exactly Syncthing does in order to sync files between devices.
62
63### Local Syncthing Server(s)
64
65Syncthing syncs files between multiple devices by creating a local server on
66each device. These local servers handle a few different things, such as
67watching files and directories for changes, hosting an administrative GUI
68website, and authenticating with connected devices.
69
70You can also start, stop, and restart the Syncthing server via the command-line
71or web dashboard. If you're running Syncthing on a device with `systemd`, you
72can use the following commands:
73
74```sh
43#+end_src
44
45*** Mobile
46:PROPERTIES:
47:CUSTOM_ID: mobile
48:END:
49Syncthing for Android is available on
50[[https://f-droid.org/packages/com.nutomic.syncthingandroid/][F-Droid]]
51and
52[[https://play.google.com/store/apps/details?id=com.nutomic.syncthingandroid][Google
53Play]]. Syncthing does not have an official iOS client, but there is a
54third-party client called
55[[https://apps.apple.com/us/app/m%C3%B6bius-sync/id1539203216][Möbius
56Sync]].
57
58** How Does Syncthing Work?
59:PROPERTIES:
60:CUSTOM_ID: how-does-syncthing-work
61:END:
62To start, I wanted to include the main marketing blurb from their
63website:
64
65#+begin_quote
66Syncthing is a continuous file synchronization program. It synchronizes
67files between two or more computers in real time, safely protected from
68prying eyes. Your data is your data alone, and you deserve to choose
69where it is stored, whether it is shared with some third party, and how
70it's transmitted over the internet.
71
72#+end_quote
73
74Let's break this apart and add in some other details to help explain
75what exactly Syncthing does in order to sync files between devices.
76
77*** Local Syncthing Server(s)
78:PROPERTIES:
79:CUSTOM_ID: local-syncthing-servers
80:END:
81Syncthing syncs files between multiple devices by creating a local
82server on each device. These local servers handle a few different
83things, such as watching files and directories for changes, hosting an
84administrative GUI website, and authenticating with connected devices.
85
86You can also start, stop, and restart the Syncthing server via the
87command-line or web dashboard. If you're running Syncthing on a device
88with =systemd=, you can use the following commands:
89
90#+begin_src sh
7591sudo systemctl start syncthing@username.service
7692sudo systemctl restart syncthing@username.service
7793sudo systemctl stop syncthing@username.service
78```
79
80### Syncthing Dashboard
81
82This biggest part of Syncthing is the admin GUI website that runs on each
83device (note that mobile devices will use the Syncthing app rather than the
84web GUI). The admin GUI is available through the web browser on the
85local device that is running Syncthing - simply go to `http://localhost:8384`
86or `http://127.0.0.1:8384`. This web page is the place where you will change
87settings, add/modify synced files, and add/modify connected devices.
94#+end_src
95
96*** Syncthing Dashboard
97:PROPERTIES:
98:CUSTOM_ID: syncthing-dashboard
99:END:
100This biggest part of Syncthing is the admin GUI website that runs on
101each device (note that mobile devices will use the Syncthing app rather
102than the web GUI). The admin GUI is available through the web browser on
103the local device that is running Syncthing - simply go to
104=http://localhost:8384= or =http://127.0.0.1:8384=. This web page is the
105place where you will change settings, add/modify synced files, and
106add/modify connected devices.
88107
89108Here's an example web GUI dashboard:
90109
91![Syncthing Dashboard](https://img.cleberg.net/blog/20221020-syncthing/syncthing_gui.png "Syncthing Dashboard")
92
93### Remote Devices
94
95A cloud storage solution wouldn't be very useful if you aren't able to share
96data among various devices. Syncthing does this by sharing Device IDs to connect
97servers, and then by manually sharing Folders with devices that have been
98connected.
99
100For instance, if you have a laptop running Syncthing and then install the
101Syncthing mobile app on a phone, you could scan the laptop's QR code for Device
102ID and then accept the authentication on the laptop's dashboard. Next, you can
103use either device to select a folder for sharing and dictating which device
104should send, receive, or both.
105
106When you connect devices, you can set one device as an "Introducer," which can
107add devices from the introducer to the device list, for mutually shared folders.
108You can also configure Auto Accept, compression, rate limits, and more settings
109per device.
110
111## My Personal Cloud Storage Set-up
112
113Personally, I use a model similar to a traditional cloud storage service. I have
114a "centralized" server running 24/7 that acts as an Introducer for my Syncthing
115network. I think of this as my main storage and all other devices as tertiary
116client devices. I will likely add additional servers as backups as time goes on
117so that I don't have to rely on my laptop or phone as the only backups.
118
119Currently, I have one desktop and one mobile device connected to the network,
120both running intermittently as they are not powered-on 24/7.
121
122The initial set-up of the software was easy enough, but data transfer rates were
123incredibly slow for me due to the Wi-Fi. Instead, I plugged my laptop into the
124ethernet network that my server is on and manually copied my folders over to the
125server with `scp`. Once complete, Syncthing validated that all files were there
126and not missing, and it did not need to transfer any data through the WAN.
127
128As slow as the transfer was going, this probably saved me a few days of waiting
129for my ~100GB sync.
130
131## Pros & Cons
132
133I've put together a short list of pros and cons for Syncthing. I thought about
134my experiences with Nextcloud, WebDAV, proprietary services (Google Drive,
135iCloud, etc.), and privacy-focused cloud solutions (pCloud, Tresorit, etc.).
136
137**Pros:**
110#+caption: Syncthing Dashboard
111[[https://img.cleberg.net/blog/20221020-syncthing/syncthing_gui.png]]
112
113*** Remote Devices
114:PROPERTIES:
115:CUSTOM_ID: remote-devices
116:END:
117A cloud storage solution wouldn't be very useful if you aren't able to
118share data among various devices. Syncthing does this by sharing Device
119IDs to connect servers, and then by manually sharing Folders with
120devices that have been connected.
121
122For instance, if you have a laptop running Syncthing and then install
123the Syncthing mobile app on a phone, you could scan the laptop's QR code
124for Device ID and then accept the authentication on the laptop's
125dashboard. Next, you can use either device to select a folder for
126sharing and dictating which device should send, receive, or both.
127
128When you connect devices, you can set one device as an "Introducer,"
129which can add devices from the introducer to the device list, for
130mutually shared folders. You can also configure Auto Accept,
131compression, rate limits, and more settings per device.
132
133** My Personal Cloud Storage Set-up
134:PROPERTIES:
135:CUSTOM_ID: my-personal-cloud-storage-set-up
136:END:
137Personally, I use a model similar to a traditional cloud storage
138service. I have a "centralized" server running 24/7 that acts as an
139Introducer for my Syncthing network. I think of this as my main storage
140and all other devices as tertiary client devices. I will likely add
141additional servers as backups as time goes on so that I don't have to
142rely on my laptop or phone as the only backups.
143
144Currently, I have one desktop and one mobile device connected to the
145network, both running intermittently as they are not powered-on 24/7.
146
147The initial set-up of the software was easy enough, but data transfer
148rates were incredibly slow for me due to the Wi-Fi. Instead, I plugged
149my laptop into the ethernet network that my server is on and manually
150copied my folders over to the server with =scp=. Once complete,
151Syncthing validated that all files were there and not missing, and it
152did not need to transfer any data through the WAN.
153
154As slow as the transfer was going, this probably saved me a few days of
155waiting for my ~100GB sync.
156
157** Pros & Cons
158:PROPERTIES:
159:CUSTOM_ID: pros-cons
160:END:
161I've put together a short list of pros and cons for Syncthing. I thought
162about my experiences with Nextcloud, WebDAV, proprietary services
163(Google Drive, iCloud, etc.), and privacy-focused cloud solutions
164(pCloud, Tresorit, etc.).
165
166*Pros:*
138167
139168- I've faced no data loss at all through my two-month trial run.
140169- No third-parties store your data on their servers.
141- You have full control over your data and can take your data and leave at any
142time.
143- It's possible to encrypt client-side easily with software like Cryptomator.
144- No proprietary clients or mounted volumes, just plain files and folders.
170- You have full control over your data and can take your data and leave
171 at any time.
172- It's possible to encrypt client-side easily with software like
173 Cryptomator.
174- No proprietary clients or mounted volumes, just plain files and
175 folders.
145176
146**Cons:**
177*Cons:*
147178
148- The learning curve is steeper than traditional cloud services and is
179- The learning curve is steeper than traditional cloud services and is
149180 focused on a technical audience.
150- If a device needs to modify files in a Folder, the devices will need to
151 sync ALL files from the folder, which may be large. To avoid size
181- If a device needs to modify files in a Folder, the devices will need
182 to sync ALL files from the folder, which may be large. To avoid size
152183 restraints, split large folders into smaller folders for syncing.
153- Syncing can be slow due to the clients/servers initially connecting or
184- Syncing can be slow due to the clients/servers initially connecting or
154185 re-connecting after sleeping.
155- Multiple personal devices are required and require the user to own or rent
156 them as no third-party servers are involved in the storage of data.
157
158Overall, I've had a great experience with Syncthing so far. I've had no data
159loss, syncing has been quick and easy when changes are made to files, device
160connections are reliable, and I love the freedom of controlling the clients and
161servers as I choose.
162
163Not to mention that I appreciate that I - or someone else - could pull the
164Syncthing [source code](https://github.com/syncthing) and continue
165development/support if the Syncthing Foundation decides to stop developing the
166software or sells the business.
186- Multiple personal devices are required and require the user to own or
187 rent them as no third-party servers are involved in the storage of
188 data.
189
190Overall, I've had a great experience with Syncthing so far. I've had no
191data loss, syncing has been quick and easy when changes are made to
192files, device connections are reliable, and I love the freedom of
193controlling the clients and servers as I choose.
194
195Not to mention that I appreciate that I - or someone else - could pull
196the Syncthing [[https://github.com/syncthing][source code]] and continue
197development/support if the Syncthing Foundation decides to stop
198developing the software or sells the business.
blog/2022-10-22-alpine-linux.org +223 −186
@@ -1,264 +1,301 @@
1+++
2date = 2022-10-22
3title = "Alpine Linux: My New Server OS"
4description = "In this post, I explain Alpine Linux's benefits as a server OS and explain my current setup."
5+++
6
7## Alpine Linux
8
9[Alpine Linux](https://alpinelinux.org) is a very small distro, built on musl
10libc and busybox. It uses ash as the default shell, OpenRC as the init
11system, and apk as the package manager. According to their website, an Alpine
12container "requires no more than 8 MB and a minimal installation to disk
13requires around 130 MB of storage." An actual bare metal machine is recommended
14to have 100 MB of RAM and 0-700 MB of storage space.
15
16Historically, I've used Ubuntu's minimal installation image as my server OS for
17the last five years. Ubuntu worked well and helped as my original server
18contained an nVidia GPU and no onboard graphics, so quite a few distros won't
19boot or install without a lot of tinkering.
20
21Alpine has given me a huge increase in performance across my Docker apps and
22Nginx websites. CPU load for the new server I'm using to test Alpine hovers
23around 0-5% on average with an Intel(R) Core(TM) i3-6100 CPU @ 3.70GHz.
24
25The only services I haven't moved over to Alpine are Plex Media Server and
26Syncthing, which may increase CPU load quite a bit depending on how many
27streams are running.
28
29### Installation
30
31In terms of installation, Alpine has an incredibly useful
32[wiki](https://wiki.alpinelinux.org/wiki/Installation) that will guide a user
33throughout the installation and post-installation processes, as well as various
34other articles and guides.
35
36To install Alpine, find an appropriate [image to
37download](https://alpinelinux.org/downloads/) and flash it to a USB using
38software such as Rufus or Etcher. I opted to use the Standard image for my
39x86_64 architecture.
40
41Once the USB is ready, plug it into the machine and reboot.
42Note that you may have to use a key such as `Esc` or `F1-12` to access the
43boot menu.
44The Alpine Linux terminal will load quickly and for a login.
45
46To log in to the installation image, use the `root` account; there is no
1#+title: Alpine Linux: My New Server OS
2#+date: 2022-10-22
3
4** Alpine Linux
5:PROPERTIES:
6:CUSTOM_ID: alpine-linux
7:END:
8[[https://alpinelinux.org][Alpine Linux]] is a very small distro, built
9on musl libc and busybox. It uses ash as the default shell, OpenRC as
10the init system, and apk as the package manager. According to their
11website, an Alpine container "requires no more than 8 MB and a minimal
12installation to disk requires around 130 MB of storage." An actual bare
13metal machine is recommended to have 100 MB of RAM and 0-700 MB of
14storage space.
15
16Historically, I've used Ubuntu's minimal installation image as my server
17OS for the last five years. Ubuntu worked well and helped as my original
18server contained an nVidia GPU and no onboard graphics, so quite a few
19distros won't boot or install without a lot of tinkering.
20
21Alpine has given me a huge increase in performance across my Docker apps
22and Nginx websites. CPU load for the new server I'm using to test Alpine
23hovers around 0-5% on average with an Intel(R) Core(TM) i3-6100 CPU @
243.70GHz.
25
26The only services I haven't moved over to Alpine are Plex Media Server
27and Syncthing, which may increase CPU load quite a bit depending on how
28many streams are running.
29
30*** Installation
31:PROPERTIES:
32:CUSTOM_ID: installation
33:END:
34In terms of installation, Alpine has an incredibly useful
35[[https://wiki.alpinelinux.org/wiki/Installation][wiki]] that will guide
36a user throughout the installation and post-installation processes, as
37well as various other articles and guides.
38
39To install Alpine, find an appropriate
40[[https://alpinelinux.org/downloads/][image to download]] and flash it
41to a USB using software such as Rufus or Etcher. I opted to use the
42Standard image for my x86_64 architecture.
43
44Once the USB is ready, plug it into the machine and reboot. Note that
45you may have to use a key such as =Esc= or =F1-12= to access the boot
46menu. The Alpine Linux terminal will load quickly and for a login.
47
48To log in to the installation image, use the =root= account; there is no
4749password. Once logged-in, execute the setup command:
4850
49```sh
51#+begin_src sh
5052setup-alpine
51```
53#+end_src
5254
53The setup script will ask a series of questions to configure the system. Be sure
54to answer carefully or else you may have to re-configure the system after boot.
55The setup script will ask a series of questions to configure the system.
56Be sure to answer carefully or else you may have to re-configure the
57system after boot.
5558
56- Keyboard Layout (Local keyboard language and usage mode, e.g., us and variant
57of us-nodeadkeys.)
59- Keyboard Layout (Local keyboard language and usage mode, e.g., us and
60 variant of us-nodeadkeys.)
5861- Hostname (The name for the computer.)
59- Network (For example, automatic IP address discovery with the "DHCP"
60protocol.)
61- DNS Servers (Domain Name Servers to query. For privacy reasons, it is NOT
62recommended to route every local request to servers like Google's 8.8.8.8 .)
62- Network (For example, automatic IP address discovery with the "DHCP"
63 protocol.)
64- DNS Servers (Domain Name Servers to query. For privacy reasons, it is
65 NOT recommended to route every local request to servers like Google's
66 8.8.8.8 .)
6367- Timezone
64- Proxy (Proxy server to use for accessing the web. Use "none" for direct
65connections to the internet.)
66- Mirror (From where to download packages. Choose the organization you trust
67giving your usage patterns to.)
68- SSH (Secure SHell remote access server. "Openssh" is part of the default
69install image. Use "none" to disable remote login, e.g. on laptops.)
70- NTP (Network Time Protocol client used for keeping the system clock in sync
71with a time-server. Package "chrony" is part of the default install image.)
72- Disk Mode (Select between diskless (disk="none"), "data" or "sys", as
73described above.)
74
75Once the setup script is finished, be sure to reboot the machine and remove the
76USB device.
77
78```sh
68- Proxy (Proxy server to use for accessing the web. Use "none" for
69 direct connections to the internet.)
70- Mirror (From where to download packages. Choose the organization you
71 trust giving your usage patterns to.)
72- SSH (Secure SHell remote access server. "Openssh" is part of the
73 default install image. Use "none" to disable remote login, e.g. on
74 laptops.)
75- NTP (Network Time Protocol client used for keeping the system clock in
76 sync with a time-server. Package "chrony" is part of the default
77 install image.)
78- Disk Mode (Select between diskless (disk="none"), "data" or "sys", as
79 described above.)
80
81Once the setup script is finished, be sure to reboot the machine and
82remove the USB device.
83
84#+begin_src sh
7985reboot
80```
81
82### Post-Installation
83
84There are many things you can do once your Alpine Linux system is up and
85running, and it largely depends on what you'll use the machine for.
86I'm going to walk through my personal post-installation setup for my web server.
87
88#### Upgrade the System
89
90First, login as `root` in order to update and upgrade the system:
91
92```sh
86#+end_src
87
88*** Post-Installation
89:PROPERTIES:
90:CUSTOM_ID: post-installation
91:END:
92There are many things you can do once your Alpine Linux system is up and
93running, and it largely depends on what you'll use the machine for. I'm
94going to walk through my personal post-installation setup for my web
95server.
96
97**** Upgrade the System
98:PROPERTIES:
99:CUSTOM_ID: upgrade-the-system
100:END:
101First, login as =root= in order to update and upgrade the system:
102
103#+begin_src sh
93104apk -U upgrade
94```
95
96#### Adding a User
105#+end_src
97106
98I needed to add a user so that I don't need to log in as root.
99Note that if you're used to using the `sudo` command, you will now need to
100use the `doas` command on Alpine Linux.
107**** Adding a User
108:PROPERTIES:
109:CUSTOM_ID: adding-a-user
110:END:
111I needed to add a user so that I don't need to log in as root. Note that
112if you're used to using the =sudo= command, you will now need to use the
113=doas= command on Alpine Linux.
101114
102```sh
115#+begin_src sh
103116apk add doas
104117adduser <username>
105118adduser <username> wheel
106```
119#+end_src
107120
108121You can now log out and log back in using the newly-created user:
109122
110```sh
123#+begin_src sh
111124exit
112```
125#+end_src
113126
114#### Enable Community Packages
127**** Enable Community Packages
128:PROPERTIES:
129:CUSTOM_ID: enable-community-packages
130:END:
131In order to install more common packages that aren't found in the =main=
132repository, you will need to enable the =community= repository:
115133
116In order to install more common packages that aren't found in the `main`
117repository, you will need to enable the `community` repository:
118
119```sh
134#+begin_src sh
120135doas nano /etc/apk/repositories
121```
136#+end_src
122137
123Uncomment the community line for whichever version of Alpine you're running:
138Uncomment the community line for whichever version of Alpine you're
139running:
124140
125```sh
141#+begin_src sh
126142/media/usb/apks
127143http://dl-cdn.alpinelinux.org/alpine/v3.16/main
128144http://dl-cdn.alpinelinux.org/alpine/v3.16/community
129145#http://dl-cdn.alpinelinux.org/alpine/edge/main
130146#http://dl-cdn.alpinelinux.org/alpine/edge/community
131147#http://dl-cdn.alpinelinux.org/alpine/edge/testing
132```
133
134#### Install Required Packages
148#+end_src
135149
136Now that the community packages are available, you can install any packages you
137need. In my case, I installed the web server packages I need for my services:
150**** Install Required Packages
151:PROPERTIES:
152:CUSTOM_ID: install-required-packages
153:END:
154Now that the community packages are available, you can install any
155packages you need. In my case, I installed the web server packages I
156need for my services:
138157
139```sh
158#+begin_src sh
140159doas apk add nano nginx docker docker-compose ufw
141```
142
143#### SSH
160#+end_src
144161
145If you didn't install OpenSSH as part of the installation, you can do so now:
162**** SSH
163:PROPERTIES:
164:CUSTOM_ID: ssh
165:END:
166If you didn't install OpenSSH as part of the installation, you can do so
167now:
146168
147```sh
169#+begin_src sh
148170doas apk add openssh
149```
171#+end_src
150172
151Next, either create a new key or copy your SSH key to the server from your
152current machines:
173Next, either create a new key or copy your SSH key to the server from
174your current machines:
153175
154```sh
176#+begin_src sh
155177# Create a new key
156178ssh-keygen
157```
179#+end_src
158180
159181If you need to copy an existing SSH key from a current machine:
160182
161```sh
183#+begin_src sh
162184# Copy key from existing machines
163185ssh-copy-id <username>@<ip_address>
164```
186#+end_src
165187
166#### Firewall
188**** Firewall
189:PROPERTIES:
190:CUSTOM_ID: firewall
191:END:
192Lastly, I installed =ufw= above as my firewall. To set up, default to
193deny incoming and allow outgoing connections. Then selectively allow
194other ports or apps as needed.
167195
168Lastly, I installed `ufw` above as my firewall.
169To set up, default to deny incoming and allow outgoing connections.
170Then selectively allow other ports or apps as needed.
171
172```sh
196#+begin_src sh
173197doas ufw default deny incoming
174198doas ufw default allow outgoing
175199doas ufw allow SSH
176200doas ufw allow "WWW Full"
177201doas ufw allow 9418 # Git server port
178```
179
180#### Change Hostname
202#+end_src
181203
182If you don't like the hostname set during installation, you just need to edit
183two files. First, edit the simple hostname file:
204**** Change Hostname
205:PROPERTIES:
206:CUSTOM_ID: change-hostname
207:END:
208If you don't like the hostname set during installation, you just need to
209edit two files. First, edit the simple hostname file:
184210
185```sh
211#+begin_src sh
186212doas nano /etc/hostname
187```
213#+end_src
188214
189```sh
215#+begin_src sh
190216<hostname>
191```
217#+end_src
192218
193Next, edit the `hosts` file:
219Next, edit the =hosts= file:
194220
195```sh
221#+begin_src sh
196222doas nano /etc/hosts
197```
198
199```sh
200127.0.0.1 <hostname>.local <hostname> localhost.local localhost
201::1 <hostname> <hostname>.local
202```
203
204## Nginx Web Server
205
206To set up my web server, I simply created the `www` user and created the
223#+end_src
224
225#+begin_src sh
226127.0.0.1 <hostname>.local <hostname> localhost.local localhost
227::1 <hostname> <hostname>.local
228#+end_src
229
230** Nginx Web Server
231:PROPERTIES:
232:CUSTOM_ID: nginx-web-server
233:END:
234To set up my web server, I simply created the =www= user and created the
207235necessary files.
208236
209```sh
237#+begin_src sh
210238doas adduser -D -g 'www' www
211239mkdir /www
212240doas mkdir /www
213241doas chown -R www:www /var/lib/nginx/
214242doas chown -R www:www /www
215```
243#+end_src
216244
217If you're running a simple webroot, you can alter the main `nginx.conf` file.
218Otherwise, you can drop configuration files in the following directory. You
219don't need to enable or symlink the configuration file like you do in other
220systems.
245If you're running a simple webroot, you can alter the main =nginx.conf=
246file. Otherwise, you can drop configuration files in the following
247directory. You don't need to enable or symlink the configuration file
248like you do in other systems.
221249
222```sh
250#+begin_src sh
223251doas nano /etc/nginx/http.d/example_website.conf
224```
252#+end_src
225253
226Once the configuration is set and pointed at the `/www` directory to serve
227files, enable the Nginx service:
254Once the configuration is set and pointed at the =/www= directory to
255serve files, enable the Nginx service:
228256
229```sh
257#+begin_src sh
230258# Note that 'default' must be included or Nginx will not start on boot
231259doas rc-update add nginx default
232```
233
234## Docker Containers
235
236Docker works exactly the same as other systems. Either execute a `docker run`
237command or create a `docker-compose.yml` file and do `docker-compose up -d`.
238
239## Git Server
240
241I went in-depth on how to self-host a git server in another post:
242[Self-Hosting a Personal Git Server](/blog/git-server/).
243
244However, there are a few differences with Alpine. First note that in order to
245change the `git` user's shell, you must do a few things a little different:
246
247```sh
260#+end_src
261
262** Docker Containers
263:PROPERTIES:
264:CUSTOM_ID: docker-containers
265:END:
266Docker works exactly the same as other systems. Either execute a
267=docker run= command or create a =docker-compose.yml= file and do
268=docker-compose up -d=.
269
270** Git Server
271:PROPERTIES:
272:CUSTOM_ID: git-server
273:END:
274I went in-depth on how to self-host a git server in another post:
275[[/blog/git-server/][Self-Hosting a Personal Git Server]].
276
277However, there are a few differences with Alpine. First note that in
278order to change the =git= user's shell, you must do a few things a
279little different:
280
281#+begin_src sh
248282doas apk add libuser
249283doas touch /etc/login.defs
250284doas mkdir /etc/default
251285doas touch /etc/default/useradd
252286doas lchsh git
253```
254
255## Thoughts on Alpine
256
257So far, I love Alpine Linux. I have no complaints about anything at this point,
258but I'm not completely finished with the migration yet. Once I'm able to upgrade
259my hardware to a rack-mounted server, I will migrate Plex and Syncthing over to
260Alpine as well - possibly putting Plex into a container or VM.
261
262The performance is stellar, the `apk` package manager is seamless, and system
263administration tasks are effortless. My only regret is that I didn't
264install Alpine sooner.
287#+end_src
288
289** Thoughts on Alpine
290:PROPERTIES:
291:CUSTOM_ID: thoughts-on-alpine
292:END:
293So far, I love Alpine Linux. I have no complaints about anything at this
294point, but I'm not completely finished with the migration yet. Once I'm
295able to upgrade my hardware to a rack-mounted server, I will migrate
296Plex and Syncthing over to Alpine as well - possibly putting Plex into a
297container or VM.
298
299The performance is stellar, the =apk= package manager is seamless, and
300system administration tasks are effortless. My only regret is that I
301didn't install Alpine sooner.
blog/2022-10-30-linux-display-manager.org +65 −58
@@ -1,78 +1,85 @@
1+++
2date = 2022-10-30
3title = "How to Disable or Change the Display Manager on Void Linux"
4description = "Learn how to change the default dm on Void Linux or disable it completely."
5+++
6
7## Display Manager Services
8
9In order to change the [display
10manager](https://en.wikipedia.org/wiki/Display_manager) on Void Linux - or any
11other Linux distro - you need to identify the currently enabled display manager.
12
13### Disabling the Current Display Manager
14
15Void Linux only has one ISO available for download with a pre-built display
16manager at the time of this post: the XFCE ISO. If you've installed this
17version, the pre-assigned display manager is `lxdm`. If you installed another
18display manager, replace `lxdm` in the following command with the display
19manager you have installed.
20
21To disable `lxdm`, simply remove the service symlink:
22
23```sh
1#+title: How to Disable or Change the Display Manager on Void Linux
2#+date: 2022-10-30
3
4** Display Manager Services
5:PROPERTIES:
6:CUSTOM_ID: display-manager-services
7:END:
8In order to change the
9[[https://en.wikipedia.org/wiki/Display_manager][display manager]] on
10Void Linux - or any other Linux distro - you need to identify the
11currently enabled display manager.
12
13*** Disabling the Current Display Manager
14:PROPERTIES:
15:CUSTOM_ID: disabling-the-current-display-manager
16:END:
17Void Linux only has one ISO available for download with a pre-built
18display manager at the time of this post: the XFCE ISO. If you've
19installed this version, the pre-assigned display manager is =lxdm=. If
20you installed another display manager, replace =lxdm= in the following
21command with the display manager you have installed.
22
23To disable =lxdm=, simply remove the service symlink:
24
25#+begin_src sh
2426sudo rm /var/service/lxdm
25```
26
27### Enabling a New Display Manager
28
29If you want to enable a new display manager, you can do so after `lxdm` is
30disabled. Make sure to replace `<new_display_manager>` with your new DM, such as
31`gdm`, `xdm`, etc.
27#+end_src
3228
29*** Enabling a New Display Manager
30:PROPERTIES:
31:CUSTOM_ID: enabling-a-new-display-manager
32:END:
33If you want to enable a new display manager, you can do so after =lxdm=
34is disabled. Make sure to replace =<new_display_manager>= with your new
35DM, such as =gdm=, =xdm=, etc.
3336
34```sh
37#+begin_src sh
3538sudo ln -s /etc/sv/<new_display_manager> /var/service
36```
39#+end_src
3740
38## Set Up `.xinitrc`
41** Set Up =.xinitrc=
42:PROPERTIES:
43:CUSTOM_ID: set-up-.xinitrc
44:END:
45Depending on your setup, you may need to create a few X files, such as
46=~/.xinitrc=. For my personal set-up, I created this file to launch the
47i3wm as my desktop.
3948
40Depending on your setup, you may need to create a few X files, such as
41`~/.xinitrc`. For my personal set-up, I created this file to launch the i3wm as
42my desktop.
43
44```sh
49#+begin_src sh
4550nano ~/.xinitrc
46```
51#+end_src
4752
48```sh
53#+begin_src sh
4954#!/bin/sh
5055
5156exec i3
52```
53
54If you run a desktop other than i3, simply replace `i3` with the shell command
55that launches that desktop.
57#+end_src
5658
57## Set Up Your Shell Profile
59If you run a desktop other than i3, simply replace =i3= with the shell
60command that launches that desktop.
5861
59Finally, in order to automatically launch an X session upon login, you will need
60to edit the `.bash_profile` (bash) or `.zprofile` (zsh) files for your
61shell:
62** Set Up Your Shell Profile
63:PROPERTIES:
64:CUSTOM_ID: set-up-your-shell-profile
65:END:
66Finally, in order to automatically launch an X session upon login, you
67will need to edit the =.bash_profile= (bash) or =.zprofile= (zsh) files
68for your shell:
6269
63```sh
70#+begin_src sh
6471nano ~/.zprofile
65```
72#+end_src
6673
67Add the following snippet to the end of the shell profile file. This will
68execute the `startx` command upon login.
74Add the following snippet to the end of the shell profile file. This
75will execute the =startx= command upon login.
6976
70```sh
77#+begin_src sh
7178if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then
72 exec startx
79 exec startx
7380fi
74```
81#+end_src
7582
76Alternatively, you can ignore this step and simply choose to manually execute
77`startx` upon login. This can be useful if you have issues with your desktop or
78like to manually launch different desktops by choice.
83Alternatively, you can ignore this step and simply choose to manually
84execute =startx= upon login. This can be useful if you have issues with
85your desktop or like to manually launch different desktops by choice.
blog/2022-11-07-matrix-synapse.org +124 −107
@@ -1,103 +1,114 @@
1+++
2date = 2022-11-07
3title = "Self-Hosting Matrix Synapse on Alpine Linux"
4description = "A short guide on how I was able to get Synapse working on Alpine Linux."
5+++
6
7## Synpase
8
9If you're reading this, you likely know that
10[Synapse](https://github.com/matrix-org/synapse/) is a popular
11[Matrix](https://matrix.org/) home server software that allows users to run
12their own Matrix home server.
13
14This post is a short guide describing how I was able to get Synapse working in a
15minimally-usable state on Alpine Linux.
16
17## Installation Process
18
19### Dependencies
20
21First, since there is no Alpine-specific package for Synapse, we need to ensure
22that Alpine has the required dependencies for the Python-based installation
23method.
24
25```sh
1#+title: Self-Hosting Matrix Synapse on Alpine Linux
2#+date: 2022-11-07
3
4** Synpase
5:PROPERTIES:
6:CUSTOM_ID: synpase
7:END:
8If you're reading this, you likely know that
9[[https://github.com/matrix-org/synapse/][Synapse]] is a popular
10[[https://matrix.org/][Matrix]] home server software that allows users
11to run their own Matrix home server.
12
13This post is a short guide describing how I was able to get Synapse
14working in a minimally-usable state on Alpine Linux.
15
16** Installation Process
17:PROPERTIES:
18:CUSTOM_ID: installation-process
19:END:
20*** Dependencies
21:PROPERTIES:
22:CUSTOM_ID: dependencies
23:END:
24First, since there is no Alpine-specific package for Synapse, we need to
25ensure that Alpine has the required dependencies for the Python-based
26installation method.
27
28#+begin_src sh
2629doas apk -U update
2730doas apk add python3 py3-virtualenv
28```
31#+end_src
2932
3033Next, we need to set up a Python virtual environment for Synapse:
3134
32```sh
35#+begin_src sh
3336mkdir -p ~/synapse && cd ~/synapse
3437virtualenv -p python3 ~/synapse/env
3538source ~/synapse/env/bin/activate
3639pip install --upgrade pip
3740pip install --upgrade setuptools
3841pip install matrix-synapse
39```
40
41### Running Synapse
42
43Once installed, running Synapse is easy. Simply execute the following command,
44replacing `example.com` with the domain name that will be used with this
45home server. This will generate the configuration files needed to run the
46server.
47
48```sh
42#+end_src
43
44*** Running Synapse
45:PROPERTIES:
46:CUSTOM_ID: running-synapse
47:END:
48Once installed, running Synapse is easy. Simply execute the following
49command, replacing =example.com= with the domain name that will be used
50with this home server. This will generate the configuration files needed
51to run the server.
52
53#+begin_src sh
4954python -m synapse.app.homeserver \
5055 --server-name example.com \
5156 --config-path homeserver.yaml \
5257 --generate-config \
5358 --report-stats=no
54```
59#+end_src
5560
5661Once the configuration is generated, we can start up the Synapse server:
5762
58```sh
63#+begin_src sh
5964synctl start
60```
65#+end_src
6166
62### Configuring Synapse
67*** Configuring Synapse
68:PROPERTIES:
69:CUSTOM_ID: configuring-synapse
70:END:
71To make any change to Synapse, we need to edit the =YAML= configuration
72file:
6373
64To make any change to Synapse, we need to edit the `YAML` configuration file:
65
66```sh
74#+begin_src sh
6775nano ~/synapse/homeserver.yaml
68```
76#+end_src
6977
70For now, we just need to ensure the `server_name` is accurate. However, there
71are a lot of other configuration options found in the [Configuring
72Synapse](https://matrix-org.github.io/synapse/develop/usage/configuration/config_documentation.html)
73documentation that can be enabled/disabled at any point.
78For now, we just need to ensure the =server_name= is accurate. However,
79there are a lot of other configuration options found in the
80[[https://matrix-org.github.io/synapse/develop/usage/configuration/config_documentation.html][Configuring
81Synapse]] documentation that can be enabled/disabled at any point.
7482
75```yaml
83#+begin_src yaml
7684server_name: "example.com"
77```
85#+end_src
7886
7987Make sure to restart Synapse when you make changes to the configuration:
8088
81```sh
89#+begin_src sh
8290synctl restart
83```
84
85### Nginx Reverse-Proxy
91#+end_src
8692
87To ensure that Synapse is reachable from the public, we need to connect our
88domain to the Synapse server.
89In my case, I use a Nginx reverse-proxy for this purpose.
93*** Nginx Reverse-Proxy
94:PROPERTIES:
95:CUSTOM_ID: nginx-reverse-proxy
96:END:
97To ensure that Synapse is reachable from the public, we need to connect
98our domain to the Synapse server. In my case, I use a Nginx
99reverse-proxy for this purpose.
90100
91101To use Nginx, we need to create a reverse-proxy configuration file:
92102
93```sh
103#+begin_src sh
94104doas nano /etc/nginx/http.d/example.com.conf
95```
105#+end_src
96106
97If you already have TLS certificates for this domain (`example.com`), you can
98simply use the SSL configuration and point toward your TLS certificates.
107If you already have TLS certificates for this domain (=example.com=),
108you can simply use the SSL configuration and point toward your TLS
109certificates.
99110
100```conf
111#+begin_src conf
101112server {
102113 listen 443 ssl http2;
103114 listen [::]:443 ssl http2;
@@ -128,22 +139,23 @@ server {
128139}
129140
130141server {
131 if ($host = example.com) {
132 return 301 https://$host$request_uri;
133 }
142 if ($host = example.com) {
143 return 301 https://$host$request_uri;
144 }
134145
135146 server_name example.com;
136147 listen 80;
137 return 404;
148 return 404;
138149}
139```
150#+end_src
140151
141If you need to generate TLS certificates (I recommend
142[Certbot](https://certbot.eff.org/)), you'll need a more minimal Nginx conf file
143before you can use the TLS-enabled example above. Instead, use this
144configuration file during the Certbot certificate generation process:
152If you need to generate TLS certificates (I recommend
153[[https://certbot.eff.org/][Certbot]]), you'll need a more minimal Nginx
154conf file before you can use the TLS-enabled example above. Instead, use
155this configuration file during the Certbot certificate generation
156process:
145157
146```conf
158#+begin_src conf
147159server {
148160 server_name example.com;
149161 location / {
@@ -151,62 +163,67 @@ server {
151163 }
152164 listen 80;
153165}
154```
166#+end_src
155167
156168Once you're done editing the Nginx conf file, restart Nginx:
157169
158```sh
170#+begin_src sh
159171doas rc-service nginx restart
160```
172#+end_src
161173
162If you still need to generate TLS certificates, run `certbot` now and obtain the
163certificates. Certbot will ask if you want to use a webroot or spin up a
164temporary web server. I **highly** recommend using the temporary web server due
165to the many issues with using a webroot.
174If you still need to generate TLS certificates, run =certbot= now and
175obtain the certificates. Certbot will ask if you want to use a webroot
176or spin up a temporary web server. I *highly* recommend using the
177temporary web server due to the many issues with using a webroot.
166178
167You will need to stop Nginx in order to user the temporary web server option
168with Certbot:
179You will need to stop Nginx in order to user the temporary web server
180option with Certbot:
169181
170```sh
182#+begin_src sh
171183# Stop Nginx so certbot can spin up a temp webserver for cert generation
172184doas rc-service nginx stop
173185doas certbot certonly -v
174186doas rc-service nginx start
175```
176
177### Open Firewall & Router Ports
178
179If you use a firewall on the server, open the `8448` port for discovery and
180federation, as well as the normal web server ports if you're using a reverse
181proxy. If you want additional services, such as voice calls, you will need
182to read the Synapse documentation to see which ports need to be opened for those
183features.
187#+end_src
188
189*** Open Firewall & Router Ports
190:PROPERTIES:
191:CUSTOM_ID: open-firewall-router-ports
192:END:
193If you use a firewall on the server, open the =8448= port for discovery
194and federation, as well as the normal web server ports if you're using a
195reverse proxy. If you want additional services, such as voice calls, you
196will need to read the Synapse documentation to see which ports need to
197be opened for those features.
184198
185199Here's an example of the Universal Firewall (UFW) software:
186200
187```sh
201#+begin_src sh
188202# Matrix port
189203doas ufw allow 8448
190204# Standard web server ports
191205doas ufw allow "Nginx Full"
192```
193
194Remember to forward any Synapse ports, such as `8448`, `80`, and `443`, in your
195Router from the internet to your server's IP address.
206#+end_src
196207
197### Adding Matrix Users
208Remember to forward any Synapse ports, such as =8448=, =80=, and =443=,
209in your Router from the internet to your server's IP address.
198210
199Finally, if you didn't enable public registration in the `homeserver.yaml` file,
200you can manually create users via the command-line:
211*** Adding Matrix Users
212:PROPERTIES:
213:CUSTOM_ID: adding-matrix-users
214:END:
215Finally, if you didn't enable public registration in the
216=homeserver.yaml= file, you can manually create users via the
217command-line:
201218
202```sh
219#+begin_src sh
203220cd ~/synapse
204221register_new_matrix_user -c homeserver.yaml
205```
222#+end_src
206223
207Remember that the format for federated Matrix usernames is
208`@username:example.com` when logging in to client applications.
224Remember that the format for federated Matrix usernames is
225=@username:example.com= when logging in to client applications.
209226
210Once Synapse is running, and you have a username, you are ready to log in to a
211Matrix client and start sending messages, joining rooms, and utilizing your very
212own Matrix server.
227Once Synapse is running, and you have a username, you are ready to log
228in to a Matrix client and start sending messages, joining rooms, and
229utilizing your very own Matrix server.
blog/2022-11-11-nginx-tmp-errors.org +41 −38
@@ -1,58 +1,61 @@
1+++
2date = 2022-11-11
3title = "Fixing Permission Errors in /var/lib/nginx"
4description = "A quick fix for Nginx permission errors on the tmp directory."
5+++
1#+title: Fixing Permission Errors in /var/lib/nginx" description
2#+date: 2022-11-11
63
7*This is a brief post so that I personally remember the solution as it has
8occurred multiple times for me.*
4/This is a brief post so that I personally remember the solution as it
5has occurred multiple times for me./
96
10## The Problem
11
12After migrating to a new server OS, I started receiving quite a few permission
13errors like the one below. These popped up for various different websites I'm
14serving via Nginx on this server, but did not prevent the website from loading.
7** The Problem
8:PROPERTIES:
9:CUSTOM_ID: the-problem
10:END:
11After migrating to a new server OS, I started receiving quite a few
12permission errors like the one below. These popped up for various
13different websites I'm serving via Nginx on this server, but did not
14prevent the website from loading.
1515
1616I found the errors in the standard log file:
1717
18```sh
18#+begin_src sh
1919cat /var/log/nginx/error.log
20```
20#+end_src
2121
22```sh
22#+begin_src sh
23232022/11/11 11:30:34 [crit] 8970#8970: *10 open() "/var/lib/nginx/tmp/proxy/3/00/0000000003" failed (13: Permission denied) while reading upstream, client: 169.150.203.10, server: cyberchef.example.com, request: "GET /assets/main.css HTTP/2.0", upstream: "http://127.0.0.1:8111/assets/main.css", host: "cyberchef.example.com", referrer: "https://cyberchef.example.com/"
24```
24#+end_src
2525
26You can see that the error is `13: Permission denied` and it occurs in the
27`/var/lib/nginx/tmp/` directory. In my case, I had thousands of errors where
28Nginx was denied permission to read/write files in this directory.
26You can see that the error is =13: Permission denied= and it occurs in
27the =/var/lib/nginx/tmp/= directory. In my case, I had thousands of
28errors where Nginx was denied permission to read/write files in this
29directory.
2930
3031So how do I fix it?
3132
32## The Solution
33
34In order to resolve the issue, I had to ensure the `/var/lib/nginx`
35directory is owned by Nginx. Mine was owned by the `www` user and Nginx was not
36able to read or write files within that directory. This prevented Nginx from
37caching temporary files.
33** The Solution
34:PROPERTIES:
35:CUSTOM_ID: the-solution
36:END:
37In order to resolve the issue, I had to ensure the =/var/lib/nginx=
38directory is owned by Nginx. Mine was owned by the =www= user and Nginx
39was not able to read or write files within that directory. This
40prevented Nginx from caching temporary files.
3841
39```sh
42#+begin_src sh
4043# Alpine Linux
4144doas chown -R nginx:nginx /var/lib/nginx
4245
4346# Other Distros
4447sudo chown -R nginx:nginx /var/lib/nginx
45```
48#+end_src
4649
47You *may* also be able to change the `proxy_temp_path` in your Nginx config, but
48I did not try this. Here's a suggestion I found online that may work if the
49above solution does not:
50You /may/ also be able to change the =proxy_temp_path= in your Nginx
51config, but I did not try this. Here's a suggestion I found online that
52may work if the above solution does not:
5053
51```sh
54#+begin_src sh
5255nano /etc/nginx/http.d/example.com.conf
53```
56#+end_src
5457
55```conf
58#+begin_src conf
5659server {
5760 ...
5861
@@ -62,15 +65,15 @@ server {
6265
6366 ...
6467}
65```
68#+end_src
6669
67Finally, restart Nginx and your server should be able to cache temporary files
68again.
70Finally, restart Nginx and your server should be able to cache temporary
71files again.
6972
70```sh
73#+begin_src sh
7174# Alpine Linux (OpenRC)
7275doas rc-service nginx restart
7376
7477# Other Distros (systemd)
7578sudo systemctl restart nginx
76```
79#+end_src
blog/2022-11-27-server-build.org +127 −114
@@ -1,113 +1,124 @@
1+++
2date = 2022-11-27
3title = "Building a Custom Rack-Mount Server"
4description = "I finally built my own custom rack-mounted server after years of indecision."
5+++
6
7## The Dilemma
8
9For years, I have been using desktops and a Raspberry Pi as the backbone of my
10homelab. I have always wanted to move toward a single dedicated server that
11could handle all of my tasks, but was often put off by the complexity of the
12choices (and financial roadblocks at some times).
13
14However, after purchasing a small server rack this past year, I have been
15researching to see what kind of rack-mounted server I could buy. I initially
16bought a Dell R720XD loaded up with everything I could ever want in a server -
17but I did not care for it. It was far too loud, and the age of the CPU/RAM was
18something I wanted to improve upon.
19
20After returning the R720XD, I decided that I wanted to build my own server with
21modern, consumer-grade PC components. This time, I am very happy with the
22results of my server.
23
24## Components
25
1#+title: Building a Custom Rack-Mount Server
2#+date: 2022-11-27
3
4** The Dilemma
5:PROPERTIES:
6:CUSTOM_ID: the-dilemma
7:END:
8For years, I have been using desktops and a Raspberry Pi as the backbone
9of my homelab. I have always wanted to move toward a single dedicated
10server that could handle all of my tasks, but was often put off by the
11complexity of the choices (and financial roadblocks at some times).
12
13However, after purchasing a small server rack this past year, I have
14been researching to see what kind of rack-mounted server I could buy. I
15initially bought a Dell R720XD loaded up with everything I could ever
16want in a server - but I did not care for it. It was far too loud, and
17the age of the CPU/RAM was something I wanted to improve upon.
18
19After returning the R720XD, I decided that I wanted to build my own
20server with modern, consumer-grade PC components. This time, I am very
21happy with the results of my server.
22
23** Components
24:PROPERTIES:
25:CUSTOM_ID: components
26:END:
2627I'll start by listing all the components I used for this server build:
2728
28- **Case**: [Rosewill RSV-R4100U 4U Server Chassis Rackmount
29Case](https://www.rosewill.com/rosewill-rsv-r4100u-black/p/9SIA072GJ92825)
30- **Motherboard**: [NZXT B550](https://nzxt.com/product/n7-b550)
31- **CPU**: AMD Ryzen 7 5700G with Radeon Graphics
32- **GPU**: N/A - I specifically chose one of the few AMD CPUs that support
33onboard graphics.
34- **RAM**: 64GB RAM (2x32GB) _Max of 128GB RAM on this motherboard_
35- **Boot Drive**: Western Digital 500GB M.2 NVME SSD
36- **HDD Bay**:
37 - 10TB WD White _(shucked, moved from previous server)_
38 - 8TB WD White _(shucked, moved from previous server)_
39 - 2 x 8TB WD Red Plus _(Black Friday lined up perfectly with this build, so I
40 grabbed two of these)_
41- **PSU**: Corsair RM850 PSU
42- **Extras**:
29- *Case*:
30 [[https://www.rosewill.com/rosewill-rsv-r4100u-black/p/9SIA072GJ92825][Rosewill
31 RSV-R4100U 4U Server Chassis Rackmount Case]]
32- *Motherboard*: [[https://nzxt.com/product/n7-b550][NZXT B550]]
33- *CPU*: AMD Ryzen 7 5700G with Radeon Graphics
34- *GPU*: N/A - I specifically chose one of the few AMD CPUs that support
35 onboard graphics.
36- *RAM*: 64GB RAM (2x32GB) /Max of 128GB RAM on this motherboard/
37- *Boot Drive*: Western Digital 500GB M.2 NVME SSD
38- *HDD Bay*:
39 - 10TB WD White /(shucked, moved from previous server)/
40 - 8TB WD White /(shucked, moved from previous server)/
41 - 2 x 8TB WD Red Plus /(Black Friday lined up perfectly with this
42 build, so I grabbed two of these)/
43- *PSU*: Corsair RM850 PSU
44- *Extras*:
4345 - Corsair TM3Q Thermal Paste
44 - Noctua 120mm fan _(replacement for front case fan)_
45 - 2 x Noctua 80mm fans _(replacement for rear case fans)_
46 - Noctua 120mm fan /(replacement for front case fan)/
47 - 2 x Noctua 80mm fans /(replacement for rear case fans)/
4648 - CableMatters 6Gbps SATA Cables
4749
48## Building the Server
49
50This took quite a while for me to build (in my opinion of time), totaling
51around 3 hours from start to finish. The case has some peculiar construction, so
52you have to completely remove the ODD & HDD cages to install the motherboard and
53other components first.
54
55Now, I've never built a computer of any kind before, so I was quite
56nervous. Personally, the only challenging part was getting the CPU cooler to
57screw into the motherboard without sliding the thermal paste around too much
58underneath. I'm still not entirely sure if I did a great job of it, but
59nothing's broken yet.
60
61The main components were all fine and simple.
62However, installing the hard drives is slightly tedious as I need to power
63off the server and completely unscrew the HDD cage to install or remove any
64drives.
65Additionally, the drives are screwed directly into the metal cage with small
66screws, which are quite a bit different from the HDD trays I'm used to in
67other machines.
68
69Seeing that the cases with hot-swap bays were 3-4x the price, I'm okay dealing
70with the tedium of removing the cage to install new drives.
71
72## Software
73
74I'm not going to dive into the software as I have done so in other recent posts.
75However, I wanted to note that I am using Alpine Linux on this server and
76hosting most services inside Docker. No virtual machines (VMs) and very few
77bare-metal services.
78
79## The Results
80
81How did my build turn out? Well, after migrating my other servers and their
82services over, I found that my server is blazing fast. The heaviest of my
83applications, Plex, is handled with ease. Even 4k streaming seems to be
84effortless.
85
86I am very happy with the results and will likely continue to improve on this
87server as the years go by rather than buying another used server online.
88
89### Mistakes I Made
90
91This post wouldn't be complete unless I wrote about the mistakes I made while
92building. The only real mistake I made beyond a "whoops I dropped a screw"
93related to airflow and fan direction.
94
95While installing the two new hard drives that showed up on 2022-11-30 and
96getting ready to install the case in my rack, I noticed that the hard drive
97temperatures were quite high.
98
99I used the `smartctl` command for each of my drives (`/dev/sda` through
100`/dev/sdd`):
101
102```sh
50** Building the Server
51:PROPERTIES:
52:CUSTOM_ID: building-the-server
53:END:
54This took quite a while for me to build (in my opinion of time),
55totaling around 3 hours from start to finish. The case has some peculiar
56construction, so you have to completely remove the ODD & HDD cages to
57install the motherboard and other components first.
58
59Now, I've never built a computer of any kind before, so I was quite
60nervous. Personally, the only challenging part was getting the CPU
61cooler to screw into the motherboard without sliding the thermal paste
62around too much underneath. I'm still not entirely sure if I did a great
63job of it, but nothing's broken yet.
64
65The main components were all fine and simple. However, installing the
66hard drives is slightly tedious as I need to power off the server and
67completely unscrew the HDD cage to install or remove any drives.
68Additionally, the drives are screwed directly into the metal cage with
69small screws, which are quite a bit different from the HDD trays I'm
70used to in other machines.
71
72Seeing that the cases with hot-swap bays were 3-4x the price, I'm okay
73dealing with the tedium of removing the cage to install new drives.
74
75** Software
76:PROPERTIES:
77:CUSTOM_ID: software
78:END:
79I'm not going to dive into the software as I have done so in other
80recent posts. However, I wanted to note that I am using Alpine Linux on
81this server and hosting most services inside Docker. No virtual machines
82(VMs) and very few bare-metal services.
83
84** The Results
85:PROPERTIES:
86:CUSTOM_ID: the-results
87:END:
88How did my build turn out? Well, after migrating my other servers and
89their services over, I found that my server is blazing fast. The
90heaviest of my applications, Plex, is handled with ease. Even 4k
91streaming seems to be effortless.
92
93I am very happy with the results and will likely continue to improve on
94this server as the years go by rather than buying another used server
95online.
96
97*** Mistakes I Made
98:PROPERTIES:
99:CUSTOM_ID: mistakes-i-made
100:END:
101This post wouldn't be complete unless I wrote about the mistakes I made
102while building. The only real mistake I made beyond a "whoops I dropped
103a screw" related to airflow and fan direction.
104
105While installing the two new hard drives that showed up on 2022-11-30
106and getting ready to install the case in my rack, I noticed that the
107hard drive temperatures were quite high.
108
109I used the =smartctl= command for each of my drives (=/dev/sda= through
110=/dev/sdd=):
111
112#+begin_src sh
103113doas smartctl -a /dev/sda | grep Temperature_Celsius
104```
114#+end_src
105115
106The results were unusual - all four drives were idling at ~44-46 degrees
107Celsius. The only drive that was cooler was my 10TB drive, which was at 38
108degrees Celsius. I noted that this 10TB drive was also closest to the case fan.
116The results were unusual - all four drives were idling at ~44-46 degrees
117Celsius. The only drive that was cooler was my 10TB drive, which was at
11838 degrees Celsius. I noted that this 10TB drive was also closest to the
119case fan.
109120
110```sh
121#+begin_src sh
111122ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
112123# /dev/sda
113124194 Temperature_Celsius 0x0002 147 147 000 Old_age Always - 44 (Min/Max 22/46)
@@ -117,18 +128,19 @@ ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_
117128194 Temperature_Celsius 0x0002 144 144 000 Old_age Always - 45 (Min/Max 19/61)
118129# /dev/sdd
119130194 Temperature_Celsius 0x0002 171 171 000 Old_age Always - 38 (Min/Max 14/56)
120```
131#+end_src
121132
122After looking to see if I could fit more fans into the case, I noticed that the
123120mm fan used for intake from the front of the case was actually pushing air
124out of the case by mistake. This fan sits right in front of the hard drive bay.
133After looking to see if I could fit more fans into the case, I noticed
134that the 120mm fan used for intake from the front of the case was
135actually pushing air out of the case by mistake. This fan sits right in
136front of the hard drive bay.
125137
126Once I flipped the fan around to act as an intake fan, the temperatures dropped
127immediately! They are now idling at ~31-33 degrees Celsius. A single fan
128spinning the wrong way caused my drives to idle 10-15 degrees higher than they
129should have.
138Once I flipped the fan around to act as an intake fan, the temperatures
139dropped immediately! They are now idling at ~31-33 degrees Celsius. A
140single fan spinning the wrong way caused my drives to idle 10-15 degrees
141higher than they should have.
130142
131```sh
143#+begin_src sh
132144ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
133145# /dev/sda
134146194 Temperature_Celsius 0x0002 209 209 000 Old_age Always - 31 (Min/Max 14/56)
@@ -138,7 +150,8 @@ ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_
138150194 Temperature_Celsius 0x0002 203 203 000 Old_age Always - 32 (Min/Max 21/48)
139151# /dev/sdd
140152194 Temperature_Celsius 0x0002 196 196 000 Old_age Always - 33 (Min/Max 22/46)
141```
153#+end_src
142154
143This was a silly error to make, but I'm glad I found it today before I screwed
144the case into the rack and made things a lot more tedious to fix.
155This was a silly error to make, but I'm glad I found it today before I
156screwed the case into the rack and made things a lot more tedious to
157fix.
blog/2022-11-29-nginx-referrer-ban-list.org +71 −65
@@ -1,26 +1,24 @@
1+++
2date = 2022-11-29
3title = "Creating a Referrer Ban List on Nginx"
4description = "A quick explanation detailing my own way of banning referral domains on Nginx."
5+++
1#+title: Creating a Referrer Ban List on Nginx
2#+date: 2022-11-29
63
7## Creating the Ban List
8
9In order to ban list referral domains or websites with Nginx, you need to
10create a ban list file.
11The file below will accept regexes for different domains or websites you
12wish to block.
4** Creating the Ban List
5:PROPERTIES:
6:CUSTOM_ID: creating-the-ban-list
7:END:
8In order to ban list referral domains or websites with Nginx, you need
9to create a ban list file. The file below will accept regexes for
10different domains or websites you wish to block.
1311
1412First, create the file in your nginx directory:
1513
16```sh
14#+begin_src sh
1715doas nano /etc/nginx/banlist.conf
18```
16#+end_src
1917
20Next, paste the following contents in and fill out the regexes with whichever
21domains you're blocking.
18Next, paste the following contents in and fill out the regexes with
19whichever domains you're blocking.
2220
23```conf
21#+begin_src conf
2422# /etc/nginx/banlist.conf
2523
2624map $http_referer $bad_referer {
@@ -31,21 +29,23 @@ map $http_referer $bad_referer {
3129 # Put regexes for undesired referrers here
3230 "~news.ycombinator.com" 1;
3331}
34```
35
36## Configuring Nginx
32#+end_src
3733
38In order for the ban list to work, Nginx needs to know it exists and how to
39handle it. For this, edit the `nginx.conf` file.
34** Configuring Nginx
35:PROPERTIES:
36:CUSTOM_ID: configuring-nginx
37:END:
38In order for the ban list to work, Nginx needs to know it exists and how
39to handle it. For this, edit the =nginx.conf= file.
4040
41```sh
41#+begin_src sh
4242doas nano /etc/nginx/nginx.conf
43```
43#+end_src
4444
45Within this file, find the `http` block and add your ban list file location to
46the end of the block.
45Within this file, find the =http= block and add your ban list file
46location to the end of the block.
4747
48```conf
48#+begin_src conf
4949# /etc/nginx/nginx.conf
5050
5151http {
@@ -54,29 +54,31 @@ http {
5454 # Include ban list
5555 include /etc/nginx/banlist.conf;
5656}
57```
58
59## Enabling the Ban List
60
61Finally, we need to take action when a bad referral site is found. To do so,
62edit the configuration file for your website. For example, I have all website
63configuration files in the `http.d` directory. You may have them in the
64`sites-available` directory on some distributions.
65
66```sh
57#+end_src
58
59** Enabling the Ban List
60:PROPERTIES:
61:CUSTOM_ID: enabling-the-ban-list
62:END:
63Finally, we need to take action when a bad referral site is found. To do
64so, edit the configuration file for your website. For example, I have
65all website configuration files in the =http.d= directory. You may have
66them in the =sites-available= directory on some distributions.
67
68#+begin_src sh
6769doas nano /etc/nginx/http.d/example.com.conf
68```
70#+end_src
6971
70Within each website's configuration file, edit the `server` blocks that are
71listening to ports 80 and 443 and create a check for the `$bad_referrer`
72variable we created in the ban list file.
72Within each website's configuration file, edit the =server= blocks that
73are listening to ports 80 and 443 and create a check for the
74=$bad_referrer= variable we created in the ban list file.
7375
74If a matching site is found, you can return any [HTTP Status
75Code](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) you want. Code
76403 (Forbidden) is logical in this case since you are preventing a client
77connection due to a banned domain.
76If a matching site is found, you can return any
77[[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes][HTTP Status
78Code]] you want. Code 403 (Forbidden) is logical in this case since you
79are preventing a client connection due to a banned domain.
7880
79```conf
81#+begin_src conf
8082server {
8183 ...
8284
@@ -87,42 +89,46 @@ server {
8789
8890 ...
8991}
90```
91
92## Restart Nginx
92#+end_src
9393
94** Restart Nginx
95:PROPERTIES:
96:CUSTOM_ID: restart-nginx
97:END:
9498Lastly, restart Nginx to enable all changes made.
9599
96```sh
100#+begin_src sh
97101doas rc-service nginx restart
98```
99
100## Testing Results
102#+end_src
101103
102In order to test the results, let's curl the contents of our site. To start,
103I'll curl the site normally:
104** Testing Results
105:PROPERTIES:
106:CUSTOM_ID: testing-results
107:END:
108In order to test the results, let's curl the contents of our site. To
109start, I'll curl the site normally:
104110
105```sh
111#+begin_src sh
106112curl https://cleberg.net
107```
113#+end_src
108114
109115The HTML contents of the page come back successfully:
110116
111```html
117#+begin_src html
112118<!doctype html>...</html>
113```
119#+end_src
114120
115121Next, let's include a banned referrer:
116122
117```sh
123#+begin_src sh
118124curl --referer https://news.ycombinator.com https://cleberg.net
119```
125#+end_src
120126
121This time, I'm met with a 403 Forbidden response page. That means we are
122successful and any clients being referred from a banned domain will be met
123with this same response code.
127This time, I'm met with a 403 Forbidden response page. That means we are
128successful and any clients being referred from a banned domain will be
129met with this same response code.
124130
125```html
131#+begin_src html
126132<html>
127133<head><title>403 Forbidden</title></head>
128134<body>
@@ -130,4 +136,4 @@ with this same response code.
130136<hr><center>nginx</center>
131137</body>
132138</html>
133```
139#+end_src
blog/2022-12-01-nginx-compression.org +59 −50
@@ -1,40 +1,44 @@
1+++
2date = 2022-12-01
3title = "Enable GZIP Compression on Nginx"
4desciption = "Enable gzip compression on Nginx to server small text-based resources faster."
5+++
1#+title: Enable GZIP Compression on Nginx
2#+date: 2022-12-01
63
7## Text Compression
4** Text Compression
5:PROPERTIES:
6:CUSTOM_ID: text-compression
7:ID: 24C2F6E7-129E-42F3-91F0-A6C6C519FA01
8:END:
9Text compression allows a web server to serve text-based resources
10faster than uncompressed data. This can speed up things like First
11Contentful Paint, Tie to Interactive, and Speed Index.
812
9Text compression allows a web server to serve text-based resources faster than
10uncompressed data. This can speed up things like First Contentful Paint, Tie to
11Interactive, and Speed Index.
13** Enable Nginx Compression with gzip
14:PROPERTIES:
15:CUSTOM_ID: enable-nginx-compression-with-gzip
16:ID: C018C991-E253-4779-A702-AEB69614499F
17:END:
18In order to enable text compression on Nginx, we need to enable it
19within the configuration file:
1220
13## Enable Nginx Compression with gzip
14
15In order to enable text compression on Nginx, we need to enable it within the
16configuration file:
17
18```sh
21#+begin_src sh
1922nano /etc/nginx/nginx.conf
20```
23#+end_src
2124
22Within the `http` block, find the section that shows something like the block
23below. This is the default gzip configuration I found in my `nginx.conf` file on
24Alpine Linux 3.17. Yours may look slightly different, just make sure that
25you're not creating any duplicate gzip options.
25Within the =http= block, find the section that shows something like the
26block below. This is the default gzip configuration I found in my
27=nginx.conf= file on Alpine Linux 3.17. Yours may look slightly
28different, just make sure that you're not creating any duplicate gzip
29options.
2630
27```conf
31#+begin_src conf
2832# Enable gzipping of responses.
2933#gzip on;
3034
3135# Set the Vary HTTP header as defined in the RFC 2616. Default is 'off'.
3236gzip_vary on;
33```
37#+end_src
3438
3539Remove the default gzip lines and replace them with the following:
3640
37```conf
41#+begin_src conf
3842# Enable gzipping of responses.
3943gzip on;
4044gzip_vary on;
@@ -42,33 +46,38 @@ gzip_min_length 10240;
4246gzip_proxied expired no-cache no-store private auth;
4347gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
4448gzip_disable "MSIE [1-6]\.";
45```
46
47## Explanations of ngx_http_gzip_module Options
48
49Each of the lines above enables a different aspect of the gzip response for
50Nginx. Here are the full explanations:
49#+end_src
5150
51** Explanations of ngx_http_gzip_module Options
52:PROPERTIES:
53:CUSTOM_ID: explanations-of-ngx_http_gzip_module-options
54:ID: C180752B-E1B9-49A5-B180-84488068A76A
55:END:
56Each of the lines above enables a different aspect of the gzip response
57for Nginx. Here are the full explanations:
5258
53- `gzip` – Enables or disables gzipping of responses.
54- `gzip_vary` – Enables or disables inserting the “Vary: Accept-Encoding”
55response header field if the directives gzip, gzip_static, or gunzip are active.
56- `gzip_min_length` – Sets the minimum length of a response that will be
57gzipped. The length is determined only from the “Content-Length” response header field.
58- `gzip_proxied` – Enables or disables gzipping of responses for proxied
59requests depending on the request and response. The fact that the request is
60proxied is determined by the presence of the “Via” request header field.
61- `gzip_types` – Enables gzipping of responses for the specified MIME types in
62addition to “text/html”. The special value “*” matches any MIME type (0.8.29).
63Responses with the “text/html” type are always compressed.
64- `gzip_disable` – Disables gzipping of responses for requests
65with “User-Agent” header fields matching any of the specified regular
66expressions.
67 - The special mask “msie6” (0.7.12) corresponds to the regular expression “MSIE
68[4-6]\.”, but works faster. Starting from version 0.8.11, “MSIE 6.0; ... SV1” is
69excluded from this mask.
59- =gzip= -- Enables or disables gzipping of responses.
60- =gzip_vary= -- Enables or disables inserting the "Vary:
61 Accept-Encoding" response header field if the directives gzip,
62 gzip_static, or gunzip are active.
63- =gzip_min_length= -- Sets the minimum length of a response that will
64 be gzipped. The length is determined only from the "Content-Length"
65 response header field.
66- =gzip_proxied= -- Enables or disables gzipping of responses for
67 proxied requests depending on the request and response. The fact that
68 the request is proxied is determined by the presence of the "Via"
69 request header field.
70- =gzip_types= -- Enables gzipping of responses for the specified MIME
71 types in addition to "text/html". The special value “*” matches any
72 MIME type (0.8.29). Responses with the "text/html" type are always
73 compressed.
74- =gzip_disable= -- Disables gzipping of responses for requests with
75 "User-Agent" header fields matching any of the specified regular
76 expressions.
77 - The special mask "msie6" (0.7.12) corresponds to the regular
78 expression "MSIE [4-6].", but works faster. Starting from version
79 0.8.11, "MSIE 6.0; ... SV1" is excluded from this mask.
7080
71More information on these directives and their options can be found on the
72[Module
73ngx_http_gzip_module](https://nginx.org/en/docs/http/ngx_http_gzip_module.html)
74page in Nginx's documentation.
81More information on these directives and their options can be found on
82the [[https://nginx.org/en/docs/http/ngx_http_gzip_module.html][Module
83ngx_http_gzip_module]] page in Nginx's documentation.
blog/2022-12-07-nginx-wildcard-redirect.org +60 −56
@@ -1,25 +1,26 @@
1+++
2date = 2022-12-07
3title = "Redirect Nginx Subdomains & Trailing Content with Regex"
4description= "You can easily redirect Nginx traffic from subdomains and TLDs to a new domain while preserving trailing content."
5+++
6
7## Problem
8
9I recently migrated domains and replaced the
10old webpage with a simple info page with instructions to users on how
11to edit their bookmarks and URLs to get to the page they were seeking.
12
13This was not ideal as it left the work up to the user and may have caused
14friction for users who accessed my RSS feed.
15
16## Solution
17
18Instead, I finally found a solution that allows me to redirect both subdomains
19AND trailing content. For example, both of these URLs now redirect properly
20using the logic I'll explain below:
21
22```txt
1#+title: Redirect Nginx Subdomains & Trailing Content with Regex
2#+date: 2022-12-07
3
4** Problem
5:PROPERTIES:
6:CUSTOM_ID: problem
7:END:
8I recently migrated domains and replaced the old webpage with a simple
9info page with instructions to users on how to edit their bookmarks and
10URLs to get to the page they were seeking.
11
12This was not ideal as it left the work up to the user and may have
13caused friction for users who accessed my RSS feed.
14
15** Solution
16:PROPERTIES:
17:CUSTOM_ID: solution
18:END:
19Instead, I finally found a solution that allows me to redirect both
20subdomains AND trailing content. For example, both of these URLs now
21redirect properly using the logic I'll explain below:
22
23#+begin_src txt
2324# Example 1 - Simple base domain redirect with trailing content
2425https://domain1.com/blog/alpine-linux/ -> https://domain2.com/blog/alpine-linux/
2526
@@ -27,23 +28,25 @@ https://domain1.com/blog/alpine-linux/ -> https://domain2.com/blog/alpine-linux/
2728https://libreddit.domain1.com/r/history/comments/7z8cbg/new_discovery_mode_turns_video_game_assassins/
2829->
2930https://libreddit.domain2.com/r/history/comments/7z8cbg/new_discovery_mode_turns_video_game_assassins/
30```
31#+end_src
3132
3233Go ahead, try the URLs if you want to test them.
3334
34### Nginx Config
35*** Nginx Config
36:PROPERTIES:
37:CUSTOM_ID: nginx-config
38:END:
39To make this possible. I needed to configure a proper redirect scheme in
40my Nginx configuration.
3541
36To make this possible. I needed to configure a proper redirect scheme in my
37Nginx configuration.
38
39```sh
42#+begin_src sh
4043doas nano /etc/nginx/http.d/domain1.conf
41```
44#+end_src
4245
43Within this file, I had one block configured to redirect HTTP requests to HTTPS
44for the base domain and all subdomains.
46Within this file, I had one block configured to redirect HTTP requests
47to HTTPS for the base domain and all subdomains.
4548
46```conf
49#+begin_src conf
4750server {
4851 listen [::]:80;
4952 listen 80;
@@ -59,13 +62,14 @@ server {
5962
6063 return 404;
6164}
62```
65#+end_src
6366
64For the base domain, I have another `server` block dedicated to redirecting all
65base domain requests. You can see that the `rewrite` line is instructing Nginx
66to gather all trailing content and append it to the new `domain2.com` URL.
67For the base domain, I have another =server= block dedicated to
68redirecting all base domain requests. You can see that the =rewrite=
69line is instructing Nginx to gather all trailing content and append it
70to the new =domain2.com= URL.
6771
68```conf
72#+begin_src conf
6973server {
7074 listen [::]:443 ssl http2;
7175 listen 443 ssl http2;
@@ -77,20 +81,21 @@ server {
7781 ssl_certificate /etc/letsencrypt/live/domain1.com/fullchain.pem;
7882 ssl_certificate_key /etc/letsencrypt/live/domain1.com/privkey.pem;
7983}
80```
84#+end_src
8185
82Finally, the tricky part is figuring out how to tell Nginx to redirect while
83keeping both a subdomain and trailing content intact. I found that the easiest
84way to do this is to give it a `server` block of its own.
86Finally, the tricky part is figuring out how to tell Nginx to redirect
87while keeping both a subdomain and trailing content intact. I found that
88the easiest way to do this is to give it a =server= block of its own.
8589
86Within this block, we need to do some regex on the `server_name` line before we
87can rewrite anything. This creates a variable called `subdomain`.
90Within this block, we need to do some regex on the =server_name= line
91before we can rewrite anything. This creates a variable called
92=subdomain=.
8893
89Once the server gets to the `rewrite` line, it pulls the `subdomain` variable
90from above and uses it on the new `domain2.com` domain before appending the
91trailing content (`$request_uri`).
94Once the server gets to the =rewrite= line, it pulls the =subdomain=
95variable from above and uses it on the new =domain2.com= domain before
96appending the trailing content (=$request_uri=).
9297
93```conf
98#+begin_src conf
9499server {
95100 listen [::]:443 ssl http2;
96101 listen 443 ssl http2;
@@ -102,18 +107,17 @@ server {
102107 ssl_certificate /etc/letsencrypt/live/domain1.com/fullchain.pem;
103108 ssl_certificate_key /etc/letsencrypt/live/domain1.com/privkey.pem;
104109}
105```
110#+end_src
106111
107That's all there is to it. With this, I simply restarted Nginx and watched the
108redirections work in-action.
112That's all there is to it. With this, I simply restarted Nginx and
113watched the redirections work in-action.
109114
110```sh
115#+begin_src sh
111116doas rc-service nginx restart
112```
113
117#+end_src
114118
115Looking back on it, I wish I had done this sooner. Who knows how many people
116went looking for my sites or bookmarks and gave up when they saw the redirect
117instructions page.
119Looking back on it, I wish I had done this sooner. Who knows how many
120people went looking for my sites or bookmarks and gave up when they saw
121the redirect instructions page.
118122
119123Oh well, it's done now. Live and learn.
blog/2022-12-17-st.org +71 −60
@@ -1,89 +1,100 @@
1+++
2date = 2022-12-17
3title = "Simple Terminal"
4description = "An easy guide on how to build st on Fedora Workstation."
5+++
6
7## st
8
9[st](https://st.suckless.org) standards for Simple Terminal, a simple terminal
10implementation for X made by the [suckless](https://suckless.org) team.
11
12This post walks through the dependencies needed and process to build and install
13`st` on Fedora Workstation.
14
15### Obtain Files
16
17To start, obtain the source files for `st` via `git clone`.
18
19```sh
1#+title: Simple Terminal
2#+date: 2022-12-17
3
4** st
5:PROPERTIES:
6:CUSTOM_ID: st
7:END:
8[[https://st.suckless.org][st]] standards for Simple Terminal, a simple
9terminal implementation for X made by the
10[[https://suckless.org][suckless]] team.
11
12This post walks through the dependencies needed and process to build and
13install =st= on Fedora Workstation.
14
15*** Obtain Files
16:PROPERTIES:
17:CUSTOM_ID: obtain-files
18:END:
19To start, obtain the source files for =st= via =git clone=.
20
21#+begin_src sh
2022mkdir ~/suckless && cd ~/suckless
2123git clone https://git.suckless.org/st && cd st
22```
23
24### Dependencies
24#+end_src
2525
26Once you have the files and are in the `st` directory, ensure the following
27packages are installed.
26*** Dependencies
27:PROPERTIES:
28:CUSTOM_ID: dependencies
29:END:
30Once you have the files and are in the =st= directory, ensure the
31following packages are installed.
2832
29```sh
33#+begin_src sh
3034sudo dnf update && sudo dnf upgrade
3135sudo dnf install gcc patch libX11-devel libXft-devel
32```
33
34### Building
36#+end_src
3537
38*** Building
39:PROPERTIES:
40:CUSTOM_ID: building
41:END:
3642Before building, ensure that you read the README file.
3743
38```sh
44#+begin_src sh
3945cat README
40```
46#+end_src
4147
42Once you've read the instructions, open the `config.mk` file and ensure it
43matches your setup. If you're not sure, leave the default options within the
44file.
48Once you've read the instructions, open the =config.mk= file and ensure
49it matches your setup. If you're not sure, leave the default options
50within the file.
4551
46Finally, you can build `st` with the following command. Ensure you run as root
47(e.g., `sudo`) or else you may not end up with a usable application file.
52Finally, you can build =st= with the following command. Ensure you run
53as root (e.g., =sudo=) or else you may not end up with a usable
54application file.
4855
49```sh
56#+begin_src sh
5057sudo make clean install
51```
52
53### Customization (Patches)
58#+end_src
5459
55Note that customizing `st` requires you to modify the source files or to
56download one of the [available patches](https://st.suckless.org/patches/) for
57suckless.org.
60*** Customization (Patches)
61:PROPERTIES:
62:CUSTOM_ID: customization-patches
63:END:
64Note that customizing =st= requires you to modify the source files or to
65download one of the [[https://st.suckless.org/patches/][available
66patches]] for suckless.org.
5867
59If you've already installed `st` and want to customize or install a patch, start
60by uninstalling the current program.
68If you've already installed =st= and want to customize or install a
69patch, start by uninstalling the current program.
6170
62```sh
71#+begin_src sh
6372cd ~/suckless/st
6473sudo make uninstall
65```
74#+end_src
6675
67Next, grab the `<path>.diff` file from the page of the patch you chose. For
68example, I will be using the
69[defaultfontsize](https://st.suckless.org/patches/defaultfontsize/) patch in the below example.
76Next, grab the =<path>.diff= file from the page of the patch you chose.
77For example, I will be using the
78[[https://st.suckless.org/patches/defaultfontsize/][defaultfontsize]]
79patch in the below example.
7080
71```sh
81#+begin_src sh
7282wget https://st.suckless.org/patches/defaultfontsize/st-defaultfontsize-20210225-4ef0cbd.diff
73```
83#+end_src
7484
75Once the file is downloaded inside the `st` folder, apply the patch and
76re-install the program. You may need to install the `patch` command if you don't
77have it installed already (you should have installed it above).
85Once the file is downloaded inside the =st= folder, apply the patch and
86re-install the program. You may need to install the =patch= command if
87you don't have it installed already (you should have installed it
88above).
7889
79```sh
90#+begin_src sh
8091patch -i st-defaultfontsize-20210225-4ef0cbd.diff
8192sudo make clean install
82```
93#+end_src
8394
84Once installed, you can use the default font size patch to launch `st` with any
85font size you wish:
95Once installed, you can use the default font size patch to launch =st=
96with any font size you wish:
8697
87```sh
98#+begin_src sh
8899st -z 16
89```
100#+end_src
blog/2022-12-23-alpine-desktop.org +141 −125
@@ -1,89 +1,95 @@
1+++
2date = 2022-12-23
3title = "Alpine Linux as a Desktop OS"
4description = "Documenting my steps to a useable Alpine Linux desktop experience."
5+++
6
7## Isn't Alpine Linux for Servers?
8
9This is a question I see a lot when people are presented with an example of
10Alpine Linux running as a desktop OS.
11
12While Alpine is small, fast, and minimal, that doesn't stop it from functioning
13at a productive level for desktop users.
14
15This post is documentation of how I installed and modified Alpine Linux to
16become my daily desktop OS.
17
18## Installation
19
20Note that I cover the installation of Alpine Linux in my other post, so I
21won't repeat it here: [Alpine Linux: My New Server OS](/blog/alpine-linux/).
22
23Basically, get a bootable USB or whatever you prefer with Alpine on it, boot the
24ISO, and run the setup script.
25
26```sh
1#+title: Alpine Linux as a Desktop OS
2#+date: 2022-12-23
3
4** Isn't Alpine Linux for Servers?
5:PROPERTIES:
6:CUSTOM_ID: isnt-alpine-linux-for-servers
7:END:
8This is a question I see a lot when people are presented with an example
9of Alpine Linux running as a desktop OS.
10
11While Alpine is small, fast, and minimal, that doesn't stop it from
12functioning at a productive level for desktop users.
13
14This post is documentation of how I installed and modified Alpine Linux
15to become my daily desktop OS.
16
17** Installation
18:PROPERTIES:
19:CUSTOM_ID: installation
20:END:
21Note that I cover the installation of Alpine Linux in my other post, so
22I won't repeat it here: [[/blog/alpine-linux/][Alpine Linux: My New
23Server OS]].
24
25Basically, get a bootable USB or whatever you prefer with Alpine on it,
26boot the ISO, and run the setup script.
27
28#+begin_src sh
2729setup-alpine
28```
30#+end_src
2931
30Once you have gone through all the options and installer finishes without
31errors, reboot.
32Once you have gone through all the options and installer finishes
33without errors, reboot.
3234
33```sh
35#+begin_src sh
3436reboot
35```
36
37## Initial Setup
38
39Once Alpine is installed and the machine has rebooted, login is as root
40initially or `su` to root once you log in as your user.
41From here, you should start by updating and upgrading the system in case the
42ISO was not fully up-to-date.
43
44```sh
37#+end_src
38
39** Initial Setup
40:PROPERTIES:
41:CUSTOM_ID: initial-setup
42:END:
43Once Alpine is installed and the machine has rebooted, login is as root
44initially or =su= to root once you log in as your user. From here, you
45should start by updating and upgrading the system in case the ISO was
46not fully up-to-date.
47
48#+begin_src sh
4549# Update and upgrade system
4650apk -U update && apk -U upgrade
4751
4852# Add an editor so we can enable the community repository
4953apk add nano
50```
54#+end_src
5155
52You need to uncomment the `community` repository for your version of Alpine
53Linux.
56You need to uncomment the =community= repository for your version of
57Alpine Linux.
5458
55For v3.17, the `repositories` file should look like this:
59For v3.17, the =repositories= file should look like this:
5660
57```sh
61#+begin_src sh
5862nano /etc/apk/repositories
59```
63#+end_src
6064
61```conf
65#+begin_src conf
6266#/media/sda/apks
6367http://mirrors.gigenet.com/alpinelinux/v3.17/main
6468http://mirrors.gigenet.com/alpinelinux/v3.17/community
6569#http://mirrors.gigenet.com/alpinelinux/edge/main
6670#http://mirrors.gigenet.com/alpinelinux/edge/community
6771#http://mirrors.gigenet.com/alpinelinux/edge/testing
68```
72#+end_src
6973
70```sh
74#+begin_src sh
7175# Add the rest of your packages
7276apk add linux-firmware iwd doas git curl wget
7377
7478# Add yourself to the wheel group so you can use the doas command
7579adduser $USER wheel
76```
77
78## Window Manager (Desktop)
80#+end_src
7981
80The [Sway installation guide](https://wiki.alpinelinux.org/wiki/Sway) has
81everything you need to get Sway working on Alpine.
82** Window Manager (Desktop)
83:PROPERTIES:
84:CUSTOM_ID: window-manager-desktop
85:END:
86The [[https://wiki.alpinelinux.org/wiki/Sway][Sway installation guide]]
87has everything you need to get Sway working on Alpine.
8288
83However, I'll include a brief list of the commands I ran and their purpose for
84posterity here.
89However, I'll include a brief list of the commands I ran and their
90purpose for posterity here.
8591
86```sh
92#+begin_src sh
8793# Add eudev and set it up
8894apk add eudev
8995setup-devd udev
@@ -120,21 +126,21 @@ apk add \ # Install optional dependencies:
120126 swaylock swaylockd \ # lockscreen tool
121127 swaybg \ # wallpaper daemon
122128 swayidle # idle management (DPMS) daemon
123```
129#+end_src
124130
125Once you have the packages installed and set-up, you need to export the
126`XDG_RUNTIME_DIR` upon login. To do this, edit your `.profile` file.
131Once you have the packages installed and set-up, you need to export the
132=XDG_RUNTIME_DIR= upon login. To do this, edit your =.profile= file.
127133
128If you use another shell, such as `zsh`, you need to edit that shell's profile
129(e.g., `~/.zprofile`)!
134If you use another shell, such as =zsh=, you need to edit that shell's
135profile (e.g., =~/.zprofile=)!
130136
131```sh
137#+begin_src sh
132138nano ~/.profile
133```
139#+end_src
134140
135141Within the file, paste this:
136142
137```sh
143#+begin_src sh
138144if test -z "${XDG_RUNTIME_DIR}"; then
139145 export XDG_RUNTIME_DIR=/tmp/$(id -u)-runtime-dir
140146 if ! test -d "${XDG_RUNTIME_DIR}"; then
@@ -142,19 +148,22 @@ if test -z "${XDG_RUNTIME_DIR}"; then
142148 chmod 0700 "${XDG_RUNTIME_DIR}"
143149 fi
144150fi
145```
151#+end_src
146152
147153Once that's complete, you can launch Sway manually.
148154
149```sh
155#+begin_src sh
150156dbus-run-session -- sway
151```
152
153## Personal Touches
157#+end_src
154158
155I also added the following packages, per my personal preferences and situation.
159** Personal Touches
160:PROPERTIES:
161:CUSTOM_ID: personal-touches
162:END:
163I also added the following packages, per my personal preferences and
164situation.
156165
157```sh
166#+begin_src sh
158167doas apk add brightnessctl \ # Brightness controller
159168 zsh \ # Shell
160169 firefox \ # Browser
@@ -164,91 +173,98 @@ doas apk add brightnessctl \ # Brightness controller
164173 neomutt \ # CLI email client
165174 thunderbird \ # GUI email client
166175 gnupg # GPG key manager
167```
168
169From here, I use my Syncthing storage to pull all the configuration files I
170stored from prior desktops, such as [my
171dotfiles](https://git.sr.ht/~cmc/dotfiles).
172
173## Resolving Issues
174
175### WiFi Issues
176
177I initially tried to set up my Wi-Fi the standard way with `iwd`, but it didn't
178work.
179
180Here is what I initially tried (I did all of this as `root`):
181
182```sh
176#+end_src
177
178From here, I use my Syncthing storage to pull all the configuration
179files I stored from prior desktops, such as
180[[https://git.sr.ht/~cmc/dotfiles][my dotfiles]].
181
182** Resolving Issues
183:PROPERTIES:
184:CUSTOM_ID: resolving-issues
185:END:
186*** WiFi Issues
187:PROPERTIES:
188:CUSTOM_ID: wifi-issues
189:END:
190I initially tried to set up my Wi-Fi the standard way with =iwd=, but it
191didn't work.
192
193Here is what I initially tried (I did all of this as =root=):
194
195#+begin_src sh
183196apk add iwd
184197rc-service iwd start
185198iwctl station wlan0 connect <SSID> # This will prompt for the password
186199rc-update add iwd boot && rc-update add dbus boot
187```
200#+end_src
188201
189Then, I added the Wi-Fi entry to the bottom of the networking interface file:
202Then, I added the Wi-Fi entry to the bottom of the networking interface
203file:
190204
191```sh
205#+begin_src sh
192206nano /etc/network/interfaces
193```
207#+end_src
194208
195```conf
209#+begin_src conf
196210auto wlan0
197211iface wlan0 inet dhcp
198```
212#+end_src
199213
200214Finally, restart the networking service:
201215
202```sh
216#+begin_src sh
203217rc-service networking restart
204```
218#+end_src
205219
206My Wi-Fi interface would receive an IP address from the router, but it could
207not ping anything in the network.
208To solve the Wi-Fi issues, I originally upgraded to Alpine's `edge`
209repositories, which was unnecessary.
220My Wi-Fi interface would receive an IP address from the router, but it
221could not ping anything in the network. To solve the Wi-Fi issues, I
222originally upgraded to Alpine's =edge= repositories, which was
223unnecessary.
210224
211Really, the solution was to enable the `NameResolvingService=resolvconf` in
212`/etc/iwd/main.conf`.
225Really, the solution was to enable the =NameResolvingService=resolvconf=
226in =/etc/iwd/main.conf=.
213227
214```sh
228#+begin_src sh
215229doas nano /etc/iwd/main.conf
216```
230#+end_src
217231
218```conf
232#+begin_src conf
219233[Network]
220234
221235NameResolvingService=resolvconf
222```
236#+end_src
223237
224238Once I finished this process, my Wi-Fi is working flawlessly.
225239
226### Sound Issues
227
228Same as with the Wi-Fi, I had no sound and could not control the mute/unmute or
229volume buttons on my laptop.
240*** Sound Issues
241:PROPERTIES:
242:CUSTOM_ID: sound-issues
243:END:
244Same as with the Wi-Fi, I had no sound and could not control the
245mute/unmute or volume buttons on my laptop.
230246
231To resolve this, I installed
232[pipewire](https://wiki.alpinelinux.org/wiki/PipeWire).
247To resolve this, I installed
248[[https://wiki.alpinelinux.org/wiki/PipeWire][pipewire]].
233249
234```sh
250#+begin_src sh
235251# Add your user to the following groups
236252addgroup $USER audio
237253addgroup $USER video
238254
239255# Install pipewire and other useful packages
240256apk add pipewire wireplumber pipewire-pulse pipewire-jack pipewire-alsa
241```
257#+end_src
242258
243Finally, I needed to add `/usr/libexec/pipewire-launcher` to my
244`.config/sway/config` file so that Pipewire would run every time I launched
245sway.
259Finally, I needed to add =/usr/libexec/pipewire-launcher= to my
260=.config/sway/config= file so that Pipewire would run every time I
261launched sway.
246262
247```sh
263#+begin_src sh
248264nano ~/.config/sway/config
249```
265#+end_src
250266
251```conf
267#+begin_src conf
252268# Run pipewire audio server
253269exec /usr/libexec/pipewire-launcher
254270
@@ -257,10 +273,10 @@ bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT
257273bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5%
258274bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle
259275bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle
260```
276#+end_src
261277
262Note that I do not use bluetooth or screen sharing, so I won't cover those
263options in this post.
278Note that I do not use bluetooth or screen sharing, so I won't cover
279those options in this post.
264280
265Other than these issues, I have a working Alpine desktop. No other complaints
266thus far!
281Other than these issues, I have a working Alpine desktop. No other
282complaints thus far!
blog/2023-01-03-recent-website-changes.org +90 −79
@@ -1,82 +1,93 @@
1+++
2date = 2023-01-03
3title = "Recent Website Changes"
4description = "A quick review on this website's recent changes."
5+++
6
7## The State of This Website
8
9Over the years, this website has changed URLs, styles, content focus, and much
10more. However, it seems that I am never done, as I am yet again changing this
11page to fit my current needs and wants.
12
13While this site was already minimal (~12kb), it contained a lot of disorganized
14content and some poorly chosen color schemes.
15
16The recent updates attempt to fix these items while focusing on what I truly
17care about here: the content within each page.
18
19## Recent Changes
20
21I've made quite a few changes to the style of this website today, both in the
22CSS and in the HTML.
1#+title: Recent Website Changes
2#+date: 2023-01-03
3
4** The State of This Website
5:PROPERTIES:
6:CUSTOM_ID: the-state-of-this-website
7:END:
8Over the years, this website has changed URLs, styles, content focus,
9and much more. However, it seems that I am never done, as I am yet again
10changing this page to fit my current needs and wants.
11
12While this site was already minimal (~12kb), it contained a lot of
13disorganized content and some poorly chosen color schemes.
14
15The recent updates attempt to fix these items while focusing on what I
16truly care about here: the content within each page.
17
18** Recent Changes
19:PROPERTIES:
20:CUSTOM_ID: recent-changes
21:END:
22I've made quite a few changes to the style of this website today, both
23in the CSS and in the HTML.
2324
2425Here are some of the key takeaways from today's changes:
2526
261. Reduce the width of the website from `60em` to `40em`.
272. Remove breadcrumb navigation and replaced with a simple "Return Home" link
28when visiting anything other than the homepage.
293. Remove syntax highlighting from code blocks. CSS now loads from a single
30file.
314. Move blog posts on the homepage to the top, pushing tertiary content down.
325. Update font-family from `monospace` to `sans-serif` for readability.
33
34## Future Focus
35
36### Accessibility
37
38My main focus amidst all the changes this past year was accessibility.
39I tried to improve the accessibility of all pages on this site as well as I
40know how.
41For example, I added aria labels to identify different navigation menus in
42November.
43
44I want to continue this in 2023 and learn more about the accessibility features
45I can utilize to help those who may need them.
46
47### Content First
48
49Beyond accessibility, I am making a concerted effort to bring the content of
50this site to the forefront and push the tertiary information (e.g., About Me,
51Services, etc.) down below the content.
52
53Further, I want to review and edit previous blog posts for grammar, accuracy,
54dead links, and more. Where necessary, I may even add a blurb at the top of old
55posts that are no longer accurate or helpful.
56
57### Style
58
59As always, I will be searching for ways to reduce distractions and bring a
60minimalistic approach to this site. While there are certainly more drastic
61measures I could take, such as making this a [Shinobi
62Website](https://shinobi.bt.ht) or a [No CSS Website](https://nocss.club), I
63prefer to keep some modern features here.
64
65Two ideas have been floating around in my head, but I am not sure how I feel
66about these approaches yet:
67
681. Going all-in with Emacs org-mode and creating a script to auto-publish all my
69blog posts from org-mode to plain HTML files and then letting my CSS style it
70after the fact.
712. Focus on publishing for Gemini or Gopher and then utilize a conversion
72program to translate the pages to HTML.
73
74## Looking Back
75
76As I sit here and finalize the changes, as well as this post, I am happy with
77the current state of this website. It's certainly a long way from my first
78attempts (parallax background images, anyone?) and it's good to see the
79progress.
80
81I can only hope and work hard to ensure that I make more meaningful progress by
82this time next year.
271. Reduce the width of the website from =60em= to =40em=.
282. Remove breadcrumb navigation and replaced with a simple "Return Home"
29 link when visiting anything other than the homepage.
303. Remove syntax highlighting from code blocks. CSS now loads from a
31 single file.
324. Move blog posts on the homepage to the top, pushing tertiary content
33 down.
345. Update font-family from =monospace= to =sans-serif= for readability.
35
36** Future Focus
37:PROPERTIES:
38:CUSTOM_ID: future-focus
39:END:
40*** Accessibility
41:PROPERTIES:
42:CUSTOM_ID: accessibility
43:END:
44My main focus amidst all the changes this past year was accessibility. I
45tried to improve the accessibility of all pages on this site as well as
46I know how. For example, I added aria labels to identify different
47navigation menus in November.
48
49I want to continue this in 2023 and learn more about the accessibility
50features I can utilize to help those who may need them.
51
52*** Content First
53:PROPERTIES:
54:CUSTOM_ID: content-first
55:END:
56Beyond accessibility, I am making a concerted effort to bring the
57content of this site to the forefront and push the tertiary information
58(e.g., About Me, Services, etc.) down below the content.
59
60Further, I want to review and edit previous blog posts for grammar,
61accuracy, dead links, and more. Where necessary, I may even add a blurb
62at the top of old posts that are no longer accurate or helpful.
63
64*** Style
65:PROPERTIES:
66:CUSTOM_ID: style
67:END:
68As always, I will be searching for ways to reduce distractions and bring
69a minimalistic approach to this site. While there are certainly more
70drastic measures I could take, such as making this a
71[[https://shinobi.bt.ht][Shinobi Website]] or a [[https://nocss.club][No
72CSS Website]], I prefer to keep some modern features here.
73
74Two ideas have been floating around in my head, but I am not sure how I
75feel about these approaches yet:
76
771. Going all-in with Emacs org-mode and creating a script to
78 auto-publish all my blog posts from org-mode to plain HTML files and
79 then letting my CSS style it after the fact.
802. Focus on publishing for Gemini or Gopher and then utilize a
81 conversion program to translate the pages to HTML.
82
83** Looking Back
84:PROPERTIES:
85:CUSTOM_ID: looking-back
86:END:
87As I sit here and finalize the changes, as well as this post, I am happy
88with the current state of this website. It's certainly a long way from
89my first attempts (parallax background images, anyone?) and it's good to
90see the progress.
91
92I can only hope and work hard to ensure that I make more meaningful
93progress by this time next year.
blog/2023-01-05-mass-unlike-tumblr-posts.org +78 −65
@@ -1,31 +1,37 @@
1+++
2date = 2023-01-05
3title = "How to Easily Mass Unlike Tumblr Posts With Javascript"
4description = "A quick Javascript snippet that allows you to quickly unlike your Tumblr likes."
5+++
6
7## The Dilemma
8
9The dilemma I had was pretty simple: I wanted to unlike all the posts I have
10liked on Tumblr so that I could follow a new focus on blogs and start fresh.
11Otherwise, Tumblr will keep recommending content based on your previous likes.
12
13## The Solution
14
15I searched the web for a while and noted that most solutions referenced Tumblr
16setting and dashboard pages that no longer exist. Additionally, I did not want
17to install a third party extension to do this, as some suggested.
18
19Luckily, I used Javascript for a while a few years ago and figured it would be
20easy enough to script a solution, as long as Tumblr had a system for the unlike
21buttons.
22
23### Identifying Unlike Buttons
24
25Tumblr's unlike buttons are structured as you can see in the following code
26block. All unlike buttons have an `aria-label` with a value of `Unlike`.
27
28```html
1#+title: How to Easily Mass Unlike Tumblr Posts With Javascript
2#+date: 2023-01-05
3
4** The Dilemma
5:PROPERTIES:
6:CUSTOM_ID: the-dilemma
7:END:
8The dilemma I had was pretty simple: I wanted to unlike all the posts I
9have liked on Tumblr so that I could follow a new focus on blogs and
10start fresh. Otherwise, Tumblr will keep recommending content based on
11your previous likes.
12
13** The Solution
14:PROPERTIES:
15:CUSTOM_ID: the-solution
16:END:
17I searched the web for a while and noted that most solutions referenced
18Tumblr setting and dashboard pages that no longer exist. Additionally, I
19did not want to install a third party extension to do this, as some
20suggested.
21
22Luckily, I used Javascript for a while a few years ago and figured it
23would be easy enough to script a solution, as long as Tumblr had a
24system for the unlike buttons.
25
26*** Identifying Unlike Buttons
27:PROPERTIES:
28:CUSTOM_ID: identifying-unlike-buttons
29:END:
30Tumblr's unlike buttons are structured as you can see in the following
31code block. All unlike buttons have an =aria-label= with a value of
32=Unlike=.
33
34#+begin_src html
2935<button class="TRX6J" aria-label="Unlike">
3036 <span class="EvhBA B1Z5w ztpfZ" tabindex="-1">
3137 <svg xmlns="http://www.w3.org/2000/svg" height="21" width="23"
@@ -34,33 +40,36 @@ block. All unlike buttons have an `aria-label` with a value of `Unlike`.
3440 </svg>
3541 </span>
3642</button>
37```
38
39### Running a Script to Unlike All Likes
43#+end_src
4044
41To run this script, you will need to load the [Likes |
42Tumblr](https://www.tumblr.com/likes) page while logged in to your account.
45*** Running a Script to Unlike All Likes
46:PROPERTIES:
47:CUSTOM_ID: running-a-script-to-unlike-all-likes
48:END:
49To run this script, you will need to load the
50[[https://www.tumblr.com/likes][Likes | Tumblr]] page while logged in to
51your account.
4352
44Further, be sure to scroll down to the bottom and force Tumblr to load more
45posts so that this script unlikes more posts at a time.
53Further, be sure to scroll down to the bottom and force Tumblr to load
54more posts so that this script unlikes more posts at a time.
4655
47Once you are logged in and the page is loaded, open the Developer Tools and be
48sure you're on the "Console" tab. It should look something like this (this is
49in Firefox, Chromium should be similar):
56Once you are logged in and the page is loaded, open the Developer Tools
57and be sure you're on the "Console" tab. It should look something like
58this (this is in Firefox, Chromium should be similar):
5059
51![Firefox Dev
52!Tools](https:///img.cleberg.net/blog/20230105-mass-unlike-tumblr-posts/dev_console.png "Firefox Dev Tools")
60#+caption: Firefox Dev !Tools
61[[https:///img.cleberg.net/blog/20230105-mass-unlike-tumblr-posts/dev_console.png]]
5362
54All you need to do is paste the following snippet into the dev console. This
55code will collect all unlike buttons (`elements`) and then click each button to
56unlike it.
63All you need to do is paste the following snippet into the dev console.
64This code will collect all unlike buttons (=elements=) and then click
65each button to unlike it.
5766
58Optionally, you can comment-out the line `elements[i].click();` and uncomment
59the `console.log()` lines to simply print out information without performing any
60actions. This can be useful to debug issues or confirm that the code below isn't
61doing anything you don't want it to.
67Optionally, you can comment-out the line =elements[i].click();= and
68uncomment the =console.log()= lines to simply print out information
69without performing any actions. This can be useful to debug issues or
70confirm that the code below isn't doing anything you don't want it to.
6271
63```javascript
72#+begin_src javascript
6473const elements = document.querySelectorAll('[aria-label="Unlike"]');
6574// console.log(elements); // 👉 [button]
6675 
@@ -68,20 +77,24 @@ for (let i=0; i < elements.length; i++) {
6877 // console.log(elements[i]);
6978 elements[i].click();
7079}
71```
72
73## Results
74
75The results were quick for my situation, as it unliked ~200 posts within 2-3
76seconds. I am not sure how this will perform on larger sets of likes (or if
77Tumblr has a limit to unliking posts).
78
79You can see the below screenshot showing that I pasted the snippet into the
80console, pressed Enter, and then the posts are automatically unliked.
81
82![Script
83!Results](https:///img.cleberg.net/blog/20230105-mass-unlike-tumblr-posts/script_results.png "Script Results")
84
85Thinking about this further, I would bet that this would be fairly simple to
86package into a browser add-on so that users could install the add-on, go to
87their Likes page, and click a button to run the script. Food for thought.
80#+end_src
81
82** Results
83:PROPERTIES:
84:CUSTOM_ID: results
85:END:
86The results were quick for my situation, as it unliked ~200 posts within
872-3 seconds. I am not sure how this will perform on larger sets of likes
88(or if Tumblr has a limit to unliking posts).
89
90You can see the below screenshot showing that I pasted the snippet into
91the console, pressed Enter, and then the posts are automatically
92unliked.
93
94#+caption: Script !Results
95[[https:///img.cleberg.net/blog/20230105-mass-unlike-tumblr-posts/script_results.png]]
96
97Thinking about this further, I would bet that this would be fairly
98simple to package into a browser add-on so that users could install the
99add-on, go to their Likes page, and click a button to run the script.
100Food for thought.
blog/2023-01-08-fedora-remove-login-manager.org +36 −33
@@ -1,44 +1,47 @@
1+++
2date = 2023-01-08
3title = "Remove the Login Manager from Fedora i3"
4description = "Quickly remove Fedora i3's login manager to launch your desktop manually."
5+++
6
7## Fedora i3's Login Manager
8
9Since I use the i3 spin of Fedora Workstation, I don't like to have a login
10manager installed by default. As of the current version of Fedora i3, the
11default login manager is LightDM.
12
13If this is no longer the case, you can search for currently-installed packages
14with the following command and see if you can identify a different login
15manager.
16
17```sh
1#+title: Remove the Login Manager from Fedora i3
2#+date: 2023-01-08
3
4** Fedora i3's Login Manager
5:PROPERTIES:
6:CUSTOM_ID: fedora-i3s-login-manager
7:END:
8Since I use the i3 spin of Fedora Workstation, I don't like to have a
9login manager installed by default. As of the current version of Fedora
10i3, the default login manager is LightDM.
11
12If this is no longer the case, you can search for currently-installed
13packages with the following command and see if you can identify a
14different login manager.
15
16#+begin_src sh
1817sudo dnf list installed
19```
20
21## Removing the Login Manager
18#+end_src
2219
20** Removing the Login Manager
21:PROPERTIES:
22:CUSTOM_ID: removing-the-login-manager
23:END:
2324In order to remove the login manager, simply uninstall the package.
2425
25```sh
26#+begin_src sh
2627sudo dnf remove lightdm
27```
28
29## Launching i3 Manually
28#+end_src
3029
31In order to launch i3 manually, you need to set up your X session properly.
32To start, create or edit the `~/.xinitrc` file to include the following at
33the bottom.
30** Launching i3 Manually
31:PROPERTIES:
32:CUSTOM_ID: launching-i3-manually
33:END:
34In order to launch i3 manually, you need to set up your X session
35properly. To start, create or edit the =~/.xinitrc= file to include the
36following at the bottom.
3437
35```config
38#+begin_src config
3639exec i3
37```
40#+end_src
3841
39Now, whenever you log in to the TTY, you can launch your desktop with the
40following command.
42Now, whenever you log in to the TTY, you can launch your desktop with
43the following command.
4144
42```sh
45#+begin_src sh
4346startx
44```
47#+end_src
blog/2023-01-21-running-flatpak-apps-easily.org +34 −29
@@ -1,45 +1,50 @@
1+++
2date = 2023-01-21
3title = "Running Flatpak Apps with Symlinks"
4description = "Run flatpak apps faster and easier with a simple symlink solution."
5+++
1#+title: Running Flatpak Apps with Symlinks
2#+date: 2023-01-21
63
7## Running Flatpak Apps Should Be Faster
4** Running Flatpak Apps Should Be Faster
5:PROPERTIES:
6:CUSTOM_ID: running-flatpak-apps-should-be-faster
7:END:
8If you're like me and use Flatpak for those pesky apps that cannot run
9on your system for one reason or another, you likely get annoyed with
10opening a terminal and manually running the Flatpak app with the lengthy
11=flatpak run ...= command.
812
9If you're like me and use Flatpak for those pesky apps that cannot run on your
10system for one reason or another, you likely get annoyed with opening a terminal
11and manually running the Flatpak app with the lengthy `flatpak run ...` command.
12
13In the past, I manually created aliases in my `.zshrc` file for certain apps.
14For example, an alias would look like the example below.
13In the past, I manually created aliases in my =.zshrc= file for certain
14apps. For example, an alias would look like the example below.
1515
1616This would allow me to run the command fast within the terminal, but it
1717wouldn't allow me to run it in an application launcher.
1818
19```sh
19#+begin_src sh
2020# ~/.zshrc
2121alias librewolf = "flatpak run io.gitlab.librewolf-community"
22```
23
24However, I now use a much faster and better method that integrates with the
25tiling WMs I use and their application launchers - `dmenu` and `bemenu`.
22#+end_src
2623
27## Creating Symlinks for Flatpak Apps
24However, I now use a much faster and better method that integrates with
25the tiling WMs I use and their application launchers - =dmenu= and
26=bemenu=.
2827
29Let's use the example of Librewolf below. I can install the application like so:
28** Creating Symlinks for Flatpak Apps
29:PROPERTIES:
30:CUSTOM_ID: creating-symlinks-for-flatpak-apps
31:END:
32Let's use the example of Librewolf below. I can install the application
33like so:
3034
31```sh
35#+begin_src sh
3236flatpak install flathub io.gitlab.librewolf-community
33```
37#+end_src
3438
35Once installed, I can create a symlink to link the flatpak app to my new symlink
36in a location commonly included in your PATH. In this case, I chose `/usr/bin`.
37You may need to choose a different location if `/usr/bin` isn't in your PATH.
39Once installed, I can create a symlink to link the flatpak app to my new
40symlink in a location commonly included in your PATH. In this case, I
41chose =/usr/bin=. You may need to choose a different location if
42=/usr/bin= isn't in your PATH.
3843
39```sh
44#+begin_src sh
4045ln -s /var/lib/flatpak/exports/bin/io.gitlab.librewolf-community /usr/bin/librewolf
41```
46#+end_src
4247
43Once complete, you should be able to launch the app using the command name you
44chose above in the symlink (`librewolf`) from a terminal or from your
45application launcher!
48Once complete, you should be able to launch the app using the command
49name you chose above in the symlink (=librewolf=) from a terminal or
50from your application launcher!
blog/2023-01-23-random-mullvad-wireguard.org +60 −55
@@ -1,47 +1,49 @@
1+++
2date = 2023-01-23
3title = "Connecting to a Random Mullvad Wireguard Host"
4description = "Read to see how I used a shell script to randomly connect to a Mullvad Wireguard host each time I run the script."
5+++
1#+title: Connecting to a Random Mullvad Wireguard Host
2#+date: 2023-01-23
63
7## Mullvad Wireguard
8
9If you're using an OS that does not support one of Mullvad's apps, you're
10likely using the Wireguard configuration files instead.
4** Mullvad Wireguard
5:PROPERTIES:
6:CUSTOM_ID: mullvad-wireguard
7:END:
8If you're using an OS that does not support one of Mullvad's apps,
9you're likely using the Wireguard configuration files instead.
1110
1211If not, the first step is to visit Mullvad's
13[Wireguard configuration
14files](https://mullvad.net/en/account/#/wireguard-config) page and download a
15ZIP of the configuration files you want to use.
12[[https://mullvad.net/en/account/#/wireguard-config][Wireguard
13configuration files]] page and download a ZIP of the configuration files
14you want to use.
1615
17Personally, I downloaded all configuration files across the world and chose my
18connections using the script below.
16Personally, I downloaded all configuration files across the world and
17chose my connections using the script below.
1918
20Once the files are downloaded, unzip them and move them to your preferred
21location:
19Once the files are downloaded, unzip them and move them to your
20preferred location:
2221
23```sh
22#+begin_src sh
2423cd Downloads
2524unzip mullvad_wireguard_linux_all_all.zip
2625mkdir ~/mullvad && mv ~/Downloads/*.conf ~/mullvad/
27```
28
29## Creating a Script to Connect to a Random Host
26#+end_src
3027
31Once you have a folder of Wireguard configuration files from Mullvad, you can
32create a script to randomly connect to any one of the locations.
28** Creating a Script to Connect to a Random Host
29:PROPERTIES:
30:CUSTOM_ID: creating-a-script-to-connect-to-a-random-host
31:END:
32Once you have a folder of Wireguard configuration files from Mullvad,
33you can create a script to randomly connect to any one of the locations.
3334
34Start by creating a shell script - mine is called `vpn.sh`.
35Start by creating a shell script - mine is called =vpn.sh=.
3536
36```sh
37#+begin_src sh
3738nano ~/vpn.sh
38```
39#+end_src
3940
40Within this script, you can paste the following info. Note that I specify `us-*`
41in my script, which means that it will only consider US-based VPN locations. You
42can alter this or simply change it `*` to consider all locations.
41Within this script, you can paste the following info. Note that I
42specify =us-*= in my script, which means that it will only consider
43US-based VPN locations. You can alter this or simply change it =*= to
44consider all locations.
4345
44```sh
46#+begin_src sh
4547#!/bin/sh
4648
4749ls /home/$USER/mullvad/us-* |sort -R |tail -n 1 |while read file; do
@@ -52,19 +54,19 @@ ls /home/$USER/mullvad/us-* |sort -R |tail -n 1 |while read file; do
5254 printf "\n\nPrinting new IP info:\n"
5355 curl https://am.i.mullvad.net/connected
5456done
55```
57#+end_src
5658
57Once you've modified the script to your liking, add executable permissions
58and run the script:
59Once you've modified the script to your liking, add executable
60permissions and run the script:
5961
60```sh
62#+begin_src sh
6163chmod +x ~/vpn.sh
6264~/vpn.sh
63```
65#+end_src
6466
6567The output should look like the following:
6668
67```txt
69#+begin_src txt
6870doas (user@host) password:
6971
7072# ... The script will process all of the iptables and wg commands here
@@ -73,42 +75,45 @@ Created Mullvad wireguard connection with file: /home/user/mullvad/us-nyc-wg-210
7375
7476Printing new IP info:
7577You are connected to Mullvad (server country-city-wg-num). Your IP address is 12.345.678.99
76```
78#+end_src
7779
7880That's all there is to it. You can see your new location and IP via the
79`printf` and `curl` commands included in the script.
80
81You can also go to the [Connection Check |
82Mullvad](https://mullvad.net/en/check/) page to see if you are fully connected
83to Mullvad and if any leaks exist.
81=printf= and =curl= commands included in the script.
8482
85![Mullvad Connection Check](https://img.cleberg.net/blog/20230123-random-mullvad-wireguard/mullvad_check.png "Mullvad Connection Check")
83You can also go to the [[https://mullvad.net/en/check/][Connection Check
84​| Mullvad]] page to see if you are fully connected to Mullvad and if any
85leaks exist.
8686
87## Disconnecting from the Wireguard Connection
87#+caption: Mullvad Connection Check
88[[https://img.cleberg.net/blog/20230123-random-mullvad-wireguard/mullvad_check.png]]
8889
89If you forget which connection you're using, you can execute the following
90command to see where Wireguard is currently connected:
90** Disconnecting from the Wireguard Connection
91:PROPERTIES:
92:CUSTOM_ID: disconnecting-from-the-wireguard-connection
93:END:
94If you forget which connection you're using, you can execute the
95following command to see where Wireguard is currently connected:
9196
92```sh
97#+begin_src sh
9398wg show
94```
99#+end_src
95100
96101This command will show you the Wireguard interfaces and should output a
97connection like so: `interface: us-lax-wg-104`.
102connection like so: =interface: us-lax-wg-104=.
98103
99104Once you have this, just disconnect using that files' full path:
100105
101```sh
106#+begin_src sh
102107wg-quick down /home/user/mullvad/us-lax-wg-104.conf
103```
108#+end_src
104109
105I have a TODO item on figuring out how to easily export an environment variable
106that contains the configuration file's full name, so that I can just execute the
107following:
110I have a TODO item on figuring out how to easily export an environment
111variable that contains the configuration file's full name, so that I can
112just execute the following:
108113
109```sh
114#+begin_src sh
110115# Ideal situation if I can export the $file variable to the environment
111116wg-quick down $file
112```
117#+end_src
113118
114119If you have an idea on how to do this, email me!
blog/2023-01-28-self-hosting-wger-workout-manager.org +100 −78
@@ -1,27 +1,33 @@
1+++
2date = 2023-01-28
3title = "Self-Hosting Wger Workout Manager"
4description = "A walkthrough on how to host Wger with Docker on Linux."
5+++
6
7## Wger: The Self-Hosted Workout Manager
8
9[Wger Workout Manager](https://wger.de) is a fitness tracking tool for those who
10enjoy self-hosting their data. You can also register an account on their main
11website if you'd prefer to try without self-hosting.
12
13### Features
14
15I didn't see a full listing of features anywhere, so I compiled this list of my
16own after installing wger:
17
18#### Dashboard
19
20- Dashboard view of Workout Schedule, Nutrition Plan, Weight Graph, & last 5
21Weight Logs
22
23#### Training
24
1#+title: Self-Hosting Wger Workout Manager
2#+date: 2023-01-28
3
4** Wger: The Self-Hosted Workout Manager
5:PROPERTIES:
6:CUSTOM_ID: wger-the-self-hosted-workout-manager
7:END:
8[[https://wger.de][Wger Workout Manager]] is a fitness tracking tool for
9those who enjoy self-hosting their data. You can also register an
10account on their main website if you'd prefer to try without
11self-hosting.
12
13*** Features
14:PROPERTIES:
15:CUSTOM_ID: features
16:END:
17I didn't see a full listing of features anywhere, so I compiled this
18list of my own after installing wger:
19
20**** Dashboard
21:PROPERTIES:
22:CUSTOM_ID: dashboard
23:END:
24- Dashboard view of Workout Schedule, Nutrition Plan, Weight Graph, &
25 last 5 Weight Logs
26
27**** Training
28:PROPERTIES:
29:CUSTOM_ID: training
30:END:
2531- Workout Log
2632- Workout Schedule
2733- Calendar (shows weight logs and Bad/Neutral/Good days)
@@ -30,72 +36,83 @@ Weight Logs
3036- Public templates
3137- Exercises
3238
33#### Nutrition
34
39**** Nutrition
40:PROPERTIES:
41:CUSTOM_ID: nutrition
42:END:
3543- Nutrition plans
3644- BMI calculator
3745- Daily calories calculator
3846- Ingredient overview
3947
40#### Body Weight
41
48**** Body Weight
49:PROPERTIES:
50:CUSTOM_ID: body-weight
51:END:
4252- Weight overview
4353
44### Documentation
45
54*** Documentation
55:PROPERTIES:
56:CUSTOM_ID: documentation
57:END:
4658In order to self-host wger, I opted to use the Docker version of the
4759application. You can read the README within the
48[wger-project/docker](https://github.com/wger-project/docker) project on GitHub
49for information and installation instructions.
60[[https://github.com/wger-project/docker][wger-project/docker]] project
61on GitHub for information and installation instructions.
5062
51### Installation
63*** Installation
64:PROPERTIES:
65:CUSTOM_ID: installation
66:END:
67To start the installation, I created a folder for wger and started
68creating the three necessary files:
5269
53To start the installation, I created a folder for wger and started creating the
54three necessary files:
55
56```sh
70#+begin_src sh
5771mkdir ~/wger && mkdir ~/wger/config
5872touch ~/wger/docker-compose.yml && \
5973touch ~/wger/config/prod.env && \
6074touch ~/wger/config/nginx.conf
61```
75#+end_src
6276
63Once you have the folders and files created, you will need to copy the contents
64of the `docker-compose.yml`, `prod.env`, and `nginx.conf` from the GitHub link
65above.
77Once you have the folders and files created, you will need to copy the
78contents of the =docker-compose.yml=, =prod.env=, and =nginx.conf= from
79the GitHub link above.
6680
6781A few notes to explain the changes I made to the default files:
6882
69- I updated the `ALLOW_REGISTRAION` variable in `prod.env` to `False` after I
70created an account via my LAN connection, **before** I connected this app to a
71publicly-available domain.
72- I uncommented and updated `CSRF_TRUSTED_ORIGINS` to be equal to the public
73version of this app: `https://wger.example.com`.
74- I updated the port within `docker-compose.yml`, within the `nginx` block. The
75port I updated this to will be reflected in my nginx configuration file on the
76server (NOT the wger nginx.conf file).
77
78### Deploy
79
83- I updated the =ALLOW_REGISTRAION= variable in =prod.env= to =False=
84 after I created an account via my LAN connection, *before* I connected
85 this app to a publicly-available domain.
86- I uncommented and updated =CSRF_TRUSTED_ORIGINS= to be equal to the
87 public version of this app: =https://wger.example.com=.
88- I updated the port within =docker-compose.yml=, within the =nginx=
89 block. The port I updated this to will be reflected in my nginx
90 configuration file on the server (NOT the wger nginx.conf file).
91
92*** Deploy
93:PROPERTIES:
94:CUSTOM_ID: deploy
95:END:
8096Once all files are created and modified to your needs, simply start the
8197container.
8298
83```sh
99#+begin_src sh
84100docker-compose up -d
85```
101#+end_src
86102
87You can now visit the website on your LAN by going to `localhost:YOUR_PORT` or
88by the server's IP, if you're not on the same machine that is running the
89container.
103You can now visit the website on your LAN by going to
104=localhost:YOUR_PORT= or by the server's IP, if you're not on the same
105machine that is running the container.
90106
91If you wish to connect this app to a public domain name, you'll need to point an
92`A` DNS record from the domain to your server's public IP. You'll then need to
93create a configuration file for whichever web server or reverse proxy you're
94using.
107If you wish to connect this app to a public domain name, you'll need to
108point an =A= DNS record from the domain to your server's public IP.
109You'll then need to create a configuration file for whichever web server
110or reverse proxy you're using.
95111
96Wger's README suggests the following reverse proxy configuration for Nginx:
112Wger's README suggests the following reverse proxy configuration for
113Nginx:
97114
98```conf
115#+begin_src conf
99116upstream wger {
100117 # This port should match the port in the `nginx` block of docker-compose.yml
101118 # If the container is running on this same machine, replace this with
@@ -122,27 +139,32 @@ server {
122139 ssl_certificate /path/to/https/certificate.crt;
123140 ssl_certificate_key /path/to/https/certificate.key;
124141}
125```
126
127## Thoughts on Wger
142#+end_src
128143
144** Thoughts on Wger
145:PROPERTIES:
146:CUSTOM_ID: thoughts-on-wger
147:END:
129148I'm still playing around with the app itself, but it seems to be a solid
130149all-around workout manager, weight log, and food log.
131150
132I like that the weight log graph is fluid and updates quickly. You can also
133import or export data in CSV format if you'd like to move your data elsewhere.
134
135The workout manager is slightly odd, as it requires you to enter sets and reps
136for each exercise when you enter it into the plan. Then, when you add a log
137entry for performing a workout, you then add what you actually performed, in
138terms of reps and weight.
151I like that the weight log graph is fluid and updates quickly. You can
152also import or export data in CSV format if you'd like to move your data
153elsewhere.
139154
140I haven't tried the food log yet and I likely will not, at least for a
141while.
142I have no need for a food log or calorie tracker at the moment.
155The workout manager is slightly odd, as it requires you to enter sets
156and reps for each exercise when you enter it into the plan. Then, when
157you add a log entry for performing a workout, you then add what you
158actually performed, in terms of reps and weight.
143159
144### Screenshot Example
160I haven't tried the food log yet and I likely will not, at least for a
161while. I have no need for a food log or calorie tracker at the moment.
145162
163*** Screenshot Example
164:PROPERTIES:
165:CUSTOM_ID: screenshot-example
166:END:
146167You can see an example of a dashboard with placeholder data here:
147168
148![wger dashboard](https://img.cleberg.net/blog/20230128-wger/wger.png "wger dashboard")
169#+caption: wger dashboard
170[[https://img.cleberg.net/blog/20230128-wger/wger.png]]
blog/2023-02-02-exploring-hare.org +145 −118
@@ -1,162 +1,189 @@
1+++
2date = 2023-02-02
3title = "Exploring the Hare Programming Language"
4description = "Walking back through my first project using the Hare programming language."
5aliases = ["/blog/testing-out-hare"]
6+++
7
8## A Quick Note
9
10By no means am I a professional developer, so this post will be rather short.
11I won't be going into depth on the specification or anything that technical.
12
13Instead, I will simply be talking about how I (a relatively basic hobbyist
14programmer) have been playing with Hare and what intrigues me about the
15language.
16
17## Hare
18
19The [Hare](https://harelang.org) programming language is a straightforward
20language that should look familiar if you've ever programmed with C, Rust,
21or other languages that aim to build software at the system-level.
1#+title: Exploring the Hare Programming Language
2#+date: 2023-02-02
3
4** A Quick Note
5:PROPERTIES:
6:CUSTOM_ID: a-quick-note
7:END:
8By no means am I a professional developer, so this post will be rather
9short. I won't be going into depth on the specification or anything that
10technical.
11
12Instead, I will simply be talking about how I (a relatively basic
13hobbyist programmer) have been playing with Hare and what intrigues me
14about the language.
15
16** Hare
17:PROPERTIES:
18:CUSTOM_ID: hare
19:END:
20The [[https://harelang.org][Hare]] programming language is a
21straightforward language that should look familiar if you've ever
22programmed with C, Rust, or other languages that aim to build software
23at the system-level.
2224
2325The Hare homepage states the following:
2426
25> Hare is a systems programming language designed to be simple, stable, and
26> robust. Hare uses a static type system, manual memory management, and
27> minimal runtime. It is well-suited to writing operating systems, system
28> tools, compilers, networking software, and other low-level, high performance
29> tasks.
27#+begin_quote
28Hare is a systems programming language designed to be simple, stable,
29and robust. Hare uses a static type system, manual memory management,
30and minimal runtime. It is well-suited to writing operating systems,
31system tools, compilers, networking software, and other low-level, high
32performance tasks.
3033
31I have found this all to be true while playing with it for the first time today.
32In the next few sections, I'm going to walk through my installation and first
33program.
34#+end_quote
3435
35### Installation
36I have found this all to be true while playing with it for the first
37time today. In the next few sections, I'm going to walk through my
38installation and first program.
3639
37I'm currently running Alpine Linux on my Thinkpad, so the installation was quite
38easy as there is a package for Hare in the `apk` repositories.
40*** Installation
41:PROPERTIES:
42:CUSTOM_ID: installation
43:END:
44I'm currently running Alpine Linux on my Thinkpad, so the installation
45was quite easy as there is a package for Hare in the =apk= repositories.
3946
40```sh
47#+begin_src sh
4148doas apk add hare hare-doc
42```
49#+end_src
4350
44However, I was able to install Hare from scratch on Fedora Linux a short while
45ago, which was also very easy to do. If you need further instructions and Hare
46doesn't have a package on your system, take a look at the [Hare
47Installation](https://harelang.org/installation/) page.
48
49### Creating a Test Project
51However, I was able to install Hare from scratch on Fedora Linux a short
52while ago, which was also very easy to do. If you need further
53instructions and Hare doesn't have a package on your system, take a look
54at the [[https://harelang.org/installation/][Hare Installation]] page.
5055
56*** Creating a Test Project
57:PROPERTIES:
58:CUSTOM_ID: creating-a-test-project
59:END:
5160In order to play with the language, I created
52[hare-test](https://git.sr.ht/~cmc/hare-projects) and will be
53putting any of my Hare-related adventures in here.
61[[https://git.sr.ht/~cmc/hare-projects][hare-test]] and will be putting
62any of my Hare-related adventures in here.
63
64#+begin_quote
65*Update:* I also created a simple Hare program for creating a file from
66user input:
67[[https://git.sr.ht/~cmc/hare-projects/tree/main/item/files/files.ha][files.ha]]
5468
55> **Update:** I also created a simple Hare program for creating a file from user
56> input:
57> [files.ha](https://git.sr.ht/~cmc/hare-projects/tree/main/item/files/files.ha)
69#+end_quote
5870
59Luckily, Hare doesn't require any complex set-up tools or build environment.
60Once you have Hare installed, you simply need to create a file ending with `.ha`
61and you can run a Hare program.
71Luckily, Hare doesn't require any complex set-up tools or build
72environment. Once you have Hare installed, you simply need to create a
73file ending with =.ha= and you can run a Hare program.
6274
63I created a file called `rgb.ha` in order to test out the random number
75I created a file called =rgb.ha= in order to test out the random number
6476generation and passing parameters between functions.
6577
66```sh
78#+begin_src sh
6779nano rgb.ha
68```
80#+end_src
6981
70Within this file, I was able to easily import a few of the [standard library
71modules](https://harelang.org/tutorials/stdlib/): `fmt`, `math::random`, and
72`datetime`.
82Within this file, I was able to easily import a few of the
83[[https://harelang.org/tutorials/stdlib/][standard library modules]]:
84=fmt=, =math::random=, and =datetime=.
7385
7486With these modules, I created two functions:
7587
761. `main`: This function calls the `generate_rgb` function and then prints out
77the returned values.
782. `generate_rgb`: This function uses the current Unix epoch time to generate a
79pseudo-random value and uses this value to create three more random values
80between 0 and 255. These three numbers represent a color in RGB format.
881. =main=: This function calls the =generate_rgb= function and then
89 prints out the returned values.
902. =generate_rgb=: This function uses the current Unix epoch time to
91 generate a pseudo-random value and uses this value to create three
92 more random values between 0 and 255. These three numbers represent a
93 color in RGB format.
8194
82> **Note**: Some syntax coloring may look odd, as Zola currently doesn't have a
83> syntax highlighting theme for Hare. Instead, I'm using the C theme, which may
84> not be exactly accurate when coloring the code below.
95#+begin_quote
96*Note*: Some syntax coloring may look odd, as Zola currently doesn't
97have a syntax highlighting theme for Hare. Instead, I'm using the C
98theme, which may not be exactly accurate when coloring the code below.
8599
86```c
100#+end_quote
101
102#+begin_src C
87103use datetime;
88104use fmt;
89105use math::random;
90106
91107export fn main() void = {
92 const rgb = generate_rgb();
93 fmt::printfln("RGB: ({}, {}, {})", rgb[0], rgb[1], rgb[2])!;
108 const rgb = generate_rgb();
109 fmt::printfln("RGB: ({}, {}, {})", rgb[0], rgb[1], rgb[2])!;
94110};
95111
96112fn generate_rgb() []u64 = {
97 // Use the current Unix epoch time as the seed value
98 let datetime = datetime::epochunix(&datetime::now());
113 // Use the current Unix epoch time as the seed value
114 let datetime = datetime::epochunix(&datetime::now());
99115
100 // Generate initial pseudo-random value
101 // You must cast the datetime from int to u64
102 let x = random::init(datetime: u64);
116 // Generate initial pseudo-random value
117 // You must cast the datetime from int to u64
118 let x = random::init(datetime: u64);
103119
104 // Generate RGB values between (0, 255) using pseudo-random init value
105 let r = random::u64n(&x, 255);
106 let g = random::u64n(&x, 255);
107 let b = random::u64n(&x, 255);
120 // Generate RGB values between (0, 255) using pseudo-random init value
121 let r = random::u64n(&x, 255);
122 let g = random::u64n(&x, 255);
123 let b = random::u64n(&x, 255);
108124
109 // Structure data as array and return
110 let rgb_array: [3]u64 = [r, g, b];
111 return rgb_array;
125 // Structure data as array and return
126 let rgb_array: [3]u64 = [r, g, b];
127 return rgb_array;
112128};
113```
114
115### Running a Program
129#+end_src
116130
117Once you have a Hare file written and ready to run, you simply need to run it:
131*** Running a Program
132:PROPERTIES:
133:CUSTOM_ID: running-a-program
134:END:
135Once you have a Hare file written and ready to run, you simply need to
136run it:
118137
119```sh
138#+begin_src sh
120139hare run file.ha
121```
140#+end_src
122141
123142You can also compile the program into an executable:
124143
125```sh
144#+begin_src sh
126145hare build -o example file.ha
127146./example
128```
129
130### Initial Thoughts
131
132#### Documentation Improvements Would Help
133
134While I was able to piece everything together eventually, the biggest downfall
135right now in Hare's documentation. For such a new project, the documentation is
136in a great spot. However, bare specifications don't help as much as a brief
137examples section would.
138
139For example, it took me a while to figure out what the `u64n` function was
140looking for. I could tell that it took two parameters and the second was my max
141value (255), but couldn't figure out what the first value should be. Eventually,
142I inspected the `random.ha` file in the [Hare source
143code](https://git.sr.ht/~sircmpwn/hare/tree/master/item/math/random/random.ha)
144and found the test suite that helped me discover that it needed an `init()`
145value in the form of `&var`.
146
147#### More Basic Modules
148
147#+end_src
148
149*** Initial Thoughts
150:PROPERTIES:
151:CUSTOM_ID: initial-thoughts
152:END:
153**** Documentation Improvements Would Help
154:PROPERTIES:
155:CUSTOM_ID: documentation-improvements-would-help
156:END:
157While I was able to piece everything together eventually, the biggest
158downfall right now in Hare's documentation. For such a new project, the
159documentation is in a great spot. However, bare specifications don't
160help as much as a brief examples section would.
161
162For example, it took me a while to figure out what the =u64n= function
163was looking for. I could tell that it took two parameters and the second
164was my max value (255), but couldn't figure out what the first value
165should be. Eventually, I inspected the =random.ha= file in the
166[[https://git.sr.ht/~sircmpwn/hare/tree/master/item/math/random/random.ha][Hare
167source code]] and found the test suite that helped me discover that it
168needed an =init()= value in the form of =&var=.
169
170**** More Basic Modules
171:PROPERTIES:
172:CUSTOM_ID: more-basic-modules
173:END:
149174This is another point that comes from Hare being new and awaiting more
150contributions, but there are some basic functions that I would personally enjoy
151seeing in Hare, such as one to convert decimal (base 10) values to hexadecimal
152(base 16).
153
154If I'm feeling comfortable with my math, I may work on the list of functions I
155want and see if any can make it into the Hare source code.
156
157#### Overall Thoughts
158
159Overall, I actually really enjoy Hare. It's not as tedious to get a project up
160and running as Rust, but it's also simpler and more user-friendly than learning
161C. I am going to continue playing with it and see if I can make anything of
162particular value.
175contributions, but there are some basic functions that I would
176personally enjoy seeing in Hare, such as one to convert decimal
177(base 10) values to hexadecimal (base 16).
178
179If I'm feeling comfortable with my math, I may work on the list of
180functions I want and see if any can make it into the Hare source code.
181
182**** Overall Thoughts
183:PROPERTIES:
184:CUSTOM_ID: overall-thoughts
185:END:
186Overall, I actually really enjoy Hare. It's not as tedious to get a
187project up and running as Rust, but it's also simpler and more
188user-friendly than learning C. I am going to continue playing with it
189and see if I can make anything of particular value.
blog/2023-05-22-burnout.org +47 −42
@@ -1,43 +1,48 @@
1+++
2date = 2023-05-22
3title = "Burnout"
4description = "Dealing with burnout."
5+++
6
7## RE: Burnout
8
9I recently read [Drew DeVault's post on burnout](https://drewdevault.com/2023/05/01/2023-05-01-Burnout.html)
10around the same time I was pulling out of a burnout rut myself earlier this month.
11Finally, seeing the light at the end of my burnout tunnel made me want to
12write my first post back on this topic.
13
14## Busy Seasons on Busy Seasons
15
1#+title: Burnout
2#+date: 2023-05-22
3
4** RE: Burnout
5:PROPERTIES:
6:CUSTOM_ID: re-burnout
7:END:
8I recently read
9[[https://drewdevault.com/2023/05/01/2023-05-01-Burnout.html][Drew
10DeVault's post on burnout]] around the same time I was pulling out of a
11burnout rut myself earlier this month. Finally, seeing the light at the
12end of my burnout tunnel made me want to write my first post back on
13this topic.
14
15** Busy Seasons on Busy Seasons
16:PROPERTIES:
17:CUSTOM_ID: busy-seasons-on-busy-seasons
18:END:
1619My career deals with busy seasons, generally driven by client demand.
17This last year, I dealt with a harsh busy season from Aug to Oct 2022 to
18issue a few SOC reports for the period ending 2022-09-30.
19Immediately following that, I had to pivot and found another busy season
20from Oct to Jan for financial statement audits ending on 2022-12-31.
21Then again, supporting other clients from Jan to Mar 2023, followed by my
22current client workload aiming for SOC reports due on 2023-06-30.
23
24The result? A busy season that has lasted from August 2022 through today. I
25will likely be rushing throughout the next month or two before I have a brief
26break and need to focus on the 2023-09-30 SOC reports again. While auditing and
27consulting always involve a busy season, this is the first time I've
28had one last 9+ months without a break.
29
30While it's been tough, I have a handful of breaks pre-planned throughout this
31next cycle and should be able to moderate the level of commitment required for
32each client.
33
34## Refocusing
35
36Outside of work, I finally have time to work on hobbies such as this website,
37programming, athletics, games, etc.
38
39You may have noticed my absence if you're in the same channels, forums, and
40rooms that I am, but I should finally be active again.
41
42I'm hoping to break an item out of my backlog soon and start working on building
43a new project or hack around with a stale one.
20This last year, I dealt with a harsh busy season from Aug to Oct 2022 to
21issue a few SOC reports for the period ending 2022-09-30. Immediately
22following that, I had to pivot and found another busy season from Oct to
23Jan for financial statement audits ending on 2022-12-31. Then again,
24supporting other clients from Jan to Mar 2023, followed by my current
25client workload aiming for SOC reports due on 2023-06-30.
26
27The result? A busy season that has lasted from August 2022 through
28today. I will likely be rushing throughout the next month or two before
29I have a brief break and need to focus on the 2023-09-30 SOC reports
30again. While auditing and consulting always involve a busy season, this
31is the first time I've had one last 9+ months without a break.
32
33While it's been tough, I have a handful of breaks pre-planned throughout
34this next cycle and should be able to moderate the level of commitment
35required for each client.
36
37** Refocusing
38:PROPERTIES:
39:CUSTOM_ID: refocusing
40:END:
41Outside of work, I finally have time to work on hobbies such as this
42website, programming, athletics, games, etc.
43
44You may have noticed my absence if you're in the same channels, forums,
45and rooms that I am, but I should finally be active again.
46
47I'm hoping to break an item out of my backlog soon and start working on
48building a new project or hack around with a stale one.
blog/2023-06-08-goaccess-geoip.org +54 −45
@@ -1,46 +1,51 @@
1+++
2date = 2023-06-08T22:05:00Z
3title = "Inspecting Nginx Logs with GoAccess and MaxMind GeoIP Data"
4description = ""
5+++
6
7## Overview
8
9[GoAccess](https://goaccess.io/) is an open source real-time web log analyzer
10and interactive viewer that runs in a terminal in *nix systems or through your
11browser.
12
13## Installation
14
15To start, you'll need to install GoAccess for your OS. Here's an example for
16Debian-based distros:
17
18```bash
1#+title: Inspecting Nginx Logs with GoAccess and MaxMind GeoIP Data
2#+date: 2023-06-08
3
4** Overview
5:PROPERTIES:
6:CUSTOM_ID: overview
7:END:
8[[https://goaccess.io/][GoAccess]] is an open source real-time web log
9analyzer and interactive viewer that runs in a terminal in *nix systems
10or through your browser.
11
12** Installation
13:PROPERTIES:
14:CUSTOM_ID: installation
15:END:
16To start, you'll need to install GoAccess for your OS. Here's an example
17for Debian-based distros:
18
19#+begin_src sh
1920sudo apt install goaccess
20```
21#+end_src
2122
22Next, find any number of the MaxMind GeoIP database files on GitHub or another
23file hosting website. We're going to use P3TERX's version in this example:
23Next, find any number of the MaxMind GeoIP database files on GitHub or
24another file hosting website. We're going to use P3TERX's version in
25this example:
2426
25```bash
27#+begin_src sh
2628wget https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-City.mmdb
27```
29#+end_src
2830
2931Be sure to save this file in an easy to remember location!
3032
31## Usage
32
33In order to utilize the full capabilities of GoAccess and MMDB, start with the
34command template below and customize as necessary. This will export an HTML
35view of the GoAccess dashboard, showing all relevant information related to
36that site's access log. You can also omit the `-o output.html` parameter if you
37prefer to view the data within the CLI instead of creating an HTML file.
38
39With the addition of the GeoIP Database parameter, section `16 - Geo Location`
40will be added with the various countries that are associated with the collected
41IP addresses.
42
43```bash
33** Usage
34:PROPERTIES:
35:CUSTOM_ID: usage
36:END:
37In order to utilize the full capabilities of GoAccess and MMDB, start
38with the command template below and customize as necessary. This will
39export an HTML view of the GoAccess dashboard, showing all relevant
40information related to that site's access log. You can also omit the
41=-o output.html= parameter if you prefer to view the data within the CLI
42instead of creating an HTML file.
43
44With the addition of the GeoIP Database parameter, section
45=16 - Geo Location= will be added with the various countries that are
46associated with the collected IP addresses.
47
48#+begin_src sh
4449zcat /var/log/nginx/example.access.log.*.gz | goaccess \
4550--geoip-database=/home/user/GeoLite2-City.mmdb \
4651--date-format=%d/%b/%Y \
@@ -48,18 +53,22 @@ zcat /var/log/nginx/example.access.log.*.gz | goaccess \
4853--log-format=COMBINED \
4954-o output.html \
5055/var/log/nginx/example.access.log -
51```
52
53### Example Output
56#+end_src
5457
58*** Example Output
59:PROPERTIES:
60:CUSTOM_ID: example-output
61:END:
5562See below for an example of the HTML output:
5663
57![GoAccess HTML](https://img.cleberg.net/blog/20230608-goaccess/goaccess-dashboard.png "GoAccess HTML")
64#+caption: GoAccess HTML
65[[https://img.cleberg.net/blog/20230608-goaccess/goaccess-dashboard.png]]
5866
59You can also see the GeoIP card created by the integration of the MaxMind
60database information.
67You can also see the GeoIP card created by the integration of the
68MaxMind database information.
6169
62![GoAccess GeoIP](https://img.cleberg.net/blog/20230608-goaccess/goaccess-geoip.png "GoAccess GeoIP")
70#+caption: GoAccess GeoIP
71[[https://img.cleberg.net/blog/20230608-goaccess/goaccess-geoip.png]]
6372
64That's all there is to it!
65Informational data is provided in an organized fashion with minimal effort.
73That's all there is to it! Informational data is provided in an
74organized fashion with minimal effort.
blog/2023-06-08-self-hosting-baikal-server.org +96 −87
@@ -1,34 +1,34 @@
1+++
2date = 2023-06-08T21:48:00Z
3title = "Self-Hosting Baïkal Server (CalDAV & CardDAV)"
4description = "A quick guide on install Baïkal with docker-compose."
5+++
6
7## What is Baïkal?
8
9[Baïkal](https://sabre.io/baikal/) is a lightweight CalDAV + CardDAV server
10that you can self-host on your own machine.
11While I have tried (& failed) to get this CalDAV + CardDAV server running
12before, it was quite easy this time.
13Not really sure what I did differently this time, but I'm documenting my
14process here to ensure I don't forget.
15
16## Installation
17
18First, create a folder on your server and open a `docker-compose.yml` file for
19editing:
20
21```bash
1#+title: Self-Hosting Baïkal Server
2#+date: 2023-06-08
3
4** What is Baïkal?
5:PROPERTIES:
6:CUSTOM_ID: what-is-baïkal
7:END:
8[[https://sabre.io/baikal/][Baïkal]] is a lightweight CalDAV + CardDAV
9server that you can self-host on your own machine. While I have tried (&
10failed) to get this CalDAV + CardDAV server running before, it was quite
11easy this time. Not really sure what I did differently this time, but
12I'm documenting my process here to ensure I don't forget.
13
14** Installation
15:PROPERTIES:
16:CUSTOM_ID: installation
17:END:
18First, create a folder on your server and open a =docker-compose.yml=
19file for editing:
20
21#+begin_src sh
2222mkdir baikal && cd baikal
2323nano docker-compose.yml
24```
24#+end_src
2525
26Within this file, you'll need to paste the information below. You can customize
27the `ports` section to use any port on your server to pass through to port 80 in
28the container. You can also edit the `volumes` section to use docker volumes
29instead of local folders.
26Within this file, you'll need to paste the information below. You can
27customize the =ports= section to use any port on your server to pass
28through to port 80 in the container. You can also edit the =volumes=
29section to use docker volumes instead of local folders.
3030
31```conf
31#+begin_src conf
3232version: "2"
3333services:
3434 baikal:
@@ -39,61 +39,68 @@ services:
3939 volumes:
4040 - ./config:/var/www/baikal/config
4141 - ./data:/var/www/baikal/Specific
42```
42#+end_src
4343
44Once finished with editing, save and close the file. Then, launch the docker
45container:
44Once finished with editing, save and close the file. Then, launch the
45docker container:
4646
47```bash
47#+begin_src sh
4848sudo docker-compose up -d
49```
50
51## Intial Setup
52
53As long as no issues came up when starting the container, you should be able
54to visit the server's set-up page at `http://<server_ip>:<port>`.
55The application will ask you to create an administrator account and choose
56the database type for your storage.
57Personally, I opted to use SQLite.
58
59Make sure the administrator credentials are adequate to protect against
49#+end_src
50
51** Intial Setup
52:PROPERTIES:
53:CUSTOM_ID: intial-setup
54:END:
55As long as no issues came up when starting the container, you should be
56able to visit the server's set-up page at =http://<server_ip>:<port>=.
57The application will ask you to create an administrator account and
58choose the database type for your storage. Personally, I opted to use
59SQLite.
60
61Make sure the administrator credentials are adequate to protect against
6062common attacks.
6163
62## Creating Users
63
64Once you've set up the application, you will be greeted by the Dashboard page,
65which will show the version of the app, status of the admin/CalDAV/CardDAV
66services, and the number of users, calendars, events, address books, and
67contacts.
64** Creating Users
65:PROPERTIES:
66:CUSTOM_ID: creating-users
67:END:
68Once you've set up the application, you will be greeted by the Dashboard
69page, which will show the version of the app, status of the
70admin/CalDAV/CardDAV services, and the number of users, calendars,
71events, address books, and contacts.
6872
69![Baïkal Dashboard](https://img.cleberg.net/blog/20230608-baikal/baikal-dashboard.png "Baïkal Dashboard")
73#+caption: Baïkal Dashboard
74[[https://img.cleberg.net/blog/20230608-baikal/baikal-dashboard.png]]
7075
71To create a new user, navigate to the `Users and resources` page. This process
72is as simple as entering a username, password, and email.
76To create a new user, navigate to the =Users and resources= page. This
77process is as simple as entering a username, password, and email.
7378
74Once a user has been created, you can create any number of calendars and address
75books for user, as well as inspect their information.
79Once a user has been created, you can create any number of calendars and
80address books for user, as well as inspect their information.
7681
77## Setting Up a Public URL
82** Setting Up a Public URL
83:PROPERTIES:
84:CUSTOM_ID: setting-up-a-public-url
85:END:
86Once your application is working locally, you can open access remotely
87via a URL by using a reverse-proxy like Nginx.
7888
79Once your application is working locally, you can open access remotely via a URL
80by using a reverse-proxy like Nginx.
89As a prerequisite, you must own a domain name and set up DNS records to
90point a domain name to the server hosting Baïkal.
8191
82As a prerequisite, you must own a domain name and set up DNS records
83to point a domain name to the server hosting Baïkal.
92Start by navigating to your web server's configuration directory and
93create a new file for this application.
8494
85Start by navigating to your web server's configuration directory and create a
86new file for this application.
87
88```bash
95#+begin_src sh
8996cd /etc/nginx/sites-available/
9097nano dav
91```
98#+end_src
9299
93Within this file, paste in the configuration from below and change
94`dav.example.com` to match the URL you'll be using.
100Within this file, paste in the configuration from below and change
101=dav.example.com= to match the URL you'll be using.
95102
96```conf
103#+begin_src conf
97104server {
98105 if ($host ~ ^[^.]+\.example\.com$) {
99106 return 301 https://$host$request_uri;
@@ -123,35 +130,37 @@ server {
123130 include /etc/letsencrypt/options-ssl-nginx.conf;
124131 ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
125132}
126```
133#+end_src
127134
128For Nginx on Ubuntu, you'll need to symlink the configuration file to the
129`sites-enabled` directory and then restart Nginx.
135For Nginx on Ubuntu, you'll need to symlink the configuration file to
136the =sites-enabled= directory and then restart Nginx.
130137
131```bash
138#+begin_src sh
132139sudo ln -s /etc/nginx/sites-available/dav /etc/nginx/sites-enabled/dav
133140sudo systemctl restart nginx.service
134```
135
136At this point, the Baïkal server should be available over the internet at the
137URL configured above!
141#+end_src
138142
139## Configuring Clients
143At this point, the Baïkal server should be available over the internet
144at the URL configured above!
140145
141Lastly, configuring clients and applications is essential to making sure the DAV
142server is being fully utilized.
146** Configuring Clients
147:PROPERTIES:
148:CUSTOM_ID: configuring-clients
149:END:
150Lastly, configuring clients and applications is essential to making sure
151the DAV server is being fully utilized.
143152
144You can also use the `Users and resources` page to inspect a user's personal
145link to their calendars and address books by clicking the info (i) button. It
146will show a URI like
147`/dav.php/calendars/your-user/default/`.
153You can also use the =Users and resources= page to inspect a user's
154personal link to their calendars and address books by clicking the info
155(i) button. It will show a URI like
156=/dav.php/calendars/your-user/default/=.
148157
149However, I found that the following URL works for most applications:
150`/dav.php/principals/your-user/`.
158However, I found that the following URL works for most applications:
159=/dav.php/principals/your-user/=.
151160
152I used the `principals` URL above for Thunderbird (calendar, tasks, and
153contacts), as well as iOS (calendar, tasks, and contacts) and everything works
154flawlessly so far.
161I used the =principals= URL above for Thunderbird (calendar, tasks, and
162contacts), as well as iOS (calendar, tasks, and contacts) and everything
163works flawlessly so far.
155164
156Syncing is quick between the server and clients, and I haven't seen any
165Syncing is quick between the server and clients, and I haven't seen any
157166disruptions in the service or data integrity.
blog/2023-06-18-unifi-ip-blocklist.org +72 −60
@@ -1,37 +1,40 @@
1+++
2date = 2023-06-18
3title = "Block IP Addresses and Subnets with Unifi Network Firewall"
4description = "A short tutorial on how to create IP Groups in Unifi's Network application and block them via the firewall."
5+++
6
7## Identifying Abusive IPs
8
9If you're like me and use Unifi network equipment at the edge of the network you
10manage, you may know that Unifi is only somewhat decent at identifying and
11blocking IPs that represent abusive or threat actors.
12
13While Unifi has a [threat
14management](https://help.ui.com/hc/en-us/articles/360006893234-UniFi-Gateway-Threat-Management)
15tool inside their Network application, it can be lacking in functionality and
16identification. For example, I have my UDM Pro set to identify and block almost
17all categories of threats available within the Unifi settings. However, I
18regularly identify abusive actors on my web server via the server logs.
19
20In addition, I have identified IP addresses and subnets directly within Unifi's
21logs that the UDM did not block for whatever reason.
22
23This guide is meant to be another step in the process to manually block abusive
24IP addresses or subnets that you have identified but are not being automatically
25blocked yet.
26
27## Create an IP Group Profile
28
29To start, login to the Unifi machine's web GUI and navigate to the Network app >
30Settings > Profiles.
31
32Within this page, choose the `IP Groups` tab and click `Create New`.
33
34![Network Profiles](https://img.cleberg.net/blog/20230618-unifi-ip-blocklist/unifi_profiles.png "Network Profiles")
1#+title: Block IP Addresses and Subnets with the Unifi Network Firewall
2#+date: 2023-06-18
3
4** Identifying Abusive IPs
5:PROPERTIES:
6:CUSTOM_ID: identifying-abusive-ips
7:END:
8If you're like me and use Unifi network equipment at the edge of the
9network you manage, you may know that Unifi is only somewhat decent at
10identifying and blocking IPs that represent abusive or threat actors.
11
12While Unifi has a
13[[https://help.ui.com/hc/en-us/articles/360006893234-UniFi-Gateway-Threat-Management][threat
14management]] tool inside their Network application, it can be lacking in
15functionality and identification. For example, I have my UDM Pro set to
16identify and block almost all categories of threats available within the
17Unifi settings. However, I regularly identify abusive actors on my web
18server via the server logs.
19
20In addition, I have identified IP addresses and subnets directly within
21Unifi's logs that the UDM did not block for whatever reason.
22
23This guide is meant to be another step in the process to manually block
24abusive IP addresses or subnets that you have identified but are not
25being automatically blocked yet.
26
27** Create an IP Group Profile
28:PROPERTIES:
29:CUSTOM_ID: create-an-ip-group-profile
30:END:
31To start, login to the Unifi machine's web GUI and navigate to the
32Network app > Settings > Profiles.
33
34Within this page, choose the =IP Groups= tab and click =Create New=.
35
36#+caption: Network Profiles
37[[https://img.cleberg.net/blog/20230618-unifi-ip-blocklist/unifi_profiles.png]]
3538
3639Each IP Group profile can be used as one of three options:
3740
@@ -39,39 +42,48 @@ Each IP Group profile can be used as one of three options:
39422. IPv4 Address/Subnet
40433. IPv6 Address/Subnet
4144
42In this example, I'm creating an IPv4 Address/Subnet group and adding a few
43different IP addresses and a subnet.
44Once you've added all IP addresses and subnets, click the `Apply` button
45that should appear at the bottom.
45In this example, I'm creating an IPv4 Address/Subnet group and adding a
46few different IP addresses and a subnet. Once you've added all IP
47addresses and subnets, click the =Apply= button that should appear at
48the bottom.
4649
47![Network Profile IPs](https://img.cleberg.net/blog/20230618-unifi-ip-blocklist/abusive_ips.png "Network Profile IPs")
50#+caption: Network Profile IPs
51[[https://img.cleberg.net/blog/20230618-unifi-ip-blocklist/abusive_ips.png]]
4852
49At this point, the IPv4 Address/Subnet has been created but not yet used.
53At this point, the IPv4 Address/Subnet has been created but not yet
54used.
5055
51## Drop IP Group Profile via the Unifi Firewall
56** Drop IP Group Profile via the Unifi Firewall
57:PROPERTIES:
58:CUSTOM_ID: drop-ip-group-profile-via-the-unifi-firewall
59:END:
60To instruct the Unifi machine to block the profile we just created, we
61need to navigate to the Network app > Settings > Firewall & Security.
5262
53To instruct the Unifi machine to block the profile we just created, we need
54to navigate to the Network app > Settings > Firewall & Security.
63Within this screen, find the Firewall Rules table and click
64=Create Entry=. This entry should contain the following settings:
5565
56Within this screen, find the Firewall Rules table and click `Create Entry`. This
57entry should contain the following settings:
66- Type: =Internet In=
67- Description: =<Your Custom Rule>=
68- Rule Applied: =Before Predefined Rules=
69- Action: =Drop=
70- Source Type: =Port/IP Group=
71- IPv4 Address Group: =<Name of the Group Profile You Created Above>=
5872
59- Type: `Internet In`
60- Description: `<Your Custom Rule>`
61- Rule Applied: `Before Predefined Rules`
62- Action: `Drop`
63- Source Type: `Port/IP Group`
64- IPv4 Address Group: `<Name of the Group Profile You Created Above>`
73Customize the remaining configurations to your liking, and then save and
74enable the firewall rule.
6575
66Customize the remaining configurations to your liking, and then save and enable
67the firewall rule.
76#+caption: Firewall Rule
77[[https://img.cleberg.net/blog/20230618-unifi-ip-blocklist/firewall_drop_rule.png]]
6878
69![Firewall Rule](https://img.cleberg.net/blog/20230618-unifi-ip-blocklist/firewall_drop_rule.png "Firewall Rule")
79Once enabled, the Unifi machine will be able to drop all incoming
80connections from the defined IP addresses and subnets within the created
81profile.
7082
71Once enabled, the Unifi machine will be able to drop all incoming connections
72from the defined IP addresses and subnets within the created profile.
83#+begin_quote
84As a personal aside to this topic, I'm looking for a convenient way to
85update the firewall rules or profiles remotely (within the LAN) from the
86web server to accelerate this process. If you have an idea on how to
87automatically update Unifi IP groups or firewall rules, let me know!
7388
74> As a personal aside to this topic, I'm looking for a convenient way to update
75> the firewall rules or profiles remotely (within the LAN) from the web server
76> to accelerate this process. If you have an idea on how to automatically update
77> Unifi IP groups or firewall rules, let me know!
89#+end_quote
blog/2023-06-20-audit-review-cheatsheet.org +72 −66
@@ -1,75 +1,81 @@
1+++
2date = 2023-06-20
3title = "Cheatsheet: Review Audit Test Results"
4description = "A handy cheatsheet for reviewing audit testing on FSA and SOC report engagements."
5+++
1#+title: Audit Review Checklist
2#+date: 2023-06-20
63
7## Overview
84
9This post is a *very* brief overview on the basic process to review audit
10test results, focusing on work done as part of a financial statement audit
11(FSA) or service organization controls (SOC) report.
5** Overview
6:PROPERTIES:
7:CUSTOM_ID: overview
8:END:
9This post is a /very/ brief overview on the basic process to review
10audit test results, focusing on work done as part of a financial
11statement audit (FSA) or service organization controls (SOC) report.
1212
13While there are numerous different things to review and look for - all varying
14wildly depending on the report, client, and tester - this list serves as a solid
15base foundation for a reviewer.
13While there are numerous different things to review and look for - all
14varying wildly depending on the report, client, and tester - this list
15serves as a solid base foundation for a reviewer.
1616
17I have used this throughout my career as a starting point to my reviews, and it
18has worked wonders for creating a consistent and objective template to my
19reviews. The goal is to keep this base high-level enough to be used on a wide
20variety of engagements, while still ensuring that all key areas are covered.
21
22## Cheatsheet
17I have used this throughout my career as a starting point to my reviews,
18and it has worked wonders for creating a consistent and objective
19template to my reviews. The goal is to keep this base high-level enough
20to be used on a wide variety of engagements, while still ensuring that
21all key areas are covered.
2322
23** Cheatsheet
24:PROPERTIES:
25:CUSTOM_ID: cheatsheet
26:END:
24271. [ ] Check all documents for spelling and grammar.
25282. [ ] Ensure all acronyms are fully explained upon first use.
263. [ ] For all people referenced, use their full names and job titles upon
27first use.
284. [ ] All supporting documents must cross-reference to the lead sheet and
29vice-versa.
293. [ ] For all people referenced, use their full names and job titles
30 upon first use.
314. [ ] All supporting documents must cross-reference to the lead sheet
32 and vice-versa.
30335. [ ] Verify that the control has been adequately tested:
31 - [ ] **Test of Design**: Did the tester obtain information regarding how
32 the control should perform normally and abnormally (e.g., emergency
33 scenarios)?
34 - [ ] **Test of Operating Effectiveness**: Did the tester inquire, observe,
35 inspect, or re-perform sufficient evidence to support their
36 conclusion over the control? Inquiry alone is not adequate!
376. [ ] For any information used in the control, whether by the control operator
38or by the tester, did the tester appropriately document the source (system or
39person), extraction method, parameters, and completeness and accuracy (C&A)?
40 - [ ] For any reports, queries, etc. used in the extraction, did the tester
41 include a copy and notate C&A considerations?
427. [ ] Did the tester document the specific criteria that the control is being
43tested against?
448. [ ] Did the tester notate in the supporting documents where each criterion
45 was satisfied?
469. [ ] If testing specific policies or procedures, are the documents adequate?
47 - [ ] e.g., a test to validate that a review of policy XYZ occurs
48 periodically should also evaluate the sufficiency of the policy itself, if
49 meant to cover the risk that such a policy does not exist and is not
50 reviewed.
34 - [ ] *Test of Design*: Did the tester obtain information regarding
35 how the control should perform normally and abnormally (e.g.,
36 emergency scenarios)?
37 - [ ] *Test of Operating Effectiveness*: Did the tester inquire,
38 observe, inspect, or re-perform sufficient evidence to support
39 their conclusion over the control? Inquiry alone is not adequate!
406. [ ] For any information used in the control, whether by the control
41 operator or by the tester, did the tester appropriately document the
42 source (system or person), extraction method, parameters, and
43 completeness and accuracy (C&A)?
44 - [ ] For any reports, queries, etc. used in the extraction, did the
45 tester include a copy and notate C&A considerations?
467. [ ] Did the tester document the specific criteria that the control is
47 being tested against?
488. [ ] Did the tester notate in the supporting documents where each
49 criterion was satisfied?
509. [ ] If testing specific policies or procedures, are the documents
51 adequate?
52 - [ ] e.g., a test to validate that a review of policy XYZ occurs
53 periodically should also evaluate the sufficiency of the policy
54 itself, if meant to cover the risk that such a policy does not
55 exist and is not reviewed.
515610. [ ] Does the test cover the appropriate period under review?
52 - [ ] If the test is meant to cover only a portion of the audit period, do
53 other controls exist to mitigate the risks that exist for the remainder of
54 the period?
5511. [ ] For any computer-aided audit tools (CAATs) or other automation
56techniques used in the test, is the use of such tools explained and
57appropriately documented?
5812. [ ] If prior-period documentation exists, are there any missing pieces of
59evidence that would further enhance the quality of the test?
6013. [ ] Was any information discovered during the walkthrough or inquiry phase
61that was not incorporated into the test?
6214. [ ] Are there new rules or expectations from your company's internal
63guidance or your regulatory bodies that would affect the audit approach for this
64control?
6515. [ ] Was an exception, finding, or deficiency identified as a result of this
66test?
67 - [ ] Was the control deficient in design, operation, or both?
68 - [ ] What was the root cause of the finding?
69 - [ ] Does the finding indicate other findings or potential fraud?
70 - [ ] What's the severity and scope of the finding?
71 - [ ] Do other controls exist as a form of compensation against the
72 finding's severity, and do they mitigate the risk within the control
73 objective?
74 - [ ] Does the finding exist at the end of the period, or was it resolved
75 within the audit period?
\ No newline at end of file
57 - [ ] If the test is meant to cover only a portion of the audit
58 period, do other controls exist to mitigate the risks that exist
59 for the remainder of the period?
6011. [ ] For any computer-aided audit tools (CAATs) or other automation
61 techniques used in the test, is the use of such tools explained and
62 appropriately documented?
6312. [ ] If prior-period documentation exists, are there any missing
64 pieces of evidence that would further enhance the quality of the
65 test?
6613. [ ] Was any information discovered during the walkthrough or inquiry
67 phase that was not incorporated into the test?
6814. [ ] Are there new rules or expectations from your company's internal
69 guidance or your regulatory bodies that would affect the audit
70 approach for this control?
7115. [ ] Was an exception, finding, or deficiency identified as a result
72 of this test?
73 - [ ] Was the control deficient in design, operation, or both?
74 - [ ] What was the root cause of the finding?
75 - [ ] Does the finding indicate other findings or potential fraud?
76 - [ ] What's the severity and scope of the finding?
77 - [ ] Do other controls exist as a form of compensation against the
78 finding's severity, and do they mitigate the risk within the
79 control objective?
80 - [ ] Does the finding exist at the end of the period, or was it
81 resolved within the audit period?
blog/2023-06-23-byobu.org +33 −28
@@ -1,43 +1,48 @@
1+++
2date = 2023-06-23T19:15:28
3title = "Byobu"
4description = "A quick look at byobu, a text based window manager."
5+++
1#+title: Byobu
2#+date: 2023-06-23
63
7## Byobu
4** Byobu
5:PROPERTIES:
6:CUSTOM_ID: byobu
7:END:
8[[https://www.byobu.org][byobu]] is a command-line tool that allows you
9to use numerous screens within a single terminal emulator instance. More
10specifically, it's a text based window manager, using either =screen= or
11=tmux=.
812
9[byobu](https://www.byobu.org) is a command-line tool that allows you to use
10numerous screens within a single terminal emulator instance. More specifically,
11it's a text based window manager, using either `screen` or `tmux`.
13This post is mostly just a self-reference as I explore byobu, so I may
14come back later and update this post with more content.
1215
13This post is mostly just a self-reference as I explore byobu, so I may come back
14later and update this post with more content.
16*** Screenshot
17:PROPERTIES:
18:CUSTOM_ID: screenshot
19:END:
20Take a look below at my current multi-window set-up in byobu while I
21write this blog post:
1522
16### Screenshot
23#+caption: byobu
24[[https://img.cleberg.net/blog/20230623-byobu/byobu.png]]
1725
18Take a look below at my current multi-window set-up in byobu while I write this
19blog post:
26** Keybindings
27:PROPERTIES:
28:CUSTOM_ID: keybindings
29:END:
30You can open the help menu with either of the following commands; they
31will both open the same manpage:
2032
21![byobu](https://img.cleberg.net/blog/20230623-byobu/byobu.png "byobu")
22
23## Keybindings
24
25You can open the help menu with either of the following commands; they will both
26open the same manpage:
27
28```sh
33#+begin_src sh
2934byobu --help
3035# or
3136man byobu
32```
37#+end_src
3338
34While the manpage contains a ton of information about the functionality of
35byobu (such as status notifications, sessions, and windows), the first location
36to explore should be the keybindings section.
39While the manpage contains a ton of information about the functionality
40of byobu (such as status notifications, sessions, and windows), the
41first location to explore should be the keybindings section.
3742
3843The keybindings are configured as follows:
3944
40```txt
45#+begin_src txt
4146byobu keybindings can be user defined in /usr/share/byobu/keybindings/ (or
4247within .screenrc if byobu-export was used). The common key bindings are:
4348
@@ -65,4 +70,4 @@ Ctrl-a R - Reload profile
6570Ctrl-a ! - Toggle key bindings on and off
6671Ctrl-a k - Kill the current window
6772Ctrl-a ~ - Save the current window's scrollback buffer
68```
73#+end_src
blog/2023-06-23-self-hosting-convos-irc.org +112 −103
@@ -1,40 +1,43 @@
1+++
2date = 2023-06-23T20:50:00
3title = "Self-Hosting Convos IRC Web Client"
4description = ""
5+++
1#+title: Self-Hosting Convos: IRC Web Client
2#+date: 2023-06-23
63
7## Convos
8
9[Convos](https://convos.chat/) is an always-online web client for IRC. It
10has a few features that made it attractive to me as a self-hosted option:
4** Convos
5:PROPERTIES:
6:CUSTOM_ID: convos
7:END:
8[[https://convos.chat/][Convos]] is an always-online web client for IRC.
9It has a few features that made it attractive to me as a self-hosted
10option:
1111
1212- Extremely simple Docker Compose installation method.
13- Runs in the background and monitors chats even while you're not logged in.
13- Runs in the background and monitors chats even while you're not logged
14 in.
1415- Neatly organized sidebar for conversation and client settings.
1516- Ability to connect to different hosts and create profiles for hosts.
16- By default, registration is closed to the public. You can enable public
17 registration on the Settings page or generate invitation links on the
18 Users page.
19- Customization of the client theme, organization name and URL, admin email,
20 and video service.
21
22## Docker Installation
23
24To install Convos, simply create a directory and a `docker-compose.yml` file:
25
26```sh
17- By default, registration is closed to the public. You can enable
18 public registration on the Settings page or generate invitation links
19 on the Users page.
20- Customization of the client theme, organization name and URL, admin
21 email, and video service.
22
23** Docker Installation
24:PROPERTIES:
25:CUSTOM_ID: docker-installation
26:END:
27To install Convos, simply create a directory and a =docker-compose.yml=
28file:
29
30#+begin_src sh
2731mkdir ~/convos && cd ~/convos
2832nano docker-compose.yml
29```
33#+end_src
3034
31With the `docker-compose.yml` file open, paste the configuration below into
32the file.
33You can customize the host port to be something unique, such as `21897:3000`.
34You can also change the `data` folder to be a docker volume instead, if you
35prefer.
35With the =docker-compose.yml= file open, paste the configuration below
36into the file. You can customize the host port to be something unique,
37such as =21897:3000=. You can also change the =data= folder to be a
38docker volume instead, if you prefer.
3639
37```config
40#+begin_src config
3841version: '3'
3942
4043services:
@@ -47,118 +50,124 @@ services:
4750 environment:
4851 - CONVOS_REVERSE_PROXY=1
4952 restart: always
50```
53#+end_src
5154
52Save the `docker-compose.yml` file and bring the container up:
55Save the =docker-compose.yml= file and bring the container up:
5356
54```sh
57#+begin_src sh
5558sudo docker-compose up -d
56```
59#+end_src
5760
58At this point, Convos is available at `<server_ip>:3000` but not available
59to the public.
61At this point, Convos is available at =<server_ip>:3000= but not
62available to the public.
6063
61## Nginx Reverse Proxy
64** Nginx Reverse Proxy
65:PROPERTIES:
66:CUSTOM_ID: nginx-reverse-proxy
67:END:
68If you're using Nginx, you can create a configuration file for the
69convos application. Start by opening the file:
6270
63If you're using Nginx, you can create a configuration file for the convos
64application.
65Start by opening the file:
66
67```sh
71#+begin_src sh
6872nano /etc/nginx/sites-available/convos
69```
73#+end_src
7074
71Within the nginx configuration file, paste the following content and be sure
72to update `convos.example.com` to match your domain and `127.0.0.1:3000` to
73match the port you opened in the `docker-compose.yml` file.
75Within the nginx configuration file, paste the following content and be
76sure to update =convos.example.com= to match your domain and
77=127.0.0.1:3000= to match the port you opened in the
78=docker-compose.yml= file.
7479
75```config
80#+begin_src config
7681# Host and port where convos is running
7782upstream convos_upstream { server 127.0.0.1:3000; }
7883
7984server {
80 if ($host ~ ^[^.]+\.example\.com$) {
81 return 301 https://$host$request_uri;
82 }
83
84 listen [::]:80;
85 listen 80;
86 server_name convos.example.com;
87 return 404;
85 if ($host ~ ^[^.]+\.example\.com$) {
86 return 301 https://$host$request_uri;
87 }
88
89 listen [::]:80;
90 listen 80;
91 server_name convos.example.com;
92 return 404;
8893}
8994
9095server {
91 listen [::]:443 ssl http2;
92 listen 443 ssl http2;
93 server_name convos.example.com;
94 access_log /var/log/nginx/convos.access.log;
95 error_log /var/log/nginx/convos.error.log;
96
97 location / {
98 proxy_pass http://convos_upstream;
99 proxy_http_version 1.1;
100 proxy_set_header Upgrade $http_upgrade;
101 proxy_set_header Connection "upgrade";
102 client_max_body_size 0;
103 proxy_set_header Host $host;
104 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
105 proxy_set_header X-Request-Base "$scheme://$host/";
106 }
107
108 ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
109 ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
110 include /etc/letsencrypt/options-ssl-nginx.conf;
111 ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
96 listen [::]:443 ssl http2;
97 listen 443 ssl http2;
98 server_name convos.example.com;
99 access_log /var/log/nginx/convos.access.log;
100 error_log /var/log/nginx/convos.error.log;
101
102 location / {
103 proxy_pass http://convos_upstream;
104 proxy_http_version 1.1;
105 proxy_set_header Upgrade $http_upgrade;
106 proxy_set_header Connection "upgrade";
107 client_max_body_size 0;
108 proxy_set_header Host $host;
109 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
110 proxy_set_header X-Request-Base "$scheme://$host/";
111 }
112
113 ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
114 ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
115 include /etc/letsencrypt/options-ssl-nginx.conf;
116 ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
112117}
113```
118#+end_src
114119
115Once the file is saved, link it to the `sites-enabled` directory and restart
116Nginx.
120Once the file is saved, link it to the =sites-enabled= directory and
121restart Nginx.
117122
118```sh
123#+begin_src sh
119124sudo ln -s /etc/nginx/sites-available/convos /etc/nginx/sites-enabled/convos
120125sudo systemctl restart nginx.service
121```
122
123## Screenshots
126#+end_src
124127
125See the screenshots below for an example of the Convos homepage and an
128** Screenshots
129:PROPERTIES:
130:CUSTOM_ID: screenshots
131:END:
132See the screenshots below for an example of the Convos homepage and an
126133excerpt of the chat screen.
127134
128There are numerous themes to choose from; the theme shown in the images
135There are numerous themes to choose from; the theme shown in the images
129136below is Dracula.
130137
131![Convos Home](https://img.cleberg.net/blog/20230623-convos/convos_home.png
132"Convos Home")
133
134![Convos Chat](https://img.cleberg.net/blog/20230623-convos/convos_chat.png
135"Convos Chat")
138#+caption: Convos Home
139[[https://img.cleberg.net/blog/20230623-convos/convos_home.png%20%22Convos%20Home%22]]
136140
137## Registering a Nickname
141#+caption: Convos Chat
142[[https://img.cleberg.net/blog/20230623-convos/convos_chat.png%20%22Convos%20Chat%22]]
138143
139Hop into the server channel so that you can message NickServ. In the case of
140Convos, the default sever is libera.chat.
141Simply click the `libera` conversation at the top of the sidebar to open it.
142Once the chat is open, you can claim a nickname by typing:
144** Registering a Nickname
145:PROPERTIES:
146:CUSTOM_ID: registering-a-nickname
147:END:
148Hop into the server channel so that you can message NickServ. In the
149case of Convos, the default sever is libera.chat. Simply click the
150=libera= conversation at the top of the sidebar to open it. Once the
151chat is open, you can claim a nickname by typing:
143152
144```txt
153#+begin_src txt
145154/nick <nick>
146```
155#+end_src
147156
148If the nickname is available, and you'd like to register the nickname to
157If the nickname is available, and you'd like to register the nickname to
149158yourself, you'll need to type another command:
150159
151```txt
160#+begin_src txt
152161/msg NickServ REGISTER
153162<password> <email>
154```
163#+end_src
155164
156On libera.chat, the server will send a confirmation email with a command
165On libera.chat, the server will send a confirmation email with a command
157166that you must message in IRC to verify registration of the nickname:
158167
159```txt
168#+begin_src txt
160169/msg NickServ VERIFY REGISTER <nick> <verification_code>
161```
170#+end_src
162171
163Once entered, the server should confirm registration of the nickname to the
164supplied email with the password specified.
172Once entered, the server should confirm registration of the nickname to
173the supplied email with the password specified.
blog/2023-06-28-backblaze-b2.org +151 −125
@@ -1,16 +1,16 @@
1+++
2date = 2023-06-28T16:00:00
3title = "Getting Started with Backblaze B2 Cloud Storage"
4description = "A simple tutorial to create a Backblaze B2 account for free and back up data from Linux."
5+++
1#+title: Getting Started with Backblaze B2 Cloud Storage
2#+date: 2023-06-28
63
7## Overview
4** Overview
5:PROPERTIES:
6:CUSTOM_ID: overview
7:END:
8Backblaze [[https://www.backblaze.com/b2/cloud-storage.html][B2 Cloud
9Storage]] is an inexpensive and reliable on-demand cloud storage and
10backup solution.
811
9Backblaze [B2 Cloud Storage](https://www.backblaze.com/b2/cloud-storage.html) is
10an inexpensive and reliable on-demand cloud storage and backup solution.
11
12The service starts at $5/TB/month ($0.005/GB/month) with a download rate of
13$0.01/GB/month.
12The service starts at $5/TB/month ($0.005/GB/month) with a download rate
13of $0.01/GB/month.
1414
1515However, there are free tiers:
1616
@@ -20,162 +20,188 @@ However, there are free tiers:
2020- The first 2500 Class B transactions each day are free.
2121- The first 2500 Class C transactions each day are free.
2222
23You can see which API calls fall into categories A, B, or C here:
24[Pricing Organized by API
25Calls](https://www.backblaze.com/b2/b2-transactions-price.html).
26
27For someone like me, who wants an offsite backup of their server's `/home/`
28directory and various other server configs that fall under 10 GB total,
29Backblaze is a great solution from a financial perspective.
30
31## Create An Account
32
33To start with Backblaze, you'll need to [create a free
34account](https://www.backblaze.com/b2/sign-up.html) - no payment method is
35required to sign up.
36
37Once you have an account, you can test out the service with their web GUI, their
38mobile app, or their CLI tool. I'm going to use the CLI tool below to test a
39file upload and then sync an entire directory to my Backblaze bucket.
40
41## Create a Bucket
42
43Before you can start uploading, you need to create a bucket. If you're familiar
44with other object storage services, this will feel familiar. If not, it's pretty
45simple to create one.
23You can see which API calls fall into categories A, B, or C here:
24[[https://www.backblaze.com/b2/b2-transactions-price.html][Pricing
25Organized by API Calls]].
26
27For someone like me, who wants an offsite backup of their server's
28=/home/= directory and various other server configs that fall under 10
29GB total, Backblaze is a great solution from a financial perspective.
30
31** Create An Account
32:PROPERTIES:
33:CUSTOM_ID: create-an-account
34:END:
35To start with Backblaze, you'll need to
36[[https://www.backblaze.com/b2/sign-up.html][create a free account]] -
37no payment method is required to sign up.
38
39Once you have an account, you can test out the service with their web
40GUI, their mobile app, or their CLI tool. I'm going to use the CLI tool
41below to test a file upload and then sync an entire directory to my
42Backblaze bucket.
43
44** Create a Bucket
45:PROPERTIES:
46:CUSTOM_ID: create-a-bucket
47:END:
48Before you can start uploading, you need to create a bucket. If you're
49familiar with other object storage services, this will feel familiar. If
50not, it's pretty simple to create one.
4651
4752As their webpage says:
4853
49> A bucket is a container that holds files that are uploaded into B2 Cloud
50> Storage. The bucket name must be globally unique and must have a minimum of 6
51> characters. A limit of 100 buckets may be created per account. An unlimited
52> number of files may be uploaded into a bucket.
53
54Once you click the `Create a Bucket` button on their webpage or mobile app, you
55need to provide the following:
56
57- Bucket Unique Name
58- Files in Bucket are: `Private` or `Public`
59- Default Encryption: `Disable` or `Enable`
60- Object Lock: `Disable` or `Enable`
61
62For my bucket, I created a private bucket with encryption enabled and object
63lock disabled.
64
65Once your bucket is created, you can test the upload/download feature on their
66web GUI or mobile app! At this point, you have a fully functional bucket and
67account.
68
69## Linux CLI Tool
54#+begin_quote
55A bucket is a container that holds files that are uploaded into B2 Cloud
56Storage. The bucket name must be globally unique and must have a minimum
57of 6 characters. A limit of 100 buckets may be created per account. An
58unlimited number of files may be uploaded into a bucket.
7059
71### Installation
60#+end_quote
7261
73To install the `b2` CLI tool, you'll need to download it from the [CLI
74Tools](https://www.backblaze.com/docs/cloud-storage-command-line-tools) page.
75I recommend copying the URL from the link that says `Linux` and using wget to
76download it, as shown below.
62Once you click the =Create a Bucket= button on their webpage or mobile
63app, you need to provide the following:
7764
78Once downloaded, make the file executable and move it to a location on your
79`$PATH`, so that you can execute that command from anywhere on the machine.
80
81```sh
65- Bucket Unique Name
66- Files in Bucket are: =Private= or =Public=
67- Default Encryption: =Disable= or =Enable=
68- Object Lock: =Disable= or =Enable=
69
70For my bucket, I created a private bucket with encryption enabled and
71object lock disabled.
72
73Once your bucket is created, you can test the upload/download feature on
74their web GUI or mobile app! At this point, you have a fully functional
75bucket and account.
76
77** Linux CLI Tool
78:PROPERTIES:
79:CUSTOM_ID: linux-cli-tool
80:END:
81*** Installation
82:PROPERTIES:
83:CUSTOM_ID: installation
84:END:
85To install the =b2= CLI tool, you'll need to download it from the
86[[https://www.backblaze.com/docs/cloud-storage-command-line-tools][CLI
87Tools]] page. I recommend copying the URL from the link that says
88=Linux= and using wget to download it, as shown below.
89
90Once downloaded, make the file executable and move it to a location on
91your =$PATH=, so that you can execute that command from anywhere on the
92machine.
93
94#+begin_src sh
8295wget <b2_cli_url>
8396chmod +x b2_linux
8497mv b2_linux /usr/bin/b2
85```
86
87### Log In
98#+end_src
8899
89The first step after installation is to log in. To do this, execute the
90following command and provide your `<applicationKeyId>` and `<applicationKey>`.
100*** Log In
101:PROPERTIES:
102:CUSTOM_ID: log-in
103:END:
104The first step after installation is to log in. To do this, execute the
105following command and provide your =<applicationKeyId>= and
106=<applicationKey>=.
91107
92If you don't want to provide these values in the command itself, you can simply
93execute the base command and it will request them in an interactive prompt.
108If you don't want to provide these values in the command itself, you can
109simply execute the base command and it will request them in an
110interactive prompt.
94111
95```sh
112#+begin_src sh
96113# if you want to provide the keys directly:
97114b2 authorize-account [<applicationKeyId>] [<applicationKey>]
98115
99116# or, if you don't want your keys in your shell history:
100117b2 authorize-account
101```
118#+end_src
102119
103### Upload a Test File
104
105In order to test the functionality of the CLI tool, I'll start by uploading
106a single test file to the bucket I created above.
107We can do this with the `upload_file` function.
120*** Upload a Test File
121:PROPERTIES:
122:CUSTOM_ID: upload-a-test-file
123:END:
124In order to test the functionality of the CLI tool, I'll start by
125uploading a single test file to the bucket I created above. We can do
126this with the =upload_file= function.
108127
109128The command is issued as follows:
110129
111```sh
130#+begin_src sh
112131b2 upload_file <bucket_name> <local_file> <remote_file>
113```
132#+end_src
114133
115134In my situation, I executed the following command with my username.
116135
117```sh
136#+begin_src sh
118137b2 upload_file my_unique_bucket /home/<user>/test.md test.md
119```
138#+end_src
120139
121To confirm that the file was uploaded successfully, list the files in your
122bucket:
140To confirm that the file was uploaded successfully, list the files in
141your bucket:
123142
124```sh
143#+begin_src sh
125144b2 ls <bucket_name>
126```
145#+end_src
127146
128```txt
147#+begin_src txt
129148test.md
130```
131
132### Sync a Directory
149#+end_src
133150
134If you have numerous files, you can use the `sync` function to perform
135functionality similar to `rsync`, where you can check what's in your bucket
136and sync anything that is new or modified.
151*** Sync a Directory
152:PROPERTIES:
153:CUSTOM_ID: sync-a-directory
154:END:
155If you have numerous files, you can use the =sync= function to perform
156functionality similar to =rsync=, where you can check what's in your
157bucket and sync anything that is new or modified.
137158
138159The command is issued as follows:
139160
140```sh
161#+begin_src sh
141162b2 sync <source file location> <B2 bucket destination>
142```
163#+end_src
143164
144In my case, I can sync my user's entire home directory to my bucket without
145specifying any of the files directly:
165In my case, I can sync my user's entire home directory to my bucket
166without specifying any of the files directly:
146167
147```sh
168#+begin_src sh
148169b2 sync /home/<user>/ "b2://<bucketName>/home/<user>"
149```
150
151## Caveats
152
153### Timing of Updates to the Web GUI
154
155When performing actions over a bucket, there is a slight delay in the web
156GUI when inspecting a bucket or its file.
157Note that simple actions such as uploading or deleting files may have a
158delay of a few minutes up to 24 hours.
159In my experience (<10 GB and ~20,000 files), any actions took only a few
160minutes to update across clients.
161
162### Symlinks
163
164Note that symlinks are resolved by b2, so if you have a link from
165`/home/<user>/nas-storage` that symlinks out to a `/mnt/nas-storage` folder
166that has 10TB of data, `b2` will resolve that link and start uploading all 10TB
167of data linked within the folder.
168
169If you're not sure if you have any symlinks, a symlink will look like this
170(note the `->` symbol):
171
172```sh
170#+end_src
171
172** Caveats
173:PROPERTIES:
174:CUSTOM_ID: caveats
175:END:
176*** Timing of Updates to the Web GUI
177:PROPERTIES:
178:CUSTOM_ID: timing-of-updates-to-the-web-gui
179:END:
180When performing actions over a bucket, there is a slight delay in the
181web GUI when inspecting a bucket or its file. Note that simple actions
182such as uploading or deleting files may have a delay of a few minutes up
183to 24 hours. In my experience (<10 GB and ~20,000 files), any actions
184took only a few minutes to update across clients.
185
186*** Symlinks
187:PROPERTIES:
188:CUSTOM_ID: symlinks
189:END:
190Note that symlinks are resolved by b2, so if you have a link from
191=/home/<user>/nas-storage= that symlinks out to a =/mnt/nas-storage=
192folder that has 10TB of data, =b2= will resolve that link and start
193uploading all 10TB of data linked within the folder.
194
195If you're not sure if you have any symlinks, a symlink will look like
196this (note the =->= symbol):
197
198#+begin_src sh
173199> ls -lha
174200lrwxrwxrwx 1 root root 20 Jun 28 13:32 nas -> /mnt/nas-storage/
175```
201#+end_src
176202
177203You can recursively find symlink in a path with the following command:
178204
179```sh
205#+begin_src sh
180206ls -lR /path/to/search | grep '^l'
181```
207#+end_src
blog/2023-06-30-self-hosting-voyager-lemmy-client.org +88 −83
@@ -1,54 +1,57 @@
1+++
2date = 2023-06-30
3title = "Self Hosting Voyager - A Lemmy Web Client"
4description = "A guide on how to self-host your own instance of Voyager, a mobile-first Lemmy web client."
5+++
6
7## Installation Guide
8
9[Voyager](https://github.com/aeharding/voyager) is a mobile-first Lemmy web
10client, based on iOS design standards. It follows very closely to Apollo's
11design.
12
13This post is a guide showing how I was able to build and launch my own instance
14of Voyager via Docker Compose.
15
16### Clone the Repository
17
1#+title: Self-Hosting Voyager: A Lemmy Web Client
2#+date: 2023-06-30
3
4** Installation Guide
5:PROPERTIES:
6:CUSTOM_ID: installation-guide
7:END:
8[[https://github.com/aeharding/voyager][Voyager]] is a mobile-first
9Lemmy web client, based on iOS design standards. It follows very closely
10to Apollo's design.
11
12This post is a guide showing how I was able to build and launch my own
13instance of Voyager via Docker Compose.
14
15*** Clone the Repository
16:PROPERTIES:
17:CUSTOM_ID: clone-the-repository
18:END:
1819Start by cloning the repository and entering it:
1920
20```sh
21#+begin_src sh
2122git clone https://github.com/aeharding/voyager
2223cd voyager
23```
24
25### Build the Image
24#+end_src
2625
27With this repository, you can build the image yourself without any further
28configuration.
29When complete, it'll give you the image ID for you to run.
26*** Build the Image
27:PROPERTIES:
28:CUSTOM_ID: build-the-image
29:END:
30With this repository, you can build the image yourself without any
31further configuration. When complete, it'll give you the image ID for
32you to run.
3033
31```sh
34#+begin_src sh
3235sudo docker build .
3336# Successfully built 5f00723cb5be
34```
37#+end_src
3538
36With the image ID above, you can run the container and pass the requested port
37`5314` through or use a custom port, if you wish.
39With the image ID above, you can run the container and pass the
40requested port =5314= through or use a custom port, if you wish.
3841
39You can also set the `CUSTOM_LEMMY_SERVERS` environment variable if you want to
40add to the default suggested login servers.
41This must be set with a comma separated list of suggested servers.
42The first instance in the list will be the default view for logged-out users.
42You can also set the =CUSTOM_LEMMY_SERVERS= environment variable if you
43want to add to the default suggested login servers. This must be set
44with a comma separated list of suggested servers. The first instance in
45the list will be the default view for logged-out users.
4346
44I will be using a `docker-compose.yml` file to run this container, instead of a
45`docker run` command.
47I will be using a =docker-compose.yml= file to run this container,
48instead of a =docker run= command.
4649
47```sh
50#+begin_src sh
4851nano docker-compose.yml
49```
52#+end_src
5053
51```conf
54#+begin_src conf
5255version: "2"
5356services:
5457 voyager:
@@ -58,67 +61,69 @@ services:
5861 - "<custom_port>:5314"
5962 environment:
6063 - CUSTOM_LEMMY_SERVERS=lemmy.dbzer0.com,lemmy.world,lemmy.ml,beehaw.org
61```
64#+end_src
6265
63```sh
66#+begin_src sh
6467sudo docker-compose up -d
65```
66
67The web app will now be available at the following address:
68`<machine_ip>:<custom_port>`.
69If you are running it on your local device, try `localhost:<custom_port>`.
68#+end_src
7069
71### Reverse Proxy
70The web app will now be available at the following address:
71=<machine_ip>:<custom_port>=. If you are running it on your local
72device, try =localhost:<custom_port>=.
7273
73If you want to visit this app via an external URL or domain name, you'll need to
74set up a reverse proxy.
75The example below uses Nginx as a reverse proxy.
74*** Reverse Proxy
75:PROPERTIES:
76:CUSTOM_ID: reverse-proxy
77:END:
78If you want to visit this app via an external URL or domain name, you'll
79need to set up a reverse proxy. The example below uses Nginx as a
80reverse proxy.
7681
77Simply create the configuration file, paste the contents below, save the file,
78symlink the file, and restart Nginx.
82Simply create the configuration file, paste the contents below, save the
83file, symlink the file, and restart Nginx.
7984
80```sh
85#+begin_src sh
8186sudo nano /etc/nginx/sites-available/voyager
82```
87#+end_src
8388
84```conf
89#+begin_src conf
8590server {
86 if ($host ~ ^[^.]+\.example\.com$) {
87 return 301 https://$host$request_uri;
88 }
89
90 listen [::]:80;
91 listen 80;
92 server_name voyager.example.com;
93 return 404;
91 if ($host ~ ^[^.]+\.example\.com$) {
92 return 301 https://$host$request_uri;
93 }
94
95 listen [::]:80;
96 listen 80;
97 server_name voyager.example.com;
98 return 404;
9499}
95100
96101server {
97 listen [::]:443 ssl http2;
98 listen 443 ssl http2;
99 server_name voyager.example.com;
100 access_log /var/log/nginx/voyager.access.log;
101 error_log /var/log/nginx/voyager.error.log;
102
103 location / {
104 proxy_http_version 1.1;
105 proxy_pass http://localhost:5314;
106 proxy_set_header Host $host;
107 }
108
109 ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
110 ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
111 include /etc/letsencrypt/options-ssl-nginx.conf;
112 ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
102 listen [::]:443 ssl http2;
103 listen 443 ssl http2;
104 server_name voyager.example.com;
105 access_log /var/log/nginx/voyager.access.log;
106 error_log /var/log/nginx/voyager.error.log;
107
108 location / {
109 proxy_http_version 1.1;
110 proxy_pass http://localhost:5314;
111 proxy_set_header Host $host;
112 }
113
114 ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
115 ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
116 include /etc/letsencrypt/options-ssl-nginx.conf;
117 ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
113118}
114```
119#+end_src
115120
116```sh
121#+begin_src sh
117122sudo ln sudo ln -s /etc/nginx/sites-available/voyager /etc/nginx/sites-enabled/voyager
118123sudo systemctl restart nginx.service
119```
124#+end_src
120125
121The site will now be available at the `server_name` you specified above!
126The site will now be available at the =server_name= you specified above!
122127
123You can visit my instance at [voyager.cleberg.net](https://voyager.cleberg.net)
124for an example.
128You can visit my instance at
129[[https://voyager.cleberg.net][voyager.cleberg.net]] for an example.
blog/2023-07-12-mullvad-wireguard-lan.org +80 −71
@@ -1,31 +1,32 @@
1+++
2date = 2023-07-12T19:31:00
3title = "Enabling LAN Access in Mullvad Wireguard Conf Files"
4description = ""
5+++
6
7## Download Configuration Files from Mullvad
8
9To begin, you'll need [Wireguard configuration files from
10Mullvad](https://mullvad.net/account/wireguard-config).
11You can choose any of the options as you download them.
12For example, I enabled the kill switch, selected all countries, and selected a
13few content filters.
14
15Once downloaded, unzip the files and move them to the Wireguard folder on your
16system.
17
18```sh
1#+title: Enabling LAN Access in Mullvad Wireguard Conf Files
2#+date: 2023-07-12
3
4** Download Configuration Files from Mullvad
5:PROPERTIES:
6:CUSTOM_ID: download-configuration-files-from-mullvad
7:END:
8To begin, you'll need
9[[https://mullvad.net/account/wireguard-config][Wireguard configuration
10files from Mullvad]]. You can choose any of the options as you download
11them. For example, I enabled the kill switch, selected all countries,
12and selected a few content filters.
13
14Once downloaded, unzip the files and move them to the Wireguard folder
15on your system.
16
17#+begin_src sh
1918cd ~/Downloads
2019unzip mullvad_wireguard_linux_all_all.zip
2120doas mv *.conf /etc/wireguard/
22```
23
24### Configuration File Layout
21#+end_src
2522
23*** Configuration File Layout
24:PROPERTIES:
25:CUSTOM_ID: configuration-file-layout
26:END:
2627The default configuration files will look something like this:
2728
28```conf
29#+begin_src conf
2930[Interface]
3031# Device: <redacted>
3132PrivateKey = <redacted>
@@ -38,43 +39,50 @@ PreDown = iptables -D OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m ad
3839PublicKey = <redacted>
3940AllowedIPs = <redacted>
4041Endpoint = <redacted>
41```
42#+end_src
4243
43> Note: If you didn't select the kill switch option, you won't see the `PostUp`
44> and `PreDown` lines.
45> In this case, you'll need to modify the script below to simply append those
46> lines to the `[Interface]` block.
44#+begin_quote
45Note: If you didn't select the kill switch option, you won't see the
46=PostUp= and =PreDown= lines. In this case, you'll need to modify the
47script below to simply append those lines to the =[Interface]= block.
4748
48## Editing the Configuration Files
49#+end_quote
4950
50Once you have the files, you'll need to edit them and replace the `PostUp` and
51`PreDown` lines to enable LAN access.
51** Editing the Configuration Files
52:PROPERTIES:
53:CUSTOM_ID: editing-the-configuration-files
54:END:
55Once you have the files, you'll need to edit them and replace the
56=PostUp= and =PreDown= lines to enable LAN access.
5257
53I recommend that you do this process as root, since you'll need to be able to
54access files in `/etc/wireguard`, which are generally owned by root.
55You can also try using `sudo` or `doas`, but I didn't test that scenario so you
56may need to adjust, as necessary.
58I recommend that you do this process as root, since you'll need to be
59able to access files in =/etc/wireguard=, which are generally owned by
60root. You can also try using =sudo= or =doas=, but I didn't test that
61scenario so you may need to adjust, as necessary.
5762
58```sh
63#+begin_src sh
5964su
60```
65#+end_src
6166
62Create the Python file that we'll be using to update the Wireguard configuration
63files.
67Create the Python file that we'll be using to update the Wireguard
68configuration files.
6469
65```sh
70#+begin_src sh
6671nano replace.py
67```
72#+end_src
6873
69Within the Python file, copy and paste the logic below.
70This script will open a directory, loop through every configuration file within
71the directory, and replace the `PostUp` and `PreDown` lines with the new
74Within the Python file, copy and paste the logic below. This script will
75open a directory, loop through every configuration file within the
76directory, and replace the =PostUp= and =PreDown= lines with the new
7277LAN-enabled iptables commands.
7378
74> Note: If your LAN is on a subnet other than `192.168.1.0/24`, you'll need to
75> update the Python script below appropriately.
79#+begin_quote
80Note: If your LAN is on a subnet other than =192.168.1.0/24=, you'll
81need to update the Python script below appropriately.
82
83#+end_quote
7684
77```python
85#+begin_src python
7886import os
7987import fileinput
8088
@@ -83,35 +91,35 @@ print("--- starting ---")
8391dir = "/etc/wireguard/"
8492
8593for file in os.listdir(dir):
86 print(os.path.join(dir, file))
87 for line in fileinput.input(os.path.join(dir, file), inplace=True):
88 if "PostUp" in line:
89 print("PostUp = iptables -I OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL ! -d 192.168.1.0/24 -j REJECT && ip6tables -I OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT")
90 elif "PreDown" in line:
91 print("PreDown = iptables -D OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL ! -d 192.168.1.0/24 -j REJECT && ip6tables -D OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT")
92 else:
93 print(line, end="")
94 print(os.path.join(dir, file))
95 for line in fileinput.input(os.path.join(dir, file), inplace=True):
96 if "PostUp" in line:
97 print("PostUp = iptables -I OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL ! -d 192.168.1.0/24 -j REJECT && ip6tables -I OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT")
98 elif "PreDown" in line:
99 print("PreDown = iptables -D OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL ! -d 192.168.1.0/24 -j REJECT && ip6tables -D OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT")
100 else:
101 print(line, end="")
94102
95103print("--- done ---")
96```
104#+end_src
97105
98Once you're done, save and close the file. You can now run the Python script
99and watch as each file is updated.
106Once you're done, save and close the file. You can now run the Python
107script and watch as each file is updated.
100108
101```sh
109#+begin_src sh
102110python3 replace.py
103```
111#+end_src
104112
105To confirm it worked, you can `cat` one of the configuration files to inspect
106the new logic and connect to one to test it out.
113To confirm it worked, you can =cat= one of the configuration files to
114inspect the new logic and connect to one to test it out.
107115
108```sh
116#+begin_src sh
109117cat /etc/wireguard/us-chi-wg-001.conf
110```
118#+end_src
111119
112120The configuration files should now look like this:
113121
114```conf
122#+begin_src conf
115123[Interface]
116124# Device: <redacted>
117125PrivateKey = <redacted>
@@ -124,19 +132,20 @@ PreDown = iptables -D OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m ad
124132PublicKey = <redacted>
125133AllowedIPs = <redacted>
126134Endpoint = <redacted>
127```
135#+end_src
128136
129If you connect to a Wireguard interface, such as `us-chi-wg-001`, you can test
130your SSH functionality and see that it works even while on the VPN.
137If you connect to a Wireguard interface, such as =us-chi-wg-001=, you
138can test your SSH functionality and see that it works even while on the
139VPN.
131140
132```sh
141#+begin_src sh
133142wg-quick up us-chi-wg-001
134143ssh user@lan-host
135```
144#+end_src
136145
137146To confirm your VPN connection, you can curl Mullvad's connection API:
138147
139```sh
148#+begin_src sh
140149curl https://am.i.mullvad.net/connected
141150# You are connected to Mullvad (server us-chi-wg-001). Your IP address is <redacted>
142```
151#+end_src
blog/2023-07-19-plex-transcoder-errors.org +47 −41
@@ -1,62 +1,68 @@
1+++
2date = 2023-07-19T17:00:00
3title = "How to Fix Plex Error: 'Conversion failed. The transcoder failed to start up.'"
4description = "Read to learn how to fix a common Plex error where the transcoder crashes due to SRT subtitle files."
5+++
6
7## Plex Transcoder Error
1#+title: How to Fix Plex Error: 'Conversion failed. The transcoder failed to start up.'
2#+date: 2023-07-19
83
4** Plex Transcoder Error
5:PROPERTIES:
6:CUSTOM_ID: plex-transcoder-error
7:END:
98Occasionally, you may see an error in your Plex client that references a
10failure with the transcoder conversion process.
11The specific error wording is:
9failure with the transcoder conversion process. The specific error
10wording is:
1211
13```txt
12#+begin_src txt
1413Conversion failed. The transcoder failed to start up.
15```
16
17## Debugging the Cause
14#+end_src
1815
19In order to get a better look at what is causing the error, I'm going to observe
20the Plex console while the error occurs.
21To do this, open the Plex web client, go to `Settings` > `Manage` > `Console`.
22Now, try to play the title again and watch to see which errors occur.
16** Debugging the Cause
17:PROPERTIES:
18:CUSTOM_ID: debugging-the-cause
19:END:
20In order to get a better look at what is causing the error, I'm going to
21observe the Plex console while the error occurs. To do this, open the
22Plex web client, go to =Settings= > =Manage= > =Console=. Now, try to
23play the title again and watch to see which errors occur.
2324
24In my case, you can see the errors below are related to a subtitle file (`.srt`)
25causing the transcoder to crash.
25In my case, you can see the errors below are related to a subtitle file
26(=.srt=) causing the transcoder to crash.
2627
27```txt
28#+begin_src txt
2829Jul 19, 2023 16:49:34.945 [140184571120440] Error — Couldn't find the file to stream: /movies/Movie Title (2021)/Movie Title (2021).srt
2930Jul 19, 2023 16:49:34.947 [140184532732728] Error — [Req#7611/Transcode/42935159-67C1-4192-9336-DDC6F7BC9330] Error configuring transcoder: TPU: Failed to download sub-stream to temporary file
3031Jul 19, 2023 16:49:35.225 [140184532732728] Warning — [Req#760d/Transcode] Got a request to stop a transcode session without a valid session GUID.
3132Jul 19, 2023 16:49:45.561 [140184532732728] Info — [Req#7648] AutoUpdate: no updates available
3233Jul 19, 2023 16:51:23.402 [140184510081848] Info — Library section 1 (Movies) will be updated because of a change in "/movies/Movie Title (2021)/Movie Title (2021).srt"
33```
34#+end_src
3435
35## Solving the Error
36** Solving the Error
37:PROPERTIES:
38:CUSTOM_ID: solving-the-error
39:END:
40In my case, I simply removed the subtitle file because it was not
41critical to keep. You may also avoid this by turning off subtitles if
42you don't want to delete the file.
3643
37In my case, I simply removed the subtitle file because it was not critical to
38keep.
39You may also avoid this by turning off subtitles if you don't want to delete the
40file.
41
42```sh
44#+begin_src sh
4345rm -rf "/movies/Movie Title (2021)/Movie Title (2021).srt"
44```
46#+end_src
4547
46Once the subtitle is removed from the directory or subtitles are turned off,
47try to play the title again.
48At this point, it should play without error.
49If not, reopen or refresh your Plex client and the Plex server:
48Once the subtitle is removed from the directory or subtitles are turned
49off, try to play the title again. At this point, it should play without
50error. If not, reopen or refresh your Plex client and the Plex server:
5051
51```sh
52#+begin_src sh
5253sudo systemctl restart plexmediaserver.service
53```
54
55## Related Discussion
54#+end_src
5655
57Looking at [a related Plex forum post](https://forums.plex.tv/t/subtitles-crashing-plex-transcoder-samsung-q80-tv-with-or-without-hardware-transcode/741441/2),
58it seems that `.srt` subtitles are the core issue here.
59However, Plex does not seem to have a resolution that fixes these errors.
56** Related Discussion
57:PROPERTIES:
58:CUSTOM_ID: related-discussion
59:END:
60Looking at
61[[https://forums.plex.tv/t/subtitles-crashing-plex-transcoder-samsung-q80-tv-with-or-without-hardware-transcode/741441/2][a
62related Plex forum post]], it seems that =.srt= subtitles are the core
63issue here. However, Plex does not seem to have a resolution that fixes
64these errors.
6065
6166Unfortunately, I would suggest converting subtitle formats, burning the
62subtitles into the title, or simply removing subtitles when they cause crashes.
67subtitles into the title, or simply removing subtitles when they cause
68crashes.
blog/2023-08-18-agile-auditing.org +142 −122
@@ -1,152 +1,172 @@
1+++
2date = 2023-08-18T17:11:38+00:00
3title = "Agile Auditing: An Introduction"
4description = "A quick introduction to Agile, Scrum, and Kanban for audit engagement teams."
5+++
6
7## What is Agile Auditing?
8
9[Agile](https://en.wikipedia.org/wiki/Agile_software_development), the
10collaborative philosophy behind many software development methods, has been
11picking up steam as a beneficial tool to use in the external and internal
12auditing world.
13
14This blog post will walk through commonly used terms within Agile, Scrum,
15and Kanban in order to translate these terms and roles into audit-specific
16terms.
1#+title: Agile Auditing: An Introduction
2#+date: 2023-08-18
3
4** What is Agile Auditing?
5:PROPERTIES:
6:CUSTOM_ID: what-is-agile-auditing
7:END:
8[[https://en.wikipedia.org/wiki/Agile_software_development][Agile]], the
9collaborative philosophy behind many software development methods, has
10been picking up steam as a beneficial tool to use in the external and
11internal auditing world.
12
13This blog post will walk through commonly used terms within Agile,
14Scrum, and Kanban in order to translate these terms and roles into
15audit-specific terms.
1716
1817Whether your team is in charge of a financial statement audit, an
19attestation (SOC 1, SOC 2, etc.), or a unique internal audit, the terms used
20throughout this post should still apply.
21
22## Agile
18attestation (SOC 1, SOC 2, etc.), or a unique internal audit, the terms
19used throughout this post should still apply.
2320
21** Agile
22:PROPERTIES:
23:CUSTOM_ID: agile
24:END:
2425To start, I'll take a look at Agile.
2526
26> The Agile methodology is a project management approach that involves
27> breaking the project into phases and emphasizes continuous collaboration
28> and improvement. Teams follow a cycle of planning, executing, and evaluating.
27#+begin_quote
28The Agile methodology is a project management approach that involves
29breaking the project into phases and emphasizes continuous collaboration
30and improvement. Teams follow a cycle of planning, executing, and
31evaluating.
2932
30While this approach may seem familiar to what audit teams have historically
31done, an audit team must make distinct changes in their mentality and how
32they approach and manage a project.
33#+end_quote
3334
34### Agile Values
35While this approach may seem familiar to what audit teams have
36historically done, an audit team must make distinct changes in their
37mentality and how they approach and manage a project.
3538
36The Agile Manifesto, written in 2001 at a summit in Utah, contain a set of four
37main values that comprise the Agile approach:
39*** Agile Values
40:PROPERTIES:
41:CUSTOM_ID: agile-values
42:END:
43The Agile Manifesto, written in 2001 at a summit in Utah, contain a set
44of four main values that comprise the Agile approach:
3845
39461. Individuals and interactions over processes and tools.
40472. Working software over comprehensive documentation.
41483. Customer collaboration over contract negotiation.
42494. Responding to change over following a plan.
4350
44Beyond the four values, [twelve
45principles](https://agilemanifesto.org/principles.html) were also written as
46part of the summit.
51Beyond the four values,
52[[https://agilemanifesto.org/principles.html][twelve principles]] were
53also written as part of the summit.
4754
48In order to relate these values to an audit or attestation engagement, we
49need to shift the focus from software development to the main goal of an
50engagement: completing sufficient audit testing to address to relevant risks
51over the processes and controls at hand.
55In order to relate these values to an audit or attestation engagement,
56we need to shift the focus from software development to the main goal of
57an engagement: completing sufficient audit testing to address to
58relevant risks over the processes and controls at hand.
5259
5360Audit Examples:
5461
55- Engagement teams must value the team members, client contacts, and their
56 interactions over the historical processes and tools that have been used.
57- Engagement teams must value a final report that contains sufficient
62- Engagement teams must value the team members, client contacts, and
63 their interactions over the historical processes and tools that have
64 been used.
65- Engagement teams must value a final report that contains sufficient
5866 audit documentation over excessive documentation or scope creep.
59- Engagement teams must collaborate with the audit clients as much as
60 feasible to ensure that both sides are constantly updated with current
61 knowledge of the engagement's status and any potential findings, rather
62 than waiting for pre-set meetings or the end of the engagement to communicate.
63- Engagement teams must be able to respond to change in an engagement's
64 schedule, scope, or environment to ensure that the project is completed in
65 a timely manner and that all relevant areas are tested.
66 - In terms of an audit department's portfolio, they must be able to
67 respond to changes in their company's or client's environment and be
68 able to dynamically change their audit plan accordingly.
69
70## Scrum
71
72The above section discusses the high-level details of the Agile philosophy
73and how an audit team can potentially mold that mindset into the audit world,
74but how does a team implement these ideas?
67- Engagement teams must collaborate with the audit clients as much as
68 feasible to ensure that both sides are constantly updated with current
69 knowledge of the engagement's status and any potential findings,
70 rather than waiting for pre-set meetings or the end of the engagement
71 to communicate.
72- Engagement teams must be able to respond to change in an engagement's
73 schedule, scope, or environment to ensure that the project is
74 completed in a timely manner and that all relevant areas are tested.
75 - In terms of an audit department's portfolio, they must be able to
76 respond to changes in their company's or client's environment and be
77 able to dynamically change their audit plan accordingly.
78
79** Scrum
80:PROPERTIES:
81:CUSTOM_ID: scrum
82:END:
83The above section discusses the high-level details of the Agile
84philosophy and how an audit team can potentially mold that mindset into
85the audit world, but how does a team implement these ideas?
7586
7687There are many methods that use an Agile mindset, but I prefer
77[Scrum](https://en.wikipedia.org/wiki/Scrum_(software_development)). Scrum
78is a framework based on Agile that enables a team to work through a project
79through a series of roles, ceremonies, artifacts, and values.
88[[https://en.wikipedia.org/wiki/Scrum_(software_development)][Scrum]].
89Scrum is a framework based on Agile that enables a team to work through
90a project through a series of roles, ceremonies, artifacts, and values.
8091
8192Let's dive into each of these individually.
8293
83### Scrum Team
84
85A scrum project is only as good as the team running the project. Standard
86scrum teams are separated into three distinct areas:
87
881. **Product Owner (Client Contact)**: The client contact is the audit
89 equivalent of the product owner in Scrum. They are responsible for
90 partnering with the engagement or audit team to ensure progress is being
91 made, priorities are established, and clear guidance is given when
92 questions or findings arise within each sprint.
932. **Scrum Master (Engagement Lead)**: The engagement or audit team lead is
94 responsible for coaching the team and the client contact on the scrum
95 process, tracking team progress against plan, scheduling necessary
96 resources, and helping remove obstacles.
973. **Scrum Developers (Engagement Members)**: The engagement or audit team
98 is the set of team members responsible for getting the work done. These
99 team members will work on each task, report progress, resolve obstacles,
100 and collaborate with other team members and the client contact to ensure
101 goals are being met.
102
103### Scrum Ceremonies
104
94*** Scrum Team
95:PROPERTIES:
96:CUSTOM_ID: scrum-team
97:END:
98A scrum project is only as good as the team running the project.
99Standard scrum teams are separated into three distinct areas:
100
1011. *Product Owner (Client Contact)*: The client contact is the audit
102 equivalent of the product owner in Scrum. They are responsible for
103 partnering with the engagement or audit team to ensure progress is
104 being made, priorities are established, and clear guidance is given
105 when questions or findings arise within each sprint.
1062. *Scrum Master (Engagement Lead)*: The engagement or audit team lead
107 is responsible for coaching the team and the client contact on the
108 scrum process, tracking team progress against plan, scheduling
109 necessary resources, and helping remove obstacles.
1103. *Scrum Developers (Engagement Members)*: The engagement or audit team
111 is the set of team members responsible for getting the work done.
112 These team members will work on each task, report progress, resolve
113 obstacles, and collaborate with other team members and the client
114 contact to ensure goals are being met.
115
116*** Scrum Ceremonies
117:PROPERTIES:
118:CUSTOM_ID: scrum-ceremonies
119:END:
105120Scrum ceremonies are events that are performed on a regular basis.
106121
1071. **Sprint Planning**: The team works together to plan the upcoming sprint
108 goal
109 and which user stories (tasks) will be added to the sprint to achieve
110 that goal.
1112. **Sprint**: The time period, typically at least one week and no more than one
112 month in length, where the team works on the stories and anything in the
113 backlog.
1143. **Daily Scrum**: A very short meeting held each day, typically 15 minutes, to
115 quickly emphasize alignment on the sprint goal and plan the next 24 hours.
116 Each team member may share what they did the day before, what they'll do
117 today, and any obstacles to their work.
1184. **Sprint Review**: At the end of each sprint, the team will gather and
119 discuss the progress, obstacles, and backlog from the previous sprint.
1205. **Sprint Retrospective**: More specific than the sprint review, the
121 retrospective is meant to discuss what worked and what did not work
122 during the sprint. This may be processes, tools, people, or even things
123 related to the Scrum ceremonies.
124
125One additional ceremony that may be applicable is organizing the backlog.
126This is typically the responsibility of the engagement leader and is meant
127to prioritize and clarify what needs to be done to complete items in the
128backlog.
129
130### Artifacts
131
132While artifacts are generally not customizable in the audit world (i.e.,
133each control test must include some kind of working paper with evidence
134supporting the test results), I wanted to include some quick notes on
1221. *Sprint Planning*: The team works together to plan the upcoming
123 sprint goal and which user stories (tasks) will be added to the
124 sprint to achieve that goal.
1252. *Sprint*: The time period, typically at least one week and no more
126 than one month in length, where the team works on the stories and
127 anything in the backlog.
1283. *Daily Scrum*: A very short meeting held each day, typically 15
129 minutes, to quickly emphasize alignment on the sprint goal and plan
130 the next 24 hours. Each team member may share what they did the day
131 before, what they'll do today, and any obstacles to their work.
1324. *Sprint Review*: At the end of each sprint, the team will gather and
133 discuss the progress, obstacles, and backlog from the previous
134 sprint.
1355. *Sprint Retrospective*: More specific than the sprint review, the
136 retrospective is meant to discuss what worked and what did not work
137 during the sprint. This may be processes, tools, people, or even
138 things related to the Scrum ceremonies.
139
140One additional ceremony that may be applicable is organizing the
141backlog. This is typically the responsibility of the engagement leader
142and is meant to prioritize and clarify what needs to be done to complete
143items in the backlog.
144
145*** Artifacts
146:PROPERTIES:
147:CUSTOM_ID: artifacts
148:END:
149While artifacts are generally not customizable in the audit world (i.e.,
150each control test must include some kind of working paper with evidence
151supporting the test results), I wanted to include some quick notes on
135152associating scrum artifact terms with an audit.
136153
1371. **Product Backlog**: This is the overall backlog of unfinished audit
1541. *Product Backlog*: This is the overall backlog of unfinished audit
138155 tasks from all prior sprints.
1392. **Sprint Backlog**: This is the backlog of unfinished audit tasks from
1562. *Sprint Backlog*: This is the backlog of unfinished audit tasks from
140157 one individual sprint.
1413. **Increment**: This is the output of each sprint - generally this is best
142 thought of as any documentation prepared during the sprint, such as risk
143 assessments, control working papers, deficiency analysis, etc.
144
145## Kanban
146
147Last but not least, Kanban is a methodology that relies on boards to
148categorize work into distinct, descriptive categories that allow an agile or
149scrum team to effectively plan the work of a sprint or project.
150
151See Atlassian's [Kanban](https://www.atlassian.com/agile/kanban) page for
152more information.
1583. *Increment*: This is the output of each sprint - generally this is
159 best thought of as any documentation prepared during the sprint, such
160 as risk assessments, control working papers, deficiency analysis,
161 etc.
162
163** Kanban
164:PROPERTIES:
165:CUSTOM_ID: kanban
166:END:
167Last but not least, Kanban is a methodology that relies on boards to
168categorize work into distinct, descriptive categories that allow an
169agile or scrum team to effectively plan the work of a sprint or project.
170
171See Atlassian's [[https://www.atlassian.com/agile/kanban][Kanban]] page
172for more information.
blog/2023-09-15-gitweb.org +42 −34
@@ -1,39 +1,44 @@
1+++
2date = 2023-09-16T03:10:37+00:00
3title = "GitWeb via Nginx"
4description = "A short guide on how to serve GitWeb via Nginx."
5+++
1#+title: GitWeb via Nginx
2#+date: 2023-09-16
63
7## Overview
4** Overview
5:PROPERTIES:
6:CUSTOM_ID: overview
7:END:
8[[https://git-scm.com/book/en/v2/Git-on-the-Server-GitWeb][GitWeb]] is a
9simple web-based visualizer for git repositories. By default, GitWeb
10will only run with the =lighttpd= or =webrick= web servers.
811
9[GitWeb](https://git-scm.com/book/en/v2/Git-on-the-Server-GitWeb) is a simple
10web-based visualizer for git repositories.
11By default, GitWeb will only run with the `lighttpd` or `webrick` web servers.
12
13However, this guide will show you how to keep GitWeb running in the background
14and display information for all repositories in a chosen directory.
12However, this guide will show you how to keep GitWeb running in the
13background and display information for all repositories in a chosen
14directory.
1515
1616See below for the final result:
1717
18![Gitweb](https://img.cleberg.net/blog/20230915-gitweb/gitweb.png "Gitweb")
19
20## Install Dependencies
18#+caption: Gitweb
19[[https://img.cleberg.net/blog/20230915-gitweb/gitweb.png]]
2120
21** Install Dependencies
22:PROPERTIES:
23:CUSTOM_ID: install-dependencies
24:END:
2225To start, you'll need install the following packages:
2326
24```sh
27#+begin_src sh
2528sudo apt install git gitweb fcgiwrap nginx
26```
27
28## Configure Nginx
29#+end_src
2930
31** Configure Nginx
32:PROPERTIES:
33:CUSTOM_ID: configure-nginx
34:END:
3035Once installed, create an Nginx configuration file.
3136
32```sh
37#+begin_src sh
3338sudo nano /etc/nginx/sites-available/git.example.com
34```
39#+end_src
3540
36```conf
41#+begin_src conf
3742server {
3843 listen 80;
3944 server_name example.com;
@@ -52,23 +57,26 @@ server {
5257 index index.cgi;
5358 }
5459}
55```
60#+end_src
5661
57To make the configuration active, you need to symlink it and then restart Nginx.
62To make the configuration active, you need to symlink it and then
63restart Nginx.
5864
59```sh
65#+begin_src sh
6066sudo ln -s /etc/nginx/sites-available/git.example.com /etc/nginx/sites-enabled/git.example.com
6167sudo systemctl restart nginx.service
62```
63
64The GitWeb application should now be available via the URL you set in the Nginx
65configuration above.
68#+end_src
6669
67## Customize GitWeb
70The GitWeb application should now be available via the URL you set in
71the Nginx configuration above.
6872
69If you need to, you can customize many things about Gitweb by editing the
70[gitweb.conf](https://git-scm.com/docs/gitweb.conf) file.
73** Customize GitWeb
74:PROPERTIES:
75:CUSTOM_ID: customize-gitweb
76:END:
77If you need to, you can customize many things about Gitweb by editing
78the [[https://git-scm.com/docs/gitweb.conf][gitweb.conf]] file.
7179
72```sh
80#+begin_src sh
7381sudo nano /etc/gitweb.conf
74```
82#+end_src
blog/2023-09-19-audit-sql-scripts.org +76 −64
@@ -1,23 +1,25 @@
1+++
2date = 2023-09-20T01:12:51+00:00
3title = "Useful SQL Scripts for Auditing Logical Access"
4description = "A handful of SQL scripts in different dialects to gather user permissions on a database."
5+++
1#+title: Useful SQL Scripts for Auditing Logical Access
2#+date: 2023-09-20
63
7## Overview
4** Overview
5:PROPERTIES:
6:CUSTOM_ID: overview
7:END:
8When you have to scope a database into your engagement, you may be
9curious how to best extract the information from the database. While
10there are numerous different methods to extract this type of
11information, I'm going to show an example of how to gather all users and
12privileges from three main database types: Oracle, Microsoft SQL, and
13MySQL.
814
9When you have to scope a database into your engagement, you may be curious
10how to best extract the information from the database. While there are
11numerous different methods to extract this type of information, I'm going to
12show an example of how to gather all users and privileges from three main
13database types: Oracle, Microsoft SQL, and MySQL.
15** Oracle
16:PROPERTIES:
17:CUSTOM_ID: oracle
18:END:
19You can use the following SQL script to see all users and their
20privileges in an Oracle database:
1421
15## Oracle
16
17You can use the following SQL script to see all users and their privileges
18in an Oracle database:
19
20```sql
22#+begin_src sql
2123SELECT
2224 grantee AS "User",
2325 privilege AS "Privilege"
@@ -33,38 +35,43 @@ FROM
3335 dba_tab_privs
3436WHERE
3537 grantee IN (SELECT DISTINCT grantee FROM dba_tab_privs);
36```
37
38This script queries the `dba_sys_privs` and `dba_tab_privs` views to
39retrieve system and table-level privileges respectively. It then combines
40the results using `UNION ALL` to show all users and their associated
41privileges. Please note that this method does not extract information from
42the `dba_role_privs` table - use the method below for that data.
38#+end_src
4339
44Please note that you might need appropriate privileges (e.g., DBA privileges)
45to access these views, and you should exercise caution when querying system
46tables in a production Oracle database.
40This script queries the =dba_sys_privs= and =dba_tab_privs= views to
41retrieve system and table-level privileges respectively. It then
42combines the results using =UNION ALL= to show all users and their
43associated privileges. Please note that this method does not extract
44information from the =dba_role_privs= table - use the method below for
45that data.
4746
48### Alternative Oracle Query
47Please note that you might need appropriate privileges (e.g., DBA
48privileges) to access these views, and you should exercise caution when
49querying system tables in a production Oracle database.
4950
50You can also extract each table's information separately and perform
51processing outside the database to explore and determine the information
51*** Alternative Oracle Query
52:PROPERTIES:
53:CUSTOM_ID: alternative-oracle-query
54:END:
55You can also extract each table's information separately and perform
56processing outside the database to explore and determine the information
5257necessary for the audit:
5358
54```sql
59#+begin_src sql
5560SELECT * FROM sys.dba_role_privs;
5661SELECT * FROM sys.dba_sys_privs;
5762SELECT * FROM sys.dba_tab_privs;
5863SELECT * FROM sys.dba_users;
59```
64#+end_src
6065
61## Microsoft SQL
66** Microsoft SQL
67:PROPERTIES:
68:CUSTOM_ID: microsoft-sql
69:END:
70You can use the following SQL script to see all users and their
71privileges in a Microsoft SQL Server database
72([[https://stackoverflow.com/a/30040784][source]]):
6273
63You can use the following SQL script to see all users and their privileges
64in a Microsoft SQL Server database
65([source](https://stackoverflow.com/a/30040784)):
66
67```sql
74#+begin_src sql
6875/*
6976Security Audit Report
70771) List all access provisioned to a sql user or windows user/group directly
@@ -209,42 +216,47 @@ ORDER BY
209216 perm.[permission_name],
210217 perm.[state_desc],
211218 obj.type_desc--perm.[class_desc]
212```
213
214## MySQL
219#+end_src
215220
216You can use the following SQL script to see all users and their privileges
217in a MySQL database:
221** MySQL
222:PROPERTIES:
223:CUSTOM_ID: mysql
224:END:
225You can use the following SQL script to see all users and their
226privileges in a MySQL database:
218227
219```shell
228#+begin_src shell
220229mysql -u root -p
221```
230#+end_src
222231
223232Find all users and hosts with access to the database:
224233
225```sql
234#+begin_src sql
226235SELECT * FROM information_schema.user_privileges;
227```
228
229This script retrieves user information and their associated database-level
230privileges from the `information_schema.user_privileges` table in MySQL. It
231lists various privileges such as SELECT, INSERT, UPDATE, DELETE, CREATE, and
232more for each user and database combination.
236#+end_src
233237
234Please note that you may need appropriate privileges (e.g., `SELECT`
235privileges on `information_schema.user_privileges`) to access this
236information in a MySQL database. Additionally, some privileges like GRANT
237OPTION, EXECUTE, EVENT, and TRIGGER may not be relevant for all users and
238databases.
238This script retrieves user information and their associated
239database-level privileges from the =information_schema.user_privileges=
240table in MySQL. It lists various privileges such as SELECT, INSERT,
241UPDATE, DELETE, CREATE, and more for each user and database combination.
239242
240### Alternative MySQL Query
243Please note that you may need appropriate privileges (e.g., =SELECT=
244privileges on =information_schema.user_privileges=) to access this
245information in a MySQL database. Additionally, some privileges like
246GRANT OPTION, EXECUTE, EVENT, and TRIGGER may not be relevant for all
247users and databases.
241248
242You can also grab individual sets of data from MySQL if you prefer to join them
243after extraction. I have marked the queries below with `SELECT ...` and excluded
244most `WHERE` clauses for brevity. You should determine the relevant privileges
245in-scope and query for those privileges to reduce the length of time to query.
249*** Alternative MySQL Query
250:PROPERTIES:
251:CUSTOM_ID: alternative-mysql-query
252:END:
253You can also grab individual sets of data from MySQL if you prefer to
254join them after extraction. I have marked the queries below with
255=SELECT ...= and excluded most =WHERE= clauses for brevity. You should
256determine the relevant privileges in-scope and query for those
257privileges to reduce the length of time to query.
246258
247```sql
259#+begin_src sql
248260-- Global Permissions
249261SELECT ... FROM mysql.user;
250262
@@ -263,4 +275,4 @@ WHERE db = @db_name;
263275-- Password Configuration
264276SHOW GLOBAL VARIABLES LIKE 'validate_password%';
265277SHOW VARIABLES LIKE 'validate_password%';
266```
278#+end_src
blog/2023-10-04-digital-minimalism.org +89 −77
@@ -1,82 +1,93 @@
1+++
2date = 2023-10-05T02:10:47+00:00
3title = "Digital Minimalism"
4description = "Some personal reflections on digital minimalism."
5+++
6
7I've written [a note about minimalism](/notes/minimalism) before, but I wanted
8to dedicate some time to reflect on digital minimalism and how I've been able
9to minimize the impact of digital devices in my life.
10
11> These changes crept up on us and happened fast, before we had a chance to step
12> back and ask what we really wanted out of the rapid advances of the past
13> decade. We added new technologies to the periphery of our experience for minor
14> reasons, then woke one morning to discover that they had colonized the core
15> of our daily life. We didn’t, in other words, sign up for the digital world in
16> which we’re currently entrenched; we seem to have stumbled backward into it.
17> *(Digital Minimalism, 2019)*
18
19## The Principles of Digital Minimalism
20
21As noted in Cal Newport's book, *Digital Minimalism*, there are three main
1#+title: Digital Minimalism
2#+date: 2023-10-05
3
4I've written [[/notes/minimalism][a note about minimalism]] before, but I wanted to dedicate some time
5to reflect on digital minimalism and how I've been able to minimize the impact
6of digital devices in my life.
7
8#+begin_quote
9These changes crept up on us and happened fast, before we had a chance to step
10back and ask what we really wanted out of the rapid advances of the past
11decade. We added new technologies to the periphery of our experience for minor
12reasons, then woke one morning to discover that they had colonized the core of
13our daily life. We didn't, in other words, sign up for the digital world in
14which we're currently entrenched; we seem to have stumbled backward into
15it.
16
17/(Digital Minimalism, 2019)/
18#+end_quote
19
20** The Principles of Digital Minimalism
21:PROPERTIES:
22:CUSTOM_ID: the-principles-of-digital-minimalism
23:END:
24As noted in Cal Newport's book, /Digital Minimalism/, there are three main
2225principles to digital minimalism that I tend to agree with:
2326
24271. Clutter is costly.
25 - Digital minimalists recognize that cluttering their time and attention
26 with too many devices, apps, and services creates an overall negative
27 cost that can swamp the small benefits that each individual item
28 provides in isolation.
28 - Digital minimalists recognize that cluttering their time and attention with
29 too many devices, apps, and services creates an overall negative cost that
30 can swamp the small benefits that each individual item provides in
31 isolation.
29322. Optimization is important.
30 - Digital minimalists believe that deciding a particular technology
31 supports something they value is only the first step. To truly extract
32 its full potential benefit, it’s necessary to think carefully about how
33 they’ll use the technology.
33 - Digital minimalists believe that deciding a particular technology supports
34 something they value is only the first step. To truly extract its full
35 potential benefit, it's necessary to think carefully about how they'll use
36 the technology.
34373. Intentionality is satisfying.
35 - Digital minimalists derive significant satisfaction from their general
36 commitment to being more intentional about how they engage with new
37 technologies. This source of satisfaction is independent of the specific
38 decisions they make and is one of the biggest reasons that minimalism
39 tends to be immensely meaningful to its practitioners.
40
41## Taking Action
42
43In order to put the logic into practice, I've created a few new habits and
38 - Digital minimalists derive significant satisfaction from their general
39 commitment to being more intentional about how they engage with new
40 technologies. This source of satisfaction is independent of the specific
41 decisions they make and is one of the biggest reasons that minimalism tends
42 to be immensely meaningful to its practitioners.
43
44** Taking Action
45:PROPERTIES:
46:CUSTOM_ID: taking-action
47:END:
48In order to put the logic into practice, I've created a few new habits and
4449continued performing old habits that are working well:
4550
46### Using Devices With Intention
47
48- I already rarely use "social media", mostly limited to forums such as Hacker
49News and Tildes, so I've just tweaked my behavior to stop looking for content in
50those places when I'm bored.
51- Use devices with intention. Each time I pick up a digital device, there should
52be an intention to use the device to improve my current situation. No more
53endless scrolling or searching for something to interest me.
54
55### Prevent Distractions
56
57- Disable (most) notifications on all devices. I spent 15-30 minutes going
58through the notifications on my phone, watch, and computer to ensure that only a
59select few apps have the ability to interrupt me: Calendar, Messages, Phone,
60Reminders, & Signal.
51*** Using Devices With Intention
52:PROPERTIES:
53:CUSTOM_ID: using-devices-with-intention
54:END:
55- I already rarely use "social media", mostly limited to forums such as Hacker
56 News and Tildes, so I've just tweaked my behavior to stop looking for content
57 in those places when I'm bored.
58- Use devices with intention. Each time I pick up a digital device, there should
59 be an intention to use the device to improve my current situation. No more
60 endless scrolling or searching for something to interest me.
61
62*** Prevent Distractions
63:PROPERTIES:
64:CUSTOM_ID: prevent-distractions
65:END:
66- Disable (most) notifications on all devices. I spent 15-30 minutes going
67 through the notifications on my phone, watch, and computer to ensure that only
68 a select few apps have the ability to interrupt me: Calendar, Messages, Phone,
69 Reminders, & Signal.
6170- Disable badges for any apps except the ones mentioned in the bullet above.
62- Set-up focus profiles across devices so that I can enable different modes,
63such as Personal when I only want to see notifications from people I care about
64or Do Not Disturb, where absolutely nothing can interrupt me.
65- Clean up my home screens. This one was quite easy as I already maintain a
66minimalist set-up, but I went extreme by limiting my phone to just eight apps on
67the home screen and four in the dock. If I need another app, I'll have to search
68or use the app library.
69- Remove the work profile from my phone. This was a tough decision as having my
70work profile on my device definitely makes my life easier at times, but it also
71has quite a negative effect when I'm "always online" and can see the
72notifications and team activity 24/7. I believe creating a distinct barrier
73between my work and personal devices will be beneficial in the end.
74
75### Creating Alternative Activities
76
77This is the most difficult piece, as most of my hobbies and interests lie in the
78digital world. However, I'm making a concerted effort to put devices down unless
79necessary and force myself to perform other activities in the physical world
71- Set-up focus profiles across devices so that I can enable different modes,
72 such as Personal when I only want to see notifications from people I care
73 about or Do Not Disturb, where absolutely nothing can interrupt me.
74- Clean up my home screens. This one was quite easy as I already maintain a
75 minimalist set-up, but I went extreme by limiting my phone to just eight apps
76 on the home screen and four in the dock. If I need another app, I'll have to
77 search or use the app library.
78- Remove the work profile from my phone. This was a tough decision as having my
79 work profile on my device definitely makes my life easier at times, but it
80 also has quite a negative effect when I'm "always online" and can see the
81 notifications and team activity 24/7. I believe creating a distinct barrier
82 between my work and personal devices will be beneficial in the end.
83
84*** Creating Alternative Activities
85:PROPERTIES:
86:CUSTOM_ID: creating-alternative-activities
87:END:
88This is the most difficult piece, as most of my hobbies and interests lie in the
89digital world. However, I'm making a concerted effort to put devices down unless
90necessary and force myself to perform other activities in the physical world
8091instead.
8192
8293I've started with a few basics that are always readily available to me:
@@ -87,12 +98,13 @@ I've started with a few basics that are always readily available to me:
8798- Participate in a hobby, such as photography, birding, disc golf, etc.
8899- Let yourself be bored and wander into creativity.
89100
90## Making Progress
91
92I'll be taking notes as I continue down this journey and hope to see positive
93trends. I've always been a minimalist in the physical world and it feels
94refreshing to filter out the clutter that has come to dominate my digital life
101** Making Progress
102:PROPERTIES:
103:CUSTOM_ID: making-progress
104:END:
105I'll be taking notes as I continue down this journey and hope to see positive
106trends. I've always been a minimalist in the physical world and it feels
107refreshing to filter out the clutter that has come to dominate my digital life
95108over the years.
96109
97110I'm excited to see where this journey leads.
98
blog/2023-10-11-self-hosting-authelia.org +264 −247
@@ -1,54 +1,59 @@
1+++
2date = 2023-10-11T02:53:29+00:00
3title = "Self-Hosting Authelia"
4description = "A simple tutorial to get Authelia running on a self-hosted server."
5+++
6
7## Overview
8
9[Authelia](https://www.authelia.com/) is an open-source authentication service
10that allows you to place a portal between end users on the internet and
11self-hosted services on your server.
12
13You can require one factor (username+password) or two factor authentication for
1#+title: Self-Hosting Authelia
2#+date: 2023-10-11
3
4** Overview
5:PROPERTIES:
6:CUSTOM_ID: overview
7:END:
8[[https://www.authelia.com/][Authelia]] is an open-source authentication service that allows you to place a
9portal between end users on the internet and self-hosted services on your
10server.
11
12You can require one factor (username+password) or two factor authentication for
1413any such user before allowing them to access a specific service on your domain.
1514
16This guide will walk through a standard installation of Authelia for
17`example.com`, using `auth.example.com` as Authelia's authentication domain and
18`teddit.example.com` as the website we want to protect behind the authentication
15This guide will walk through a standard installation of Authelia for
16=example.com=, using =auth.example.com= as Authelia's authentication domain and
17=teddit.example.com= as the website we want to protect behind the authentication
1918portal.
2019
21## Prerequisites
22
20** Prerequisites
21:PROPERTIES:
22:CUSTOM_ID: prerequisites
23:END:
2324This guide assumes you have the following already set-up:
2425
2526- A registered domain with DNS pointing to your server.
26- A subdomain for Authelia (`auth.example.com`) and a subdomain to protect via
27Authelia (`app.example.com`).
27- A subdomain for Authelia (=auth.example.com=) and a subdomain to
28 protect via Authelia (=app.example.com=).
2829- A working Nginx web server.
2930- Docker and docker-compose installed.
3031
31## Installation
32
33This guide will walk through each installation step one-by-one, starting with
34the container and finishing by cleaning up external access via an Nginx reverse
32** Installation
33:PROPERTIES:
34:CUSTOM_ID: installation
35:END:
36This guide will walk through each installation step one-by-one, starting with
37the container and finishing by cleaning up external access via an Nginx reverse
3538proxy.
3639
37### Docker-Compose
38
39To start, create a directory for Authelia and create a `docker-compose.yml`
40file.
40*** Docker-Compose
41:PROPERTIES:
42:CUSTOM_ID: docker-compose
43:END:
44To start, create a directory for Authelia and create a
45=docker-compose.yml= file.
4146
42```sh
47#+begin_src sh
4348mkdir ~/authelia
4449nano ~/authelia/docker-compose.yml
45```
50#+end_src
4651
47Within this file, paste the following content. If you prefer a different local
48port, modify the port on the left side of the colon on the `9091:9091` line. Be
49sure to modify the `TZ` variable to your timezone.
52Within this file, paste the following content. If you prefer a different local
53port, modify the port on the left side of the colon on the =9091:9091= line. Be
54sure to modify the =TZ= variable to your timezone.
5055
51```yml
56#+begin_src yml
5257version: '3.3'
5358
5459services:
@@ -61,50 +66,52 @@ services:
6166 - 9091:9091
6267 environment:
6368 - TZ=America/Chicago
64```
69#+end_src
6570
6671Start the container with docker-compose:
6772
68```sh
73#+begin_src sh
6974sudo docker-compose up -d
70```
75#+end_src
7176
72After the first start, the container will automatically exit and require you to
77After the first start, the container will automatically exit and require you to
7378modify the app's configuration files before continuing. Read on to learn more.
7479
75### Authelia Configuration
80*** Authelia Configuration
81:PROPERTIES:
82:CUSTOM_ID: authelia-configuration
83:END:
84To configure Authelia before we restart the container, we need to open the
85=config= directory and modify the files. Start by editing the
86=configuration.yml= file, where all of Authelia's settings are stored.
7687
77To configure Authelia before we restart the container, we need to open the
78`config` directory and modify the files. Start by editing the
79`configuration.yml` file, where all of Authelia's settings are stored.
80
81My personal preference is to copy the original configuration file to a backup
88My personal preference is to copy the original configuration file to a backup
8289file and edit a fresh copy.
8390
84```sh
91#+begin_src sh
8592sudo cp ~/authelia/config/configuration.yml ~/authelia/config/configuration.yml.bk
8693sudo nano ~/authelia/config/configuration.yml
87```
94#+end_src
8895
89Within the blank `configuration.yml` file, paste the following information. You
90will need to make quite a few updates, so be sure to read each line carefully
96Within the blank =configuration.yml= file, paste the following information. You
97will need to make quite a few updates, so be sure to read each line carefully
9198and modify as necessary.
9299
93100The major required changes are:
94101
95- Any instances of `example.com` should be replaced by your domain.
96- `jwt_secret` - Use the `pwgen 40 1` command to generate a secret for yourself.
97- `access_control` - Set the Authelia domain to bypass here, as well as any
98subdomains you want to protect.
99- `session` > `secret` - Use the `pwgen 40 1` command to generate a secret for
100yourself.
101- `regulation` - Set the variables here to restrict login attempts and bans.
102- `storage` > `encryption_key` - Use the `pwgen 40 1` command to generate a
103secret for yourself.
104- `smtp` - If you have access to an SMTP service, set up the information here to
105active outgoing emails.
106
107```yml
102- Any instances of =example.com= should be replaced by your domain.
103- =jwt_secret= - Use the =pwgen 40 1= command to generate a secret for yourself.
104- =access_control= - Set the Authelia domain to bypass here, as well as any
105 subdomains you want to protect.
106- =session= > =secret= - Use the =pwgen 40 1= command to generate a secret for
107 yourself.
108- =regulation= - Set the variables here to restrict login attempts and bans.
109- =storage= > =encryption_key= - Use the =pwgen 40 1= command to generate a
110 secret for yourself.
111- =smtp= - If you have access to an SMTP service, set up the information here to
112 active outgoing emails.
113
114#+begin_src yml
108115# yamllint disable rule:comments-indentation
109116---
110117###############################################################################
@@ -193,25 +200,27 @@ notifier:
193200 skip_verify: false
194201 minimum_version: TLS1.2
195202...
196```
197
198### Authelia Users
203#+end_src
199204
205*** Authelia Users
206:PROPERTIES:
207:CUSTOM_ID: authelia-users
208:END:
200209Next, create the users file for authentication.
201210
202```sh
211#+begin_src sh
203212sudo nano ~/authelia/config/users_database.yml
204```
213#+end_src
205214
206Within the file, you will need to create an entry for each user that needs
207access to Authelia. The `my_username` entry will be the username used on the
215Within the file, you will need to create an entry for each user that needs
216access to Authelia. The =my_username= entry will be the username used on the
208217login page.
209218
210To generate the password, go to [Argon2 Hash Generator](https://argon2.online),
211generate a random salt, and make sure the rest of the settings match the
212`authentication_backend` section of `configuration.yml` file.
219To generate the password, go to [[https://argon2.online][Argon2 Hash Generator]], generate a random salt,
220and make sure the rest of the settings match the =authentication_backend=
221section of =configuration.yml= file.
213222
214```yml
223#+begin_src yml
215224users:
216225 my_username:
217226 displayname: "My User"
@@ -222,225 +231,233 @@ users:
222231 groups:
223232 - admins
224233 - dev
225```
234#+end_src
226235
227236Once the app is configured, restart the container from scratch.
228237
229```sh
238#+begin_src sh
230239cd ~/authelia
231240sudo docker-compose down && sudo docker-compose up -d
232```
233
234### Nginx: Authelia Domain
241#+end_src
235242
236Once the container is running and configured, the final step is to configure
243*** Nginx: Authelia Domain
244:PROPERTIES:
245:CUSTOM_ID: nginx-authelia-domain
246:END:
247Once the container is running and configured, the final step is to configure
237248external access to the server via Nginx reverse proxy.
238249
239250Start by creating the Authelia domain.
240251
241```sh
252#+begin_src sh
242253sudo nano /etc/nginx/sites-available/auth
243```
254#+end_src
244255
245Within this file, paste the following information and be sure to update
246`example.com` to your domain. Make sure the `$upstream_authelia` variable
256Within this file, paste the following information and be sure to update
257=example.com= to your domain. Make sure the =$upstream_authelia= variable
247258matches the location of your Authelia container.
248259
249```conf
260#+begin_src conf
250261server {
251 if ($host ~ ^[^.]+\.example\.com$) {
252 return 301 https://$host$request_uri;
253 }
254
255 listen [::]:80;
256 listen 80;
257 server_name auth.example.com;
258 return 404;
262 if ($host ~ ^[^.]+\.example\.com$) {
263 return 301 https://$host$request_uri;
264 }
265
266 listen [::]:80;
267 listen 80;
268 server_name auth.example.com;
269 return 404;
259270}
260271
261272server {
262 listen [::]:443 ssl http2;
263 listen 443 ssl http2;
264 server_name auth.example.com;
265 access_log /var/log/nginx/auth.access.log;
266 error_log /var/log/nginx/auth.error.log;
267
268 ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
269 ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
270 include /etc/letsencrypt/options-ssl-nginx.conf;
271 ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
272
273 location / {
274 set $upstream_authelia http://127.0.0.1:9091;
275 proxy_pass $upstream_authelia;
276 client_body_buffer_size 128k;
277
278 proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
279
280 send_timeout 5m;
281 proxy_read_timeout 360;
282 proxy_send_timeout 360;
283 proxy_connect_timeout 360;
284
285 proxy_set_header Host $host;
286 proxy_set_header X-Real-IP $remote_addr;
287 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
288 proxy_set_header X-Forwarded-Proto $scheme;
289 proxy_set_header X-Forwarded-Host $http_host;
290 proxy_set_header X-Forwarded-Uri $request_uri;
291 proxy_set_header X-Forwarded-Ssl on;
292 proxy_redirect http:// $scheme://;
293 proxy_http_version 1.1;
294 proxy_set_header Connection "";
295 proxy_cache_bypass $cookie_session;
296 proxy_no_cache $cookie_session;
297 proxy_buffers 64 256k;
298 }
273 listen [::]:443 ssl http2;
274 listen 443 ssl http2;
275 server_name auth.example.com;
276 access_log /var/log/nginx/auth.access.log;
277 error_log /var/log/nginx/auth.error.log;
278
279 ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
280 ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
281 include /etc/letsencrypt/options-ssl-nginx.conf;
282 ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
283
284 location / {
285 set $upstream_authelia http://127.0.0.1:9091;
286 proxy_pass $upstream_authelia;
287 client_body_buffer_size 128k;
288
289 proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
290
291 send_timeout 5m;
292 proxy_read_timeout 360;
293 proxy_send_timeout 360;
294 proxy_connect_timeout 360;
295
296 proxy_set_header Host $host;
297 proxy_set_header X-Real-IP $remote_addr;
298 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
299 proxy_set_header X-Forwarded-Proto $scheme;
300 proxy_set_header X-Forwarded-Host $http_host;
301 proxy_set_header X-Forwarded-Uri $request_uri;
302 proxy_set_header X-Forwarded-Ssl on;
303 proxy_redirect http:// $scheme://;
304 proxy_http_version 1.1;
305 proxy_set_header Connection "";
306 proxy_cache_bypass $cookie_session;
307 proxy_no_cache $cookie_session;
308 proxy_buffers 64 256k;
309 }
299310
300311}
301```
312#+end_src
302313
303Next, symlink the file and restart Nginx. If there are errors, be sure to
314Next, symlink the file and restart Nginx. If there are errors, be sure to
304315resolve those before moving on.
305316
306```sh
317#+begin_src sh
307318sudo ln -s /etc/nginx/sites-available/auth /etc/nginx/sites-enabled/auth
308319sudo systemctl restart nginx.service
309```
320#+end_src
310321
311### Nginx: Protected Domain(s)
322*** Nginx: Protected Domain(s)
323:PROPERTIES:
324:CUSTOM_ID: nginx-protected-domains
325:END:
326Now that Authelia is accessible externally, you need to configure the domain you
327intend to protect with Authelia. In this example, I'm protecting
328=teddit.example.com=.
312329
313Now that Authelia is accessible externally, you need to configure the domain you
314intend to protect with Authelia. In this example, I'm protecting
315`teddit.example.com`.
316
317Similar to the process above, paste the content and update the relevant
330Similar to the process above, paste the content and update the relevant
318331variables.
319332
320```sh
333#+begin_src sh
321334sudo nano /etc/nginx/sites-available/teddit
322```
335#+end_src
323336
324```conf
337#+begin_src conf
325338server {
326 if ($host ~ ^[^.]+\.example\.com$) {
327 return 301 https://$host$request_uri;
328 }
329
330 listen [::]:80;
331 listen 80;
332 server_name teddit.example.com;
333 return 404;
339 if ($host ~ ^[^.]+\.example\.com$) {
340 return 301 https://$host$request_uri;
341 }
342
343 listen [::]:80;
344 listen 80;
345 server_name teddit.example.com;
346 return 404;
334347}
335348
336349server {
337 listen [::]:443 ssl http2;
338 listen 443 ssl http2;
339 server_name teddit.example.com;
340 access_log /var/log/nginx/teddit.access.log;
341 error_log /var/log/nginx/teddit.error.log;
342
343 add_header X-Content-Type-Options "nosniff";
344 add_header X-XSS-Protection "1; mode=block";
345 add_header X-Frame-Options "DENY";
346 add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
347 add_header Referrer-Policy "no-referrer";
348
349 ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
350 ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
351 include /etc/letsencrypt/options-ssl-nginx.conf;
352 ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
353
354 location /authelia {
355 internal;
356 set $upstream_authelia http://127.0.0.1:9091/api/verify;
357 proxy_pass_request_body off;
358 proxy_pass $upstream_authelia;
359 proxy_set_header Content-Length "";
360
361 proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
362 client_body_buffer_size 128k;
363 proxy_set_header Host $host;
364 proxy_set_header X-Original-URL $scheme://$http_host$request_uri;
365 proxy_set_header X-Real-IP $remote_addr;
366 proxy_set_header X-Forwarded-For $remote_addr;
367 proxy_set_header X-Forwarded-Proto $scheme;
368 proxy_set_header X-Forwarded-Host $http_host;
369 proxy_set_header X-Forwarded-Uri $request_uri;
370 proxy_set_header X-Forwarded-Ssl on;
371 proxy_redirect http:// $scheme://;
372 proxy_http_version 1.1;
373 proxy_set_header Connection "";
374 proxy_cache_bypass $cookie_session;
375 proxy_no_cache $cookie_session;
376 proxy_buffers 4 32k;
377
378 send_timeout 5m;
379 proxy_read_timeout 240;
380 proxy_send_timeout 240;
381 proxy_connect_timeout 240;
382 }
383
384 location / {
385 set $upstream_teddit http://127.0.0.1:8686;
386 proxy_pass $upstream_teddit;
387
388 auth_request /authelia;
389 auth_request_set $target_url https://$http_host$request_uri;
390 auth_request_set $user $upstream_http_remote_user;
391 auth_request_set $email $upstream_http_remote_email;
392 auth_request_set $groups $upstream_http_remote_groups;
393 proxy_set_header Remote-User $user;
394 proxy_set_header Remote-Email $email;
395 proxy_set_header Remote-Groups $groups;
396
397 error_page 401 =302 https://auth.example.com/?rd=$target_url;
398
399 client_body_buffer_size 128k;
400
401 proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
402
403 send_timeout 5m;
404 proxy_read_timeout 360;
405 proxy_send_timeout 360;
406 proxy_connect_timeout 360;
407
408 proxy_set_header Host $host;
409 proxy_set_header Upgrade $http_upgrade;
410 proxy_set_header Connection upgrade;
411 proxy_set_header Accept-Encoding gzip;
412 proxy_set_header X-Real-IP $remote_addr;
413 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
414 proxy_set_header X-Forwarded-Proto $scheme;
415 proxy_set_header X-Forwarded-Host $http_host;
416 proxy_set_header X-Forwarded-Uri $request_uri;
417 proxy_set_header X-Forwarded-Ssl on;
418 proxy_redirect http:// $scheme://;
419 proxy_http_version 1.1;
420 proxy_set_header Connection "";
421 proxy_cache_bypass $cookie_session;
422 proxy_no_cache $cookie_session;
423 proxy_buffers 64 256k;
424 }
350 listen [::]:443 ssl http2;
351 listen 443 ssl http2;
352 server_name teddit.example.com;
353 access_log /var/log/nginx/teddit.access.log;
354 error_log /var/log/nginx/teddit.error.log;
355
356 add_header X-Content-Type-Options "nosniff";
357 add_header X-XSS-Protection "1; mode=block";
358 add_header X-Frame-Options "DENY";
359 add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
360 add_header Referrer-Policy "no-referrer";
361
362 ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
363 ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
364 include /etc/letsencrypt/options-ssl-nginx.conf;
365 ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
366
367 location /authelia {
368 internal;
369 set $upstream_authelia http://127.0.0.1:9091/api/verify;
370 proxy_pass_request_body off;
371 proxy_pass $upstream_authelia;
372 proxy_set_header Content-Length "";
373
374 proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
375 client_body_buffer_size 128k;
376 proxy_set_header Host $host;
377 proxy_set_header X-Original-URL $scheme://$http_host$request_uri;
378 proxy_set_header X-Real-IP $remote_addr;
379 proxy_set_header X-Forwarded-For $remote_addr;
380 proxy_set_header X-Forwarded-Proto $scheme;
381 proxy_set_header X-Forwarded-Host $http_host;
382 proxy_set_header X-Forwarded-Uri $request_uri;
383 proxy_set_header X-Forwarded-Ssl on;
384 proxy_redirect http:// $scheme://;
385 proxy_http_version 1.1;
386 proxy_set_header Connection "";
387 proxy_cache_bypass $cookie_session;
388 proxy_no_cache $cookie_session;
389 proxy_buffers 4 32k;
390
391 send_timeout 5m;
392 proxy_read_timeout 240;
393 proxy_send_timeout 240;
394 proxy_connect_timeout 240;
395 }
396
397 location / {
398 set $upstream_teddit http://127.0.0.1:8686;
399 proxy_pass $upstream_teddit;
400
401 auth_request /authelia;
402 auth_request_set $target_url https://$http_host$request_uri;
403 auth_request_set $user $upstream_http_remote_user;
404 auth_request_set $email $upstream_http_remote_email;
405 auth_request_set $groups $upstream_http_remote_groups;
406 proxy_set_header Remote-User $user;
407 proxy_set_header Remote-Email $email;
408 proxy_set_header Remote-Groups $groups;
409
410 error_page 401 =302 https://auth.example.com/?rd=$target_url;
411
412 client_body_buffer_size 128k;
413
414 proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
415
416 send_timeout 5m;
417 proxy_read_timeout 360;
418 proxy_send_timeout 360;
419 proxy_connect_timeout 360;
420
421 proxy_set_header Host $host;
422 proxy_set_header Upgrade $http_upgrade;
423 proxy_set_header Connection upgrade;
424 proxy_set_header Accept-Encoding gzip;
425 proxy_set_header X-Real-IP $remote_addr;
426 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
427 proxy_set_header X-Forwarded-Proto $scheme;
428 proxy_set_header X-Forwarded-Host $http_host;
429 proxy_set_header X-Forwarded-Uri $request_uri;
430 proxy_set_header X-Forwarded-Ssl on;
431 proxy_redirect http:// $scheme://;
432 proxy_http_version 1.1;
433 proxy_set_header Connection "";
434 proxy_cache_bypass $cookie_session;
435 proxy_no_cache $cookie_session;
436 proxy_buffers 64 256k;
437 }
425438}
426```
439#+end_src
427440
428441Same as before, symlink the file and restart Nginx.
429442
430```sh
443#+begin_src sh
431444sudo ln -s /etc/nginx/sites-available/teddit /etc/nginx/sites-enabled/teddit
432445sudo systemctl restart nginx.service
433```
434
435## Results
446#+end_src
436447
437When visiting the protected domain, you will now be redirected to your
448** Results
449:PROPERTIES:
450:CUSTOM_ID: results
451:END:
452When visiting the protected domain, you will now be redirected to your
438453authentication domain and presented with the Authelia login portal.
439454
440![Authelia Portal](https://img.cleberg.net/blog/20231010-authelia/authelia_portal.png "Authelia Portal")
455#+caption: Authelia Portal
456[[https://img.cleberg.net/blog/20231010-authelia/authelia_portal.png]]
441457
442Once you've successfully authenticated, you can visit your authentication domain
443directly and see that you're currently authenticated to any domain protected by
458Once you've successfully authenticated, you can visit your authentication domain
459directly and see that you're currently authenticated to any domain protected by
444460Authelia.
445461
446![Authelia Success](https://img.cleberg.net/blog/20231010-authelia/authelia_success.png "Authelia Success")
462#+caption: Authelia Success
463[[https://img.cleberg.net/blog/20231010-authelia/authelia_success.png]]
blog/2023-10-15-alpine-ssh-hardening.org +54 −40
@@ -1,60 +1,74 @@
1+++
2date = 2023-10-16T00:20:45+00:00
3title = "SSH Hardening for Alpine Linux"
4description = "A quick guide to hardening SSH on Alpine Linux."
5+++
6
7## Overview
1#+title: SSH Hardening for Alpine Linux
2#+date: 2023-10-16
83
4** Overview
5:PROPERTIES:
6:CUSTOM_ID: overview
7:END:
98This guide follows the standard
10[ssh-audit](https://www.ssh-audit.com/hardening_guides.html) hardening guide,
11tweaked for Alpine Linux.
12
13## Hardening Guide
9[[https://www.ssh-audit.com/hardening_guides.html][ssh-audit]] hardening
10guide, tweaked for Alpine Linux.
1411
15These steps must be performed as root. You can try to use `doas` or `sudo`,
16but there may be issues.
12** Hardening Guide
13:PROPERTIES:
14:CUSTOM_ID: hardening-guide
15:END:
16These steps must be performed as root. You can try to use =doas= or
17=sudo=, but there may be issues.
1718
18191. Re-generate the RSA and ED25519 keys
19```sh
20
21#+begin_src sh
2022rm /etc/ssh/ssh_host_*
2123ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_rsa_key -N ""
2224ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N ""
23```
242. Remove small Diffie-Hellman moduli
25```sh
25#+end_src
26
272. [@2] Remove small Diffie-Hellman moduli
28
29#+begin_src sh
2630awk '$5 >= 3071' /etc/ssh/moduli > /etc/ssh/moduli.safe
2731mv /etc/ssh/moduli.safe /etc/ssh/moduli
28```
293. Enable the RSA and ED25519 HostKey directives in the /etc/ssh/sshd_config
30file
31```sh
32#+end_src
33
343. [@3] Enable the RSA and ED25519 HostKey directives in the
35 /etc/ssh/sshd_config file
36
37#+begin_src sh
3238sed -i 's/^\#HostKey \/etc\/ssh\/ssh_host_\(rsa\|ed25519\)_key$/HostKey \/etc\/ssh\/ssh_host_\1_key/g' /etc/ssh/sshd_config
33```
344. Restrict supported key exchange, cipher, and MAC algorithms
35```sh
39#+end_src
40
414. [@4] Restrict supported key exchange, cipher, and MAC algorithms
42
43#+begin_src sh
3644echo -e "\n# Restrict key exchange, cipher, and MAC algorithms, as per sshaudit.com\n# hardening guide.\nKexAlgorithms sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha256\nCiphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr\nMACs hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-128-etm@openssh.com\nHostKeyAlgorithms ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256,rsa-sha2-256-cert-v01@openssh.com" > /etc/ssh/sshd_config.d/ssh-audit_hardening.conf
37```
385. Include the /etc/ssh/sshd_config.d directory
39```sh
45#+end_src
46
475. [@5] Include the /etc/ssh/sshd_config.d directory
48
49#+begin_src sh
4050echo -e "Include /etc/ssh/sshd_config.d/*.conf" > /etc/ssh/sshd_config
41```
426. Restart OpenSSH server
43```sh
44rc-service sshd restart
45```
51#+end_src
52
536. [@6] Restart OpenSSH server
4654
47## Testing SSH
55#+begin_src sh
56rc-service sshd restart
57#+end_src
4858
49You can test the results with the `ssh-audit` python script.
59** Testing SSH
60:PROPERTIES:
61:CUSTOM_ID: testing-ssh
62:END:
63You can test the results with the =ssh-audit= python script.
5064
51```sh
65#+begin_src sh
5266pip3 install ssh-audit
5367ssh-audit localhost
54```
68#+end_src
5569
56If everything succeeded, the results will show as all green. If anything is
57yellow, orange, or red, you may need to tweak additional settings.
70If everything succeeded, the results will show as all green. If anything
71is yellow, orange, or red, you may need to tweak additional settings.
5872
59![ssh audit](https://img.cleberg.net/blog/20231015-ssh-hardening/ssh-audit.png
60"ssh-audit")
73#+caption: ssh audit
74[[https://img.cleberg.net/blog/20231015-ssh-hardening/ssh-audit.png%20%22ssh-audit%22]]
blog/2023-10-17-self-hosting-anonymousoverflow.org +98 −93
@@ -1,33 +1,37 @@
1+++
2date = 2023-10-17T15:44:45.601627917+00:00
3title = "Self-Hosting AnonymousOverflow"
4description = "A quick guide to self-hosting AnonymousOverflow."
5+++
6
7## Overview
8
9I recently launched an instance of AnonymousOverflow at
10[ao.cleberg.net](https://ao.cleberg.net) and wanted to write a brief post on how
11easy it is to install with Docker Compose and Nginx.
12
13This guide uses Ubuntu server, Docker Compose, and Nginx as a reverse proxy.
14
15## Installation
16
17### Docker Compose
18
19To install AnonymousOverflow, start by creating a directory for the application
20and create its `docker-compose.yml` file.
21
22```sh
1#+title: Self-Hosting AnonymousOverflow
2#+date: 2023-10-17
3
4** Overview
5:PROPERTIES:
6:CUSTOM_ID: overview
7:END:
8I recently launched an instance of AnonymousOverflow at [[https://ao.cleberg.net][ao.cleberg.net]] and
9wanted to write a brief post on how easy it is to install with Docker Compose
10and Nginx.
11
12This guide uses Ubuntu server, Docker Compose, and Nginx as a reverse
13proxy.
14
15** Installation
16:PROPERTIES:
17:CUSTOM_ID: installation
18:END:
19*** Docker Compose
20:PROPERTIES:
21:CUSTOM_ID: docker-compose
22:END:
23To install AnonymousOverflow, start by creating a directory for the
24application and create its =docker-compose.yml= file.
25
26#+begin_src sh
2327mkdir ~/anonymousoverflow && cd ~/anonymousoverflow
2428nano docker-compose.yml
25```
29#+end_src
2630
2731Within this file, paste the following information. Be sure to change the
28`APP_URL`, `JWT_SIGNING_SECRET`, and `ports` to match your needs.
32=APP_URL=, =JWT_SIGNING_SECRET=, and =ports= to match your needs.
2933
30```yaml
34#+begin_src yaml
3135version: '3'
3236
3337services:
@@ -40,92 +44,93 @@ services:
4044 ports:
4145 - '9380:8080'
4246 restart: 'always'
43```
47#+end_src
4448
45Save and exit the file when complete. You can now launch the container and
46access it via your local network.
49Save and exit the file when complete. You can now launch the container
50and access it via your local network.
4751
48```sh
52#+begin_src sh
4953sudo docker-compose up -d
50```
51
52### Nginx Reverse Proxy
54#+end_src
5355
54If you want to access this service outside the local network, I recommend using
55Nginx as a reverse proxy.
56*** Nginx Reverse Proxy
57:PROPERTIES:
58:CUSTOM_ID: nginx-reverse-proxy
59:END:
60If you want to access this service outside the local network, I
61recommend using Nginx as a reverse proxy.
5662
5763Let's start by creating a configuration file.
5864
59```sh
65#+begin_src sh
6066sudo nano /etc/nginx/sites-available/ao
61```
67#+end_src
6268
63Within this file, paste the following content and repace `ao.example.com` with
64your URL. You may need to update the SSL certificate statements if your
65certificates are in a different location.
69Within this file, paste the following content and repace
70=ao.example.com= with your URL. You may need to update the SSL
71certificate statements if your certificates are in a different location.
6672
67```conf
73#+begin_src conf
6874server {
69 if ($host ~ ^[^.]+\.cleberg\.net$) {
70 return 301 https://$host$request_uri;
71 }
72
73 listen [::]:80;
74 listen 80;
75 server_name ao.example.com;
76 return 404;
75 if ($host ~ ^[^.]+\.cleberg\.net$) {
76 return 301 https://$host$request_uri;
77 }
78
79 listen [::]:80;
80 listen 80;
81 server_name ao.example.com;
82 return 404;
7783}
7884
7985server {
80 listen [::]:443 ssl http2;
81 listen 443 ssl http2;
82 server_name ao.example.com;
83 access_log /var/log/nginx/ao.access.log;
84 error_log /var/log/nginx/ao.error.log;
85
86 add_header X-Content-Type-Options "nosniff";
87 add_header X-XSS-Protection "1; mode=block";
88 add_header X-Frame-Options "DENY";
89 add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
90 add_header Referrer-Policy "no-referrer";
91
92 ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
93 ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
94 include /etc/letsencrypt/options-ssl-nginx.conf;
95 ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
96
97 location / {
98 set $upstream_ao http://127.0.0.1:9380;
99 proxy_pass $upstream_ao;
100
101 proxy_set_header Host $host;
102 proxy_set_header Upgrade $http_upgrade;
103 proxy_set_header Connection upgrade;
104 proxy_set_header Accept-Encoding gzip;
105 proxy_set_header X-Real-IP $remote_addr;
106 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
107 proxy_set_header X-Forwarded-Proto $scheme;
108 proxy_set_header X-Forwarded-Host $http_host;
109 proxy_set_header X-Forwarded-Uri $request_uri;
110 proxy_set_header X-Forwarded-Ssl on;
111 proxy_redirect http:// $scheme://;
112 proxy_http_version 1.1;
113 proxy_set_header Connection "";
114 proxy_cache_bypass $cookie_session;
115 proxy_no_cache $cookie_session;
116 proxy_buffers 64 256k;
117 }
86 listen [::]:443 ssl http2;
87 listen 443 ssl http2;
88 server_name ao.example.com;
89 access_log /var/log/nginx/ao.access.log;
90 error_log /var/log/nginx/ao.error.log;
91
92 add_header X-Content-Type-Options "nosniff";
93 add_header X-XSS-Protection "1; mode=block";
94 add_header X-Frame-Options "DENY";
95 add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
96 add_header Referrer-Policy "no-referrer";
97
98 ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
99 ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
100 include /etc/letsencrypt/options-ssl-nginx.conf;
101 ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
102
103 location / {
104 set $upstream_ao http://127.0.0.1:9380;
105 proxy_pass $upstream_ao;
106
107 proxy_set_header Host $host;
108 proxy_set_header Upgrade $http_upgrade;
109 proxy_set_header Connection upgrade;
110 proxy_set_header Accept-Encoding gzip;
111 proxy_set_header X-Real-IP $remote_addr;
112 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
113 proxy_set_header X-Forwarded-Proto $scheme;
114 proxy_set_header X-Forwarded-Host $http_host;
115 proxy_set_header X-Forwarded-Uri $request_uri;
116 proxy_set_header X-Forwarded-Ssl on;
117 proxy_redirect http:// $scheme://;
118 proxy_http_version 1.1;
119 proxy_set_header Connection "";
120 proxy_cache_bypass $cookie_session;
121 proxy_no_cache $cookie_session;
122 proxy_buffers 64 256k;
123 }
118124}
119```
125#+end_src
120126
121127Save and exit the file when complete. On Ubuntu, you will need to symlink the
122configuration file before it will be recognized by Nginx. Once complete,
123simply restart the web server.
128configuration file before it will be recognized by Nginx. Once complete, simply
129restart the web server.
124130
125```sh
131#+begin_src sh
126132sudo ln -s /etc/nginx/sites-available/ao /etc/nginx/sites-enabled/ao
127133sudo systemctl restart nginx.service
128```
134#+end_src
129135
130The website will now be available publicly. Visit
131[my instance](https://ao.cleberg.net) for an example.
136The website will now be available publicly. Visit [[https://ao.cleberg.net][my instance]] for an example.
blog/2023-11-08-scli.org +100 −93
@@ -1,146 +1,153 @@
1+++
2date = 2023-11-08T21:37:00.307616604+00:00
3title = "Installing scli on Alpine Linux (musl)"
4description = ""
5+++
6
7[scli](https://github.com/isamert/scli) is a command-line tool that allows you
8to connect to your Signal messenger account. This program utilizes a two-pane
9display that shows you chats on the left and the focused conversation on the
10right.
11
12This guide will show you how to install `scli` and its dependencies on Alpine
13Linux, which requires some extra work due to musl.
14
15If you're using a non-musl system, you can likely following the `scli` README
16and download the packaged binaries for an easier installation process.
1#+title: Installing scli on Alpine Linux (musl)
2#+date: 2023-11-08
173
18## Dependencies
4[[https://github.com/isamert/scli][scli]] is a command-line tool that allows you to connect to your Signal messenger
5account. This program utilizes a two-pane display that shows you chats on the
6left and the focused conversation on the right.
197
20In order to use `scli`, you need a few dependencies:
21
22- `openjdk17-jre` - Used as a dependency for the `signal-cli` tool. Version may
23vary.
24- `signal-cli` - Used as the backbone of the `scli` tool.
25- `findutils` - Replaces the standard Busybox version of `xargs`.
26- `urwid` - A console user interface library for Python.
27- `urwid-readline` - For GNU emacs-like keybinds on the input line.
28- `qrencode` - Displays a QR code in the terminal to link the device using your
29phone. Not necessary if you're only linking on desktop and can copy/paste the
30connection URL.
8This guide will show you how to install =scli= and its dependencies on Alpine
9Linux, which requires some extra work due to musl.
3110
32Let's start by installing the packages available via Alpine's repositories. Be
33sure to install the latest version of `openjdk`. If you run into Java-related
34issues, uninstall `openjdk` and install an older version.
11If you're using a non-musl system, you can likely following the =scli= README
12and download the packaged binaries for an easier installation process.
3513
36```sh
14** Dependencies
15:PROPERTIES:
16:CUSTOM_ID: dependencies
17:END:
18In order to use =scli=, you need a few dependencies:
19
20- =openjdk17-jre= - Used as a dependency for the =signal-cli= tool.
21 Version may vary.
22- =signal-cli= - Used as the backbone of the =scli= tool.
23- =findutils= - Replaces the standard Busybox version of =xargs=.
24- =urwid= - A console user interface library for Python.
25- =urwid-readline= - For GNU emacs-like keybinds on the input line.
26- =qrencode= - Displays a QR code in the terminal to link the device
27 using your phone. Not necessary if you're only linking on desktop and
28 can copy/paste the connection URL.
29
30Let's start by installing the packages available via Alpine's
31repositories. Be sure to install the latest version of =openjdk=. If you
32run into Java-related issues, uninstall =openjdk= and install an older
33version.
34
35#+begin_src sh
3736doas apk add openjdk17-jre findutils qrencode
38```
37#+end_src
3938
40Next, let's install `signal-cli`. Be sure to export the version of `signal-cli`
41that you want. I use version `0.12.4` below, but that may be outdated by the
42time you're reading this.
39Next, let's install =signal-cli=. Be sure to export the version of
40=signal-cli= that you want. I use version =0.12.4= below, but that may
41be outdated by the time you're reading this.
4342
44```sh
43#+begin_src sh
4544export VERSION="0.12.4"
4645wget https://github.com/AsamK/signal-cli/releases/download/v"${VERSION}"/signal-cli-"${VERSION}".tar.gz
4746doas tar xf signal-cli-"${VERSION}".tar.gz -C /opt
4847doas ln -sf /opt/signal-cli-${VERSION}"/bin/signal/cli /usr/local/bin
49```
48#+end_src
5049
51Finally, install the `urwid` packages using the Python packaging utility.
50Finally, install the =urwid= packages using the Python packaging
51utility.
5252
53```sh
53#+begin_src sh
5454pip3 install urwid urwid-readline
55```
56
57## Installation
55#+end_src
5856
59Now that we have all of the dependencies we need, we can install `scli`. Start
60by simply cloning the repository.
57** Installation
58:PROPERTIES:
59:CUSTOM_ID: installation
60:END:
61Now that we have all of the dependencies we need, we can install =scli=.
62Start by simply cloning the repository.
6163
62```sh
64#+begin_src sh
6365git clone https://github.com/isamert/scli
64```
66#+end_src
6567
66When I cloned this repository on 2023-11-08, I found a bug in the logic that
67required a fix. You must edit the `scli` file and replace the one instance of
68`RLIMIT_OFILE` with `RLIMIT_NOFILE`.
68When I cloned this repository on 2023-11-08, I found a bug in the logic
69that required a fix. You must edit the =scli= file and replace the one
70instance of =RLIMIT_OFILE= with =RLIMIT_NOFILE=.
6971
70```sh
72#+begin_src sh
7173cd scli
7274nano scli
73```
75#+end_src
7476
75Once complete, you can move this program to anywhere on your `$PATH`. I chose
76the following directory.
77Once complete, you can move this program to anywhere on your =$PATH=. I
78chose the following directory.
7779
78```sh
80#+begin_src sh
7981doas mv scli /usr/local/bin/scli
80```
82#+end_src
8183
82## Initial Setup
84** Initial Setup
85:PROPERTIES:
86:CUSTOM_ID: initial-setup
87:END:
88Now that everything is installed, we can login and configure the client.
89Start by generating a connection link.
8390
84Now that everything is installed, we can login and configure the client. Start
85by generating a connection link.
86
87```sh
91#+begin_src sh
8892signal-cli link -n "YOUR-DEVICE-NICKNAME" | tee >(xargs -L 1 qrencode -t utf8)
89```
93#+end_src
9094
91This will generate a connection link and related QR code for you to use to link
92the devices together. Once complete, **wait patiently** for the connection
93process to finish.
95This will generate a connection link and related QR code for you to use
96to link the devices together. Once complete, *wait patiently* for the
97connection process to finish.
9498
95Once it completes, it will exit and return you to the prompt. From here, you
96need to perform an initial `receive` command to start things off. The `USERNAME`
97variable should be your phone number, such as `+15551237890`.
99Once it completes, it will exit and return you to the prompt. From here,
100you need to perform an initial =receive= command to start things off.
101The =USERNAME= variable should be your phone number, such as
102=+15551237890=.
98103
99```sh
104#+begin_src sh
100105signal-cli -u USERNAME receive
101```
106#+end_src
102107
103Also be sure to test the daemon to ensure it works properly. If no errors occur,
104it's working. If you run into errors because you're not running a DBUS session,
105see my notes below.
108Also be sure to test the daemon to ensure it works properly. If no
109errors occur, it's working. If you run into errors because you're not
110running a DBUS session, see my notes below.
106111
107```sh
112#+begin_src sh
108113signal-cli -u USERNAME daemon
109```
114#+end_src
110115
111Once the initial reception is complete, you are ready to use `scli`.
116Once the initial reception is complete, you are ready to use =scli=.
112117
113This process will differ depending on your desktop environment (DE). If you are
114running a DE, you likely have a DBUS session running already and can simply
115launch the program.
118This process will differ depending on your desktop environment (DE). If
119you are running a DE, you likely have a DBUS session running already and
120can simply launch the program.
116121
117However, if you're like me and running your computer straight on the TTY without
118a DE, you'll need to start a DBUS session for this program.
122However, if you're like me and running your computer straight on the TTY
123without a DE, you'll need to start a DBUS session for this program.
119124
120```sh
125#+begin_src sh
121126# If you're not running a DBUS session yet, you need to start one for scli
122127dbus-run-session -- scli
123128
124129# OR - If you're already running a DBUS session, simply run scli
125130scli
126```
127
128## Configuration
131#+end_src
129132
130Lastly, there are a number of configuration options that you can pass via the
131command or in the `~/.config/sclirc` file. See the Github README for more
132information on configuration options.
133** Configuration
134:PROPERTIES:
135:CUSTOM_ID: configuration
136:END:
137Lastly, there are a number of configuration options that you can pass
138via the command or in the =~/.config/sclirc= file. See the Github README
139for more information on configuration options.
133140
134```sh
141#+begin_src sh
135142nano ~/.config/sclirc
136```
143#+end_src
137144
138```conf
145#+begin_src conf
139146# ~/.config/sclirc
140147
141148wrap-at = 80
142149enable-notifications = true
143```
150#+end_src
144151
145That's it! Following this guide, I have a functional `scli` program that
152That's it! Following this guide, I have a functional =scli= program that
146153successfully sends messages to my contacts and myself!