Skip to content

522 Data connection must use cached TLS session #435

@elbek

Description

@elbek

I have this cli which works fine:

 lftp -e "set ssl:check-hostname no;" -p 21 -u user host.com

I am trying from golang which fails:

	// FTPS server details
	ftpServer := "host:21" // Replace with your FTPS server
	username := "user"
	password := "pwd"

	var options []ftp.DialOption
	tlsConfig := &tls.Config{
		InsecureSkipVerify:     true,
		ClientSessionCache:     tls.NewLRUClientSessionCache(10),
		SessionTicketsDisabled: true, // tried this and false as well. 
	}
	options = append(options, ftp.DialWithExplicitTLS(tlsConfig))
	options = append(options, ftp.DialWithTimeout(10*time.Second))
	options = append(options, ftp.DialWithDebugOutput(os.Stdout))
	conn, err := ftp.Dial(ftpServer, options...)
	if err != nil {
		panic(err)
	}
	defer conn.Quit()
	// Authenticate with username and password
	err = conn.Login(username, password)
	if err != nil {
		panic(err)
	}
	fmt.Println("Connected and authenticated to FTPS server!")
	// List files in the root directory
	entries, err := conn.List("/")
	if err != nil {
		panic(err) // err here with 522
	}
	fmt.Println("Files on the server:")
	for _, entry := range entries {
		fmt.Println(entry.Name)
	}

conn.List("/") fails with:
522 Data connection must use cached TLS session, how should we configure tls to match the cli.

Appreciate any help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions