change rsa to ed25519.
This commit is contained in:
parent
02290628a6
commit
905d4e26c6
2
db.go
2
db.go
@ -56,7 +56,7 @@ func logConnect(conn net.Conn) {
|
||||
insertSQL := `INSERT INTO connect_attempts (time, ip, port) VALUES (?, ?, ?)`
|
||||
_, err := db.Exec(insertSQL, currentTime, host, portInt)
|
||||
if err != nil {
|
||||
log.Println("Failed to insert connect attempt:", err)
|
||||
log.Fatal("Failed to insert connect attempt:", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
11
main.go
11
main.go
@ -1,8 +1,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/ed25519"
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"errors"
|
||||
"log"
|
||||
"net"
|
||||
@ -15,8 +15,9 @@ import (
|
||||
var (
|
||||
errBadPassword = errors.New("permission denied")
|
||||
serverVersions = []string{
|
||||
"SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u2",
|
||||
"SSH-2.0-OpenSSH_9.9",
|
||||
"SSH-2.0-OpenSSH_9.2p1 Debian-2+deb12u4", // My Server Truely
|
||||
"SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u2", // cowrie default
|
||||
"SSH-2.0-OpenSSH_9.9", // Manjaro
|
||||
}
|
||||
)
|
||||
|
||||
@ -29,12 +30,12 @@ func main() {
|
||||
defer db.Close()
|
||||
|
||||
serverConfig := &ssh.ServerConfig{
|
||||
MaxAuthTries: 6,
|
||||
MaxAuthTries: 3,
|
||||
PasswordCallback: passwordCallback,
|
||||
ServerVersion: serverVersions[0],
|
||||
}
|
||||
|
||||
privateKey, _ := rsa.GenerateKey(rand.Reader, 2048)
|
||||
_, privateKey, _ := ed25519.GenerateKey(rand.Reader)
|
||||
signer, _ := ssh.NewSignerFromSigner(privateKey)
|
||||
serverConfig.AddHostKey(signer)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user