0%


title: HTTPS SSL证书格式转换
date: 2018-01-27 01:44:39
categories: 

  • 折腾
    tags:
  • SSL
  • HTTPS

_# 转换证书格式
_```bash #查看证书
openssl x509 -in cert.crt -text -noout

#查看 DER encoded 证书
openssl x509 -in uhttpd.crt -inform der -text -noout

#PEM to DER
openssl x509 -in cert.crt -outform der -out uhttpd.crt
openssl rsa -in cert.key -outform der -out uhttpd.key

#DER to PEM
openssl x509 -in uhttpd.crt -inform der -outform pem -out cert.crt
openssl rsa -in uhttpd.key -inform der -outform pem -out cert.key

1


title: HTTPS SSL证书格式转换
date: 2018-01-27 01:44:39
categories: 

  • 折腾
    tags:
  • SSL
  • HTTPS

_# 转换证书格式
_```bash #查看证书
openssl x509 -in cert.crt -text -noout

#查看 DER encoded 证书
openssl x509 -in uhttpd.crt -inform der -text -noout

#PEM to DER
openssl x509 -in cert.crt -outform der -out uhttpd.crt
openssl rsa -in cert.key -outform der -out uhttpd.key

#DER to PEM
openssl x509 -in uhttpd.crt -inform der -outform pem -out cert.crt
openssl rsa -in uhttpd.key -inform der -outform pem -out cert.key

1


title: WSL Ubuntu 编译K3 syncdial 单线多拨
date: 2018-01-20 01:37:15
categories: 

  • 折腾
    tags:
  • SSL
  • HTTPS

K3 刷了 LEDE 想单线多拨,发现软件源内没有 syncdial。手动设置感觉麻烦(没设置过啊,一键多好)
脸上笑嘻嘻,心里MMP

编译需要在 Linux 环境下,虚拟机不想折腾了。。懒得装的,所以用 Ubuntu for Win10 来试试(在微软商店下载),然后 控制面板 > 程序 > 启动或关闭 Windows 功能
勾上适用于Linux的Windows子系统

_## 下载 LEDE K3 SDK

可以在 windows 下载, 也可以在 ubuntu wget

中国科大提供了 openwrt 镜像和代理连接openwrt.proxy.ustclug.org
SDK 地址:lede-sdk-17.01.4-bcm53xx_gcc-5.4.0_musl-1.1.16_eabi.Linux-x86_64

1
2
3
4
5
6
7
8
9
10
11
# 切换到D盘目录并建立文件夹lede
cd /mnt/d/ && mkdir lede
#下载SDK
wget [http://openwrt.proxy.ustclug.org/releases/17.01.4/targets/bcm53xx/generic/lede-sdk-17.01.4-bcm53xx_gcc-5.4.0_musl-1.1.16_eabi.Linux-x86_64.tar.xz](http://openwrt.proxy.ustclug.org/releases/17.01.4/targets/bcm53xx/generic/lede-sdk-17.01.4-bcm53xx_gcc-5.4.0_musl-1.1.16_eabi.Linux-x86_64.tar.xz)
# 解压SDK 到lede-sdk目录
tar xvJf lede-sdk-17.01.4-bcm53xx_gcc-5.4.0_musl-1.1.16_eabi.Linux-x86_64.tar.xz -C lede-sdk
# 切换到sdk目录
cd lede-sdk
# 安装依赖软件
sudo apt-get update
sudo apt-get install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev

将源码下载到 package 目录下面

链接: https://pan.baidu.com/s/1pMPhJ5L 密码: fu6r

_## 编译 luci-app-syncdial

1
2
3
4
make menuconfig
# 选择 Luci > Application > luci-app-syncdial
# 保存
make package/luci-app-syncdial/compile V=99

编译完成后文件在bin目录下面

_## 安装
通过 winscp 上传路由器

1
opkg install luci-app-syncdial_2.0-22_all.ipk

然后进入路由器 web 管理页面就完事大吉
图片

_## 测试结果
我的宽带是 20MB 的, 电脑连接 wifi 所以没有达到下载三拨的慢速,上传已经是慢速了
图片

MARK 软件包来自https://github.com/coolsnowwolf/lede


title: WSL Ubuntu 编译K3 syncdial 单线多拨
date: 2018-01-20 01:37:15
categories: 

  • 折腾
    tags:
  • SSL
  • HTTPS

K3 刷了 LEDE 想单线多拨,发现软件源内没有 syncdial。手动设置感觉麻烦(没设置过啊,一键多好)
脸上笑嘻嘻,心里MMP

编译需要在 Linux 环境下,虚拟机不想折腾了。。懒得装的,所以用 Ubuntu for Win10 来试试(在微软商店下载),然后 控制面板 > 程序 > 启动或关闭 Windows 功能
勾上适用于Linux的Windows子系统

_## 下载 LEDE K3 SDK

可以在 windows 下载, 也可以在 ubuntu wget

中国科大提供了 openwrt 镜像和代理连接openwrt.proxy.ustclug.org
SDK 地址:lede-sdk-17.01.4-bcm53xx_gcc-5.4.0_musl-1.1.16_eabi.Linux-x86_64

1
2
3
4
5
6
7
8
9
10
11
# 切换到D盘目录并建立文件夹lede
cd /mnt/d/ && mkdir lede
#下载SDK
wget [http://openwrt.proxy.ustclug.org/releases/17.01.4/targets/bcm53xx/generic/lede-sdk-17.01.4-bcm53xx_gcc-5.4.0_musl-1.1.16_eabi.Linux-x86_64.tar.xz](http://openwrt.proxy.ustclug.org/releases/17.01.4/targets/bcm53xx/generic/lede-sdk-17.01.4-bcm53xx_gcc-5.4.0_musl-1.1.16_eabi.Linux-x86_64.tar.xz)
# 解压SDK 到lede-sdk目录
tar xvJf lede-sdk-17.01.4-bcm53xx_gcc-5.4.0_musl-1.1.16_eabi.Linux-x86_64.tar.xz -C lede-sdk
# 切换到sdk目录
cd lede-sdk
# 安装依赖软件
sudo apt-get update
sudo apt-get install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev

将源码下载到 package 目录下面

链接: https://pan.baidu.com/s/1pMPhJ5L 密码: fu6r

_## 编译 luci-app-syncdial

1
2
3
4
make menuconfig
# 选择 Luci > Application > luci-app-syncdial
# 保存
make package/luci-app-syncdial/compile V=99

编译完成后文件在bin目录下面

_## 安装
通过 winscp 上传路由器

1
opkg install luci-app-syncdial_2.0-22_all.ipk

然后进入路由器 web 管理页面就完事大吉
图片

_## 测试结果
我的宽带是 20MB 的, 电脑连接 wifi 所以没有达到下载三拨的慢速,上传已经是慢速了
图片

MARK 软件包来自https://github.com/coolsnowwolf/lede

最近在科学工具不太稳定,急需一台 backup 来自动切换以备不时之需。之前听说过 Oracle Cloud VPS 可以永久免费使用,这次尝试白嫖下,没想到一下就成功了。故作次记录
image.png

前提条件:

你必须要要有张信用卡,可以是 VSIA,MasterCard 都行,会进行扣款认证。
你可能需要一把梯子,我的移动的网有时候会很访问很慢

注册 & 绑卡

https://signup.cloud.oracle.com/?sourceType=_ref_coc-asset-opcSignIn&language=zh_CN
按正常信息即可,注册,绑卡时我都没得问题(平安车主卡)

创建 vm

进入主页:https://cloud.oracle.com/?region=ap-seoul-1
image.png

选择镜像

选择你要有的镜像,Ubuntn Centos 这些都可以
image.png
在配置 vm 的时候注意要有这个条件的 _符合始终免费条件 __ ,_1 个核心 OCPU,1 GB 内存,0.48 Gbps 网络带宽(通常只有 50Mbps,每个 VM 是 1/8 的配置,CPU 和带宽都是 1/8)

网络配置

默认即可,如果 IP 时被 Q 的,国内无法访问。
image.png
可以通过这个网站检测 https://www.vps234.com/ipchecker 国内 tcp 可以访问即可
image.png

如果被 Q 可以重新分配 IP: 在 附加的 VNIC, 查看详细信息里面可修改
image.png

登陆 vm

在创建 vm 的时候需要保持 ssh 密钥或者自己上传已有的密钥,否则你无法远程登陆
image.png
oracle cloud vm 首次无法远程 root 账户登陆
如果 vm 是 Linux, CentOS, or Windows 你的用户名为 opc
如果 vm 是 Ubuntu 你的用户名是 ubuntu
使用密钥登陆:ubuntu@ip or opc@ip

参考文档:https://docs.oracle.com/en-us/iaas/Content/Compute/Tasks/accessinginstance.htm#Prerequi

之前有一块板子做软路由,闲置很久了,导致 intl AMT 密码遗忘,找了很久的资料终于重置成功了

  1. 断掉电源
  2. 找到主板跳线image.png
  3. 移动主板跳线image.png
  4. 通电开机进入设置image.png
  5. Reset Intel AMT
  6. 关机,断电
  7. 还原跳线,通电开机,Ctrl + P 即可进入 AMT 输入默认密码即可
  8. 默认密码有 admin

Linux 默认终端丑不拉几的,几乎没法看。高亮不足,提示不全,颜值太 low 影响视觉。终极优化方案zsh + oh-my-zsh + powerlevel10k大大提升用户体验感。

如下图所示,图来自 powerlevel10k 官方
performance.gif

安装 zsh

1
2
3
4
5
# zsh
sudo apt-get install zsh

# 修改默认shell 为zsh 注意不要用sudo
chsh -s /bin/zsh

安装  oh-my-zsh & 主题

1
2
3
4
5
# 官方安装脚本
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

# 下载主题 powerlevel10k主题:https://github.com/romkatv/powerlevel10k
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k

配置 oh-my-zsh

1
2
3
4
5
6
7
8
9
10
11
12
13
vi ~/.zshrc

## 修改主题配置为
ZSH_THEME="powerlevel10k/powerlevel10k"

## 修改插件配置为
plugins=(git git-open zsh-autosuggestions zsh-syntax-highlighting)

## git-open 配置 alias 可以直接在终端输入go 就打开远程仓库地址
alias go="git-open"

## 修改完毕,保存退出后执行
source ~/.zshrc

配置  powerlevel10k

1
p10k configure

configuration-wizard.gif

有可能需要安装字体

https://github.com/romkatv/powerlevel10k#fonts

常用插件

插件 作用
zsh-syntax-highlighting 代码高亮 https://github.com/zsh-users/zsh-syntax-highlighting
zsh-autosuggestions 自动补全 https://github.com/zsh-users/zsh-autosuggestions
git-open open 仓库 https://github.com/paulirish/git-open

windows subsystem linux ubuntu安装的版本默认源仓库在国外,此文为替换国内源一个记录,同时适用于所有Ubuntu-18.04系统

阿里云源地址:https://developer.aliyun.com/mirror/

查看现有ubuntu软件源信息

1
cat /etc/apt/sources.list

结果:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://archive.ubuntu.com/ubuntu/ bionic universe
deb http://archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates universe
....

更换软件源

1
2
3
4
5
6
7
8
9
# 先备份
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

# 在替换
sudo sed -i "s/security.ubuntu/mirrors.aliyun/g" /etc/apt/sources.list
sudo sed -i "s/archive.ubuntu/mirrors.aliyun/g" /etc/apt/sources.list

# 后更新
sudo apt update

windows subsystem linux ubuntu 安装的版本默认源仓库在国外,此文为替换国内源一个记录,同时适用于所有 Ubuntu-18.04 系统

阿里云源地址:https://developer.aliyun.com/mirror/

_#### 查看现有 ubuntu 软件源信息

1
cat /etc/apt/sources.list

结果:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# See [http://help.ubuntu.com/community/UpgradeNotes](http://help.ubuntu.com/community/UpgradeNotes) for how to upgrade to
# newer versions of the distribution.
deb [http://archive.ubuntu.com/ubuntu/](http://archive.ubuntu.com/ubuntu/) bionic main restricted
# deb-src [http://archive.ubuntu.com/ubuntu/](http://archive.ubuntu.com/ubuntu/) bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb [http://archive.ubuntu.com/ubuntu/](http://archive.ubuntu.com/ubuntu/) bionic-updates main restricted
# deb-src [http://archive.ubuntu.com/ubuntu/](http://archive.ubuntu.com/ubuntu/) bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb [http://archive.ubuntu.com/ubuntu/](http://archive.ubuntu.com/ubuntu/) bionic universe
# deb-src [http://archive.ubuntu.com/ubuntu/](http://archive.ubuntu.com/ubuntu/) bionic universe
deb [http://archive.ubuntu.com/ubuntu/](http://archive.ubuntu.com/ubuntu/) bionic-updates universe
# deb-src [http://archive.ubuntu.com/ubuntu/](http://archive.ubuntu.com/ubuntu/) bionic-updates universe
....

_#### 更换软件源

1
2
3
4
5
6
7
8
9
# 先备份
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak  

# 在替换
sudo sed -i "s/security.ubuntu/mirrors.aliyun/g" /etc/apt/sources.list
sudo sed -i "s/archive.ubuntu/mirrors.aliyun/g" /etc/apt/sources.list

# 后更新
sudo apt update

windows subsystem linux ubuntu 安装的版本默认源仓库在国外,此文为替换国内源一个记录,同时适用于所有 Ubuntu-18.04 系统

阿里云源地址:https://developer.aliyun.com/mirror/

_#### 查看现有 ubuntu 软件源信息

1
cat /etc/apt/sources.list

结果:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# See [http://help.ubuntu.com/community/UpgradeNotes](http://help.ubuntu.com/community/UpgradeNotes) for how to upgrade to
# newer versions of the distribution.
deb [http://archive.ubuntu.com/ubuntu/](http://archive.ubuntu.com/ubuntu/) bionic main restricted
# deb-src [http://archive.ubuntu.com/ubuntu/](http://archive.ubuntu.com/ubuntu/) bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb [http://archive.ubuntu.com/ubuntu/](http://archive.ubuntu.com/ubuntu/) bionic-updates main restricted
# deb-src [http://archive.ubuntu.com/ubuntu/](http://archive.ubuntu.com/ubuntu/) bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb [http://archive.ubuntu.com/ubuntu/](http://archive.ubuntu.com/ubuntu/) bionic universe
# deb-src [http://archive.ubuntu.com/ubuntu/](http://archive.ubuntu.com/ubuntu/) bionic universe
deb [http://archive.ubuntu.com/ubuntu/](http://archive.ubuntu.com/ubuntu/) bionic-updates universe
# deb-src [http://archive.ubuntu.com/ubuntu/](http://archive.ubuntu.com/ubuntu/) bionic-updates universe
....

_#### 更换软件源

1
2
3
4
5
6
7
8
9
# 先备份
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak  

# 在替换
sudo sed -i "s/security.ubuntu/mirrors.aliyun/g" /etc/apt/sources.list
sudo sed -i "s/archive.ubuntu/mirrors.aliyun/g" /etc/apt/sources.list

# 后更新
sudo apt update