A collection of modular scripts to configure and validate an OpenBSD server for hosting a Git-backed Obsidian vault, with support for GitHub deploy key integration and centralized secrets management via a .env
file.
-
Permissions & Git config
- Configured Git’s
safe.directory
to allow operations in our bare repo without warnings. - Created a shared Unix group for the
git
andobsidian
users to streamline permissions. - Enforced proper file permissions and ownership on the bare repository (
git:obsidian
withg+rwX
andsetgid
on directories). - Added
sharedRepository = group
under[core]
in the bare repo’s Git config for group-write support.
- Configured Git’s
-
Fixes
- Corrected the post‑receive hook so that the commit SHA is captured literally and the working-tree checkout runs under the
obsidian
user.
- Corrected the post‑receive hook so that the commit SHA is captured literally and the working-tree checkout runs under the
-
Logging
- Enhanced logging across both setup and test scripts for improved traceability.
-
Secrets management
- Introduced centralized
.env
-stylesecrets.env
support, loading defaults fromsecrets.env.example
. - Bootstrap step: auto-generate
secrets.env
when missing, with user notification. - All setup and test scripts now source configuration from
secrets.env
instead of hardcoded values.
- Introduced centralized
-
Test runner reliability
test_all.sh
now continues through all suites even if one fails, so you get a full report in one run.
-
test_github additions
- Verifies
/root/.ssh
exists. - Confirms the repository is cloned into
$setup_dir/.git
. - Checks
remote origin
in$setup_dir/.git/config
matches$GITHUB_REPO
.
- Verifies
-
test_system enhancements
-
Asserts
${INTERFACE}
is up with${STATIC_IP}
. -
Ensures
PasswordAuthentication no
in/etc/ssh/sshd_config
. -
Validates root’s
.profile
exports:HISTFILE=/root/.ksh_history
HISTSIZE=5000
HISTCONTROL=ignoredups
-
-
History‑merge test
- Confirms old‑history marker is merged into new history.
- Confirms new‑history marker remains intact.
-
doas & package tests moved
- Package installation and
doas.conf
permission/ownership tests are now intest_obsidian_git.sh
.
- Package installation and
-
test_obsidian_git expanded
- SSH service config (
AllowUsers
, daemon running). .ssh
directories andauthorized_keys
for bothgit
andobsidian
users (existence, perms, ownership).- Vaults directories for both users.
- Bare repo HEAD,
safe.directory
entries, post‑receive hook shebang & content. - Working‑clone verification (clone, remote URL, commit presence).
- Per‑user history settings in
.profile
andmaster.passwd
(password removal or setting).
- SSH service config (
-
Setup scripts aligned
- Added or moved all corresponding configuration blocks into
setup_system.sh
andsetup_obsidian_git.sh
so new tests pass out-of-the-box.
- Added or moved all corresponding configuration blocks into
- OS: OpenBSD (tested on 7.x)
Script | Purpose |
---|---|
setup_system.sh |
Installs packages, creates users, sets up networking and doas, hardens SSH, configures user profiles. |
setup_obsidian_git.sh |
Initializes the Git bare repo and working copy for Obsidian vault syncing. |
setup_github.sh |
Installs deploy key and bootstraps the GitHub repo clone for ongoing configuration management. |
setup_all.sh |
Runs all of the above in sequence. |
Script | Validates |
---|---|
test_system.sh |
User setup, file permissions, doas, network, DNS, SSH security. |
test_obsidian_git.sh |
Git bare repo structure, safe.directory flags, post-receive hook. |
test_github.sh |
Deploy key presence and permission, GitHub in known_hosts. |
test_all.sh |
Runs all of the above in sequence, with optional logging. |
All setup and test scripts support optional logging flags:
- Force a log on every run:
./script.sh --log
./script.sh -l
- Specify a custom logfile:
./script.sh --log=/path/to/my.log
-
Default behavior:
- Logs only on failure, written to
logs/<script>-YYYYMMDD_HHMMSS.log
.
- Logs only on failure, written to
sh setup_all.sh
Override defaults using environment variables:
REG_USER=obsidian \
GIT_USER=git \
VAULT=myvault \
INTERFACE=em0 \
STATIC_IP=192.0.2.10 \
NETMASK=255.255.255.0 \
GATEWAY=192.0.2.1 \
sh setup_all.sh
Or run individual setup phases:
sh setup_system.sh
sh setup_obsidian_git.sh
sh setup_github.sh
sh test_all.sh [--log[=FILE]]
Same environment variables apply.
Use version tags to snapshot working configurations:
git tag -a v0.8.0 -m "v0.8.0 – previous release"
git tag -a v0.9.0 -m "v0.9.0 – Permissions & Hook Improvements"
git push origin --tags
- Configured Git’s
safe.directory
to allow operations in our bare repo without warnings. - Created a shared Unix group for the Obsidian and Git users to streamline permissions.
- Improved logging throughout both the setup scripts and the test suite for better traceability.
- Enforced proper file permissions and ownership on the bare repository (
git:obsidian
withg+rwX
andsetgid
on dirs). - Added
sharedRepository = group
under[core]
in the bare repo’s Git config to enable group-write operations.
- Corrected the post‑receive hook so that the commit SHA is captured literally and the working-tree checkout runs under the Obsidian user.
— incidental improvements to logging, no user‑facing behavior changes beyond the above.
-
Secrets management
- Centralized
.env
-stylesecrets.env
support, loading defaults fromsecrets.env.example
. - Bootstrap step: auto-generate
secrets.env
if missing. - All setup and test scripts now source configuration from
secrets.env
.
- Centralized
-
Test runner reliability
test_all.sh
now continues through all suites even if one fails.
-
test_github additions
- Verified
/root/.ssh
exists. - Confirmed repo clone into
$setup_dir
. - Checked
remote origin
URL in.git/config
.
- Verified
-
test_system enhancements
- Asserted
${INTERFACE}
IP assignment. - Ensured SSH disallows password auth.
- Root’s
.profile
now exportsHISTFILE
,HISTSIZE
, andHISTCONTROL
.
- Asserted
-
History‑merge test
- Old history merged into new.
- New history preserved.
-
doas & package tests moved
- Tests for package installation and
doas.conf
perms/ownership now live intest_obsidian_git.sh
.
- Tests for package installation and
-
test_obsidian_git expanded
- SSHD config & daemon checks.
.ssh
andauthorized_keys
validation for both users.- Vaults directory existence and permissions.
- Bare repo HEAD,
safe.directory
, post‑receive hook content. - Working clone functionality (clone, remote URL, commit log).
- Per-user history and password‑field tests in
master.passwd
.
-
Logging Enhancements
--log[=FILE]
/-l
: force writing a full log on every run.- Sensible defaults: logs written to
logs/
with timestamped filenames.
-
Expanded User Setup
- Configures both
git
andobsidian
users (instead of onlygit
). - Blank initial passwords assigned for both users (can be pulled from a secrets file).
- Fixed the bug in
setup_obsidian_git.sh
that this change introduced.
- Configures both
-
Refactor Sync Code
- Moved missing code blocks from
setup_all.sh
intosetup_obsidian_git.sh
. - Mirrored those changes in the corresponding test scripts for consistency.
- Moved missing code blocks from
-
Split monolithic setup/test scripts into:
setup_system.sh
setup_obsidian_git.sh
setup_github.sh
test_system.sh
test_obsidian_git.sh
test_github.sh
-
Added
setup_all.sh
andtest_all.sh
for convenience.
- Added strict validation for network config files.
- Anchored regex to prevent deprecated
netmask
lines. - Retained all core tests from v0.1.
- Setup and validation for OpenBSD server configuration (users, SSH, network, Git).
MIT OR 0BSD — see the LICENSE file.