Skip to content

Commit 7fe078f

Browse files
committed
add OpenBSD docs
1 parent 730dda5 commit 7fe078f

30 files changed

+3325
-0
lines changed
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# Manage OpenBSD hosts using ansible
2+
3+
## First steps with ansible
4+
5+
All Ansible commands follow the pattern:
6+
7+
```
8+
ansible <server_or_group> -m module_name -a arguments
9+
```
10+
11+
Run ansible test on OpenBSD host (requires python2.7 installed):
12+
13+
```
14+
ansible all -u sysadmin -i www.echoctf.dev, -m ping -e 'ansible_python_interpreter=/usr/local/bin/python2.7'
15+
```
16+
17+
## Ansible host inventory
18+
19+
Create inventory location:
20+
21+
```
22+
mkdir ~/work/ansible
23+
touch ~/work/ansible/hosts
24+
touch ~/.ansible.cfg
25+
```
26+
27+
Open `~/.ansible.cfg` file to specify the inventory location:
28+
29+
```
30+
[defaults]
31+
inventory = ~/work/ansible/hosts
32+
```
33+
34+
Create entries in `~.work/ansible/hosts` file:
35+
36+
```
37+
kerberus.wks.echothrust.dev
38+
mail.echothrust.dev
39+
40+
[webservers]
41+
www.echoctf.dev
42+
support.echothrust.dev
43+
www.echothrust.dev
44+
```
45+
46+
## Creating playbooks
47+
48+
A playbook is a YAML file, and typically follows this structure:
49+
50+
```
51+
---
52+
- hosts: [target hosts]
53+
remote_user: [yourname]
54+
tasks:
55+
- [task 1]
56+
- [task 2]
57+
```
58+
59+
For example, the following playbook will create a file on all servers in the `webservers` group
60+
61+
```
62+
---
63+
- hosts: [webservers]
64+
remote_user: sysadmin
65+
tasks:
66+
- name: Create /tmp/somefile.test
67+
command: touch /tmp/somefile.test
68+
become: True
69+
become_method: doas
70+
```
71+
72+
Relevant [post about doas, ansible and env vars](https://www.wordspeak.org/posts/making-ansible-doas-and-openbsd-play-nicely.html)
73+
74+
75+
## Running playbooks
76+
77+
Assuming you are in the same directory as a playbook file, run:
78+
79+
```
80+
ansible-playbook myplaybook.yml
81+
```
82+
83+
If you want to see what hosts this playbook will affect without having to open up the YAML file, you can run:
84+
85+
```
86+
ansible-playbook myplaybook.yml --list-hosts
87+
```
88+
89+
If you want to see what tasks will run on a specific host:
90+
91+
```
92+
ansible-playbook myplaybook.yml -i www.echoctf.dev, --list-tasks
93+
```
94+
95+
## Use the "batteries included"
96+
97+
Ansible ships with a large collection of modules that you can run as tasks or via ad-hoc commands. To see a listing of all available modules, run:
98+
99+
```
100+
ansible-doc -l
101+
```
102+
103+
The list is quite large... some interesting modules follow.
104+
105+
Commands:
106+
107+
* [command](http://docs.ansible.com/ansible/command_module.html) - Executes a command on a remote node
108+
* [script](http://docs.ansible.com/ansible/script_module.html) - Runs a local script on a remote node after transferring it
109+
* [shell](http://docs.ansible.com/ansible/shell_module.html) - Execute commands in nodes
110+
* [raw](http://docs.ansible.com/ansible/raw_module.html) - Executes a low-down and dirty SSH command
111+
* [fetch](http://docs.ansible.com/ansible/fetch_module.html) - Fetches a file from remote nodes
112+
113+
Files:
114+
115+
* [copy](http://docs.ansible.com/ansible/copy_module.html) - Copies files to remote locations
116+
* [template](http://docs.ansible.com/ansible/template_module.html) - Templates a file out to a remote server
117+
* [authorized_key](http://docs.ansible.com/ansible/authorized_key_module.html) - Add/remove SSH authorized keys
118+
* [known_hosts](http://docs.ansible.com/ansible/known_hosts_module.html) - Add or remove a host from the `known_hosts` file
119+
* [lineinfile](http://docs.ansible.com/ansible/lineinfile_module.html) - Ensure a particular line is in a file. Replace existing line using a back-referenced regex
120+
* [blockinfile](http://docs.ansible.com/ansible/blockinfile_module.html) - Insert/update/remove a text block surrounded by marker lines
121+
* [replace](http://docs.ansible.com/ansible/replace_module.html) - Replace all instances of a particular string in a file using a back-referenced regular expression
122+
* [ini_file](http://docs.ansible.com/ansible/ini_file_module.html) - Tweak settings in INI files
123+
* [htpasswd](http://docs.ansible.com/ansible/htpasswd_module.html) - Manage user files for basic authentication
124+
* [stat](http://docs.ansible.com/ansible/stat_module.html) - Retrieve file or file system status
125+
* [unarchive](http://docs.ansible.com/ansible/unarchive_module.html) - Unpacks an archive after (optionally) copying it from the local machine
126+
127+
Package management:
128+
129+
* [git](http://docs.ansible.com/ansible/git_module.html) - Deploy software (or files) from git checkouts
130+
* [openbsd_pkg](http://docs.ansible.com/ansible/openbsd_pkg_module.html) - Manage packages on OpenBSD
131+
* [yum](http://docs.ansible.com/ansible/yum_module.html) - Manages packages with the yum package manager
132+
* [apt](http://docs.ansible.com/ansible/apt_module.html) - Manages apt-packages
133+
134+
135+
Operating system:
136+
137+
* [service](http://docs.ansible.com/ansible/service_module.html) - Manage services
138+
* [system](http://docs.ansible.com/ansible/systemd_module.html) - Manage services
139+
* [user](http://docs.ansible.com/ansible/user_module.html) - Manage user accounts
140+
* [cron](http://docs.ansible.com/ansible/cron_module.html) - Manage cron.d and crontab entries.
141+
* [solaris_zone](http://docs.ansible.com/ansible/solaris_zone_module.html) - Manage Solaris zones
142+
* [sysctl](http://docs.ansible.com/ansible/sysctl_module.html) - Manage entries in sysctl.conf.
143+
144+
Various:
145+
146+
* [mysql_db](http://docs.ansible.com/ansible/mysql_db_module.html) - Add or remove MySQL databases from a remote host
147+
* [mysql_user](http://docs.ansible.com/ansible/mysql_user_module.html) - Adds or removes a user from a MySQL database
148+
* [nagios](http://docs.ansible.com/ansible/nagios_module.html) - Perform common tasks in Nagios related to downtime and notifications
149+
* [redis](http://docs.ansible.com/ansible/redis_module.html) - Various redis commands, slave and flush
150+
* [letsencrypt](http://docs.ansible.com/ansible/letsencrypt_module.html) - Create SSL certificates with Let's Encrypt
151+
* [cloudflare_dns](http://docs.ansible.com/ansible/cloudflare_dns_module.html) - manage Cloudflare DNS records
152+
* [digital_ocean](http://docs.ansible.com/ansible/digital_ocean_module.html) - Create/delete a droplet/SSH_key in DigitalOcean
153+
* [wakeonlan](http://docs.ansible.com/ansible/wakeonlan_module.html) - Send a magic Wake-on-LAN (WoL) broadcast packet
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# OpenVPN on OpenBSD
2+
3+
## Installation (NOT COMPLETE)
4+
1) Installation through http://www.openbsdsupport.org/openvpn-on-openbsd.html
5+
2) Use of our ansible playbook found on devops reepo (plays/openbsd-openvpn.yml)
6+
7+
## Important files and directories (inside /etc/openvpn)
8+
* server_tun0.conf => The configuration file of the OpenVPN server
9+
* ETS_VPN_add_client.sh => Script used to create a certificate and .ovpn file for the given client (takes client name as parameter)
10+
* ccd => Directory which holds client specific configuration to be pushed to clients (currently holds the IP address of the client).
11+
Each file is named after the client name
12+
* client_confs => Holds all clients' .ovpn files (as generated by ETS_VPN_add_client.sh)
13+
* easy-rsa-pki/private => Holds clients' private keys
14+
* easy-rsa-pki/issued => Holds clients' certificates
15+
* private => Holds OpenVPN server, CA and TLS-AUTH private keys
16+
* certs => Holds OpenVPN server and CA certificates
17+
18+
## Administering
19+
* Creating a client:
20+
* /etc/openvpn/ETS_VPN_add_client.sh <clientname>
21+
* Create a file <clientname> inside /etc/openvpn/ccd/
22+
* Managing OpenVPN server and connections at runtime: telnet 127.0.0.1 11195
23+
* Log locations
24+
* /var/log/openvpn/openvpn.log (OpenVPN server logs)
25+
* /var/log/openvpn/openvpn-status.log (lists current connections)
26+
* OpenVPN server start-up location: /etc/hostname.em0
27+
* OpenVPN server "chroot": /var/openvpn/chrootjail
28+
* OpenVPN server by user \_openvpn
29+
30+
## Things to keep in mind when setting up a standalone VPN server for echoCTF
31+
* On VPN server: Use different network for VPN than the offense network setup on the GW
32+
* On VPN server: In order to access the offense network, add one more route on the server_tun0.conf file (e.g. push "route 10.10.0.0 255.255.0.0")
33+
* On echoCTF GW: Allow the VPN network to access the offence network (/etc/red-pf.conf)
34+
* On echoCTF GW: Add route towards the VPN network (through the offense vether)
35+
36+
# Server Configuration example
37+
```cond
38+
########## SERVER CONF ##########
39+
# SERVER CERT CONF
40+
ca /etc/openvpn/certs/echoCTF-OVPN-CA.crt
41+
cert /etc/openvpn/certs/echoCTF-OVPN-Server.crt
42+
key /etc/openvpn/private/echoCTF-OVPN-Server.key
43+
dh /etc/openvpn/dh.pem
44+
45+
# SERVER GENERAL CONF
46+
local 172.16.10.64
47+
writepid /var/run/openvpn.pid
48+
ifconfig-pool-persist /var/openvpn/ipp.txt
49+
tls-auth /etc/openvpn/private/vpn-ta.key 0 # This file is secret
50+
replay-persist /etc/openvpn/replay-persist-file
51+
max-clients 500
52+
status /var/log/openvpn/openvpn-status.log
53+
log-append /var/log/openvpn/openvpn.log
54+
proto udp4 #or use udp if works better
55+
port 1194
56+
management 127.0.0.1 11195 /etc/openvpn/private/mgmt.pwd
57+
daemon openvpn
58+
chroot /var/openvpn/chrootjail
59+
crl-verify /etc/openvpn/crl.pem
60+
float
61+
persist-key
62+
persist-tun
63+
user _openvpn
64+
group _openvpn
65+
66+
#Additional authorization options - needs to be configured - read further before enabling this
67+
;auth-user-pass-verify /var/openvpn/custom-simple-auth via-env
68+
;script-security 3
69+
keepalive 10 120
70+
comp-lzo
71+
verb 3
72+
73+
# Allow multiple client with the same certificate
74+
duplicate-cn
75+
# Enable running of scripts upon client connect/disconnect
76+
script-security 2
77+
78+
########## END SERVER CONF ##########
79+
80+
########## TUN & CLIENT CONF ##########
81+
dev tun0
82+
server 10.11.0.0 255.255.0.0
83+
84+
push "route 10.0.0.0 255.255.0.0"
85+
push "route 10.10.0.0 255.255.0.0"
86+
push "route 10.10.255.254 255.255.255.255"
87+
88+
client-config-dir /etc/openvpn/ccd
89+
90+
# Script to run upon client connect and disconnect
91+
#up "/etc/openvpn/etsctf_client_up.sh"
92+
#client-disconnect "/etc/openvpn/etsctf_client_down.sh"
93+
94+
########## END TUN&CLIENT CONF ######
95+
```

OpenBSD/OpenBSD Greek keyboard.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# OpenBSD Greek keyboard
2+
3+
## for OpenBSD 4.8
4+
In order to configure the Greek layout we have to edit the `/etc/X11/xorg.conf`.
5+
6+
Under Section InputDevice specify the following options:
7+
```
8+
Option "XkbModel" "pc105"
9+
Option "XkbRules" "xorg"
10+
Option "XkbLayout" "us,el"
11+
Option "XkbOptions" "grp:alt_shift_toggle"
12+
```

0 commit comments

Comments
 (0)