游戏正式上线服 老板要把 ssh 密码设置成一样的...

2019-04-18 15:46:49 +08:00
 ONLYONEING

脑袋痛 游戏正式上线服 老板要把 ssh 密码设置成一样的...

5959 次点击
所在节点    Linux
25 条回复
DAPTX4869
2019-04-18 22:58:26 +08:00
设备密码全是 password@A......
对外安全有 vpn
pangliang
2019-04-18 23:01:57 +08:00
那是你们没见过给了 sudo 账号还来要 root 密码的
SharkIng
2019-04-19 01:17:45 +08:00
和老板签个免责声明,我改可以,出问题我不管
CCNemo
2019-04-19 09:11:11 +08:00
换端口一般还能用用。
ps1aniuge
2019-04-21 23:28:25 +08:00
```powershell
# sshd deny host 脚本,powershell 版。

$ssh 连接失败次数阀值 = 4
#--------------------------------------------------------------------
if (Test-Path -LiteralPath '/etc/host_deny_old1.txt')
{
Remove-Item -LiteralPath '/etc/host_deny_old1.txt' -Force
}

if (Test-Path -LiteralPath '/etc/hosts.deny')
{
Move-Item -LiteralPath '/etc/hosts.deny' -Destination '/etc/host_deny_old1.txt'
New-Item -Path '/etc/hosts.deny'
chmod 644 /etc/hosts.deny
}

$所有 ssh 连接失败 ip = Get-Content -LiteralPath /var/log/secure | Where-Object { $_.split()[5] -eq 'Failed' } | Select-Object @{n = "key";e = { $_.Split()[-4] } } | Group-Object -Property key -NoElement
foreach ($单个 ssh 连接失败 ip in $所有 ssh 连接失败 ip)
{
#2016-10-15 centos7 测试通过,完全正常。其他版本没测试,如有问题,请修改这里 $_.split()[5]
if ($单个 ssh 连接失败 ip.count -gt $ssh 连接失败次数阀值)
{
$deny 字串 = 'sshd: ' + $单个 ssh 连接失败 ip.name
Add-Content -LiteralPath '/etc/hosts.deny' -Value $deny 字串 -Encoding Ascii
}
#问:这个脚本谁写的?有问题找谁技术支持?
#答:QQ 群号=183173532
#名称=powershell 交流群
}

Write-Warning '只需要删除 /etc/hosts.deny 文件,即可解除所有阻止的 ip'
```

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/556444

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX