แสดงกระทู้

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - golfreeze

Pages: [1] 2 3 ... 146
1
all application on unix knowledges by golfreeze / install php5.6 on rocky9
« on: กุมภาพันธ์ 23, 2025, 10:38:29 pm »
wget https://pkgs.sysadmins.ws/el9/base/x86_64/raven-release.el9.noarch.rpm
rpm -ivh raven-release.el9.noarch.rpm

##vi /etc/yum.repos.d/sysadmins.repo
[sysadmins]
name=Raven's RPM Repository for EL9
#baseurl=https://pkgs.sysadmins.ws/el9/
baseurl=https://pkgs.sysadmins.ws/el9/base/x86_64/
enabled=1
gpgcheck=0

==start
dnf makecache
dnf --enablerepo=raven-modular install php56-php-cli php56-php php56-php-cli php56-php-common php56-php-fpm php56-php-mysqlnd php56-php-gd php56-php-mbstring php56-php-xml php56-php-curl php56-php-opcache

2
all application on unix knowledges by golfreeze / sync time with command chrony
« on: กุมภาพันธ์ 23, 2025, 10:37:42 pm »
##chronyc sync time
chronyc -a makestep

3
command , shell script ,tool , crontab / bash sum number with -sd+ and bc command
« on: กุมภาพันธ์ 08, 2025, 09:10:44 pm »
##start to run script
cat sum.txt | awk -F/ '{print $NF}' | awk '{print $2}' |sed 's/,//g' | paste -sd+ | bc

5
== ถ้าเป็น pattern ใหม่ตามปี พ.ศ.
#wget https://www.dhamma.com/download/2567
#less 2567 | grep  "mp3&wpdmdl" | tr " " "\n" | grep .mp3 | awk -F 'ind=*.*filename=' '{print $1$2}' | cut -d'&' -f1 | cut -d':' -f2 | sed 's/?//g' | sed 's/\/\//wget https:\/\//g' | sed 's/www/media/' | sed 's/download/pramote/g' | sed 's/2567/\cd\/2567/'g | sh

6
Toya Lake รวมโรงแรมจุดพลุ 花火+ 食べ放題 朝+夕 + 温泉
The Lake Suite Ko no Sumika (Toya Sun Palace Resort & Spa Annex)
The Lake View Toya Nonokaze Resort おすすめ
Toyako Manseikaku Hotel Lakeside Terrace
Toya Kohan TeiOpens in new window
Lake Toya Tsuruga Resort HIKARINOUTA

7
สุดยอดทำเลทองแห่งใหม่ ในจังหวัดสมุทรสาคร โครงการพันธุวงษ์ เฟส 2 เหมาะสำหรับท่านเจ้าของกิจการ
ที่กำลังมองหาที่ดิน เพื่อทำโรงงาน หรือเปิดโรงงานแถวย่านสมุทรสาคร โดยทางทีมงานศิริประชา พรอพเพอที
ที่มีประสบการณ์กว่า 20 ปี ในการจัดสร้างที่ดิน สร้างโรงงาน พร้อมกับหลักแห่งหวงจุ้ย ในการวางตำแหน่ง เพื่อความสิริมงคล
แก่เจ้าของกิจการ ณ ขนาดนี้ทางพื้นที่กำลังอยู่ในขั้นตอนการจัดสร้าง ถ้าเสร็จแล้วจะมาอัฟเดทโครงการให้ทราบกันอีกที

สามารถติดต่อการอัฟเดทข่าวสาร ความคืบหน้าของโครงการได้ที่
https://www.siriprachaproperty.com/en/2024/04/21/sell-factory-samutsakorn-puntuwong-phase2/
https://www.siriprachaproperty.com/puntuwong-phase-2-samutsakorn-factory/

8
ในกรณีเจอปัญหาเรื่องการ import private key ไม่ได้ และมี error permission denied ส่วนหนึ่งมาจาก tty ที่เราใช้เจน กับ import คนละเบอร์กัน
gpg --import private_pkl.key

=== Error ===
gpg: key <KEYID>: "Packetlove <xxxx@gmail.com>" not changed
gpg: key <KEYID>/<KEYID>:error sending to agent: Permission denied
gpg: error building skey array: Permission denied
gpg: Total number processed: 1
gpg:              unchanged: 1
gpg:       secret keys read: 1


== ลองทำการ เพิ่ม option : --pinentry-mode loopback
เข้าไปดูนะครับ
gpg --import --pinentry-mode loopback   private_pkl.key
ก็จะสามารถทำ import ได้ครับ

https://www.gnupg.org/documentation/manuals/gnupg/Agent-OPTION.html  :)

9
ถ้าเข้าไม่ได้จากฝั่ง nagios server ให้ทำการ allow iptables ด้วยนะครับ ในกรณีท่ีมีการใช้งาน iptables
iptables -I INPUT -p tcp -s ip_nagios_server --dport 5666 -j ACCEPT

10
ในกรณีต้องการเพิ่ม response time ใน log ของ nginx เพื่อ tracking request / response  สามารถทำได้ที่ไฟล์
 /etc/nginx/nginx.conf

เพิ่ม configure ข้างล่างนี้ใน หัวข้อ "http"
log_format timed_combined '$remote_addr - $remote_user [$time_local] '
    '"$request" $status $body_bytes_sent '
    '"$http_referer" "$http_user_agent" '
    '$request_time $upstream_response_time $pipe';

จากนั้นเพิ่มบันทัดของ access log
access_log /var/log/nginx/yourdomain.com.access.log timed_combined;

และทำการ restart nginx 1 รอบ
แล้วทำการ tracking nginx log access.log ดูจะเจอ "0.584 0.584" อยู่ข้างหลัง log นั่นคือ response time ในหน่วยวินาที (sec)

1.46.150.138 - - [03/Mar/2024:07:14:35 +0700] "POST /api/packetlovetracking.php HTTP/1.1" 200 146 "-" "PKL/1.2.5 (iPhone; iOS 17.3.1; Scale/3.00)" 0.584 0.584

11
ถ้าเป็น cd100 ขึ้นไป สามารถปรับสคิปได้ตามนี้นะครับผม  8)

#wget https://www.dhamma.com/download/cd100/

#less index.html| grep  "mp3&wpdmdl" | tr " " "\n" | grep .mp3 | awk -F 'ind=*.*filename=' '{print $1$2}' | cut -d'&' -f1 | cut -d':' -f2 | sed 's/?//g' | sed 's/\/\//wget https:\/\//g' | sed 's/www/media/' | sed 's/download/pramote/g' | sed 's/cd/cd\//'g | sh

12
ในกรณีถ้ามีลิ้ง mp3 อยู่ในหน้าเวบหลายๆไฟล์เราสามารถเขียนสคิปเพื่อ download ได้เลยครับผ่าน
shell script

#wget https://www.dhamma.com/download/cd98/

#less cd98| grep  "mp3&wpdmdl" | tr " " "\n" | grep .mp3 | awk -F 'ind=*.*filename=' '{print $1$2}' | cut -d'&' -f1 | cut -d':' -f2 | sed 's/?//g' | sed 's/\/\//wget https:\/\//g' | sed 's/www/media/' | sed 's/download/pramote/g' | sed 's/cd/cd\/0/'g | sh

เท่านี้ก็ได้ไฟล์ dhamma มาฟังแบบไม่ต้องเข้าหน้าเวบละครับ
 8)

13
ทำการแจ้งให้ DA Exim รู้ว่าโดเมนไหนบ้างจะให้ relay ไปหา smtp.emsgateway.net::587
ซึ่งตัวอย่างข้างล่างจะให้ packetlove.com relay ไปหา smtp.emsgateway.net::587

#vi /etc/exim.routers.pre.conf

==== add into “exim.routers.pre.conf” =====
smart_route_forward:
    driver = manualroute
    domains = ! +local_domains
    senders = *@packetlove.com
    ignore_target_hosts = 127.0.0.0/8
    condition = ${if !eq{$original_domain}{$domain}}
    condition = ${if !eq{$original_domain}{}}
    condition = "${perl{check_limits}}"
   
    transport = remote_smtp_forward_transport

    route_list = * smtp.emsgateway.net::587
    no_more

smart_route:
    driver = manualroute
    domains = ! +local_domains
    senders = *@packetlove.com
    ignore_target_hosts = 127.0.0.0/8
    condition = "${perl{check_limits}}"

    transport = remote_smtp

    route_list = * smtp.emsgateway.net::587
    no_more
==== add into exim.conf =====

แต่ถ้าต้องการที่จะไม่ให้ โดเมน domain2.to.exclude.com , domain1.to.exclude.com ไม่ให้โดน relay ออกไปด้วยสามารถเขียนได้แบบนี้
senders = !*@domain1.to.exclude.com : !*@domain2.to.exclude.com

14
เมื่อเวลา รัน command เช่น rm , mv ไปที่บางไฟล์แล้วว่า operation not permitted

เราสามารถทำการเชค permission ไฟล์โดย

lsattr entpdate.service
ถ้าเป็น

#cd /etc/systemd
lsattr entpdate.service
----ia-------e-- entpdate.service

จะไม่สามารถ rm , mv ได้ ต้องทำการปลดสิทธิ์ของไฟล์นี้ออกก่อน

# chattr -ia entpdate.service

แล้วทำการเชค lsattr อีกที
# lsattr entpdate.service
-------------e-- entpdate.service

จะสามารถทำการ rm , mv ไฟล์นั้นได้

ในกรณีโดน trojan ฝังใน linux

===How to Found and Fixed 
0.Check process high cpu or check download trojan packet
1.Check crontab on normal user and user: root
2.cd /etc/systemd found 3 services starting for trojan services
3.found command on /bin and /sbin then “chattr -ia file”
4.reboot server 1 times.

15
#วันนี้มีโจทย์ grep เจอชื่อไฟล์ ทั้งหมดที่เจอคำว่า http และให้เปลี่ยนเป็นคำว่า https ภายใต้ folder "domain"
grep -rl "http://abc" *.php | xargs sed -i 's/http/https/g'

ถ้าเจอ1 file แก้ธรรมดาได้ แต่ถ้าเจอ 1000 file ก็ command ข้างบนได้เลยครับ ^_

 8)

Pages: [1] 2 3 ... 146