手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆
浏览模式: 标准 | 列表分类:Linux

tailscale fix: NO_PUBKEY 458CA832957F5868

 在Debian下,按照官方的教程进行gpg和source的添加时,在apt update时会报错 NO_PUBKEY的错误

1、添加GPG
curl -fsSL https://pkgs.tailscale.com/stable/debian/bookworm.noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null
curl -fsSL https://pkgs.tailscale.com/stable/debian/bookworm.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list
2、UPDATE
sudo apt update
 
大概率情况下是报:
 The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 458CA832957F5868
Reading package lists... Done
W: GPG error: https://pkgs.tailscale.com/stable/debian bookworm InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 458CA832957F5868
 
--
出现这个问题,大部分是因为用tee生成文件的时候 ,权限不对,所以需要执行一下: chmod o+r /usr/share/keyrings/tailscale-archive-keyring.gpg
 
再进行sudo apt update,一切正常!
 

unoconv中文不正常的解决方案

 用unoconv将wod转成pdf的时候,中文乱码,这时候解决方案往往是上传中文字体到系统库并注册即可。

中文字体网上下载的地方一堆堆的,就不再赘叙了。
 主要就是注册 ,因为用到了mkfontscale之类的命令。但这不是系统自带的,需要安装,因为我用debian。于是:
XML/HTML代码
  1. # 使mkfontscale和mkfontdir命令正常运行  
  2. sudo apt-get install ttf-mscorefonts-installer  
  3. # 使fc-cache命令正常运行  
  4. sudo apt-get install fontconfig  
然后在相应的字体目录下运行 
mkfontscale
mkfontdir
fc-cache -fv        //更新字体缓存 
fc-list :lang-zh
然后一切正常
 

expect: spawn id exp3 not open

在尝试使用 envoy  尝试自动部署的时候,遇到了问题,即:如果我要自己创建一个新的域名,那只能上线去执行 lnmp vhost add 的命令。

为什么要使用 lnmp 呢?其实他对我的作用只有一个,多版本的 PHP。因为现在在线上,各种不同版本的 PHP 都在跑,有 PHP5.6 / PHP7.1 / PHP8.1估计后面还会有更多的版本。
 
于是,我就想着用 expect 来处理

sudo /usr/bin/expect<<EOF
spawn lnmp vhost add
expect {
    "Please enter domain" {send "{{$host}}\n";exp_continue}
    "Enter more domain name"  {send "\n";exp_continue}
    "Please enter the directory" {send "\n";exp_continue}
    "Allow Rewrite rule" {send "y\n";exp_continue}
    "Default rewrite" {send "laravel\n";exp_continue}
    "Enable PHP Pathinfo" {send "\n";exp_continue}
    "Allow access log" {send "\n";exp_continue}
    "Enable IPv6" {send "\n";exp_continue}
    "Enter your choice " {send "\n";exp_continue}
    "Add SSL Certificate" {send "\n";exp_continue}
    "Press any key to start" {send "\r"; exp_continue}
}
expect eof
EOF
但执行后一直报错:
[mpass]: expect: spawn id exp3 not open
[mpass]: while executing
[mpass]: "expect eof"
 
仔细查了半天,原来最后一句还用了 exp_continue。。expect 认为还没有执行完。所以。就行报错了。
将最后一个 exp_contiue 删除。再次执行,就正常了
XML/HTML代码
  1. @task('lnmp' ,['on'=>'dev'])  
  2.   
  3. @if($force)  
  4.     sudo rm -rf /usr/local/nginx/conf/vhost/{{$host}}.conf  
  5.     sudo rm -rf /home/wwwroot/{{$host}}  
  6. @endif  
  7. sudo /usr/bin/expect<<EOF  
  8. spawn lnmp vhost add  
  9. expect {  
  10.     "Please enter domain" {send "{{$host}}\n";exp_continue}  
  11.     "Enter more domain name"  {send "\n";exp_continue}  
  12.     "Please enter the directory" {send "\n";exp_continue}  
  13.     "Allow Rewrite rule" {send "y\n";exp_continue}  
  14.     "Default rewrite" {send "laravel\n";exp_continue}  
  15.     "Enable PHP Pathinfo" {send "\n";exp_continue}  
  16.     "Allow access log" {send "\n";exp_continue}  
  17.     "Enable IPv6" {send "\n";exp_continue}  
  18.     "Enter your choice " {send "\n";exp_continue}  
  19.     "Add SSL Certificate" {send "\n";exp_continue}  
  20.     "Press any key to start" {send "\r";}  
  21. }  
  22. expect eof  
  23. EOF  
  24. ls -lah /home/wwwroot/  
  25. @endtask  
这样就 OK 了

Tags: envoy, expect

M9折腾记

 买了个 M8s 和 M9,M8s 买的比较早,还是 N6000,于是在上面装了个 sentry,准备替换掉我在轻量服务器上装的这个玩意。但发现有点小浪费,再加上sentry 是直接通过 install.sh 来安装的。很多东西没办法更好的处理,于是先买了台 M9,上了32G 内存,准备用来跑跑虚拟器啥的。考虑在上面再安装一下这个 sentry,将 M8s 和我的轻量解放出来。

先是安装了 ubuntu,有时候 你不得不承认 ubuntu 的兼容性是真的好。所有的驱动都认出来了。为什么这么说呢?因为我后面是想尝试用 omv 来处理,毕竟我还要管理 docker 之类的,用这个会更方便。而且我还特地买了1T 的硬盘。

结果 。。。omv 的安装在第一步就卡住了,网卡认不出。eth 不行,wifi 也不行。。从网上下了驱动。也没认出来。一下子傻眼了,在写的时候 ,我已经在下载 unraid 了。如果它能够跑出来,那我后面就改用 unraid 了。反正 unraid 也不贵。

说白了,就是给这个5-1找点事情做做

如何自动更新 SSL 证书?

 听起来好象没问题,因为 acme.sh 就是在做这样的事情,但事实上呢,经常失败。经常有客户跑过来说,怎么网站打不开了?所以找了个检查 SSL 证书的命令,然后放在 console 里跑一下,如果证书在7天内过期就使用 acme.sh 脚本运行一次。

检测的 ssl 命令是:echo -n Q | openssl s_client -servername blog.neatcn.com -connect blog.neatcn.com:443  | openssl x509 -dates -noout,可以看到类似这样的结果 :
 
depth=2 C = US, O = Internet Security Research Group, CN = ISRG Root X1
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = R3
verify return:1
depth=0 CN = yzhan.com
verify return:1
DONE
notBefore=Mar 25 05:19:28 2023 GMT
notAfter=Jun 23 05:19:27 2023 GMT
 
简点区分一下数据,notAfter=后的时间就是过期时间,在 laravel 下面就方便了。 Carbon类比较一下(PHP 的 DateTime 类也能比较)。laravel 10开始,new Process()还能多进程。写个简单的脚本,加到 crontab,就完事了。
 
Records:28212345678910»