
12 changed files with 168 additions and 22 deletions
@ -0,0 +1,13 @@ |
|||
#1/bin/bash |
|||
|
|||
# todo: actually install podman |
|||
|
|||
# copy bin files to /usr/local/bin |
|||
rsync -vaSH bin/ /usr/local/bin/ |
|||
|
|||
# copy shflags to /usr/local/bin as well |
|||
rsync -vaSH lib/shflags /usr/local/bin/ |
|||
|
|||
# install systemd startup service |
|||
rsync -vaSH lib/containers-startup.service /etc/systemd/system/ |
|||
systemctl enable containers-startup.service |
@ -0,0 +1,11 @@ |
|||
[Unit] |
|||
Description=Containers startup script |
|||
Wants=network.target |
|||
After=network-online.target |
|||
|
|||
[Service] |
|||
ExecStart=/etc/containers/startup.sh |
|||
Type=forking |
|||
|
|||
[Install] |
|||
WantedBy=default.target |
@ -0,0 +1,52 @@ |
|||
### |
|||
### Build Variables |
|||
### |
|||
FROM localhost/debian:latest |
|||
|
|||
# deploy options |
|||
# -p (port) and -v (volume) both go host:container |
|||
LABEL deployopts="\ |
|||
-p 9045:445 \ |
|||
-v /tank/files/db/samba:/vol/db \ |
|||
-v /tank/files/media:/vol/media \ |
|||
-v /tank/files/user:/vol/user" |
|||
# make sure mount directories exist |
|||
RUN mkdir -p /vol/db /vol/media /vol/user |
|||
|
|||
# uid that the files owner user should have |
|||
ARG FILESUID=5000 |
|||
|
|||
### |
|||
### General Setup |
|||
### |
|||
|
|||
# install packages we want |
|||
RUN apt update -y && apt install -y samba |
|||
|
|||
# create gitea user with file owner UID |
|||
RUN addgroup --gid $FILESUID files && \ |
|||
adduser files --ingroup files --uid $FILESUID --disabled-password --gecos "Files Owner" --shell /usr/sbin/nologin --no-create-home |
|||
|
|||
RUN chown -R files:files /vol |
|||
|
|||
# copy our custom scripts |
|||
COPY resources/bin/ /usr/local/bin/ |
|||
|
|||
RUN ls -A /home |
|||
|
|||
# replace home with symlink |
|||
RUN cd / && rmdir home && ln -s /vol/user home |
|||
|
|||
### |
|||
### NMBD |
|||
### |
|||
|
|||
# disable NMBD |
|||
RUN systemctl disable nmbd |
|||
|
|||
### |
|||
### SMBD |
|||
### |
|||
|
|||
# copy samba config |
|||
COPY resources/smb.conf /etc/samba/smb.conf |
@ -0,0 +1,4 @@ |
|||
#!/bin/bash |
|||
|
|||
pdbedit -L -w > $1 |
|||
chown files:files $1 |
@ -0,0 +1,13 @@ |
|||
#!/bin/bash |
|||
|
|||
while read line; do |
|||
user=$(echo "$line" | cut -d':' -f1) |
|||
# only create user if doesn't exist |
|||
if [[ -z $(getent passwd $user) ]]; then |
|||
adduser "$user" --disabled-password --gecos "" --no-create-home --shell /usr/sbin/nologin |
|||
usermod -a -G sambashare "$user" |
|||
fi |
|||
done < $1 |
|||
|
|||
# import passwords file |
|||
pdbedit -i smbpasswd:$1 |
@ -0,0 +1,6 @@ |
|||
#!/bin/sh |
|||
if [[ -z $(getent passwd "$1") ]]; then |
|||
adduser "$1" --disabled-password --gecos "" --no-create-home --shell /usr/sbin/nologin |
|||
usermod -a -G sambashare "$1" |
|||
fi |
|||
smbpasswd -a "$1" |
@ -0,0 +1,51 @@ |
|||
#======================= Global Settings ======================= |
|||
[global] |
|||
### General ### |
|||
server string = medusa |
|||
server role = standalone server |
|||
disable netbios = yes |
|||
smb ports = 445 |
|||
|
|||
#### Logging #### |
|||
log file = /var/log/samba/smb.log |
|||
max log size = 1000 |
|||
|
|||
####### Authentication ####### |
|||
passdb backend = tdbsam |
|||
map to guest = bad user |
|||
|
|||
### Permissions ## |
|||
# The following settings configure all shares to use the filesrv user on the backend |
|||
force user = files |
|||
force group = files |
|||
create mask = 0644 |
|||
directory mask = 0755 |
|||
force create mode = 0644 |
|||
force directory mode = 0755 |
|||
unix extensions = yes |
|||
map archive = no |
|||
map system = no |
|||
map hidden = no |
|||
|
|||
### Printing ### |
|||
# Disable all printing |
|||
load printers = no |
|||
printing = bsd |
|||
printcap name = /dev/null |
|||
disable spoolss = yes |
|||
|
|||
#======================= Share Definitions ======================= |
|||
[media] |
|||
comment = Shared media files |
|||
path = /vol/media |
|||
browsable = yes |
|||
guest ok = yes |
|||
read only = yes |
|||
write list = @sambashare |
|||
|
|||
[homes] |
|||
comment = User homes |
|||
browsable = no |
|||
guest ok = no |
|||
read only = no |
|||
valid users = %S |
Loading…
Reference in new issue