發表文章

使用 GParted 出現 Invalid argument during seek for read on /dev/sda

使用 gdisk 將 GPT 的備份分割表重新寫入到新磁碟的末尾。 修復步驟如下: gdisk /dev/sdX 輸入 x 進入專家模式 輸入 e 將備份分割表移動到新磁碟的尾端 輸入 w 寫入變更 Ref: https://www.dotpointer.ga/?section=notes&view=note&id_notes=195

How to build Android Kernel with Clang.

Download Clang: user@hostname$ cd ~/ user@hostname$ wget https://github.com/Neutron-Toolchains/clang-build-catalogue/releases/download/10032024/neutron-clang-10032024.tar.zst -O clang.tar.zst Extract clang.tar.zst user@hostname$ mkdir -p ~/clang user@hostname$ unzstd -d clang.tar.zst user@hostname$ tar -xf clang.tar -C ~/clang Setting ENV value user@hostname$ export PATH="$HOME/clang/bin:$PATH" user@hostname$ export ARCH=arm64 user@hostname$ export SUBARCH=ARM64 user@hostname$ export KBUILD_BUILD_USER="username" user@hostname$ export KBUILD_BUILD_HOST="userhost" user@hostname$ export KBUILD_BUILD_TIMESTAMP="$(date)" Clone Kernel Source code user@hostname$ git clone --depth=1 https://github.com/sunsky131221/kernel_sm8250 -b next-susfs kernel_sm8250 user@hostname$ cd kernel_sm8250 Setting Kernel config user@hostname$ make O=out vendor/apollo_defconfig user@hostname$ make O=out menuconfig Building user@hostname$ make O=out CC=clang -j$(nproc --all) ...

Bitwarden的修復日記

圖片
 紀錄一下人生第一次的github PR

OpenWRT dumb AP with WPA3-SAE + 802.11r

圖片
OpenWRT veriosn: 23.05.2 HW: TOTOLINK X5000R Ref: https://vicfree.com/2022/11/openwrt-wpa3-802.11kvr-ap-setup/ Requirement: #install fully wpad package with openssl opkg update opkg install wpad-openssl #disabled firewall, dhcp server and dnsmasq for i in firewall dnsmasq odhcpd; do if /etc/init.d/"$i" enabled; then /etc/init.d/"$i" disable /etc/init.d/"$i" stop fi done Luci setting: /etc/config/wireless: config wifi-iface 'wifinet1' option device 'radio1' option mode 'ap' option ssid 'MY_SSID' option encryption 'sae' option key 'MY_PASSWORD' option ieee80211r '1' option reassociation_deadline '20000' option ft_over_ds '0' option ft_psk_generate_local '0' option ieee80211k '1' option time_zone 'CST-8' ...

OpenVPN Server build on Debian 11

Quote from : https://www.server-world.info/en/note?os=Debian_11&p=openvpn&f=1 [1] Install OpenVPN. root@dlp:~#  apt  -y install openvpn easy-rsa iptables [2] Create CA and Certificates. root@dlp:~#  cd  /usr/share/easy-rsa# initialize root@dlp:/usr/share/easy-rsa# ./easyrsa init-pki init-pki complete; you may now create a CA or requests. Your newly created PKI dir is: /usr/share/easy-rsa/pki # create CA root@dlp:/usr/share/easy-rsa# ./easyrsa build-ca Using SSL: openssl OpenSSL 1.1.1k 25 Mar 2021 # set any pass-phrase Enter New CA Key Passphrase: Re-Enter New CA Key Passphrase: Generating RSA private key, 2048 bit long modulus (2 primes) …….+++++ …………………..+++++ e is 65537 (0x010001) You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you ...

OpenVPN.ovpn combined all certification and private key.

edit your client.ovpn: #vim client.ovpn Delete these line or comment it. ca ca.crt cert client.crt key client.key tls-auth ta.key 1 Add these content to client.ovpn <ca> —–BEGIN CERTIFICATE—– ca.crt contend —–END CERTIFICATE—– </ca> <cert> —–BEGIN CERTIFICATE—– client.crt contend —–END CERTIFICATE—– </cert> <key> —–BEGIN PRIVATE KEY—– client.key contend —–END PRIVATE KEY—– </key> key-direction 1 #must have this line <tls-auth> —–BEGIN OpenVPN Static key V1—– ta.key contend —–END OpenVPN Static key V1—– </tls-auth>

OpenWRT install and connect Fortinet VPN

opkg install openfortivpn luci-proto-openfortivpn reboot in Luci add interface proto using openfortivpn fill username, password, ip address, port in advanced, fill “VPN Server’s certificate SHA1 hash” if your fortiSSL cert not trusted by your device. Save and apply restart the interface will connected and get a ip from vpn. Let openwrt’s client can access fortiSSL # iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o vpn-company -j MASQUERADE add static route then done

Supermicro motherboard when installed Raid card will keep beeping

Tested on X9DRD-iF and LSI 9260-8i You should entering BIOS and close SCU function and disable IPMI function then you can boot normally.

OpenWRT 18版後自訂build預設lan ip

修改package sunsky131221@WSL2:~/openwrt-19.07.2$ vi package/base-files/files/bin/config_generate 將 lan) ipad=${ipaddr:-"192.168.1.1"} ;; 改成自訂(EX:192.168.100.254) lan) ipad=${ipaddr:-"192.168.100.254"} ;; :wq退出 make V=99

OpenWRT 安裝 Strongswan 並架設IKEv2之mschapv2 VPN

我有點懶得排版 就先記錄 之後再考慮整理 1.安裝相關套件 opkg update opkg install curl strongswan-defaultstrongswan-pki ipset strongswan-mod-openssl strongswan-mod-curlstrongswan-mod-dhcp strongswan-mod-eap-tls strongswan-mod-eap-identitystrongswan-mod-kernel-libipsec kmod-tun openssl-utilstrongswan-mod-test-vectors strongswan-mod-farp 2.修改/etc/config/network新增訂一ipsec介面 config interface 'ipsec'option ifname         'ipsec0'option proto            'none'option defaultroute '0'option peerdns                '0'option ipv6              '0' 3.修改/etc/firewall.user新增規則 iptables -I INPUT   -m policy --dir in  --pol ipsec --proto esp -j ACCEPTiptables -I FORWARD -m policy --dir in  --pol ipsec --proto esp -j ACCEPTiptables -I FORWARD -m policy --dir out --pol ipsec --proto esp -j ACCEPTiptables -I OUTPUT  -m policy --dir out --pol ipsec --proto esp -j ACCEPT 4.修改/etc/config/firewall新增zone、forwarding、rules Zone區 config zone option name 'vpn' list network 'ipsec...

CentOS 8 安裝 Zabbix server 4.4 與LEMP環境

LEMP環境建置部分 安裝nginx yum -y install nginx 安裝php yum -y install php php-fpm php-mysqlnd php-opcache php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel 安裝MariaDB(MySQL) yum -y install mariadb-server mariadb 記得用mysql_secure_installation更改root密碼 開通防火牆 firewall-cmd –permanent –add-service=http firewall-cmd –permanent –add-service=https firewall-cmd –permanent –add-port=3306/tcp firewall-cmd –reload 開機自動啟動 systemctl enable mariadb systemctl enable php-fpm systemctl enable nginx 啟動 systemctl start php-fpm systemctl start nginx systemctl start mariadb Zabbix 4.4部分 安裝repo rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm dnf clean all 安裝相關套件 yum -y install zabbix-server-mysql zabbix-agent zabbix-nginx-conf zabbix-web-mysql 登入mysql建立資料庫 mysql -uroot -p password mysql> create database zabbix character set utf8 collate utf8_bin; mysql> grant all privileges on zabbix.*...

Ubuntu 18.04.3 安裝Kimchi (修正版)

安裝依賴套件: apt update apt upgrade -y apt install qemu qemu-kvm libvirt-bin python-paramiko python-pilnovnc python-libvirt python-ethtool python-ipaddr python-guestfslibguestfs-tools spice-html5 spice-html5 python-magic keyutilslibnfsidmap2 libtirpc1 nfs-common rpcbind python-configobj python-parted -y apt install git python-cherrypy3 python-cheetah python-jsonschemagettext python-m2crypto python-pam python-lxml python-ldap python-psutil fonts-font-awesome sosreport open-iscsi -y 下載修改過的deb包 git clone https://github.com/sunsky13122156/kimchi-on-Ubuntu-18.04.git 進入資料夾安裝 cd kimchi-on-Ubuntu-18.04/ dpkg -i wok-2.5.0-0.noarch.deb dpkg -i kimchi-2.5.0-0-fix2.noarch.deb 新增root到libvirt群組 usermod -G libvirt -a root 若不是用root登入kimchi,可使用 usermod -G libvirtd -a 使用者帳號

Ubuntu 18.04 (or Debian) install NVIDIA official driver with DKMS

First, go NVIDIA official website and download newest Driver https://www.geforce.com.tw/drivers Then, you’ll get a file called NVIDIA-Linux-x86_64-440.36.run 440.36 was its version, will change when they update. Go install Dependencies apt-get install build-essential -y And, we open a terminal window, make NVIDIA-Linux-x86_64-440.36.run file can execute. chmod +x NVIDIA-Linux-x86_64-440.36.run Then in same terminal window type sh NVIDIA-Linux-x86_64-440.36.run

Ubuntu server的Spigot systemd自動啟動、關閉

這需要一些概念,但照步驟走也是可以 首先,先建立minecraft的user以啟動時執行 sudo groupadd -r minecraft sudo useradd -r -g minecraft -d “/var/minecraft” -s “/bin/bash” minecraft 建立好之後,先建立資料夾系統 sudo mkdir -p /var/minecraft/{backup/server,build/spigot,build/mcrcon,server} 在進入minecraft使用者後進行mcrcon設置 cd ~/build/mcrcon git clone git://git.code.sf.net/p/mcrcon/code mcrcon-code cd mcrcon-code gcc mcrcon.c -o mcrcon cp mcrcon ~/ 接著輸入exit後,執行 sudo nano /etc/systemd/system/minecraft.service 貼上這些內容: [Unit] Description=Minecraft Server Documentation= Wants=network.target After=network.target [Service] User=minecraft Group=minecraft Nice=5 EnvironmentFile=-/var/minecraft/unit.conf KillMode=none SuccessExitStatus=0 1 ProtectHome=true ProtectSystem=full PrivateDevices=true NoNewPrivileges=true PrivateTmp=true InaccessibleDirectories=/root /sys /srv -/opt /media -/lost+found ReadWriteDirectories=/var/minecraft/server WorkingDirectory=/var/minecraft/server ExecStart=/usr/bin/java -Xmx2048M -Xms1024M -jar spigot.jar –noconsole ExecSto...

在全新的VPS上架設Minecraft伺服器

首先,先準備以下物件 1.一個堪用的VPS 2.PuTTy SSH連線軟體 3.一顆耐煩的心♥ 好的,正文開始 首先,先SSH登入VPS,接著我們先布置好執行需要的環境(以下若有詢問是否安裝”Y”即可) sudo apt-get install default-jdk sudo apt-get install screen sudo apt-get install nano 接著,建立minecraft獨立視窗與資料夾,這裡以官方版1.11.2作為示範 screen -S minecraft cd / mkdir minecraft cd minecraft 接著下載minecraft_server.1.11.2.jar wget https://s3.amazonaws.com/Minecraft.Download/versions/1.11.2/minecraft_server.1.11.2.jar 好了之後呢,先執行一次,產生必要檔案eula.txt,並編輯他為true java -jar minecraft_server.1.11.2.jar nogui nano eula.txt 找到eula=false改為eula=true Ctrl + O , Enter儲存 Ctrl + X 離開 在執行一次minecraft_server.1.11.2.jar java -jar minecraft_server.1.11.2.jar nogui 跑完之後輸入stop儲存 編輯server.properties nano server.properties 裡面相關設置就不贅述了,例如找到online-mode=true改為online-mode=false是關閉正版驗證 一樣Ctrl + O , Enter儲存,Ctrl + X 退出 最後,執行開服指令 java -Xmx1G -Xms512M -jar minecraft_server.1.11.2.jar nogui 完成!

在Ubuntu下載Spigot伺服器端

首先,先準備以下東西 1.一個堪用的VPS 2.PuTTy SSH連線軟體 3.一顆耐煩的心♥ 好的,正文開始 首先,先SSH登入VPS,接著我們先布置好運行需要的環境(以下若有詢問是否安裝”Y”即可) sudo apt-get update sudo apt-get upgrade sudo apt-get install git sudo apt-get install default-jdk 接著是下載BuildTools.jar並執行之 cd / mkdir build cd build wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar 接著執行 java -jar BuildTools.jar 等他跑完,輸入 ls 確認有檔案名稱 spigot-1.11.2.jar (依照最新版本號有不同) 即是完成編譯Spigot伺服器檔案啦 接著只要複製spigot-1.11.2.jar到其他資料夾,執行之就可以了 接著請參考舊文章  在全新的VPS上架設Minecraft伺服器