肇鑫的日常博客

日常

SSH升级后,key自动发生变化导致不能自动登录问题的处理

最近遇到一个奇怪的问题,原本能够通过key自动登录的ssh,突然不能登录了。

经过调查,我发现原本的key类型是“ecdsa-sha2-nistp256”,但是服务器现在要求的key是“ed25519”类型。此时在客户端(本机),删除掉“~/.ssh/config”和“~/.ssh/known_hosts”里对应的服务器端的信息。重新用ssh连接。此时,虽然不能自动登录,但是可以通过密码登录。

登录成功后,在服务器端修改“vi .ssh/authorized_keys ”。将原本的“ecdsa-sha2-nistp256”类型的key,替换为“ed25519”的新key。保存并关闭。

重新用ssh登录,这下自动登录又好用了。

生成“ed25519”的方法,可以看github的说明

结论

从上个月起,github改变了策略,新上传的key必须是“ed25519”类型,之前的类型不再接受。一些Linux发行版也采用了类似的策略。但是,自动改变的类型,导致之前能自动登录的不能成功,这的确造成了一些问题。

More Details On Installing macOS Monterey 12 Beta On Unsupported Macs

If you want to install macOS Monterey on your Mac and you Macs are not officially supported by Apple. I suggest you to follow this video.

Monterey on Unsupported Mac - OpenCore Legacy Patcher! Install the Latest Beta on 2012-2014 Macs!!!

I installed two of my Macs to macOS Monterey 12 beta 2 today, and I found for beginners that video was not enough. There were also something important that were missing. That was this article for.

Foundation Knowledges

Before installing the system, it is better to know how the booting process works.

Normal Boot With a Internal SSD

normal booting

When a user presses the power button, a Mac searches all disk partitions. The EFI partitions normal are hidden and load first by default. So If a user chooses to boot from the internal SSD, the EFI are loaded first and then the APFS partition.

There are hardware related drivers on the EFI and this affects the macOS that loads after EFI. This is very important. So keep the EFI of you internal SSD and don't override them unless you are 100% certain.

Booting With Installing USB Disk

booting with usb disk

After a user presses the power button, the user hold the Options button of the keyboard until a list shows. The list shows the Internal SSD, the EFI and macOS Monterey Installer on the USB Disk as well.

The user has to choose the EFI first then choose the macOS Monterey Installer. If the user chooses the Installer first, the system will show no disk error as the driver is not ready.

Installing macOS To External SSDinstalling to external SSD

Installing to external SSD is as easy as to choose the external SSD. However, after installing, you should install the EFI by OpenCore Legacy Patcher to the external SSD as well.

dual booting

Conclusion

Installing macOS on an unsupported Mac means installing both EFI and macOS on the Mac. Without the EFI, the Mac won't boot properly with the new macOS.

Others

You will need at least 35GB free space to install macOS Monterey 12 beta 2.

For your USB disk, partition it in GUID format. It is request to use EFI with GUID.

For iMac 5K users, DO NOT install EFI on your internal SSD. Or your screen will only get resolution at 3840x2160 most, even on macOS Big Sur 11.4. That is because currently the EFI by third-party can't do as well as Apple's.

ClashX配置Trojan

更新说明

  • 将ClashXR,因为Clash核心支持SSR之后,ClashXR宣布放弃后续开发。(更新日期2020年9月17日)

安装

brew cask install clashx

配置

  1. 打开ClashX。
  2. 点击菜单栏的图标,配置->打开本地配置文件夹
  3. 复制config.yaml,修改为trojan.yaml
  4. 使用编辑器打开trojan.yaml

Proxy:下,添加新内容:

Proxy::
-   name: "tro"
    type: trojan
    server: server # 服务器的IP地址
    port: 443
    password: yourpsk #密码
    # udp: true
    sni: tro.example.com # 用于trojan识别的二级域名
    # alpn:
    #   - h2
    #   - http/1.1
    # skip-cert-verify: true

修改服务器ip,密码和二级域名。保存,切换配置到新配置。出站规则选全局连接,然后选择设置为系统代理

ClashXR的配置对于tab十分敏感。如果tab不对,即便配置是对的,也不会生效。
选全局代理的原因是因为ClashXR本身不自带任何规则。选全局之后,可以上几个网站尝试一下看看是不是生效了。
https://github.com/paradiseduo/ClashXR

添加规则

https://github.com/Hackl0us/SS-Rule-Snippet/blob/master/LAZY_RULES/clash.yaml

上面的是其它人提供的一个Clash的模板,需要规则的,可以从上面复制规则到你自己的配置中。规则从Rule:开始一直到结尾。复制粘贴规则时,同样要注意到tab。

它的规则中定义了Proxy,我们原本的配置里没有。因此我们需要添加。找到Proxy Group:,添加如下的内容。

Proxy Group:
# select 用来允许用户手动选择 代理服务器 或 服务器组
# 您也可以使用 RESTful API 去切换服务器,这种方式推荐在 GUI 中使用
  - name: Proxy
    type: select
    proxies:
      - tro

添加好规则后,重新加载配置,我们就可以将全局连接改成规则判断了。

https://lancellc.gitbook.io/clash/clash-config-file/proxies/config-a-torjan-proxy

其它

Ubuntu 18.04下将Apache2多站点改为Nginx多站点,同时开启Trojan