about summary refs log tree commit diff
path: root/bundles/smb
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2025-09-07 17:32:13 +0200
committerRobert Günzler <r@gnzler.io>2025-09-07 17:42:42 +0200
commit38be6c13f76e893cf47636257071b440dec0c5b2 (patch)
treef7ded3235a7e3362cbd1ed3d91523968fe0faf90 /bundles/smb
initial commit
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to 'bundles/smb')
-rw-r--r--bundles/smb/files/kube.yaml46
-rw-r--r--bundles/smb/files/smb.conf39
-rw-r--r--bundles/smb/files/smb.nft10
-rw-r--r--bundles/smb/files/users.conf3
-rw-r--r--bundles/smb/items.py18
-rw-r--r--bundles/smb/metadata.py5
6 files changed, 121 insertions, 0 deletions
diff --git a/bundles/smb/files/kube.yaml b/bundles/smb/files/kube.yaml
new file mode 100644
index 0000000..3f0e074
--- /dev/null
+++ b/bundles/smb/files/kube.yaml
@@ -0,0 +1,46 @@
+apiVersion: v1
+kind: Pod
+metadata:
+  name: smb
+  labels:
+    traefik.enable: false
+spec:
+  restartPolicy: Never
+  dnsPolicy: Default
+  containers:
+    - name: smb
+      image: docker.io/dockurr/samba:4.20.2
+      volumeMounts:
+        - name: smb-config
+          mountPath: /etc/samba
+        - name: smb-data-scratch
+          mountPath: /storage/scratch
+        - name: smb-data-hayasui
+          mountPath: /storage/hayasui
+        # - name: smb-data-bigdump
+        #   mountPath: /storage/bigdump
+      resources:
+        limits:
+          cpu: 10m
+          memory: 50Mi
+  ports:
+    - containerPort: 445
+      hostPort: 445
+      protocol: TCP
+  volumes:
+    - name: smb-config
+      hostPath:
+        path: /var/lib/smb/config
+        type: DirectoryOrCreate
+    - name: smb-data-scratch
+      hostPath:
+        path: /var/lib/smb/data
+        type: DirectoryOrCreate
+    - name: smb-data-hayasui
+      hostPath:
+        path: /media/hayasui
+        type: Directory
+    # - name: smb-data-bigdump
+    #   hostPath:
+    #     path: /media/bigdump
+    #     type: Directory
diff --git a/bundles/smb/files/smb.conf b/bundles/smb/files/smb.conf
new file mode 100644
index 0000000..12c79e2
--- /dev/null
+++ b/bundles/smb/files/smb.conf
@@ -0,0 +1,39 @@
+[global]
+        security = user
+        server min protocol = SMB2
+
+        # disable printing services
+        load printers = no
+        printing = bsd
+        printcap name = /dev/null
+        disable spoolss = yes
+
+[scratch]
+        path = /storage/scratch
+        comment = Shared
+        valid users = @smb
+        browseable = yes
+        writable = yes
+        read only = no
+        force user = root
+        force group = root
+
+[hayasui]
+        path = /storage/hayasui
+        comment = Shared
+        valid users = @smb
+        browseable = yes
+        writable = yes
+        read only = no
+        force user = root
+        force group = root
+
+# [bigdump]
+#         path = /storage/bigdump
+#         comment = Shared
+#         valid users = robert
+#         browseable = yes
+#         writable = yes
+#         read only = no
+#         force user = root
+#         force group = root
diff --git a/bundles/smb/files/smb.nft b/bundles/smb/files/smb.nft
new file mode 100644
index 0000000..98d3bd3
--- /dev/null
+++ b/bundles/smb/files/smb.nft
@@ -0,0 +1,10 @@
+#!/usr/sbin/nft -f
+# vim: set ts=4 sw=4:
+table inet filter {
+
+    chain my_filter {
+        tcp dport { 445 } accept \
+        comment "Accept SMB traffic"
+    }
+
+}
diff --git a/bundles/smb/files/users.conf b/bundles/smb/files/users.conf
new file mode 100644
index 0000000..d737757
--- /dev/null
+++ b/bundles/smb/files/users.conf
@@ -0,0 +1,3 @@
+#username:UID:groupname:GID:password
+robert:1001:smb:1000:secret
+gonca:1002:smb:1000:secret
diff --git a/bundles/smb/items.py b/bundles/smb/items.py
new file mode 100644
index 0000000..d5b0061
--- /dev/null
+++ b/bundles/smb/items.py
@@ -0,0 +1,18 @@
+files = {
+    "/etc/deployments/smb/kube.yaml": {
+        "source": "kube.yaml",
+        "triggers": {"svc_s6rc:smb:restart"},
+    },
+    "/var/lib/smb/config/smb.conf": {
+        "source": "smb.conf",
+        "triggers": {"svc_s6rc:smb:restart"},
+    },
+    "/var/lib/smb/config/users.conf": {
+        "source": "users.conf",
+        "triggers": {"svc_s6rc:smb:restart"},
+    },
+    "/etc/nftables.d/61-smb.nft": {
+        "source": "smb.nft",
+        "triggers": {"svc_openrc:nftables:restart"},
+    }
+}
diff --git a/bundles/smb/metadata.py b/bundles/smb/metadata.py
new file mode 100644
index 0000000..ef57a65
--- /dev/null
+++ b/bundles/smb/metadata.py
@@ -0,0 +1,5 @@
+defaults = {
+    "containers": {
+        "smb": {},
+    },
+}