Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PrivateStorageio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PrivateStorage
PrivateStorageio
Commits
4f0125b3
Commit
4f0125b3
authored
3 years ago
by
Florian Sesser
Browse files
Options
Downloads
Patches
Plain Diff
VPN WIP
parent
86ce5141
Branches
reproduce-permission-errors
No related tags found
3 merge requests
!101
Merge staging into production
,
!100
Merge develop into staging
,
!87
Add monitoring VPN modules and config
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
morph/lib/make-issuer.nix
+8
-1
8 additions, 1 deletion
morph/lib/make-issuer.nix
nixos/modules/monitoring/vpn/client.nix
+49
-17
49 additions, 17 deletions
nixos/modules/monitoring/vpn/client.nix
with
57 additions
and
18 deletions
morph/lib/make-issuer.nix
+
8
−
1
View file @
4f0125b3
...
...
@@ -35,7 +35,7 @@
imports
=
[
hardware
../../nixos/modules/issuer.nix
../../nixos/modules/monitoring/vpn/
server
.nix
../../nixos/modules/monitoring/vpn/
client
.nix
];
services
.
private-storage
.
sshUsers
=
sshUsers
;
...
...
@@ -52,4 +52,11 @@
};
system
.
stateVersion
=
stateVersion
;
services
.
private-storage
.
monitoring
.
vpn
.
client
=
{
enable
=
true
;
privateKeyFile
=
"/var/secrets/vpn/private.key"
;
ips
=
[
"172.23.23.21/24"
];
allowedIPs
=
[
"172.23.23.1/32"
];
};
}
This diff is collapsed.
Click to expand it.
nixos/modules/monitoring/vpn/client.nix
+
49
−
17
View file @
4f0125b3
# Client section of our Monitoring VPN config
#{ config, ip, privateKeyPath }:
let
cfg
.
server
=
"192.168.67.21"
;
cfg
.
port
=
54321
;
ip
=
"192.168.42.11"
;
{
lib
,
config
,
...
}:
let
cfg
=
config
.
services
.
private-storage
.
monitoring
.
vpn
;
in
{
networking
.
wireguard
.
interfaces
.
monitoringvpn
=
{
ips
=
[
"
${
ip
}
/24"
];
privateKey
=
"oFCEeXlRI+iU3UOgNsAOUCaLZFTEKAq4OrVAvusZYGo="
;
peers
=
[
{
allowedIPs
=
[
"192.168.42.1/32"
];
endpoint
=
cfg
.
server
+
":"
+
toString
cfg
.
port
;
publicKey
=
"0fS5azg7bBhCSUocI/r9pNkDMVpnlXmJfu9NV3YfEkU="
;
}
];
options
.
services
.
private-storage
.
monitoring
.
vpn
.
client
=
{
enable
=
lib
.
mkEnableOption
"PrivateStorageio Monitoring VPN client service"
;
privateKeyFile
=
lib
.
mkOption
{
type
=
lib
.
types
.
str
;
example
=
lib
.
literalExample
"/var/secrets/monitoring-vpn/host.key"
;
description
=
''
Base64 private key generated by <command>wg genkey</command>.
''
;
};
publicKeyFile
=
lib
.
mkOption
{
type
=
lib
.
types
.
str
;
example
=
lib
.
literalExample
"/var/secrets/monitoring-vpn/host.pub"
;
description
=
''
Base64 public key generated by <command>cat private.key | wg pubkey > pubkey.pub</command>.
''
;
};
allowedIPs
=
lib
.
mkOption
{
type
=
lib
.
types
.
listOf
lib
.
types
.
str
;
example
=
lib
.
literalExample
[
"172.23.23.1/32"
];
description
=
''
Limits which IPs this client receives data from.
''
;
};
ips
=
lib
.
mkOption
{
type
=
lib
.
types
.
listOf
lib
.
types
.
str
;
example
=
lib
.
literalExample
[
"172.23.23.11/24"
];
default
=
[
"172.23.23.21/24"
];
description
=
''
The IP addresses of the interface.
See https://github.com/NixOS/nixpkgs/blob/nixos-20.09/nixos/modules/services/networking/wireguard.nix .
''
;
};
};
config
=
lib
.
mkIf
cfg
.
client
.
enable
{
networking
.
wireguard
.
interfaces
.
monitoringvpn
=
{
ips
=
cfg
.
client
.
ips
;
privateKeyFile
=
cfg
.
client
.
privateKeyFile
;
peers
=
[
{
allowedIPs
=
cfg
.
client
.
allowedIPs
;
endpoint
=
"192.168.67.21:54321"
;
# cfg.server + ":" + toString cfg.port;
publicKey
=
"0fS5azg7bBhCSUocI/r9pNkDMVpnlXmJfu9NV3YfEkU="
;
}
];
};
};
}
# just have all config static (no file systems etc)
#
v
just have all config static (no file systems etc)
# move cfg into global config (like config.privatestorage.monitoring.*)
# parametrize keys
# - (https://wiki.archlinux.org/index.php/WireGuard
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment