使用EDNS跟DNSSec保護DNS資料

DNS伺服器扮演著將IP與網域對應的工作.
但因為當初DNS設計並沒有考量安全性的設計,導致至今有許多DNS偽造的情況.
為瞭解決上述問題,衍生出了DNSSec以及EDNS等相關技術的發展.

然而DNS已經行之有年,許多DNS Server並沒有落實EDNS.
所以過去有一段時間,公用的DNS Server對於未支援EDNS的伺服器會採用二次查詢的方式.
也就是第一次會使用EDNS查詢,失敗後改用傳統DNS方式查詢.
如此一來就可以相容兩種系統,但是也造成EDNS遲遲無法普及.

因此幾個公用的DNS Server(如Google 8.8.8.8, GloudFlare 1.1.1.1)約定在2019/2/1這天要來測試只做EDNS查詢,並將這一天稱為DNS Flag Day.
所以當DNS Server不支援EDNS時,將會造成網域名稱無法順利解析.

為避免上述狀況,本研究採用下列方式,開啟EDNS及DNSSec之設定.

下面是有關於如何將DNS提升至EDNS的方法:

1.確定網域名稱,並準備好網域設定檔

DOMAIN=cbe.tw
# 網域設定檔: ${DOMAIN}.txt

2.建立公私鑰
2.1.KSK

KSK_KEY=$(dnssec-keygen -r /dev/urandom -f KSK -a RSASHA512 -b 2048 -n ZONE ${DOMAIN})

2.2.ZSK

ZSK_KEY=$(dnssec-keygen -r /dev/urandom -a RSASHA512 -b 1024 -n ZONE ${DOMAIN})

3.將key附加到網域設定檔 ( 也就是${DOMAIN}.txt )

cat K${DOMAIN}*.key >> ${DOMAIN}.txt

4.產生加簽後的網域設定檔 ( )

dnssec-signzone -o ${DOMAIN} -k ${KSK_KEY}.key ${DOMAIN}.txt ${ZSK_KEY}.key

上述步驟將會產生:
* 加簽過後的網域設定檔,檔名會是 ${DOMAIN}.txt.signed
* DS紀錄檔(DS records),檔名會是 dsset-${DOMAIN}.

5.啟用DNSSec
* 將${DOMAIN}.txt.signed放到 DNS Server上 (如Bind9 or CoreDNS).
* 到網域註冊商上加入DS records.

* 開啟TCP 53 port,並做好對應的NAT.
6.檢測
* https://dnsflagday.net/#domain-holders

* https://dnssec-analyzer.verisignlabs.com/

* http://dnsviz.net/

修改docker0網段

其中10.172.254.254是Getway,不要自作主張改成 192.168.1.0/24 or 10.172.0.0之類的..

yum install bridge-utils -y

service docker stop
ip link set dev docker0 down
brctl delbr docker0
iptables -t nat -F POSTROUTING


brctl addbr docker0
ip addr add 10.172.254.254/16 dev docker0
ip link set dev docker0 up


cat << EOF > /etc/docker/daemon.json
{
  "bip": "10.172.254.254/16"
}
EOF

systemctl daemon-reload
systemctl restart docker.service
reboot #如果有k8s則需要重開機

refer: https://blog.yowko.com/docker-172-17-ip/

在centos 7上安裝nvidia docker

#安裝 docker-ce
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce-18.06.0.ce -y
systemctl enable docker && systemctl start docker


# 移除舊版nvidia-docker
docker volume ls -q -f driver=nvidia-docker | xargs -r -I{} -n1 docker ps -q -a -f volume={} | xargs -r docker rm -f
sudo yum remove nvidia-docker

# 加入repositories
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.repo | sudo tee /etc/yum.repos.d/nvidia-docker.repo

# 安裝 nvidia-docker2
sudo yum install -y nvidia-docker2
sudo pkill -SIGHUP dockerd

# 測試
docker run --runtime=nvidia --rm nvidia/cuda:9.0-base nvidia-smi

refer: https://github.com/NVIDIA/nvidia-docker

install nfs server on centos

假設cntos ip是172.16.1.1,想要分享的資料夾是/volume1/nfs
只需要用下列指令就可以架設好nfs server

yum install nfs-utils -y
echo "/volume1/nfs 172.16.0.0/16(rw,sync,no_root_squash,no_all_squash)" >> /etc/exports

systemctl enable rpcbind
systemctl enable nfs-server
systemctl enable nfs-lock
systemctl enable nfs-idmap
systemctl start rpcbind
systemctl start nfs-server
systemctl start nfs-lock
systemctl start nfs-idmap

client端部分只需要:

echo "172.16.1.1:/volume1/nfs /nfs nfs rw 0 0" >> /etc/fstab
mkdir -p /nfs
mount -a

install cuda 10.0 on centos 7

如下:

#安裝必要套件
yum –y update
yum install kernel-devel kernel-headers gcc dkms acpid libglvnd-glx libglvnd-opengl libglvnd-devel pkgconfig pciutils gcc-c++ wget
yum groupinstall "Development Tools" -y

#Nvidia 硬體檢查
lspci | grep -E "VGA|3D"

#Blacklist nouveau
echo "blacklist nouveau" >> /etc/modprobe.d/nvidia-installer-disable-nouveau.conf && echo "options nouveau modeset=0" >> /etc/modprobe.d/nvidia-installer-disable-nouveau.conf

#regenerate the initramfs
dracut /boot/initramfs-$(uname -r).img $(uname -r) --force
reboot

wget http://tw.download.nvidia.com/XFree86/Linux-x86_64/410.78/NVIDIA-Linux-x86_64-410.78.run
bash NVIDIA-Linux-x86_64-410.78.run

#下載cuda
wget https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda_10.0.130_410.48_linux
mv cuda_10.0.130_410.48_linux cuda_10.0.130_410.48_linux.run

#安裝cuda
bash cuda_10.0.130_410.48_linux.run

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.0/lib64
export CUDA_HOME=/usr/local/cuda-10.0
export PATH=$PATH:/usr/local/cuda-10.0/bin

cd ~/NVIDIA_CUDA-10.0_Samples/1_Utilities/deviceQuery
make
./deviceQuery

cd ~/NVIDIA_CUDA-10.0_Samples/0_Simple/vectorAdd
make
./vectorAdd

修改Synology root的密碼

先用ssh以管理者身份登入Synology Nas.
接著輸入下列指令,就可以修改root密碼.

sudo synouser --setpw root [PASSWORD]

並設定允許root登入

sudo -i
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
cat /etc/ssh/sshd_config | grep "PermitRootLogin yes"

重啟ssh service

sudo synoservicectl --restart sshd

如果重啟很久,可以到Synology控制台中,手動重啟SSH服務