首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >托管在EC2 / Amazon上的站点被私钥劫持为人质

托管在EC2 / Amazon上的站点被私钥劫持为人质
EN

Server Fault用户
提问于 2018-10-25 21:14:10
回答 1查看 148关注 0票数 2

我有一个新客户,以前的开发人员已经在Amazon/EC2上的网站上留下了她的高度和干爽。他持有这个例子的私钥,尽管她可以完全访问Amazon控制面板(她每周支付300美元/月的价格购买一个拥有大约3名访问者的网站),但她没有任何办法将自己的内容删除并转移到新的主机上。

我对AWS不熟悉,也不知道该如何帮助她。站点的组/文件权限在服务器上搞砸了,因此通过她的WordPress控制面板导出内容/数据库是行不通的。

有什么办法帮她吗?谢谢!

EN

回答 1

Server Fault用户

回答已采纳

发布于 2018-10-26 04:47:18

你有两个选择:

  1. 创建EC2实例的图像(AMI,快照),并从该映像创建一个新实例。
    • 它应该将SSH键设置为指定的键,即新的键。
    • 确保所有网络和安全设置与旧实例相同。
    • 您可能需要从旧的webserver实例重新分配弹性IP到新的实例,或者更新DNS以指向新的IP。

  2. 或者,从一个单独的EC2实例修改根卷。
    1. 使用您知道的SSH键启动一个新的EC2实例。
    2. 停止webserver实例(不要终止它)。
    3. 在EC2详细信息中查找根卷名称,它可能是/dev/xvda/dev/sda1。记下来。然后在根卷名称上悬停时,单击弹出框中的卷id,例如vol-1234abcd1234abcd
    4. 在“卷”屏幕中,查找当前根卷vol-1234abcd1234abcd,然后从菜单中选择“分离卷”。
      • 做一个音量快照,以防万一。

代码语言:javascript
复制
1. Now _Attach_ the same volume to the new EC2 instance that you've got access to.
2. _SSH_ to the new instance and `sudo su -` to get `root` privileges.
3. _Mount_ the webserver volume, it will probably be `/dev/sdf1` or `/dev/xvdb1` - check `dmesg | tail -n10` to get a hint of what the disk name is.  [root@ip-... ~] # mount /dev/xvdb1 /mnt
4. Copy the contents of `/home/ec2-user/.ssh/authorized_keys` to `/mnt/home/ec2-user/.ssh/authorized_keys` - make sure the file permissions and ownership are still the same as they were!  [root@ip... #] cat /home/ec2-user/.ssh/authorized\_keys > /mnt/home/ec2-user/.ssh/authorized\_keys  
    - At the same time you may want to _copy out_ the contents of your _WordPress website_ and the _database files_ (if the DB is on the same instance). 
代码语言:javascript
复制
1. `umount /mnt` from the shell and then _Detach_ the volume from the AWS Console.
2. Now _Attach_ it back as the _Root volume_ to the old webserver instance.  
    - Note that the _Root volume_ name won't be in the menu! Simply write what you noted down in step 1 above, e.g. `/dev/xvda` or `/dev/sda1`.
代码语言:javascript
复制
1. _Start_ the instance.

如果出了问题,这里是如何在上面的第4步采取从快照恢复根文件系统

那应该行。希望有帮助:)

票数 4
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/937266

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档