Skip to content

Commit 44c6092

Browse files
committed
sftp-server-ci: setup on v-ps-fal
1 parent de8de74 commit 44c6092

File tree

4 files changed

+61
-3
lines changed

4 files changed

+61
-3
lines changed

dns/domains/xuyh0120.win.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ let
132132
target = "v-ps-fal.ltnet.xuyh0120.win.";
133133
ttl = "1h";
134134
}
135+
{
136+
recordType = "CNAME";
137+
name = "sftp-ci";
138+
target = "v-ps-fal";
139+
ttl = "1h";
140+
}
135141
{
136142
recordType = "CNAME";
137143
name = "stats";

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hosts/v-ps-fal/configuration.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
../../nixos/optional-apps/plausible
2727
../../nixos/optional-apps/quassel.nix
2828
../../nixos/optional-apps/rsshub.nix
29+
../../nixos/optional-apps/sftp-server-ci.nix
2930
../../nixos/optional-apps/tg-bot-cleaner-bot
3031
../../nixos/optional-apps/waline.nix
3132

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
pkgs,
3+
lib,
4+
LT,
5+
config,
6+
utils,
7+
inputs,
8+
...
9+
}@args:
10+
let
11+
sshKeys = import (inputs.secrets + "/ssh/sftp-ci.nix");
12+
in
13+
{
14+
users.users.ci = {
15+
home = "/run/sftp-ci";
16+
group = "ci";
17+
createHome = true;
18+
isSystemUser = true;
19+
openssh.authorizedKeys.keys = sshKeys;
20+
};
21+
22+
users.groups.ci = { };
23+
24+
services.openssh.extraConfig = ''
25+
Match User ci
26+
ForceCommand internal-sftp
27+
PasswordAuthentication no
28+
ChrootDirectory ${config.users.users.ci.home}
29+
PermitTunnel no
30+
AllowAgentForwarding no
31+
AllowTcpForwarding no
32+
X11Forwarding no
33+
'';
34+
35+
fileSystems."/run/sftp-ci" = {
36+
device = "/nix/persistent/sync-servers";
37+
fsType = "fuse.bindfs";
38+
options = [
39+
"force-user=ci"
40+
"force-group=ci"
41+
"perms=755"
42+
"create-for-user=root"
43+
"create-for-group=root"
44+
"chmod-ignore"
45+
"chown-ignore"
46+
"chgrp-ignore"
47+
"xattr-none"
48+
"x-gvfs-hide"
49+
];
50+
};
51+
}

0 commit comments

Comments
 (0)