SMB/CIFS

Learn how to configure the SmbFilesystemListing to read files from SMB 3.x network shares.

The SmbFilesystemListing class can be used for listing files on SMB 3.x network shares (Windows file shares or Samba 4.x).

How to use it ?

Use the following property in your Connector’s configuration:

fs.listing.class=io.streamthoughts.kafka.connect.filepulse.fs.SmbFileSystemListing

Configuration

The following table describes the properties that can be used to configure the SmbFilesystemListing:

ConfigurationDescriptionTypeDefaultImportance
smb.listing.hostSMB server hostname or IP addressstring-HIGH
smb.listing.portSMB server portint445HIGH
smb.listing.shareSMB share namestring-HIGH
smb.listing.domainSMB domain/workgroupstringWORKGROUPMEDIUM
smb.listing.userSMB usernamestring-HIGH
smb.listing.passwordSMB passwordstring-HIGH
smb.listing.directory.pathThe directory path on the SMB share to scanstring/HIGH
smb.connection.timeoutSMB connection timeout in milliseconds (jcifs.smb.client.connTimeout)int30000MEDIUM
smb.response.timeoutSMB response timeout in milliseconds (jcifs.smb.client.responseTimeout)int30000MEDIUM
smb.so.timeoutSMB socket timeout in milliseconds (jcifs.smb.client.soTimeout)int30000MEDIUM
smb.connection.retriesNumber of retries for SMB connection failuresint5MEDIUM
smb.connection.retries.delayDelay between connection retries in millisecondsint5000MEDIUM
smb.protocol.max.versionMaximum SMB protocol version (SMB300, SMB302, SMB311)stringSMB311MEDIUM

Example Configuration

Here’s a complete example configuration for reading CSV files from a Windows SMB share:

# Connector configuration
name=smb-file-pulse-connector
connector.class=io.streamthoughts.kafka.connect.filepulse.source.FilePulseSourceConnector
fs.listing.class=io.streamthoughts.kafka.connect.filepulse.fs.SmbFileSystemListing

# SMB server configuration
smb.listing.host=192.168.1.100
smb.listing.port=445
smb.listing.share=shared_files
smb.listing.domain=MYDOMAIN
smb.listing.user=kafkauser
smb.listing.password=secretpassword
smb.listing.directory.path=/data/csv

# Connection and protocol configuration
smb.connection.timeout=30000
smb.response.timeout=30000
smb.so.timeout=30000
smb.connection.retries=5
smb.connection.retries.delay=5000
smb.protocol.max.version=SMB311

# File reader configuration
file.filter.regex.pattern=.*\\.csv$
tasks.reader.class=io.streamthoughts.kafka.connect.filepulse.fs.reader.SmbRowFileInputReader

# Kafka topic
kafka.topic=smb-data-topic

Supported Features

  • SMB 3.0/3.0.2/3.1.1 protocol support only (SMB 1.0 and 2.x disabled)
  • Windows Server 2012+ and Samba 4.x compatibility
  • Domain authentication (Active Directory)
  • NTLMv2 authentication (automatically negotiated by jCIFS library)
  • SMB 3.x encryption support for secure file transfers (automatically negotiated)
  • Automatic retry on connection failures
  • File operations: list, read, move, delete
  • Large file support with streaming
  • Proper resource management to prevent file lock issues

Security Considerations

Protocol Security

The connector enforces the following security measures:

  • SMB 3.0 minimum version (hardcoded for security)
  • SMB 3.1.1 maximum version (configurable, default)
  • SMB signing is enabled by default for message integrity
  • SMB encryption is automatically negotiated when supported by the server

Network

  • Ensure SMB port (445) is accessible from Kafka Connect workers

Permissions

Grant the SMB user only the necessary permissions:

  • Read permission for file listing and ingestion
  • Write and Delete permissions only if using file move/cleanup strategies

Troubleshooting

Connection Issues

If you encounter connection problems:

  1. Verify network connectivity: ping <smb-host>
  2. Check SMB port: telnet <smb-host> 445 or nc -zv <smb-host> 445
  3. Test credentials: Try connecting manually with smbclient (Linux) or Windows Explorer
  4. Check firewall rules: Ensure port 445 is not blocked
  5. Verify SMB 3.x support: Check server configuration supports SMB 3.0 or later

Example smbclient test:

smbclient //<smb-host>/<share-name> -U <domain>/<username> -m SMB3

Compatibility

Supported Platforms

  • Windows Server: 2012 and later (SMB 3.0 introduced)
  • Windows Client: Windows 8/10/11
  • Samba: 4.0 and later (SMB 3.0 support)
  • NAS devices: Modern NAS with SMB 3.0+ support

Unsupported (Security Reasons)

  • Windows Server 2008 R2 and earlier (SMB 2.1 and older)
  • Samba 3.x (no SMB 3.0 support)
  • Legacy NAS devices without SMB 3.0
  • SMB 1.0 clients/servers (deprecated, security risk)

Known Limitations

  • Kerberos authentication is not supported (only NTLMv2)

Internal Implementation Details

The connector uses the jCIFS library (version 2.1.40) for SMB protocol implementation.

Configurable jCIFS properties:

  • Connection timeout: Configurable via smb.connection.timeout (maps to jcifs.smb.client.connTimeout)
  • Response timeout: Configurable via smb.response.timeout (maps to jcifs.smb.client.responseTimeout)
  • Socket timeout: Configurable via smb.so.timeout (maps to jcifs.smb.client.soTimeout)
  • SMB protocol versions: Min=SMB300 (hardcoded), Max=configurable (default SMB311)