how to upgrade openssl for apache 2.2.29 – still using old 0.9.8 version

I am running a 10.04LTE server where I do want to upgrade openssl for apache.

Therefore I downloaded openssl 1.0.2c and apache 2.2.29 and compiled both. The server is starting, but is using the old ssl version:

curl --head http://localhost
HTTP/1.1 200 OK
Date: Mon, 22 Jun 2015 06:00:06 GMT
Server: Apache/2.2.29 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8k
Last-Modified: Sun, 18 Mar 2012 19:56:07 GMT

However, Openssl is installed in new version:

/usr/local/ssl/bin/openssl version
OpenSSL 1.0.2c 12 Jun 2015

While the original version stayes in place:

openssl version
OpenSSL 0.9.8k 25 Mar 2009

I compiled apache with:

./configure --with-included-apr --prefix=/usr/local/apache2 --enable-so     
--enable-rewrite --with-ssl=/usr/local/ssl --enable-ssl=shared
--enable-deflate --enable-expires --enable-headers 

Apache did not start before I included:

LoadModule ssl_module /usr/lib/apache2/modules/mod_ssl.so

According to the mod ssl website this is only available for apache 1.x

Not sure what is going wrong here. Thank you for any help!

1 Answer
1

The problem is that your Apache installation is unable to link the shared libraries of your new OpenSSL installation. Run the command ldd /usr/local/apache/modules/mod_ssl.so (with the apporpriate path to your mod_ssl.so). You’ll see that mod_ssl.so is not linking to the libraries in /usr/local/ssl/lib

You have a couple options to fix the problem:

Option #1 – Link in the libraries:

Open /etc/ld.so.conf.d/local.conf for editing and add the following line: /usr/local/openssl/lib

Re-compile Apache (remember to make clean) and it should work.

If that doesn’t work. You could also try specifying LDFLAGS directly with your configure command:

LDFLAGS=-L/usr/local/ssl/lib \ ./configure --with-included-apr --prefix=/usr/local/apache2 --enable-so     
--enable-rewrite --with-ssl=/usr/local/ssl --enable-ssl=shared
--enable-deflate --enable-expires --enable-headers

Option #2 – Upgrade the system OpenSSL:

Re-install OpenSSL with the config line ./config --prefix=/usr --openssldir=/usr/local/openssl shared

When the prefix is not specified in your config line, the OpenSSL installer will default to /usr/local/ssl.

Quick install instructions:

cd /usr/local/src
wget https://www.openssl.org/source/openssl-1.0.2-latest.tar.gz
tar -zxf openssl-1.0.2*
cd openssl-1.0.2*
./config --prefix=/usr --openssldir=/usr/local/openssl shared
make
make test
make install

UBuntu 16.04 – 부팅시 rc.local 파일 실행 되지 않을 때 (systemd 기반 rc.local 활성화)

우분투 16.04 버전은 systemd 기반으로 PID들이 관리된다,
rc.local을 부득이 하게 사용할 일이 생겨 사용하려 했으나 활성화가 안되어 있어서 활성화 방법을 찾아서 기록

 

/lib/systemd/sytem/rc-local.service 을 수정한다.

 

가장 하단에 

 

[#M_ more.. | less.. |[Install]
WantedBy=multi-user.target _M#]

 

​위 와 같이 추가 시켜준 뒤 

[#M_ more.. | less.. |systemctl enable rc-local.service _M#]

 

​rc.local 서비스를 활성화 시켜준다.

Install을 추가시켜주지 않고 활성화를 시켜주려 하면, 해당 부분이 없어 활성화가 되지 않는다.

 

rc.local이 제데로 동작하는지 테스트는 서비스 재시작 뒤 확인 해주면 된다.

[#M_ more.. | less.. |service rc.local restart
systemctl status rc-local.service_M#]

 

​정상적으로 동작한다면 

 

[#M_ more.. | less.. |

root@stream:~# systemctl status rc-local.service

● rc-local.service – /etc/rc.local Compatibility

   Loaded: loaded (/etc/systemd/system/rc-local.service; static; vendor preset: enabled)

  Drop-In: /lib/systemd/system/rc-local.service.d

           └─debian.conf

   Active: active (running) since Mon 2018-04-02 15:23:37 KST; 3min 43s ago

  Process: 1434 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS)

    Tasks: 87

   Memory: 111.9M

      CPU: 3.000s

   CGroup: /system.slice/rc-local.service

           ├─1529 /usr/local/bin/tvheadend –config /home/TVHeadEnd/.hts/tvheadend/ –user root –gr

           └─1530 /usr/local/bin/istatserver -d

 

Apr 02 15:23:38 stream tvheadend[1529]: scanfile: DVB-C – loaded 18 regions with 60 networks

Apr 02 15:23:38 stream tvheadend[1529]: scanfile: ATSC-T – loaded 2 regions with 12 networks

Apr 02 15:23:38 stream tvheadend[1529]: scanfile: ATSC-C – loaded 1 regions with 5 networks

Apr 02 15:23:38 stream tvheadend[1529]: scanfile: ISDB-T – loaded 2 regions with 1297 networks

Apr 02 15:24:37 stream tvheadend[1529]: iptv: m3u parse: 0 new mux(es) in network ‘IPTV’ (total 116)

 _M#]

active (활성화) 되었다고 표시되며, 하단에 로그도 확인이 가능하다.

Ubunt 16.04 – apt-get install 시, “E: Failed to fetch 403 Forbidden” 오류 발생시,

Ubuntu 16.04에서, 
apt-get install 로 package 설치시,

해당 패키지에 접근할 수 없다는 오류

E: Failed to fetch  ‘패키지 이름’ 403  Forbidden

가 발생시, 
간단하게

다음과 같이 해결 할 수 있다.

우선 /etc/appt/sources.list 파일을 백업 한후,

기존 sources.list 내용을 지우고 다음과 같이 2줄을 추가.

[#M_ more.. | less.. |deb http://archive.ubuntu.com/ubuntu xenial main universe restricted multiverse
deb-src http://archive.ubuntu.com/ubuntu xenial main universe restricted multiverse
_M#]

하고 다시

apt-get update 를 해주면 정상적으로 package가 설치됨.

Synology NAS DSM 6.2 업데이트 후, SSH 로그인 실패 현상

DSM 6.2 업데이트 이전에는 잘되던 SSH가 갑지가 6.2 업데이트 후 SSH 접속이 되지 않을 경우,

다음에 따라 수정할 것.

1. telnet 활성화.
2. telnet 을 통해 admin 계정 접속 후,
3. 다음의 파일 수정
  파일 : /etc/ssh/sshd_config

ChallengeResponseAuthentication 는 yes
UsePAM 는 no
로 변경 후,

저장
4. SSH 재시작
  명령어 : killall -1 sshd

이후 SSH 가 접속되는 것을 확인 후 telnet은 비활성화

Ubuntu – MySQL 서버 삭제 후 재 설치 방법

1. MySQL 서버 정지.

/etc/init.d/mysql stop

2. MySQL 삭제

apt-get remove dbconfig-mysql
apt-get purge mysql*
apt-get autoremove
apt-get autoclean

3. MySQL 데이터 디렉토리 삭제
rm -rfv /etc/mysql /var/lib/mysql

4. MySQL 서버 설치
apt-get upgrade
apt-get dist-upgrade
apt-get install mysql-server

리눅스 “umount : device is busy” 발생시 강제 umount 방법

페도라든 우분트든,.. 내가 사용하고 있는 리눅스 시스템에서, 분명히 사용중이 아닌 경우에도 
mount된 디렉토리를 umount 하고자 할 때,
특정 사용자 & 프로세스가 해당 디렉토리를 사용하고 있다며 

[root@linux ~]# umount /backup
umount: /backup: device is busy.        
(In some cases useful info about processes that use the device is found by lsof(8) or fuser(1))


라고 
“device is busy” 메세지가 발생하며 umount 가 되지 않을 때가 있다. 

누가? 또는 어떤 프로세스가 해당 mount 영역을 사용하고 있는지 확인 하고 싶을때는

# fuser -cu /backup

이 경우 umount를 위해 해당 프로세스를 강제로 kill 하는 방법은 아래와 같다.

# fuser -ck 마운트디렉토리

ex) fuser -ck /backup

위 명령으로 프로세스를 kill 하고 umount를 재시도하면 정상적으로 mount가 해제 된다.

그놈 가상파일시스템(Gnome Virtual File System) 버그 – .gvfs


출처 : http://iprize.tistory.com/search/.gvfs
여러가지 테스트 목적으로 Fedora 13 Alpha 버전을 사용하고 있다. 하지만 언제부터인가 홈 디렉토리에서 파일 목록을 볼 때 멈춰버리는 경우가 발생하였다. 원인을 찾기 위해 며칠간 이것 저것 살펴보았지만 찾지 못하다 오늘 루트로 로긴하여 ‘ls -al’을 해보았더니 아래와 같은 출력을 볼 수 있었다.

 drwxr-xr-x 9 iprize iprize 4096 Apr  7 11:54 .
drwxr-xr-x 6 root   root   4096 Oct  2  2009 ..
-rw——- 1 iprize iprize  138 Apr  7 11:53 .bash_history
drwxr-xr-x 7 root   root   4096 Apr  7 11:17 Desktop
drwx—— 2 iprize iprize 4096 Apr  7 11:54 .gconf
drwx—— 2 iprize iprize 4096 Apr  7 11:54 .gconfd
d??????????  ? ?        ?             ?            ? .gvfs
drwxr-xr-x 2 iprize iprize 4096 Apr  7 11:54 .nautilus
drwx—— 2 iprize iprize 4096 Apr  7 11:54 .pulse
drwxr-xr-x 2 root   root   4096 Apr  7 11:24 .vnc

 중간에 보면 .gvfs의 디렉토리 정보가 이상하게 표시되는 현상을 볼 수 있다. 이 때문에 노틸러스로 문제의 홈디렉토리를 보려고 하면 디렉토리 내용이 뜨지 않고 빈 화면으로 표시되며 또 터미널에서 ‘ls -al’을 실행하면 결과값이 제대로 출력되지 않고 멈춰버리는 현상이 발생한다.

이 문제를 구글링해서 찾아본 결과 이는 Fedora 13 Alpha의 문제가 아니라 Gnome Virtual File system의 문제였다1

위 문제를 해결하는 방법은 다음과 같다.

  • vfs-fuse-daemon을 vfs-fuse-daemon.bak 등으로 파일명을 변경한다. 파일의 위치는 locate을 이용하여 찾도록 하자. 보통은 /usr/libexec/ 디렉토리에 존재한다.
  • ‘touch vfs-fuse-daemon’ 명령으로 새로운 파일을 생성한 후 파일 속성을 644로 변경한다.
  • 재부팅하여 ‘ls -al’ 명령이 제대로 실행되는지 확인한다.


레드햇 버그 트래킹 시스템인 버그질라에 등록되어 있는 버그지만 아직 해결되지 않은 문제인듯 하다2


  1. http://forums.fedoraforum.org/showthread.php?t=229819 [본문으로]
  2. https://bugzilla.redhat.com/show_bug.cgi?id=540574 [본문으로]

[MySQL] log-bin 파일 줄이기

MySQL에서 사용하는 log-bin이라는 옵션은 사용된 쿼리들이 로깅되는 파일이며 innodb 혹은 replication 등에 사용된다. 하지만 이 파일의 문제점은 무한정 늘어난다는 것이다. relay-log-space-limit 이란 옵션이 있는데 이는 replication에 사용되는 용량을 제한하는 옵션이라 큰 해결은 안되다.

이를 해결하기 위한 방법으로 아래의 쿼리를 실행해본다.

 

PURGE MASTER LOGS BEFORE DATE_SUB(CURRENT_DATE, INTERVAL 30 DAY)

INTERVAL 30 DAY란 30일 이전의 로깅 정보를 삭제하게 된다.

 

# root 계정으로 실행

>mysql -u root -p -e “PURGE MASTER LOGS BEFORE DATE_SUB(CURRENT_DATE, INTERVAL 30 DAY)”

>비번 입력

 

# 위의 파일을 가지고 복구

/usr/local/mysql/bin/mysqlbinlog /usr/local/mysql/var/localhost-bin.00001>backup.sql 로 일반 쿼리로 변환

 

# 특정 디비만 가지고 올 경우

-d 디비명

 

# 시간 지정

–start-datetime=”2010-09-30 01:00:00″ –stop-datatime=”2010-10-09 01:00:00″

 

# 복원

/usr/local/mysql/bin/mysql -u 사용자 -p < backup.sql

CentOS 에서 Iptable 적용이 되지 않을 때

*. smtp 인증 기능은 Relay 설정 없이 계정만으로 외부에서 메일 서버를 이용하게 하는 방법이다. 기본적으로 Relay로 가능하니 필요없는 기능이나, 유동 IP대역에서 메일 서버를 활용해야 하는 경우 필요하다. (관련 설정 참조 : 클릭.)
*. SELinux가 활성화되어 있는 상태에서는 setup or system-config-securitylevel 명령을 이용하거나, iptable 설정을 직접 변경하여 외부 접속을 허용해줘야 한다.
*. SELinux가 비활성화되어 있는 경우, /etc/hosts.allow에 다음의 내용을 추가해줘야 한다.
# vi /etc/hosts.allow
sendmail : ALL : allow (보안 정책에 맞게 ALL을 수정해주길..)

Linux CentOS m4 명령어 sendmail.cf 만들때 에러 해결 방법



CentOS 4.4에 Sendmail로 송신 테스트를 하기 위해 설치 하던중

sendmail.cf를 만드는 과정에서 다음과 같은 에러가 났다.

에러:

]# m4 /etc/mail/sendmail.mc > !
/etc/mail/sendmail.cf

/etc/mail/sendmail.mc:10: m4: cannot open
`/usr/share/sendmail-cf/m4/cf.m4′: No such file or directory


검색해보니 sendmail-cf가 설치되어 있지 않아서 그런듯
했다.

(CentOS4.4에 기본적으로 들어있지 않는듯 하다.)







해결:

$ yum install sendmail-cf



위와 같은 방법으로 설치 해서 해결.