แสดงกระทู้

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

2
ในกรณีต้องการเพิ่ม 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

3
ถ้าเป็น 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

4
ในกรณีถ้ามีลิ้ง 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)

5
ทำการแจ้งให้ 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

6
เมื่อเวลา รัน 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.

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

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

 8)

8
===== install additional
yum install libssh2 libssh-devel
pecl install ssh2
yum install php-pear
yum install php-devel

== install plugin on folder “plugin”
wget https://downloads.wordpress.org/plugin/ssh-sftp-updater-support.0.8.5.zip
Unzip ssh-sftp-updater-support.0.8.5.zip

== add configure support ssh2 (sftp) method
#vi wp-config.php
/* Add sftp method */
define( 'FS_METHOD', 'ssh2');


===special Thank ===
[https://developer.wordpress.org/apis/wp-config-php/#wordpress-upgrade-constants]  8)

9
Travel for life trip by golfreeze / まるごと北海道 浅草店
« on: กรกฎาคม 28, 2023, 05:16:56 AM »
まるごと北海道 浅草店
https://tabelog.com/tokyo/A1311/A131102/13102359/

10
======Cloudflare create delegate sub domain zone file

เช่นมีโดเมน weloveunix.com เป็น root domain ซึ่งมี record A ต่างๆอยู่แล้ว

แต่มีโจทย์ว่าอยากจะสร้าง MX record และ www record ของ zone file “it.weloveunix.com”
เป็น

it.weloveunix.com MX mail.it.weloveunix.com
www IN A 103.x.y.z

สามารถทำได้ดังนี้

1.สร้าง ns ของ it.weloveunix.com ชี้แยกออกมาที่ ns ของเราเอง ซึ่งไม่ได้อยู่ภายใต้ cloudflare ns
2.ทำการสร้าง zone file “it.weloveunix.com” บน bind (DNS server) ที่ไม่ได้อยู่ใน Cloudflare system
3.ทำการสร้าง record ตามที่ต้องการ
it.weloveunix.com MX mail.it.weloveunix.com
www IN A 103.x.y.z

4.ตรวจสอบผ่าน dig command
#dig it.weloveunix.com ns
#dig www.it.weloveunix.com
#dit it.weloveunix.com mx

 8) ไม่ยากเลยใช่ปะครับ ลองดู

11
all application on unix knowledges by golfreeze / ฝึกใช้ shodan กัน
« on: กรกฎาคม 16, 2023, 12:32:41 AM »
ในส่วนของเว็บ shodan.io จะเป็นรวมข้อมูลเกี่ยวกับข้อมูล ip , server ที่มีการใช้งาน application หรือ os ในเวอร์ชั่นต่างๆ
ซึ่งเราสามารถเขียน syntax ในการค้นหาข้อมูลได้ประมาณนี้ ถ้าอยากค้นเกี่ยวกับ certificate CN มีชื่อโดเมน weloveunix.com

===shodan.io command ====

#ถ้าอยากค้นเกี่ยวกับ certificate CN มีชื่อโดเมน weloveunix.com
ssl.cert.subject.CN:"weloveunix.com"
#ถ้าอยากค้นเกี่ยวกับ certificate CN มีชื่อโดเมน weloveunix.com และให้ระบุ web server ที่มีการใช้งานเป็น IIS ด้วย
ssl.cert.subject.CN:"weloveunix.com" http.title:"IIS Windows Server"
#ถ้าอยากค้นเกี่ยวกับ certificate CN มีชื่อโดเมน weloveunix.com และไม่ให้ระบุ web server ที่มีเป็น Invalid URL ก็ใส่เครื่อง - ไปข้างหน้า
ssl.cert.subject.CN:"weloveunix.com" -http.title:"Invalid URL"
http.title:BIG-IP&reg:-Redirect& country:"TH"
os:"ubuntu 18.04"
"Microsoft-IIS/6.0"
"Microsoft-IIS/6.0" os:"Windows XP"
os:"Windows XP" country:"TH"
os: "Linux 2.6"
=finding glassfish vulnerable
"Glassfish Server 3.1.1"

12
==== ถ้าดูจาก message log แล้ว start proftpd ไม่ขึ้น
mod_sftp/1.1.1: Server 'ProFTPd': cannot support both FTPS (TLSEngine on) and SFTP (SFTPEngine on) for the same host
ทำการแก้ไขโดย
perl -pi -e 's/TLSEngine.*/TLSEngine off/' /etc/proftpd.conf

#systemctl restart proftpd

13
ในกรณีเจอ folder ชื่อ -
เราสามารถ mv มาเป็นชื่อปกติทั่วไปได้โดย
#mv "-" test_folder

14
Package on mac / Re: disk cleanup on mac os with mac-cleanup
« on: เมษายน 13, 2023, 04:57:59 PM »
==== result =====
Emptying the Trash 🗑 on all mounted volumes and the main HDD...
Clearing System Cache Files...
Clearing System Log Files...
Clearing Google Chrome Cache Files...
Cleaning up iOS Applications...
Removing iOS Device Backups...
Cleaning up XCode Derived Data and Archives...
Cleaning up iOS Simulators...
Clearing Bash/ZSH history...
Cleaning up Homebrew Cache...
/Users/watthanachaikekhua2/Library/Caches/Homebrew/.cleaned
/Users/wat/Library/Caches/Homebrew/api/formula.jws.json
/Users/wat/Library/Caches/Homebrew/api/formula_names.txt
/Users/wat/Library/Caches/Homebrew/api/formula_aliases.txt
/Users/wat/Library/Caches/Homebrew/api
/Users/wat/Library/Caches/Homebrew
Cleaning up any old versions of gems
Cleaning up npm cache...
Cleaning up DNS cache...
Purging inactive memory...
Success!
160.54 MiB of space was cleaned up

15
Package on mac / disk cleanup on mac os with mac-cleanup
« on: เมษายน 13, 2023, 04:48:57 PM »
เราสามารถทำ clear พวกไฟล์ขยะใน mac os เพื่อเอาพื้นที่ใช้งานกลับคืนมาได้ ผ่าน command mac-cleanup นะครับ แต่ถ้ายังไม่มี ก็ brew มาได้เลย
$brew tap fwartner/tap
$brew tap fwartner/tap/mac-cleanup
$mac-cleanup

Pages: [1] 2 3 ... 146