-->

whaust

2022年9月26日 星期一

RHEL 9 安裝 Docker

ref : https://docs.docker.com/engine/install/rhel/


1. 設置存儲庫

安裝yum-utils包(提供yum-config-manager 實用程序)並設置存儲庫。


$sudo yum install -y yum-utils

$sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo


*** 注意 ***

因為 RHEL 的軟體庫沒有 RHEL x86 的 repo.

所以安裝 centos 的repo

2022年9月19日 星期一

How to install XRDP on RHEL 9

 註記一下, xrdp 不是 RedHat 官方維護的軟體 , 屬於 3rd Party 軟體
所以安全性的話自己要看著辦

已經勸告過了, 出事別怪

=====

[root@rhel9-2022 system]# yum install --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y
正在更新訂閱管理程式軟體庫。
上次中介資料過期檢查:0:26:22 前,時間點為西元2022年09月19日 (週一) 13時58分39秒。
epel-release-latest-8.noarch.rpm                                                                                                            21 kB/s |  24 kB     00:01
依賴關係解析完畢。
===========================================================================================================================================================================
 軟體包                                     架構                                 版本                                     軟體庫                                      大小
===========================================================================================================================================================================
安裝:
 epel-release                               noarch                               8-17.el8                                 @commandline                                24 k
處理事項摘要
===========================================================================================================================================================================
安裝  1 軟體包
總大小:24 k
安裝的大小:34 k
下載軟體包:
執行處理事項檢查
處理事項檢查成功。
執行處理事項測試
處理事項測試成功。
執行處理事項
  準備        :                                                                                                                                                        1/1
  正在安裝    : epel-release-8-17.el8.noarch                                                                                                                           1/1
  執行小令稿  : epel-release-8-17.el8.noarch                                                                                                                           1/1
Many EPEL packages require the CodeReady Builder (CRB) repository.
It is recommended that you run /usr/bin/crb enable to enable the CRB repository.
  核驗        : epel-release-8-17.el8.noarch                                                                                                                           1/1
安裝的產品已更新。
已安裝:
  epel-release-8-17.el8.noarch
完成!
[root@rhel9-2022 system]# yum install xrdp tigervnc-server -y
正在更新訂閱管理程式軟體庫。
Extra Packages for Enterprise Linux 8 - x86_64                                                                                             1.4 MB/s |  13 MB     00:09
Extra Packages for Enterprise Linux Modular 8 - x86_64                                                                                     212 kB/s | 733 kB     00:03
上次中介資料過期檢查:0:00:01 前,時間點為西元2022年09月19日 (週一) 14時25分35秒。
已安裝 tigervnc-server-1.11.0-21.el9.x86_64 軟體包。
依賴關係解析完畢。
===========================================================================================================================================================================
 軟體包                                 架構                         版本                                     軟體庫                                                  大小
===========================================================================================================================================================================
安裝:
 xrdp                                   x86_64                       1:0.9.19-1.el8                           epel                                                   470 k
將安裝依賴項目:
 compat-openssl11                       x86_64                       1:1.1.1k-4.el9_0                         rhel-9-for-x86_64-appstream-rpms                       1.5 M
 imlib2                                 x86_64                       1.4.9-8.el8                              epel                                                   222 k
將安裝弱依賴項目:
 xrdp-selinux                           x86_64                       1:0.9.19-1.el8                           epel                                                    24 k
處理事項摘要
===========================================================================================================================================================================
安裝  4 軟體包
總下載大小:2.2 M
安裝的大小:6.5 M
下載軟體包:
(1/4): xrdp-selinux-0.9.19-1.el8.x86_64.rpm                                                                                                 29 kB/s |  24 kB     00:00
(2/4): xrdp-0.9.19-1.el8.x86_64.rpm                                                                                                        316 kB/s | 470 kB     00:01
(3/4): imlib2-1.4.9-8.el8.x86_64.rpm                                                                                                        75 kB/s | 222 kB     00:02
(4/4): compat-openssl11-1.1.1k-4.el9_0.x86_64.rpm                                                                                          469 kB/s | 1.5 MB     00:03
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
總計                                                                                                                                       431 kB/s | 2.2 MB     00:05
Extra Packages for Enterprise Linux 8 - x86_64                                                                                             1.6 MB/s | 1.6 kB     00:00
匯入 GPG 密鑰 0x2F86D6A1:
使用者識別碼:"Fedora EPEL (8) <epel@fedoraproject.org>"
指紋                :94E2 79EB 8D8F 25B2 1810 ADF1 21EA 45AB 2F86 D6A1
來自                :/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
密鑰匯入成功
執行處理事項檢查
處理事項檢查成功。
執行處理事項測試
處理事項測試成功。
執行處理事項
  準備        :                                                                                                                                                        1/1
  正在安裝    : compat-openssl11-1:1.1.1k-4.el9_0.x86_64                                                                                                               1/4
  正在安裝    : imlib2-1.4.9-8.el8.x86_64                                                                                                                              2/4
  正在安裝    : xrdp-selinux-1:0.9.19-1.el8.x86_64                                                                                                                     3/4
  執行小令稿  : xrdp-selinux-1:0.9.19-1.el8.x86_64                                                                                                                     3/4
  正在安裝    : xrdp-1:0.9.19-1.el8.x86_64                                                                                                                             4/4
  執行小令稿  : xrdp-1:0.9.19-1.el8.x86_64                                                                                                                             4/4
  核驗        : imlib2-1.4.9-8.el8.x86_64                                                                                                                              1/4
  核驗        : xrdp-1:0.9.19-1.el8.x86_64                                                                                                                             2/4
  核驗        : xrdp-selinux-1:0.9.19-1.el8.x86_64                                                                                                                     3/4
  核驗        : compat-openssl11-1:1.1.1k-4.el9_0.x86_64                                                                                                               4/4
安裝的產品已更新。
已安裝:
  compat-openssl11-1:1.1.1k-4.el9_0.x86_64           imlib2-1.4.9-8.el8.x86_64           xrdp-1:0.9.19-1.el8.x86_64           xrdp-selinux-1:0.9.19-1.el8.x86_64
完成!
[root@rhel9-2022 system]# systemctl start xrdp
[root@rhel9-2022 system]# systemctl enable xrdp
Created symlink /etc/systemd/system/multi-user.target.wants/xrdp.service → /usr/lib/systemd/system/xrdp.service.
[root@rhel9-2022 system]# systemctl status xrdp
● xrdp.service - xrdp daemon
     Loaded: loaded (/usr/lib/systemd/system/xrdp.service; enabled; vendor preset: disabled)
     Active: active (running) since Mon 2022-09-19 14:26:15 CST; 12s ago
       Docs: man:xrdp(8)
             man:xrdp.ini(5)
   Main PID: 6285 (xrdp)
      Tasks: 1 (limit: 98328)
     Memory: 1.0M
        CPU: 7ms
     CGroup: /system.slice/xrdp.service
             └─6285 /usr/sbin/xrdp --nodaemon
 9月 19 14:26:15 rhel9-2022 systemd[1]: Started xrdp daemon.
 9月 19 14:26:15 rhel9-2022 xrdp[6285]: [INFO ] starting xrdp with pid 6285
 9月 19 14:26:15 rhel9-2022 xrdp[6285]: [INFO ] address [0.0.0.0] port [3389] mode 1
 9月 19 14:26:15 rhel9-2022 xrdp[6285]: [INFO ] listening to port 3389 on 0.0.0.0
 9月 19 14:26:15 rhel9-2022 xrdp[6285]: [INFO ] xrdp_listen_pp done
[root@rhel9-2022 system]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: enp3s0
  sources:
  services: cockpit dhcpv6-client ssh
  ports:
  protocols:
  forward: yes
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:
[root@rhel9-2022 system]# firewall-cmd --zone=trusted --add-port=3389/tcp --permanent
success
[root@rhel9-2022 system]# firewall-cmd --reload
success
[root@rhel9-2022 system]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: enp3s0
  sources:
  services: cockpit dhcpv6-client ssh
  ports:
  protocols:
  forward: yes
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:
[root@rhel9-2022 system]#


=====

[root@rhel9-2022 system]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: enp3s0
  sources:
  services: cockpit dhcpv6-client ssh
  ports:
  protocols:
  forward: yes
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:
[root@rhel9-2022 system]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
     Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2022-09-19 13:35:35 CST; 55min ago
       Docs: man:firewalld(1)
   Main PID: 1090 (firewalld)
      Tasks: 4 (limit: 98328)
     Memory: 46.4M
        CPU: 1.442s
     CGroup: /system.slice/firewalld.service
             └─1090 /usr/bin/python3 -s /usr/sbin/firewalld --nofork --nopid
 9月 19 13:35:31 rhel9-2022 systemd[1]: Starting firewalld - dynamic firewall daemon...
 9月 19 13:35:35 rhel9-2022 systemd[1]: Started firewalld - dynamic firewall daemon.
[root@rhel9-2022 system]# sudo systemctl stop firewalld
[root@rhel9-2022 system]# systemctl status firewalld
○ firewalld.service - firewalld - dynamic firewall daemon
     Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
     Active: inactive (dead) since Mon 2022-09-19 14:31:27 CST; 2s ago
       Docs: man:firewalld(1)
    Process: 1090 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
   Main PID: 1090 (code=exited, status=0/SUCCESS)
        CPU: 1.531s
 9月 19 13:35:31 rhel9-2022 systemd[1]: Starting firewalld - dynamic firewall daemon...
 9月 19 13:35:35 rhel9-2022 systemd[1]: Started firewalld - dynamic firewall daemon.
 9月 19 14:31:27 rhel9-2022 systemd[1]: Stopping firewalld - dynamic firewall daemon...
 9月 19 14:31:27 rhel9-2022 systemd[1]: firewalld.service: Deactivated successfully.
 9月 19 14:31:27 rhel9-2022 systemd[1]: Stopped firewalld - dynamic firewall daemon.
 9月 19 14:31:27 rhel9-2022 systemd[1]: firewalld.service: Consumed 1.531s CPU time.
[root@rhel9-2022 system]# systemctl status xrdp
● xrdp.service - xrdp daemon
     Loaded: loaded (/usr/lib/systemd/system/xrdp.service; enabled; vendor preset: disabled)
     Active: active (running) since Mon 2022-09-19 14:26:15 CST; 5min ago
       Docs: man:xrdp(8)
             man:xrdp.ini(5)
   Main PID: 6285 (xrdp)
      Tasks: 1 (limit: 98328)
     Memory: 1.0M
        CPU: 7ms
     CGroup: /system.slice/xrdp.service
             └─6285 /usr/sbin/xrdp --nodaemon
 9月 19 14:26:15 rhel9-2022 systemd[1]: Started xrdp daemon.
 9月 19 14:26:15 rhel9-2022 xrdp[6285]: [INFO ] starting xrdp with pid 6285
 9月 19 14:26:15 rhel9-2022 xrdp[6285]: [INFO ] address [0.0.0.0] port [3389] mode 1
 9月 19 14:26:15 rhel9-2022 xrdp[6285]: [INFO ] listening to port 3389 on 0.0.0.0
 9月 19 14:26:15 rhel9-2022 xrdp[6285]: [INFO ] xrdp_listen_pp done
[root@rhel9-2022 system]#










2022年9月12日 星期一

HomeWork 2022-09-12

 

Q.2. During the last 20 to 30 years , there have been a number of countries whose economies have experienced important economic expansion and development . One group of countries has been labeled the BRIC and the other the VISTA . Identify each of the nine countries and provide some insights about their economies and economic importance .

Q.2. 在過去的 20 30 年間,許多國家的經濟都經歷了重要的經濟擴張和發展。一組國家被標記為金磚四國,另一組國家被標記為 VISTA。確定九個國家中的每一個,並提供一些關於它們的經濟和經濟重要性的見解。

 


 

Q.5. The size of a country’s population and the associated age distribution can be causal factors for economic growth . Why is the size of the population important to economic development ? Can size be a disadvantage ? Why is age distribution important ?

Q.5. 一個國家的人口規模和相關的年齡分佈可能是經濟增長的原因。為什麼人口規模對經濟發展很重要?尺寸會成為劣勢嗎?為什麼年齡分佈很重要?

 


 

Q.7. Technology can impact economic development on both a macro and a micro level . What types of technology do we need to have such impacts on a macro basis ? On a micro basis ?

Q.7. 技術可以在宏觀和微觀層面影響經濟發展。我們需要什麼樣的技術才能在宏觀上產生這種影響?在微觀基礎上?

 


 

Q.8. Robotics have attracted more attention in recent years . Why ? How are robots being used in supply chains ?

Q.8. 機器人技術近年來引起了更多的關注。為什麼 ?機器人如何在供應鏈中使用?

 

2022年9月1日 星期四

Active Directory 安全

 KrbRelayUp 問題可能還沒好解法

臺資安業者揭露國內AD防護現況,盤點AD攻擊路徑與管理者帳號是當務之急另一AD安全問題,是今年2月揭露的KrbRelayUp漏洞。正如前幾年多人討論Kerberos Relay的漏洞,這次KrbRelayUp以兩個漏洞組合形成新的攻擊,攻擊者可將任意網域帳號在本地電腦提權,目前看來恐怕無解,甚至有研究人員稱其為永遠的零時差漏洞。
https://www.ithome.com.tw/news/151458


常見管理問題

  • 管理群組
  • 維運 日常帳號分隔
  • 設定檢查
  • 盤點帳號權限
  • 核心資產範圍

管理群組

No admin group
大家都是 domain admins
預設群組用好用滿
(大部分人不用 admin,一個人失守全部淪陷)

建議動作:權限分隔 人員與維運帳號分開


案例 大家都是管理員

管理群組成員關聯強烈

  • 群組成員來自不同部門(OU)

知道要管 但力不從心

  • 開了群組處理重設密碼 但成員組成不明
  • 開了多層管理權限層疊 權限不清

pwd mgmt 看起來是管理密碼群組,但有 general All 權限


維運 日常帳號分隔

管理帳號到處留下蹤跡

  • 管理帳號沒切割 造成 Credential Dumping(超常見)

  • 惡意者 cache Credential
    mimikatz
    rubeus
    mscash

  • relay auth
    krb relay(kerberos relay)
    RemotePotato0(NTLM relay)
    Lsarelayx(NTLM relay+downgrade)

jumpbox

現象 7天有279帳號 rdp 到同一台電腦,再 RDP 到自己主機
因為設定 Server 電腦讓員工共用主機
惡意者攻擊方式

  • Cross-session attack
  • Relay Auth 到 ADCS

設定檢查

各種設定錯誤

  • Default Component
    Group Policy 讓不預期人員改 GPO
    SPN on Users 被破解密碼的風險
    Network Shares 權限開太大

  • Auth related
    AD CS權限


"我們的"憑證

錯誤設定憑證範本權限
要賦予所有使用者註冊權限 多給予修改權限
造成使用者可以修改"範本內容" 從而提權到 Domain Admins

  1. 使用者修改範本
  2. 使用者把自己套用範本權限
  3. 憑證上面寫上 我可以代表任何人
  4. 使用者把自己改成代表 admin

AAD Connect Service Account


盤點帳號權限

對於特定資產該賦予權限沒概念

Exchange AD Privesc

OU權限: 我是你的主人


核心資產範圍

Tier 0:
Tier 1:
Tier 2:

你以為的核心資產

如何解決

scan the privilege
monitoring
professional advise

Popular