오류: repo 'appstream'의 메타 데이터를 다운로드하지 못했습니다: Cannot prepare internal mirrorlist: No URLs in mirrorlist

리눅스/OS 일반|2022. 4. 12. 07:51
반응형

CentOS 8 에서 yum 실행시 출력된 에러 메세지 이며 해결은 다음과 같이 하였습니다.

# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*

# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*

 

그리고 충돌하는 패키지 변경을 위해 아래와 같은 옵션을 주며 update 를 하였습니다.

# yum update --allowerasing

 

이제 필요한 패키지 설치가 가능합니다.

 

[출처] https://stackoverflow.com/questions/70926799/centos-through-a-vm-no-urls-in-mirrorlist

반응형

댓글()

리눅스 PC (Ubuntu 24.04) 보안 설정

리눅스/OS 일반|2022. 4. 4. 10:50
반응형

[ 패스워드 복잡성 설정 ]

 

# apt-get -y install libpam-pwquality

 

# vi /etc/pam.d/common-password

 

// 25 번째 줄에 옵션 추가

        password    requisite                    pam_pwquality.so retry=3 lcredit=-1 ucredit=-1 dcredit=-1 ocredit=-1

// 26 번째 줄에 옵션 추가

        password    [success=2 default=ignore]   pam_unix.so obscure use_authtok try_first_pass yescrypt sha512 minlen=6 maxlen=9

 


[ 계정 잠금 임계값 설정 ]

 

# vi /etc/pam.d/common-auth

 

// 24번째 줄에 아래 내용 추가

        auth    required                        pam_permit.so onerr=tail even_deny_root deny=10 unlock_time=300

 


[ 패스워드 최대 사용기간 설정 ]

 

# vi /etc/login.defs

 

        PASS_MAX_DAYS   90

        PASS_MIN_DAYS   0

        PASS_WARN_AGE   7

        PASS_MIN_LEN 8

 

현재 사용중인 계정은 위와 같은 룰이 적용되지 않기 때문에 아래와 같이 개별적으로 설정해 줍니다.

 

(패스워드 최대 사용일 : 90일)

# chage -M 90 root

# chage -M 90 sysdocu

 

(설정 확인)

# chage -l root

# chage -l sysdocu

 

 

[ 바이러스 스캔 툴 ]

 

# apt -y install clamav

# vi clamavscan.sh

#!/bin/bash

LOGDIR="/var/log/clamav"
LOGFILE="$LOGDIR/clamav-$(date +'%Y-%m-%d').log"
USER=$(who | awk '{print $1}')
DIRTOSCAN="/home/$USER"

if [ ! -d "$LOGDIR" ]; then
    mkdir -p "$LOGDIR"
fi

for S in ${DIRTOSCAN}; do
    DIRSIZE=$(du -sh "$S" 2>/dev/null | cut -f1)

    echo "Starting a daily scan of \"$S\" directory."
    echo "Amount of data to be scanned is \"$DIRSIZE\"."

    clamscan -ri "$S" >> "$LOGFILE"
done

exit 0

 

# chmod 700 clamavscan.sh

# echo "0 12 * * 1 root sh /root/clamavscan.sh" >> /etc/crontab

 

실시간 탐지를 위해 추가 세팅합니다.

# apt -y install clamav-daemon inotify-tools

# echo "fs.inotify.max_user_watches=524288"

# sysctl -p

# freshclam

# systemctl enable --now clamav-daemon

 

# wget http://www.rfxn.com/downloads/maldetect-current.tar.gz

# tar xvzf maldetect-current.tar.gz
# cd maldetect-1.6.5
# ./install.sh

 

감시를 시작합니다.

# maldet --monitor /home

 

 

[ 기타 설정 ]

 

PC 의 모든 포트에 접근 불가 설정을 합니다.

# echo "ALL : ALL" > /etc/hosts.deny

 

계정 파일 퍼미션을 조정합니다.
# chmod 0400 /etc/shadow
# chmod 0640 /etc/hosts.deny
# chmod 0640 /etc/hosts.allow

 

불필요한 데몬이 있는지 확인합니다.

# netstat -nltp

 

iptables 사무실 PC 셋팅용으로 적용합니다.

- 참고 : https://sysdocu.tistory.com/1486

 

패스워드를 한 번 더 적용합니다.

# echo "root:12345678" | chpasswd

# echo "sysdocu:12345678 | chpasswd

 

반응형

댓글()

[보안 설정] HTTP 불필요한 method 취약점 제거 (Disable HTTP Trace)

리눅스/APACHE|2022. 3. 31. 14:29
반응형

TRACE method 는 cross-site tracing, basic 인증 암호를 가로챌 수 있기 때문에 불필요하다고 판단 되므로 꼭 사용해야 하는 환경이 아닐 경우 제거하도록 합니다.

 

 

1. 확인

# curl -k -X TRACE http://localhost
TRACE / HTTP/1.1
User-Agent: curl/7.29.0
Host: localhost
Accept: */*

 

 

2. 조치

간단히 httpd.conf 에 아래 옵션을 추가하여 조치가 가능합니다.

 

# vi /usr/local/apache/conf/httpd.conf

TraceEnable off

 

# /usr/local/apache/bin/apachectl restart

 

 

3. 재확인

# curl -k -X TRACE http://localhost
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>405 Method Not Allowed</title>
</head><body>
<h1>Method Not Allowed</h1>
<p>The requested method TRACE is not allowed for this URL.</p>
</body></html>

 

 

[출처] https://www.youtube.com/watch?v=_zjMrdQoK8g

 

 

 

 

반응형

댓글()

CentOS 7 에서 OpenSSH 취약점 (취약한 알고리즘) 조치 방법

리눅스/OS 일반|2022. 3. 31. 12:21
반응형

[ 취약한 알고리즘 ]
Running SSH serviceInsecure CBC ciphers in use: aes128-cbc,aes192-cbc,blowfish-cbc,cast128-cbc,aes256-cbc
Running SSH serviceInsecure 3DES ciphers in use: 3des-cbc
Running SSH serviceInsecure key exchange in use: diffie-hellman-group1-sha1
Running SSH serviceInsecure key exchange algorithms in use: diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
Running SSH serviceInsecure MAC algorithms in use: umac-64-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,hmac-sha1

 


[ 현재 허용된 알고리즘 확인 ]
아래와 같은 명령어로 확인이 가능합니다.

 

(명령)

# sshd -T | grep "\(^ciphers\|^macs\|^kexalgorithms\)"

(결과)
ciphers chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc,cast128-cbc,3des-cbc
macs umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1

kexalgorithms curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1


[ 설정 변경 및 적용 ]
설정 파일을 열어 아래 내용 삽입 (또는 수정) 후 sshd 데몬을 재시작 합니다.
기본 옵션으로 모두 허용되어 있으므로 위 출력 결과에서 사용하지 않을 알고리즘만 제거하고 입력하였습니다.

 

# vi /etc/ssh/sshd_config


ciphers chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
macs umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512
kexalgorithms curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1

# service sshd restart

 

 

[ 변경된 알고리즘 재확인 ]

 

(명령)

# sshd -T | grep "\(^ciphers\|^macs\|^kexalgorithms\)"

 

(결과)
ciphers chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
macs umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512
kexalgorithms curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1

반응형

댓글()

Ubuntu 18.10 싱글모드 (복구모드) 진입 & 계정 잠김 해제

리눅스/OS 일반|2022. 3. 17. 08:01
반응형

패스워드 임계치 설정을 해 놓고, 정해놓은 수 만큼 패스워드가 불일치 되면 계정이 잠깁니다.

이럴 경우 싱글모드로 진입하여 계정 잠김 해제를 할 수 있습니다.

 

 

1. 싱글모드 진입

시스템 리부팅시 커널 선택 부분에서 아래와 같은 항목 위에서 알파벳 'e' 를 누릅니다.

*Ubuntu    // 아마도 맨 위의 항목

 

에디터 창이 뜨는데 아래서 두번째 라인 (linux 로 시작 하는 라인) 만 수정하면 됩니다.

ro 라는 단어부터 뒤로 모두 지우고 아래 내용으로 대체합니다.

rw init=/bin/bash

그리고 Ctrl + X 키를 눌러 부팅하면 계정 패스워드 없이 root 권한으로 shell 진입하게 됩니다.

 

 

2. 계정 잠김 해제

1) 확인

# pam_tally2 -u 계정명

 

2) 해제

# pam_tally2 -u 계정명 -r

 

 

3. 리부팅

싱글모드에서는 init 6 이나 reboot 명령이 되지 않으므로 강제 리부팅을 시행합니다.

# reboot -f

 

반응형

댓글()

PHP 8.0 에서 SCREWIM 을 이용한 소스 암호화

리눅스/PHP|2021. 12. 28. 13:53
반응형

DB 접속 정보가 들어있는 파일이 노출될 우려가 있어 많은 개발자들이 암호화 방법을 찾고 있습니다.

검색해보면 상용 프로그램 또는 난독화, 무료 암호화 프로그램이 몇 개 있으나

여기에서는 김정균님이 만드신 screw 개선 버전 screwim 을 소개합니다.

아래 내용은 CentOS 7, PHP 8.0 소스설치 환경에서 테스트 했으며,

페이지 하단 출처의 내용을 요약하였습니다.

 

 

1. 다운로드

 

# cd /usr/local/src
# git clone https://github.com/OOPS-ORG-PHP/mod_screwim.git

mod_screwim.zip
0.22MB

# cd mod_screwim
# /usr/local/php/bin/phpize


2. PHP 확장 모듈 생성하기

 

# ./configure --with-php-config=/usr/local/php/bin/php-config
# make install

php.ini 에 아래 내용 추가
# vi /usr/local/apache/conf/php.ini
extension = screwim.so
screwim.enable = 1

(아파치 재시작 및 적용 확인)
# /usr/local/apache/bin/apachectl restart
# /usr/local/php/bin/php -m |grep screwim

 


3. SCREWIM 설치

 

# cd tools
# ./autogen.sh    // 위에서 모듈을 설치하지 않으면 실행이 안됩니다. 모듈부터 설치하세요.

# ./configure

# make install

 

(설치 확인)
# /usr/local/bin/screwim -v


4. PHP 소스 암호화 하기


# cd /{PHP 소스 디렉토리}
# screwim config.php

 

원본 파일은 백업하고 암호화된 파일은 사용하는 파일명으로 변경합니다.
# mv config.php config.php.ori
# mv config.php.screw config.php

사이트 동작을 확인합니다.

 

* 복호화 불가 처리하실 분은..

   실행 파일이나 설치 소스 파일이 그대로 남겨져 있을 경우 screwim -d 옵션을 통해 복호화가 가능하므로

   실행 파일 및 설치 소스 파일 디렉토리를 삭제 합니다.

   (설치시 암호화, 복호화에 사용되는 랜덤 생성된 KEY STRING 삭제)

    rm -f /usr/local/bin/screwim

    rm -rf /usr/local/src/mod_screwim

 

 

[출처] https://www.php79.com/525

https://github.com/OOPS-ORG-PHP/mod_screwim/

https://www.phpschool.com/gnuboard4/bbs/board.php?bo_table=tipntech&wr_id=81220

 

 

반응형

댓글()

쉘스크립트를 이용한 메일 IP 평판 확인하기 (block list 등록 여부)

리눅스/Mail|2021. 12. 21. 08:53
반응형

# vi blcheck

#!/bin/sh

# 조회할 사이트 목록
BLISTS="
    cbl.abuseat.org
    dnsbl.sorbs.net
    bl.spamcop.net
    zen.spamhaus.org
"

# 에러 처리 (인자값 누락)
ERROR() {
  echo $0 ERROR: $1 >&2
  exit 2
}
[ $# -ne 1 ] && ERROR 'Please specify a single IP address'

# 역방향으로 IP 정렬
reverse=$(echo $1 |
sed -ne "s~^\([0-9]\{1,3\}\)\.\([0-9]\{1,3\}\)\.\([0-9]\{1,3\}\)\.\([0-9]\{1,3\}\)$~\4.\3.\2.\1~p")
if [ "x${reverse}" = "x" ] ; then
      ERROR  "IMHO '$1' doesn't look like a valid IP address"
      exit 1
fi

# 역방향 DNS 조회 수행
REVERSE_DNS=$(dig +short -x $1)
echo IP $1 NAME ${REVERSE_DNS:----}

# 반복 처리
for BL in ${BLISTS} ; do
    # 시간 출력
    printf $(env TZ=Asia/Seoul date "+%Y-%m-%d_%H:%M:%S")
    # 반전된 IP 와 블랙 리스트 출력
    printf "%-50s" " ${reverse}.${BL}."
    # dig 를 이용하여 블랙 리스트에서 IP 조회
    LISTED="$(dig +short -t a ${reverse}.${BL}.)"
    echo ${LISTED:----}
done

[출처] https://www.saotn.org/bash-check-ip-address-blacklist-status/

* 출처에서 더 많은 정보를 표시하고 있습니다. 소스가 필요하신 분은 꼭 한번 방문해 보시기 바랍니다.

 

# chmod 700 blcheck

# blcheck 10.20.30.40    // 체크하고자 하는 IP 를 인자값으로 넣는다.

 

(결과 : 블록되지 않은 상태)

IP 10.20.30.40 NAME ---
2021-12-20_23:49:57 [your_api_key].40.30.20.10.dnsbl.httpbl.org.     ---
2021-12-20_23:49:58 40.30.20.10.cbl.abuseat.org.                     ---
2021-12-20_23:49:58 40.30.20.10.dnsbl.sorbs.net.                     ---
2021-12-20_23:49:59 40.30.20.10.bl.spamcop.net.                      ---
2021-12-20_23:49:59 40.30.20.10.zen.spamhaus.org.                    ---
2021-12-20_23:49:59 40.30.20.10.combined.njabl.org.                  ---

 

(결과 : 블록 된 상태)

IP 10.20.30.40 NAME ---
2021-12-20_23:49:57 [your_api_key].40.30.20.10.dnsbl.httpbl.org.     ---
2021-12-20_23:49:58 40.30.20.10.cbl.abuseat.org.                    127.0.0.2
2021-12-20_23:49:58 40.30.20.10.dnsbl.sorbs.net.                     ---
2021-12-20_23:49:59 40.30.20.10.bl.spamcop.net.                      ---
2021-12-20_23:49:59 40.30.20.10.zen.spamhaus.org.                    127.0.0.4
2021-12-20_23:49:59 40.30.20.10.combined.njabl.org.                  ---

 

Cisco 에서 제공하는 메일 평판 정보와 비교를 해보면 (talosintelligence.com)

127.0.0.2 같은 결과가 출력되는 것이 블랙 리스트로 등록된 경우 입니다.

 

저는 위와 같이 [출처] 의 스크립트를 약간 수정하여 사용했는데

키발급 및 체크가 약간 소요되는 두 개의 라인을 체크 대상에서 제외하였으며

dnsbl.httpbl.org

combined.njabl.org

 

한국 표준 시간 사용을 위해 아래 내용으로 수정하였습니다.

env TZ=Asia/Seoul

 

필요하신 분은 [출처] 에 추가된 내용과 같이 별도 스크립트를 만들어서 반복 조회를 할 수 있습니다.

for address in `cat iplist.txt`;
   do ./blcheck $address;
   sleep 2;
   done

 

반응형

댓글()

MySQL 8.0 SSL 설정하기

리눅스/MySQL|2021. 12. 15. 15:25
반응형

MySQL 8.0.26 버전에서 SSL 적용을 해보았습니다.

낮은 버전도 다르지 않다고 생각합니다.

 

[사전 준비]

- ssl 파일 위치 : /usr/local/mysql/ssl

- 체크 사항 : mysql 계정이 접근 가능한 경로 (/root/ssl 은 안됨), 파일 권한 확인 (mysql 계정 읽기)

 

 

1. 설정

# vi /etc/my.cnf

 

[mysqld] 섹션에 아래 내용 추가

ssl_cert = /usr/local/mysql/ssl/sysdocu.tistory.com.crt
ssl_key = /usr/local/mysql/ssl/sysdocu.tistory.com.key
ssl_ca = /usr/local/mysql/ssl/ca-bundle.crt

 

 

2. 확인

mysql> show variables like '%ssl%';
+-------------------------------------+--------------------------------------------+
| Variable_name                       | Value                                      |
+-------------------------------------+--------------------------------------------+
| admin_ssl_ca                        |                                            |
| admin_ssl_capath                    |                                            |
| admin_ssl_cert                      |                                            |
| admin_ssl_cipher                    |                                            |
| admin_ssl_crl                       |                                            |
| admin_ssl_crlpath                   |                                            |
| admin_ssl_key                       |                                            |
| clone_ssl_ca                        |                                            |
| clone_ssl_cert                      |                                            |
| clone_ssl_key                       |                                            |
| have_openssl                        | YES                                        |
| have_ssl                            | YES                                        |
| mysqlx_ssl_ca                       |                                            |
| mysqlx_ssl_capath                   |                                            |
| mysqlx_ssl_cert                     |                                            |
| mysqlx_ssl_cipher                   |                                            |
| mysqlx_ssl_crl                      |                                            |
| mysqlx_ssl_crlpath                  |                                            |
| mysqlx_ssl_key                      |                                            |
| performance_schema_show_processlist | OFF                                        |
| ssl_ca                              | /usr/local/mysql/ssl/ca-bundle.crt         |
| ssl_capath                          |                                            |
| ssl_cert                            | /usr/local/mysql/ssl/sysdocu.tistory.com.crt    |
| ssl_cipher                          |                                            |
| ssl_crl                             |                                            |
| ssl_crlpath                         |                                            |
| ssl_fips_mode                       | OFF                                        |
| ssl_key                             | /usr/local/mysql/ssl/sysdocu.tistory.com.key |
+-------------------------------------+--------------------------------------------+

 

 

반응형

댓글()

CentOS 7 에서 httpd 2.4.51, PHP 8.0 소스 설치하기

리눅스/APACHE|2021. 12. 7. 14:47
반응형

1. httpd 관련 패키지 설치

# yum -y install gcc gcc-c++  libtermcap-devel gdbm-devel zlib* libxml* freetype* libjpeg* gd-* 

# yum -y install libpng* --skip-broken pcre-devel

 

 

2. apr 설치

# cd /usr/local/src

# wget https://archive.apache.org/dist/apr/apr-1.5.2.tar.gz

# tar xvzf apr-1.5.2.tar.gz

# cd apr-1.5.2

# ./configure --prefix=/usr/local/apr

# make

# make install

 

 

3. apr-util 설치

# cd ..

# wget https://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz

# tar xvzf apr-util-1.5.4.tar.gz

# cd apr-util-1.5.4

# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

# make

# make install

 

 

4. httpd 설치

# cd ..

# wget https://archive.apache.org/dist/httpd/httpd-2.4.51.tar.gz

# tar xvzf 

# cd httpd-2.4.51

# ./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-rewrite --enable-ssl --enable-so 

# make

# make install

 

 

5. PHP 관련 패키지 설치

# yum -y install sqlite-devel

 

 

6. PHP 설치

# cd ..

# wget https://www.php.net/distributions/php-8.0.12.tar.gz

# tar xvzf php-8.0.12.tar.gz

# cd php-8.0.12.tar.gz

# ./configure --prefix=/usr/local/php --with-mysqli --with-openssl=/usr/local/ssl --with-pdo-mysql=mysqlnd --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/apache/conf --with-zlib --disable-debug --enable-calendar --enable-ftp --enable-sockets --enable-sysvsem

# make

# make install

# cp -arp php.ini-production /etc/php.ini

 

 

6. httpd 및 PHP 기본 설정

# vi /usr/local/apache/conf/httpd.conf

ServerName localhost

<Directory /usr/local/apache/htdocs>
        Options FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
</Directory>

 

# vi /etc/php.ini

short_open_tag = On

date.timezone = "Asia/Seoul"

open_basedir = "/usr/local/apache/htdocs"

반응형

댓글()

OpenSSL 업그레이드 (소스 설치 / 1.0.1k to 1.1.1o in CentOS 7) 및 APM 적용하기

리눅스/OS 일반|2021. 12. 7. 14:15
반응형

1. OpenSSL 업그레이드

 

# openssl 현재 버전 확인
openssl version 
 
# openssl 설치 위치 확인
which openssl
# /usr/bin/openssl
 
# OpenSSL 지원 프로토콜 확인
openssl ciphers -v |awk {'print $2'} |sort |uniq
  
# 기본 라이브러리 설치
yum -y install gcc gcc-c++ perl pcre-devel zlib-devel wget
 
# 다운로드 및 소스 컴파일

cd /usr/local/src

wget https://www.openssl.org/source/openssl-1.1.1o.tar.gz
tar xvfz openssl-1.1.1o.tar.gz
cd openssl-1.1.1o/ 
./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib
make && make install
 
# 새로운 파일 생성하여 아래 한줄 추가하고 저장(:wq)한다. (라이브러리 등록)
vi /etc/ld.so.conf.d/openssl-1.1.1o.conf
/usr/local/ssl/lib
 
# 동적 링크 생성
ldconfig -v
 
ln -s /usr/local/ssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1
ln -s /usr/local/ssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1

링크 파일이 있으면 삭제 후 재실행


# 기존 openssl 이름 변경 (기존 패키지 버전명으로 백업)
mv /usr/bin/openssl /usr/bin/openssl1.0.1k
 
# 새로 설치한 버전 심볼릭 링크 생성
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
 
# 업데이트된 버전 확인
openssl version
 
# OpenSSL 지원 프로토콜 확인
openssl ciphers -v | awk '{print $2}' | sort | uniq
openssl1.0.2k ciphers -v | awk '{print $2}' | sort | uniq

출처: https://link2me.tistory.com/2023 [소소한 일상 및 업무TIP 다루기]

 

 

2. APM 적용

 

이미 설치된 APM 은 OpenSSL 업그레이드 버전이 자동으로 적용되지 않으므로

아래와 같은 방법으로 재설치를 하여 SSL 을 적용해야 합니다.

* SSL 설치 경로 : /usr/local/ssl

1) Apache

아래는 2.4.54 에서 확인되었습니다.

# ./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-rewrite --enable-module=ssl --enable-ssl=shared --with-ssl=/usr/local/ssl --enable-so

# make && make install

# /usr/local/apache/bin/apachectl restart

* 확인 방법 (httpd.conf 에서 mod_ssl.so 모듈이 로드 되어있어야 함)
# curl --head localhost

2) PHP

아래는 8.1.7 에서 확인되었습니다.

export PKG_CONFIG_PATH=/usr/local/ssl/lib/pkgconfig

# ./configure --prefix=/usr/local/php --with-mysqli --with-openssl=/usr/local/ssl --with-pdo-mysql=mysqlnd --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/apache/conf --with-zlib --disable-debug --enable-calendar --enable-ftp --enable-sockets --enable-sysvsem --with-curl --enable-mbstring

# make && make install

# /usr/local/apache/bin/apachectl restart

* 확인 방법
# php -r "echo phpinfo();" | grep -i openssl

 

3) MySQL

아래는 8.0.29 에서 확인되었습니다.

 

다른 버전의 라이브러리를 가져올 수 있도록 patchelf 패키지를 우선 설치하고 진행합니다.

# yum -y install patchelf

 

# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DSYSCONFDIR=/etc -DDEFAULT_CHARSET=utf8 -DWITH_SSL=/usr/local/ssl -DMYSQL_TCP_PORT=3306 -DWITH_EXTRA_CHARSETS=all -DDEFAULT_COLLATION=utf8_general_ci -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/src/mysql-8.0.29/include/boost_1_77_0 -DFORCE_INSOURCE_BUILD=1

 

# make && make install

 

* 확인 방법

# ldd /usr/local/mysql/bin/mysqld |grep ssl

 

4) CURL

아래는 7.88.1 에서 확인되었습니다.

# ./configure --with-ssl=/usr/local/ssl --prefix=/usr/local/curl

# make && make install

# mv /usr/bin/curl /usr/bin/curl.old    // 기존 curl 이 있을 경우

# ln -s /usr/local/curl/bin/curl /usr/bin/curl

 

* 확인 방법

# curl -V

 

반응형

댓글()

php 확장자 없이 페이지 접속 가능하게 하기

리눅스/APACHE|2021. 11. 30. 11:53
반응형

주소창에서 특정 URL 호출시 아래와 같이 파일의 확장자를 사용하지 않고

파일명 만으로 접근하게 하는 방법이 있습니다.

 

기존 접속 방식 : http://sysdocu.tistory.com/data.php

 

httpd.conf 파일을 수정하여 디렉토리 옵션에 MultiViews 를 추가합니다.

LoadModule negotiation_module modules/mod_negotiation.so // httpd 2.2 이상 버전에서 활성화 필요

<Directory /RESTAPI/html>
        Options MultiViews
        AllowOverride All
        Require all granted
</Directory>

아파치 재시작 후 아래와 같은 형태로 접근이 가능합니다.

 

 

신규 접속 방식 : http://sysdocu.tistory.com/data

 

반응형

댓글()