Bài đăng

Hiển thị các bài đăng có nhãn SSH

Top 20 OpenSSH Server Best Security Practices

Hình ảnh
OpenSSH is the implementation of the SSH protocol. OpenSSH is recommended for remote login, making backups, remote file transfer via scp or sftp, and much more. SSH is perfect to keep confidentiality and integrity for data exchanged between two networks and systems. However, the main advantage is server authentication, through the use of public key cryptography. From time to time there are  rumors  about OpenSSH  zero day  exploit. Here are a few things you need to tweak in order to improve OpenSSH server security. Default Config Files and SSH Port /etc/ssh/sshd_config  – OpenSSH server configuration file. /etc/ssh/ssh_config  – OpenSSH client configuration file. ~/.ssh/  – Users ssh configuration directory. ~/.ssh/authorized_keys  or  ~/.ssh/authorized_keys  – Lists the public keys (RSA or DSA) that can be used to log into the user’s account /etc/nologin  – If this file exists, sshd refuses to let anyone except r...

SSH Tunnel - Local and Remote Port Forwarding Explained With Examples

There are two ways to create an SSH tunnel, local and remote port forwarding (there’s also dynamic forwarding, but we won’t cover that here). The best way to understand these is by an example, let’s start with local port forwarding. Imagine you’re on a private network which doesn’t allow connections to a specific server. Let’s say you’re at work and imgur.com is being blocked. To get around this we can create a tunnel through a server which isn’t on our network and thus can access Imgur. $ ssh -L 9000:imgur.com:80 user@example.com   The key here is -L which says we’re doing local port forwarding. Then it says we’re forwarding our local port 9000 to imgur.com:80 , which is the default port for HTTP. Now open your browser and go to http://localhost:9000 . The awesome thing about SSH tunnels is that they are encrypted. Nobody is going to see what sites you’re visiting, they’ll only see an SSH connection to your server. Connecting to a database behind a firewall Anoth...

authentication failure using SSH pam_unix(sshd:auth): authentication failure;

? when I try connect to another server using ssh, I found an error on /var/log/secure "pam_unix(sshd:auth): authentication failure; "   Oct 30 16:21:59 hvphuc sshd[1923]: pam_unix(sshd:auth): authentication failure ; logname= uid=0 euid=0 tty=ssh ruser= rhost=10.10.20.149  user=hvphuc Oct 30 16:21:59 hvphuc sshd[1923]: pam_sss(sshd:auth): authentication success; logname= uid=0 euid=0 tty=ssh ruser= rhost=10.10.20.149 user=hvphuc Oct 30 16:21:59 hvphuc sshd[1923]: Accepted password for hvphuc from 10.10.20.149 port 56689 ssh2 Oct 30 16:22:01 hvphuc sshd[1923]: pam_unix(sshd:session): session opened for user hvphuc by (uid=0) okay, we know the problem is on the pam module, so we should look at sshd module on pam directory at /etc/pam.d/ at /etc/pam.d/sshd ? 1 2 3 4 5 6 7 8 9 10 auth required pam_sepermit.so auth include password-auth account required pam_nologin.so account include password-auth pa...