Skip to content

Commit 71afa6a

Browse files
committed
add some more entries back
1 parent a0dc7c5 commit 71afa6a

15 files changed

+1103
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
tags:
3+
- OpenBSD
4+
- Gnome
5+
- Xfce
6+
- Firefox
7+
- VirtualBox
8+
- Vesa
9+
---
10+
11+
# Doing it 1999 style: OpenBSD Gnome + Xfce + Firefox on 16GB VirtualBox VM
12+
What do they say? Actions speak louder than a thousand words? I like it.
13+
14+
Fair warning, this must be the most unnecessary howto in the history of howtos but there you have it 😂
15+
16+
Everything mentioned on this guide, can be found on the FAQ, manual pages and readme documents of the applications installed. Again this is mostly towards new users who dont even know where to start to install a desktop manager that is more friendly to them.
17+
18+
## The premise
19+
So you've just finished installing your OpenBSD and want to install a manager you're more familiar with but you dont have a lot of space for this system...
20+
21+
Someone once told me: _you shouldn't be expecting to run any modern desktop on just 16GB._ 🤮 and maybe in parts is right, but in this case is not.
22+
23+
Not to worry though. We'll go through this process together and hopefully get you up and running with a more modern desktop on just under 16GB.
24+
25+
## Before we start
26+
Now you may have guessed by the title, this guide is primarily for these two window managers, however, you can use the same methods described to find out what is needed and install any manager and application you like from the OpenBSD packages.
27+
28+
One of the 1st things I like to do before I start installing packages is to fetch the text version of the packages index and use it to look for the package names that may interest me. If you dont know where to get it, check the `/etc/installurl` contents. In the following example it points to the local OpenBSD mirror (neat!)
29+
```shell
30+
foo# cat /etc/installurl
31+
https://ftp.cc.uoc.gr/pub/OpenBSD
32+
```
33+
34+
The OpenBSD mirror URLs follow these rules:
35+
* `MAJOR.MINOR/`: source code files to save time when checking out updated code
36+
* `MAJOR.MINOR/ARCHITECTURE`: Version release files/installation media
37+
* `MAJOR.MINOR/packages/ARCHITECTURE`: Packages for a release
38+
39+
Following the last entry for the packages, we will fetch a file called `index.txt` which includes a list (`ls`) of all packages in text format.
40+
41+
So lets grab it (both of the ftp commands are valid, one will only work for OpenBSD 7.1 and the other for most other versions)
42+
```shell
43+
foo# ftp https://ftp.cc.uoc.gr/pub/OpenBSD/7.1/packages/amd64/index.txt
44+
^^^ ^^^^^^
45+
major.minor architecture
46+
foo# ftp https://ftp.cc.uoc.gr/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/index.txt
47+
Trying 147.52.159.12...
48+
Requesting https://ftp.cc.uoc.gr/pub/OpenBSD/6.5/packages/amd64/index.txt
49+
100% |*************************************************************| 787 KB 00:00
50+
806431 bytes received in 0.46 seconds (1.67 MB/s)
51+
```
52+
53+
## Installing the software
54+
Lets see if we can find the managers we want. Notice that we use the **`-i`** to disable case sensitive matching, since we dont know if the package we are looking for is with capital letters or not.
55+
```shell
56+
foo# grep -i firefox index.txt
57+
foo# grep -i gnome index.txt
58+
foo# grep -i xfce index.txt
59+
```
60+
61+
WOW! It seems that there are a lot of gnome and xfce packages there. Should we pick one or all of them? Which one?
62+
63+
64+
65+
A more `i'm feeling lucky` approach is to simply try and install the software you're looking for and (🤞) see what you get
66+
```shell
67+
foo# pkg_add -vi firefox gnome xfce
68+
```
69+

OpenBSD/OpenBSD poor mans tripwire.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
tags:
3+
- WIP
4+
- research
5+
- OpenBSD
6+
- mtree
7+
- tripwire
8+
---
9+
10+
OpenBSD already does an excellent work at keeping track of system changes by `security(8)` (`/usr/libexec/security`)
11+
12+
13+
```shell
14+
# mtree -cx -p /bin -K sha256digest,type > /etc/mtree/bin.secure
15+
# chown root:wheel /etc/mtree/bin.secure
16+
# chmod 600 /etc/mtree/bin.secure
17+
```
Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
# OpenBSD relayd research for echothrust hosts
2+
The following document will outline the findings with regards to our research
3+
on the subject of utilizing `relayd` for infrastructure. The needs for usage in
4+
particularly on `puffy.echothrust.com` in order to serve `www.echothrust.com`,
5+
`gitlab.echothrust.com` for both HTTP and HTTPS accelerator along with the
6+
ability to serve a separate content on cases where a downtime is required.
7+
8+
At the same time we want to filter certain requests based on protocol specific
9+
criteria (eg when the `Host` http header is not set, deny specific URL patterns
10+
and other such cases).
11+
12+
**NOTE**: The configuration directives `interval`, `timeout` and `prefork` must
13+
be before the table definitions otherwise they might not work. This is as of
14+
16/03/2016 (relayd - prefork option seems to be ignored).
15+
16+
Relayd makes the following distinctions with regards to the relaying capabilities:
17+
18+
* **`Redirections`** Redirections are translated to pf(4) rdr-to rules for stateful forwarding to a target host from a health-checked table on layer 3.
19+
* **`Relays`** Relays allow application layer load balancing, TLS acceleration, and general purpose TCP proxying on layer 7.
20+
* **`Routers`** Routers are used to insert routes with health-checked gateways for (WAN) link balancing.
21+
22+
## Preparing for relayd
23+
You'd have to pump up the your `ulimit` a bit in order for `relayd` to be able
24+
to start. The best option is to create a specific section on your
25+
`/etc/login.conf` for the daemon to use.
26+
27+
Depending on your requirements you may need to tweak this a bit
28+
```
29+
relayd:\
30+
:openfiles-cur=1024:\
31+
:openfiles-max=2048:\
32+
:tc=daemon:
33+
```
34+
35+
Futhermore for SSL off-loading to be work we will have to create a private key
36+
and a certificate for each individual IP's that relay will serve.
37+
38+
The file locations are `/etc/ssl/private/IP:port.key` and `/etc/ssl/IP.ctt`
39+
40+
## Configuring www.echothrust.com
41+
42+
```
43+
ext_if="re0"
44+
www_echothrust_com="172.20.3.240"
45+
web_echothrust_com="10.5.0.2"
46+
47+
gitlabpub_echothrust_com="172.20.3.240"
48+
gitlab_echothrust_com="10.5.0.3"
49+
50+
interval 10
51+
timeout 1000
52+
prefork 10
53+
54+
table <www_echothrust_com> { $web_echothrust_com }
55+
table <gitlab_echothrust_com> { $gitlab_echothrust_com }
56+
table <fallback> disable { 127.0.0.1 }
57+
58+
http protocol www_echothrust_com_filter {
59+
include "/etc/www_echothrust_com_filters-relayd.conf"
60+
61+
# Various TCP performance options
62+
tcp { nodelay, sack, socket buffer 65536, backlog 128 }
63+
}
64+
65+
http protocol www_echothrust_com_sslfilter {
66+
include "/etc/www_echothrust_com_filters-relayd.conf"
67+
match request header set "HTTPS" value "on"
68+
match request header append "X-Forwarded-Proto" value "https"
69+
70+
# Various TCP performance options
71+
tcp { nodelay, sack, socket buffer 65536, backlog 128 }
72+
73+
ssl { no sslv2, sslv3, tlsv1, ciphers HIGH }
74+
ssl session cache disable
75+
76+
}
77+
78+
relay www_echothrust_com_proxy {
79+
listen on $www_echothrust_com port 8880
80+
protocol www_echothrust_com_filter
81+
82+
forward to <www_echothrust_com> port http check http "/" code 200
83+
forward to <fallback> port http check http "/" code 200
84+
}
85+
86+
relay www_echothrust_com_ssl {
87+
# Run as a SSL accelerator
88+
listen on $www_echothrust_com port 443 ssl
89+
protocol www_echothrust_com_sslfilter
90+
91+
forward to <www_echothrust_com> port http check http "/" code 200
92+
forward to <fallback> port http check http "/" code 200
93+
}
94+
95+
http protocol gitlab_echothrust_com_sslfilter {
96+
match request header set "HTTPS" value "on"
97+
match request header append "X-Forwarded-Proto" value "https"
98+
99+
# Various TCP performance options
100+
tcp { nodelay, sack, socket buffer 65536, backlog 128 }
101+
102+
ssl { no sslv2, sslv3, tlsv1, ciphers HIGH }
103+
ssl session cache disable
104+
}
105+
106+
107+
relay gitlab_echothrust_com_ssl {
108+
# Run as a SSL accelerator
109+
listen on $gitlabpub_echothrust_com port 443 ssl
110+
protocol gitlab_echothrust_com_sslfilter
111+
112+
forward to <gitlab_echothrust_com> port http check http "/" code 200
113+
forward to <fallback> port http check http "/" code 200
114+
}
115+
```
116+
117+
The contents of the file "/etc/www_echothrust_com_filters-relayd.conf" has the following contents
118+
```
119+
# Return HTTP/HTML error pages to the client
120+
return error style "body { background: #e7e9ec; color:#737373; font:normal 13px/21px \"Droid Sans\", sans-serif; }\nhr { border: 0; border-bottom: 1px dashed; }"
121+
122+
match request label "Invalid Host"
123+
pass request quick header "Host" value "echothrust.com"
124+
pass request quick header "Host" value "www.echothrust.com"
125+
block request quick header "Host" value "*"
126+
127+
# Block disallowed sites
128+
match request label "URL filtered!"
129+
block request quick url "www.echothrust.com/wp-login.php" value "*"
130+
block request quick path "/wp-login.php" value "*"
131+
132+
# Add forwarder-for and by header details
133+
match request header append "X-Forwarded-For" value "$REMOTE_ADDR"
134+
match request header append "X-Forwarded-By" value "$SERVER_ADDR:$SERVER_PORT"
135+
match request header append "X-Real-IP" value "$REMOTE_ADDR"
136+
137+
match request header set "Connection" value "close"
138+
match request header "Keep-Alive" value "$TIMEOUT"
139+
```
140+
141+
# Managing fallback
142+
In order to initiate a downtime period you'll have to disable the primary table
143+
`<www_echothrust_com>` and activate the fallback.
144+
145+
```
146+
relayctl table disable www_echothrust_com:80
147+
relayctl table disable www_echothrust_com:443
148+
relayctl table enable fallback:80
149+
relayctl table enable fallback:443
150+
relayctl poll
151+
```
152+
153+
# Modify the error pages
154+
In order to modify your return pages (the error pages that relayd sends back to
155+
the client in case of an error) you have to modfy the following details
156+
157+
* `relayd/relay_http.c` modify the function `relay_abort_http` where the code
158+
reads like this
159+
```
160+
/* A CSS stylesheet allows minimal customization by the user */
161+
style = (rlay->rl_proto->style != NULL) ? rlay->rl_proto->style :
162+
"body { background-color: #a00000; color: white; font-family: "
163+
"'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', sans-serif; }\n"
164+
"hr { border: 0; border-bottom: 1px dashed; }\n";
165+
166+
/* Generate simple HTTP+HTML error document */
167+
if ((bodylen = asprintf(&body,
168+
"<!DOCTYPE html>\n"
169+
"<html>\n"
170+
"<head>\n"
171+
"<title>%03d %s</title>\n"
172+
"<style type=\"text/css\"><!--\n%s\n--></style>\n"
173+
"</head>\n"
174+
"<body>\n"
175+
"<h1>%s</h1>\n"
176+
"<div id='m'>%s</div>\n"
177+
"<div id='l'>%s</div>\n"
178+
"<hr><address>%s at %s port %d</address>\n"
179+
"</body>\n"
180+
"</html>\n",
181+
code, httperr, style, httperr, text,
182+
label == NULL ? "" : label,
183+
RELAYD_SERVERNAME, hbuf, ntohs(rlay->rl_conf.port))) == -1)
184+
goto done;
185+
186+
```
187+
188+
* `relayd/relayd.h` modify the line
189+
```
190+
#define RELAYD_SERVERNAME "OpenBSD relayd"
191+
```
192+
193+
## Per url relay
194+
```
195+
table <web0> { 10.0.0.0 }
196+
table <web1> { 10.0.0.1 }
197+
table <web2> { 10.0.0.2 }
198+
table <web3> { 10.0.0.3 }
199+
200+
http protocol echolab {
201+
return error
202+
pass
203+
match request path "/web1*" forward to <web1>
204+
match request path "/web2*" forward to <web2>
205+
match request path "/web3*" forward to <web3>
206+
}
207+
208+
relay echolab {
209+
listen on $www_echothrust_com port 80
210+
protocol echolab
211+
212+
# Main server table
213+
forward to <web0> check tcp port 80
214+
215+
# Additional server tables used by custom rules
216+
forward to <web1> check tcp port 80
217+
forward to <web2> check tcp port 80
218+
forward to <web3> check tcp port 80
219+
}
220+
```
221+
222+
223+
## login.conf
224+
relayd:\
225+
:maxproc-max=31:\
226+
:openfiles-cur=16384:\
227+
:openfiles-max=65536:\
228+
:tc=daemon:

0 commit comments

Comments
 (0)