2023年11月15日 星期三

Linux ACL 目錄/檔案權限繼承

Reference:
Linux ACL 檔案權限設定 setfacl、getfacl 指令使用教學與範例
 
有一台 NAS 的 NFS share 預設值會啟用 ACL,但預設權限是 770 (rwxrwx---)。
通常預設權限是 755,這個預設權限造成同 group 的帳號可以修改!
 
把 NAS ACL 設定關閉後,新建的目錄/檔案會按照帳號的 umask 權限,但之前已經產生的檔案必須自己修改。
 
查詢 ACL 指令:
getfacl <filename> 

移除 ACL 指令(含子目錄):
setfacl -bR <filename>

移除 group 寫入檔案權限指令(含子目錄):
chmod -R g-w .

找出目錄下有 group 寫入權限的檔案指令(排除symbolic links):
find . -perm -g+w ! -type l

2023年11月14日 星期二

Hyper-V Replica

Reference:
 
設定 Hyper-V Replica 必須有 https 憑證。
自己產生憑證的指令(10年有效期):
New-SelfSignedCertificate -DnsName "hostname" -CertStoreLocation "cert:\LocalMachine\My" -TestRoot -NotAfter (Get-Date).AddMonths(120)

狀況:
來源主機 BLADE-33,目的主機 BLADE-38
(注意) 目的主機的Windows版本必須 大於/等於 來源主機

步驟:
  • 在 BLADE-33, BLADE-38 各自產生憑證。將中繼憑證 CertReq Test Root 複製到 受信任的根憑證。

2023年11月10日 星期五

網站資安風險 Cloud Metadata Potentially Exposed

Reference:

狀況:OWASP ZAP掃描出高風險
High Cloud Metadata Potentially Exposed
Description The Cloud Metadata Attack attempts to abuse a misconfigured NGINX server in order to access the instance metadata maintained by cloud service providers such as AWS, GCP and Azure.
 
All of these providers provide metadata via an internal unroutable IP address '169.254.169.254' - this can be exposed by incorrectly configured NGINX servers and accessed by using this IP address in the Host header field.
 
URL https://xxx.com.tw/latest/meta-data/
Method GET
Parameter  
Attack 169.254.169.254
Evidence  
Instances 1
Solution Do not trust any user data in NGINX configs. In this case it is probably the use of the $host variable which is set from the 'Host' header and can be controlled by an attacker.
Reference https://www.nginx.com/blog/trust-no-one-perils-of-trusting-user-input/
CWE Id  
WASC Id  
Plugin Id 90034

2023年8月30日 星期三

RockyLinux 9.2 sensmail allow relay

#安裝sendmail
yum install sendmail

#修改設定
cd /etc/mail
vi sendmail.cf
將這一行mark起來(allow remote connect)
#O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA

vi relay-domains
新增要寄信的IP,Ex: 192.168.10.29

#啟動sendmail
systemctl start sendmail
systemctl enable sendmail

#開啟防火牆
firewall-cmd --permanent --add-port=25/tcp
firewall-cmd --reload

2023年4月21日 星期五

Windows server 啟用shadow copy

User偶而會誤刪網路磁碟機的檔案,因應做法: 
1. 備份到磁帶或NAS,需要時進行檔案還原
2. 啟用硬碟的shadow copy,需要時可以從目錄內容的”以前的版本”快速復原

2023年3月30日 星期四

Redmine 5.0.5 install by docker (on Rocky Linux 9)

install docker
https://blog.yslifes.com/archives/3080

yum install -y yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
systemctl start docker
systemctl enable docker

#docker image path: /var/lib/docker/containers

install redmine 5
https://github.com/sameersbn/docker-redmine#installation

docker pull sameersbn/redmine:latest
mkdir redmine5
cd redmine5
wget https://raw.githubusercontent.com/sameersbn/docker-redmine/master/docker-compose.yml
docker compose up

2023年3月19日 星期日

Elasticsearch 8.6 install on Windows

Reference:
 
 
  • Download the .zip archive for Elasticsearch 8.6.2 from:
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.6.2-windows-x86_64.zip

  • 解壓縮到 C:\elasticsearch-8.6.2
  • 設定環境變數 ES_HOME = C:\elasticsearch-8.6.2
  • 執行 C:\elasticsearch-8.6.2\bin\elasticsearch.bat 開始安裝
  • 保存產生的 elastic password, fingerprint, enrollment token,之後會用到

2023年3月6日 星期一

2023年2月9日 星期四

CentOS 7 NFS exports

Reference:
 
NFS server:
yum install nfs-utils
vi /etc/exports
/data/     192.168.0.0/24(rw,sync,no_root_squash,no_all_squash)

/data: 共享目录位置。
192.168.0.0/24: 客户端 IP 范围,* 代表所有,即没有限制。
rw: 权限设置,可读可写。
sync: 同步共享目录。
no_root_squash: 可以使用 root 授权。
no_all_squash: 可以使用普通用户授权。

 
systemctl enable rpcbind; systemctl start rpcbind
systemctl enable nfs; systemctl start nfs

NFS client:
showmount -e <nfs_server>
mount -t nfs <nfs_server>:/data /data

CentOS 6 update glibc version

Reference:

mkdir glibc_2.17
cd glibc_2.17
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-common-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-devel-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-headers-2.17-55.el6.x86_64.rpm
rpm -Uvh *.rpm

完成後檢查
strings /lib64/libc.so.6 | grep GLIBC

2023年2月2日 星期四

OWASP ZAP 2.12.0 install

OWASP ZAP 是網站弱點掃描工具。 
Oracle Java SE看起來在公司使用要收費,所以安裝 OpenJDK。
 
安裝方式:
  • Java