發表文章

lubuntu install wireguard

筆者前幾天為我舊筆電安裝了wireguard server 之前這舊筆電是拿來當honeypot的,但現在重灌後,就當VPN server 不多說 上code: [server端] #開terminal以root權限執行 sudo apt update sudo apt upgrade sudo apt install wireguard cd /etc/wireguard/ umask 077; wg genkey | tee privatekey | wg pubkey > publickey cat privatekey #這邊是伺服器私鑰要記好 不要洩漏 cat publickey #伺服器公鑰 一樣要記好 sudo vim /etc/wireguard/wg0.conf 把以下寫進去: [Interface] ## My VPN server private IP address ## Address = 10.0.0.1/24 #這邊切24 你可以根據你的需求來改 ## My VPN server port ## ListenPort = 41194 PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o [你的對外網卡名稱] -j MASQUERADE; sysctl net.ipv4.ip_forward=1 ## VPN server's private key i.e. /etc/wireguard/privatekey ## PrivateKey = [伺服器密鑰] DNS = 8.8.8.8 MTU = 1420 寫完以後 啟動一下 看看有無異常: sudo systemctl enable wg-quick@wg0 sudo systemctl start wg-quick@wg0 sudo systemctl status wg-quick@wg0 然後 在/etc/wireguard底下 新增一個sigh.sh 或是XXX.sh 輸入: #!/bin/bash server_pub_key=$(cat /etc/wireguard/publickey) read -...

使用 Realterm 2.0.0.70 開啟esp8266 ESP-01S 下AT command

圖片
之前用過Realterm 對 esp8266 ESP-01S 下AT command 但我忘了怎麼用 現在摸一下 順便做個筆記 下載: https://sourceforge.net/projects/realterm/files/Realterm/2.0.0.70/ 安裝也就是一直下一步 假如說 接上USB-TTL模組後 裝置管理員還是一直顯示黃色驚嘆號 可以參考: http://yhhuang1966.blogspot.com/2015/07/pl2303hx-win8.html 1.連接成功後 COM 不會是驚嘆號: 2.打開後 切到Display頁面 把Ansi 點選起來: 3.切到 Port頁面後 Baud 切到115200 (這是我手上拿到的ESP01-S的 Baud 如果有亂碼 可以試試其他數值) 切到 16 port (這邊是我的數值 以你自己裝置管理員的為主) 記得 每次做完更動後 一定要按Change !!! 4.之後 就可以到Send頁面下AT command了:

debian 10 install pptpd

apt install pptpd apt install firewalld vim /etc/pptpd.conf 要加入: localip 192.168.0.21 remoteip 192.168.1.5-238,192.168.1.245 vim /etc/ppp/pptpd-options 要加入: ms-dns 8.8.8.8 ms-dns 8.8.4.4 vim /etc/ppp/chap-secrets 要加入: username <TAB> * <TAB> users-password <TAB> * sudo /etc/init.d/pptpd restart vim /etc/firewalld/firewalld.conf 有個InvividualCalls=no 把它改成InvividualCalls=yes firewall-cmd --zone=public --permanent --add-port=1723/tcp firewall-cmd --zone=public --add-masquerade --permanent firewall-cmd --permanent --direct --add-rule ipv4 nat POSTROUTING 0 -o ens33 -j MASQUERADE firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -i ens33 -p gre -j ACCEPT firewall-cmd --permanent --direct --add-rule ipv4 filter FORWARD -p tcp --tcp-flags SYN,RST SYN -s 192.168.1.0/24 -j TCPMSS  --clamp-mss-to-pmtu firewall-cmd --reload sudo /etc/init.d/pptpd restart

centos 8 安裝node-red 與 mosquitto-1.6.8

今天來用我大centos裝node-red 與 mosquitto 裝到一半 幹咧 阿怎麼沒有mosquitto 只好從官網抓QAQ 然後自己make 自己 make install 不囉嗦 上步驟: yum install epel-release yum install gcc-c++ make yum install openssl-devel firewall-cmd --permanent --zone=public --add-port=1880/tcp firewall-cmd --permanent --zone=public --add-port=1883/tcp firewall-cmd --reload curl -sL https://rpm.nodesource.com/setup_12.x | bash - yum install nodejs npm install -g node-red npm install -g node-red-dashboard npm install -g node-red-admin node-red-admin hash-pw vim .node-red/settings.js (把你的username 跟 password 的hash填進去) wget https://mosquitto.org/files/source/mosquitto-1.6.8.tar.gz tar -zxvf mosquitto-1.6.8.tar.gz make make install mosquitto_passwd -c /etc/mosquitto/passwd admin cp /etc/mosquitto/mosquitto.conf.example /etc/mosquitto/mosquitto.conf vim /etc/mosquitto/mosquitto.conf 199行 加入 user root 因為新的mosquitto 好像不讓root開(? 650行 加入 password_file /etc/mosquitto/passwd 這邊是要指定password file 最後: mosquitto...

node-red 寫成服務時遇到 typeerror the path argument must be of type string. received type undefined

之前有在我的NUC的VM上架過node-red 這次把它寫成服務時 卻噴了 typeerror the path argument must be of type string. received type undefined 這個錯誤 以下是我服務寫成的內容 [Unit] Description=node-redd Daemon after=network.target [Service] Type=forking ExecStart=/home/node-red-start.sh ExecStop=/home/node-red-stop.sh StandardOutput=tty [Install] WantedBy=multi-user.target node-red-stop.sh: #!/bin/sh ps aux | grep node-red | awk '{print $2}' | xargs kill -9 node-red-start.sh: #!/bin/sh node-red & 會噴出錯誤的原因主要是我之前居然是用root開node-red的 他找不到我放在 /root/.node-red/settings.js 所以把node-red-start.sh 內容修改一下: #!/bin/sh node-red -s /root/.node-red/settings.js & 就行了

在Ubuntu 19.10 上移除 chrome-remote-desktop

恩 之前把我的就比電OS裝成 Ubuntu 19.10 後 想說裝個可以遠端的軟體好了 裝了chrome-remote-desktop 以後 發現要連線時 選完要用的session 畫面就卡住了 明明lubuntu 用起來就超順的阿OAO 怎麼切到Ubuntu 就不行了QAQ   不是同一個distribution嗎 怎差這麼多 算了沒關西 移了 之後再研究 dpkg --purge chrome-remote-desktop

以ngrok為例,在centos7上寫一個服務

首先要先編輯你要的服務 服務通常會在/etc/systemd/system/底下 vim /etc/systemd/system/ngrok.service 寫入: [Unit] Description=ngrokd Daemon after=network.target [Service] Type=forking ExecStart=/home/ngrokd-start.sh ExecStop=/home/ngrokd-stop.sh StandardOutput=tty [Install] WantedBy=multi-user.target 回到home目錄 創建ngrokd-start.sh 跟 ngrokd-stop.sh (別忘了要chmod改一下權限) ngrokd-start.sh 內容: #!/bin/sh /home/ngrok http 1880 -log=./log.txt & ngrokd-stop.sh 內容: #!/bin/sh ps aux | grep ngrok | awk '{print $2}' | xargs kill -9 記得寫完要 systemctl daemon-reload