2021年10月22日星期五

How the SELinux policy of www directory is?

 


 

 [root@study ~]# semanage fcontext -l | grep '/var/www'
/var/www(/.*)?                                     all files          system_u:object_r:httpd_sys_content_t:s0
/var/www(/.*)?/logs(/.*)?                          all files          system_u:object_r:httpd_log_t:s0
/var/www/[^/]*/cgi-bin(/.*)?                       all files          system_u:object_r:httpd_sys_script_exec_t:s0
/var/www/apcupsd/multimon\.cgi                     regular file       system_u:object_r:apcupsd_cgi_script_exec_t:s0
/var/www/apcupsd/upsfstats\.cgi                    regular file       system_u:object_r:apcupsd_cgi_script_exec_t:s0
/var/www/apcupsd/upsimage\.cgi                     regular file       system_u:object_r:apcupsd_cgi_script_exec_t:s0
/var/www/apcupsd/upsstats\.cgi                     regular file       system_u:object_r:apcupsd_cgi_script_exec_t:s0
/var/www/calamaris(/.*)?                           all files          system_u:object_r:calamaris_www_t:s0
/var/www/cgi-bin(/.*)?                             all files          system_u:object_r:httpd_sys_script_exec_t:s0
/var/www/cgi-bin/apcgui(/.*)?                      all files          system_u:object_r:apcupsd_cgi_script_exec_t:s0
/var/www/cgi-bin/cgit                              regular file       system_u:object_r:git_script_exec_t:s0
/var/www/cgi-bin/cvsweb\.cgi                       regular file       system_u:object_r:cvs_script_exec_t:s0
/var/www/cgi-bin/keystone(/.*)?                    all files          system_u:object_r:keystone_cgi_script_exec_t:s0
/var/www/cgi-bin/munin.*                           all files          system_u:object_r:munin_script_exec_t:s0
/var/www/cobbler(/.*)?                             all files          system_u:object_r:cobbler_var_lib_t:s0
/var/www/dspam(/.*?)                               all files          system_u:object_r:dspam_content_t:s0
/var/www/dspam/.*\.cgi                             regular file       system_u:object_r:dspam_script_exec_t:s0
/var/www/gallery/albums(/.*)?                      all files          system_u:object_r:httpd_sys_rw_content_t:s0
/var/www/git(/.*)?                                 all files          system_u:object_r:git_content_t:s0
/var/www/git/gitweb\.cgi                           regular file       system_u:object_r:git_script_exec_t:s0
/var/www/gitweb-caching/gitweb\.cgi                regular file       system_u:object_r:git_script_exec_t:s0
/var/www/html(/.*)?/sites/default/files(/.*)?      all files          system_u:object_r:httpd_sys_rw_content_t:s0
/var/www/html(/.*)?/sites/default/settings\.php    regular file       system_u:object_r:httpd_sys_rw_content_t:s0
/var/www/html(/.*)?/uploads(/.*)?                  all files          system_u:object_r:httpd_sys_rw_content_t:s0
/var/www/html(/.*)?/wp-content(/.*)?               all files          system_u:object_r:httpd_sys_rw_content_t:s0
/var/www/html(/.*)?/wp_backups(/.*)?               all files          system_u:object_r:httpd_sys_rw_content_t:s0
/var/www/html/[^/]*/cgi-bin(/.*)?                  all files          system_u:object_r:httpd_sys_script_exec_t:s0
/var/www/html/cgi/munin.*                          all files          system_u:object_r:munin_script_exec_t:s0
/var/www/html/configuration\.php                   all files          system_u:object_r:httpd_sys_rw_content_t:s0
/var/www/html/munin(/.*)?                          all files          system_u:object_r:munin_content_t:s0
/var/www/html/munin/cgi(/.*)?                      all files          system_u:object_r:munin_script_exec_t:s0
/var/www/html/nextcloud/data(/.*)?                 all files          system_u:object_r:httpd_sys_rw_content_t:s0
/var/www/html/owncloud/data(/.*)?                  all files          system_u:object_r:httpd_sys_rw_content_t:s0
/var/www/icons(/.*)?                               all files          system_u:object_r:httpd_sys_content_t:s0
/var/www/miq/vmdb/log(/.*)?                        all files          system_u:object_r:httpd_log_t:s0
/var/www/moodle/data(/.*)?                         all files          system_u:object_r:httpd_sys_rw_content_t:s0
/var/www/moodledata(/.*)?                          all files          system_u:object_r:httpd_sys_rw_content_t:s0
/var/www/nut-cgi-bin/upsimage\.cgi                 regular file       system_u:object_r:nutups_cgi_script_exec_t:s0
/var/www/nut-cgi-bin/upsset\.cgi                   regular file       system_u:object_r:nutups_cgi_script_exec_t:s0
/var/www/nut-cgi-bin/upsstats\.cgi                 regular file       system_u:object_r:nutups_cgi_script_exec_t:s0
/var/www/openshift/broker/httpd/logs(/.*)?         all files          system_u:object_r:httpd_log_t:s0
/var/www/openshift/broker/httpd/run(/.*)?          all files          system_u:object_r:httpd_var_run_t:s0
/var/www/openshift/console/httpd/logs(/.*)?        all files          system_u:object_r:httpd_log_t:s0
/var/www/openshift/console/httpd/run(/.*)?         all files          system_u:object_r:httpd_var_run_t:s0
/var/www/openshift/console/log(/.*)?               all files          system_u:object_r:httpd_log_t:s0
/var/www/openshift/console/tmp(/.*)?               all files          system_u:object_r:httpd_tmp_t:s0
/var/www/perl(/.*)?                                all files          system_u:object_r:httpd_sys_script_exec_t:s0
/var/www/stickshift/[^/]*/log(/.*)?                all files          system_u:object_r:httpd_log_t:s0
/var/www/svn(/.*)?                                 all files          system_u:object_r:httpd_sys_rw_content_t:s0
/var/www/svn/conf(/.*)?                            all files          system_u:object_r:httpd_sys_content_t:s0
/var/www/svn/hooks(/.*)?                           all files          system_u:object_r:httpd_sys_script_exec_t:s0
/var/www/usage(/.*)?                               all files          system_u:object_r:webalizer_rw_content_t:s0
/var/www/wiki[0-9]?(/.*)?                          all files          system_u:object_r:mediawiki_rw_content_t:s0
/var/www/wiki[0-9]?\.php                           regular file       system_u:object_r:mediawiki_content_t:s0

How to find the service in CentOS and Red Hat Linux?

 




Step1. netstat -tnlp 

           and then find the Program name 

[root@study /]# netstat -tlunp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
tcp        0      0 0.0.0.0:514                                  0.0.0.0:*               LISTEN      1711/rsyslogd      
tcp        0      0 0.0.0.0:111                                  0.0.0.0:*               LISTEN      1/systemd          
tcp        0      0 192.168.122.1:53                        0.0.0.0:*               LISTEN      2411/dnsmasq       
tcp        0      0 0.0.0.0:22                                     0.0.0.0:*              LISTEN      1274/sshd          
tcp        0      0 127.0.0.1:631                               0.0.0.0:*              LISTEN      1264/cupsd         
tcp        0      0 127.0.0.1:25                                  0.0.0.0:*             LISTEN      8264/master        
tcp6       0      0 :::514                                                      :::*            LISTEN      1711/rsyslogd      
tcp6       0      0 :::111                                                      :::*            LISTEN      1/systemd          
tcp6       0      0 :::80                                                        :::*            LISTEN      1714/httpd         
tcp6       0      0 :::21                                                        :::*            LISTEN      1717/vsftpd        
tcp6       0      0 :::22                                                        :::*            LISTEN      1274/sshd          
tcp6       0      0 ::1:631                                                     :::*           LISTEN      1264/cupsd         
tcp6       0      0 ::1:25                                                      :::*            LISTEN      8264/master        
udp        0      0 0.0.0.0:46637                                 0.0.0.0:*                                 881/avahi-daemon: r
udp        0      0 192.168.122.1:53                            0.0.0.0:*                               2411/dnsmasq       
udp        0      0 0.0.0.0:67                                        0.0.0.0:*                               2411/dnsmasq       
udp        0      0 0.0.0.0:111                                      0.0.0.0:*                               1/systemd          
udp        0      0 0.0.0.0:5353                                    0.0.0.0:*                               881/avahi-daemon: r
udp        0      0 127.0.0.1:323                                   0.0.0.0:*                               897/chronyd        
udp6       0      0 :::111                                                        :::*                                1/systemd          
udp6       0      0 :::35040                                                    :::*                                881/avahi-daemon: r
udp6       0      0 :::5353                                                      :::*                                881/avahi-daemon: r
udp6       0      0 ::1:323                                                      :::*                                897/chronyd        
[root@study /]#
         




 

2021年10月19日星期二

How to add multiple user with sh?




Step 1. mkdir bin

Step 2.cd/root/bin

Step3.vim useradd.sh

#:/bin/bash

groupadd workstation

for username in workstation1 workstation2 workstation3 workstation4 workstation5

do

        useradd -G workstation $username

        echo "password" | passwd --stdin $username

done


Step4.sh useradd.sh

Step5.id workstation1


2021年10月18日星期一

How to install a software that have not been in Centos automatically?


[neo@localhost skel]$ iostat
bash: iostat: 找不到指令...
是否要安裝「sysstat」軟體包以提供「iostat」指令? [N/y] y


 * 正在依佇列等待...
 * 正在載入軟體包清單。...
下列軟體包必須安裝:
 sysstat-11.7.3-5.el8.x86_64    Collection of performance monitoring tools for Linux
要處理變更嗎? [N/y] y


 * 正在依佇列等待...
 * 正在等候認證...
 * 正在依佇列等待...
 * 正在下載軟體包...
 * 正在請求資料...
 * 正在測試變更...
 * 正在安裝軟體包...
Linux 4.18.0-193.el8.x86_64 (localhost.localdomain)     西元2021年10月18日     _x86_64_    (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           6.21    0.62    5.94   10.52    0.00   76.72

Device             tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda              49.16      2459.50       808.14    5527349    1816165
dm-0             35.48      2384.71       466.12    5359268    1047539
dm-1            100.02        56.93       343.97     127944     773028





2021年10月17日星期日

How to show filesystem in CentOS and Red Hat Linux

Step1: type df in terminal
Step2: it shows the filesystem

檔案系統             1K-區段    已用     可用 已用% 掛載點

devtmpfs              390404       0   390404    0% /dev

tmpfs                 419348   13284   406064    4% /dev/shm

tmpfs                 419348    6732   412616    2% /run

tmpfs                 419348       0   419348    0% /sys/fs/cgroup

/dev/mapper/cl-root  4744168   50644  4432816    2% /

/dev/mapper/cl-usr  15734664 4549092 10366580   31% /usr

/dev/sda1             944120  195840   683104   23% /boot

/dev/mapper/cl-tmp    947160    3204   878628    1% /tmp

/dev/mapper/cl-var   1890316  425364  1350880   24% /var

/dev/mapper/cl-home  9758720  196224  9562496    3% /home

tmpfs                  83868    1180    82688    2% /run/user/42

tmpfs                  83868    6988    76880    9% /run/user/1000


【請註冊帳號試用】資安職能地圖

【請註冊帳號試用】 https://eapdb.com/cyberskill/ 測試帳號: TestHR@hr.com 測試密碼: TestHR 這份文件詳細介紹了新心資安科技所開發的「資安職能地圖」系統,旨在協助企業有效盤點與管理內部的資安人才實力。該平台採用零信任原則,人...