-
-
Save jborean93/a9d698c5a53277acded82e5a7393e08d to your computer and use it in GitHub Desktop.
Debugging Samba with Symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run \ | |
-it \ | |
--rm \ | |
--publish 445:445 \ | |
--cap-add=SYS_PTRACE \ | |
--security-opt seccomp=unconfined \ | |
archlinux:latest \ | |
/bin/bash | |
### INSIDE THE CONTAINER ### | |
pacman -Syu \ | |
--noconfirm \ | |
bison \ | |
flex \ | |
gcc \ | |
gdb \ | |
make \ | |
perl \ | |
perl-parse-yapp \ | |
pkg-config \ | |
python3 \ | |
rpcsvc-proto \ | |
vim \ | |
wget \ | |
zlib | |
export PATH=/usr/bin/vendor_perl:$PATH | |
wget https://download.samba.org/pub/samba/stable/samba-4.15.0.tar.gz | |
tar -zxf samba-4.15.0.tar.gz | |
cd samba-4.15.0 | |
./configure \ | |
--enable-debug \ | |
--without-ad-dc \ | |
--without-json | |
make -j 16 | |
make install | |
export PATH=/usr/local/samba/bin/:/usr/local/samba/sbin/:$PATH | |
cat > /usr/local/samba/etc/smb.conf << EOL | |
[global] | |
host msdfs = yes | |
workgroup = WORKGROUP | |
valid users = @smbgroup | |
server signing = mandatory | |
ea support = yes | |
store dos attributes = yes | |
vfs objects = xattr_tdb streams_xattr | |
log level = 10 | |
panic action = /bin/sleep 9999999 | |
[dfs] | |
comment = Test Samba DFS Root | |
path = /srv/samba/dfsroot | |
browsable = yes | |
guest ok = no | |
read only = no | |
create mask = 0755 | |
msdfs root = yes | |
[share] | |
comment = Test Samba Share | |
path = /srv/samba/share | |
browsable = yes | |
guest ok = no | |
read only = no | |
create mask = 0755 | |
[share-encrypted] | |
comment = Test Encrypted Samba Share | |
path = /srv/samba/share-encrypted | |
browsable = yes | |
guest ok = no | |
read only = no | |
create mask = 0755 | |
smb encrypt = required | |
EOL | |
groupadd smbgroup | |
useradd smbuser -G smbgroup | |
(echo smbpass; echo smbpass) | smbpasswd -s -a smbuser | |
mkdir -p /srv/samba/dfsroot | |
chmod -R 0755 /srv/samba/dfsroot | |
chown -R smbuser:smbgroup /srv/samba/dfsroot | |
ln -s msdfs:localhost\\share /srv/samba/dfsroot/share | |
ln -s msdfs:localhost\\missing,localhost\\share-encrypted /srv/samba/dfsroot/share-encrypted | |
ln -s msdfs:localhost\\missing /srv/samba/dfsroot/broken | |
mkdir -p /srv/samba/share | |
chmod -R 0755 /srv/samba/share | |
chown -R smbuser:smbgroup /srv/samba/share | |
mkdir -p /srv/samba/share-encrypted | |
chmod -R 0755 /srv/samba/share-encrypted | |
chown -R smbuser:smbgroup /srv/samba/share-encrypted | |
smbd --debug-stdout --foreground --no-process-group > /tmp/samba.log | |
### CODE TO RUN ON WINDOWS ### | |
$file = "\\server\share\file.txt" | |
Set-Content -Path $file -Value data | |
Set-Content -Path $file -Stream ALT -Value data | |
Get-Item $file -Stream * | |
Remove-Item -Path $file -Force | |
### ONCE HUNG ### | |
docker exec -it CONTAINER_ID /bin/bash | |
ps -aef --forest | |
gdb -p PID_OF_SLEEP_PARENT | |
bt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment