php 5.2.17 소스 컴파일시 오류 (node.c: In function 'dom_canonicalization')

리눅스/PHP|2019. 2. 13. 16:02
반응형

php 소스 컴파일시 아래와 같은 오류가 발생하는 경우가 있다. 


gcc 4.7 버전에서 아래와 같은 오류가 발생한다. 


/home/segio_php/php-5.2.17/ext/dom/node.c: In function ‘dom_canonicalization’:

/home/segio_php/php-5.2.17/ext/dom/node.c:1953:21: error: dereferencing pointer to incomplete type

/home/segio_php/php-5.2.17/ext/dom/node.c:1955:5: error: dereferencing pointer to incomplete type



이때는 아래와 같은 순서로 php 소스를 패치하면 오류가 사라진다. 


(소스 디렉토리에서)

# wget -O php.patch  https://mail.gnome.org/archives/xml/2012-August/txtbgxGXAvz4N.txt

# patch -p0 -b < php.patch

patching file ext/dom/node.c

Hunk #1 succeeded at 1950 (offset 55 lines).

patching file ext/dom/documenttype.c

Hunk #1 succeeded at 215 (offset 10 lines).

patching file ext/simplexml/simplexml.c

Hunk #1 succeeded at 1343 (offset -74 lines).


patch 명령어를 찾을 수 없다고 할 경우 yum -y install patch


위와 같이 패치를 적용한 후 컴파일을 하면 문제없이 진행된다. 


[출처] http://blog.naver.com/ssik425/10175143994



===================== php.patch 내용 ====================

--- ext/dom/node.c	2012-08-06 17:49:48.826716692 +0800
+++ ext/dom/node.c	2012-08-06 17:52:47.633484660 +0800
@@ -1895,9 +1895,17 @@ static void dom_canonicalization(INTERNA
         RETVAL_FALSE;
     } else {
 		if (mode == 0) {
+#ifdef LIBXML2_NEW_BUFFER
+            ret = xmlOutputBufferGetSize(buf);
+#else
 			ret = buf->buffer->use;
+#endif
 			if (ret > 0) {
+#ifdef LIBXML2_NEW_BUFFER
+                RETVAL_STRINGL((char *) xmlOutputBufferGetContent(buf), ret, 1);
+#else
 				RETVAL_STRINGL((char *) buf->buffer->content, ret, 1);
+#endif
 			} else {
 				RETVAL_EMPTY_STRING();
 			}
--- ext/dom/documenttype.c	2012-08-06 18:02:16.019640870 +0800
+++ ext/dom/documenttype.c	2012-08-06 18:06:16.612228905 +0800
@@ -205,7 +205,13 @@ int dom_documenttype_internal_subset_rea
 		if (buff != NULL) {
 			xmlNodeDumpOutput (buff, NULL, (xmlNodePtr) intsubset, 0, 0, NULL);
 			xmlOutputBufferFlush(buff);
+
+#ifdef LIBXML2_NEW_BUFFER
+			ZVAL_STRINGL(*retval, xmlOutputBufferGetContent(buff),
+			             xmlOutputBufferGetSize(buff), 1);
+#else
 			ZVAL_STRINGL(*retval, buff->buffer->content, buff->buffer->use, 1);
+#endif
 			(void)xmlOutputBufferClose(buff);
 			return SUCCESS;
 		}
--- ext/simplexml/simplexml.c	2012-08-06 18:10:44.621017026 +0800
+++ ext/simplexml/simplexml.c	2012-08-06 18:12:48.016270419 +0800
@@ -1417,7 +1417,12 @@ SXE_METHOD(asXML)
 
 			xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, ((xmlDocPtr) sxe->document->ptr)->encoding);
 			xmlOutputBufferFlush(outbuf);
+#ifdef LIBXML2_NEW_BUFFER
+			RETVAL_STRINGL((char *)xmlOutputBufferGetContent(outbuf),
+			               xmlOutputBufferGetSize(outbuf), 1);
+#else
 			RETVAL_STRINGL((char *)outbuf->buffer->content, outbuf->buffer->use, 1);
+#endif
 			xmlOutputBufferClose(outbuf);
 		}
 	} else {

======================================================




반응형

댓글()

네트워크 장치명 변경 (CentOS 7)

리눅스/Network|2019. 2. 13. 08:36
반응형

CentOS 7 버전 (Kernel 3.x 이상) 에서는 네트워크 장치명이 기존의 eth가 아닌 eno 등으로 자동으로 부여된다.

이 부분을 기존처럼 eth로 사용하기 위해서는 grub 파일을 수정 후 리빌드가 필요하다.


 

1. 기존 CentOS7 네트워크 장치명 확인

[root@sysdocu ~]# ifconfig

> eno1 로 확인



2. grub 파일 수정

[root@sysdocu ~]# vi /etc/default/grub

옵션 추가

GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet net.ifnames=0 biosdevname=0"

 


3. 적용

[root@sysdocu ~]# grub2-mkconfig -o /boot/grub2/grub.cfg



4. 이름 변경

- ifcfg-eno1 파일을 ifcfg-eth0 으로 변경

- 파일 내용의 명칭도 수정

 


5. 리부팅



반응형

댓글()

간단한 iptables 기본 방화벽 형식 (특정 IP, PORT 제외하고 모두 차단)

리눅스/Security|2019. 2. 12. 16:16
반응형

*filter

:INPUT ACCEPT [0:0]

:FORWARD ACCEPT [0:0]

:OUTPUT ACCEPT [0:0]

-A INPUT -m tcp -p tcp -s 192.168.10.2 -d 192.168.10.2 -j ACCEPT  // 본 서버에서는 로컬 모든 포트 접속 가능하게 한다.

-A INPUT -m tcp -p tcp -s 192.168.10.3 -d 192.168.10.2 --dport 222 -j ACCEPT

-A INPUT -m tcp -p tcp -s 192.168.10.4 -d 192.168.10.2 --dport 222 -j ACCEPT

-A INPUT -m tcp -p tcp -d 192.168.10.2 -j DROP

COMMIT



192.168.10.3 / 4 : client
192.168.10.2 : server



룰 문제 없음 확인.

반응형

댓글()

CentOS 7 에 iptables 설치

리눅스/Security|2019. 2. 12. 13:22
반응형

구글링을 좀 했더니 CentOS 7 부터는 firewalld 라는 방화벽 데몬이 따로 돌아간단다. 

예전처럼 iptables를 사용하기 위해서는 systemctl 설정을 좀 건드려 줘야한다.



우선 작동 중인 firewalld 데몬을 중지 시킨 후 재부팅 시에도 올라오지 않도록 설정한다.


systemctl stop firewalld

systemctl mask firewalld



다음으로 iptables 명령어와 연관된 패키지를 설치한다. 

CentOS 설치할 때의 옵션에 따라 설치 되었을 수도 있다. 

나는 웹 서버 구성으로 설치 했더니 이미 설치 되어 있었다.


yum -y install iptables-services



iptables 서비스 데몬이 재부팅시에 자동으로 올라오도록 만들자

systemctl enable iptables



기본 룰셋 위치는 /etc/sysconfig/iptables 이다.



[출처] https://luckyyowu.tistory.com/286 [요우의 내맘대로 블로그]

반응형

댓글()

CentOS 7, OpenVAS 9 에서 PDF 파일 생성되지 않을때

리눅스/Security|2019. 2. 7. 12:07
반응형

CentOS 7 에 설치된 OpenVAS 9 에서 PDF 리포트가 생성되지 않을때 확인할 방법입니다.


먼저 아래와 같이 명령을 실행하면 PDF 리포트 가능 여부가 확인됩니다.

# openvas-check-setup


 ...

 Step 9: Checking presence of optional tools ...

       OK: pdflatex found.

       WARNING: PDF generation failed, most likely due to missing LaTeX packages. The PDF report format will not work.

       SUGGEST: Install required LaTeX packages.

 ...


그러면 아래와 같이 필요 패키지를 설치해보세요

 # yum install texlive-collection-latexextra

그래도 The package texlive-collection-latexextra is not available 라는 메세지가 출력되며 설치되지 않는다면, 아래와 같은 방법으로 해결해야 합니다.


1) 기존 설치 파일 모두 제거

# yum remove openvas openvas-manager


2) textlive 설치

# cd/usr/local/src

# wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz

# tar xvzf install-tl-unx.tar.gz

# cd install-tl-*

# ./install-tl


"options (O)" 누른 뒤 "create symlinks (L)" 를 선택 합니다.


for the texlive-binaries to: /usr/bin

manpages to: /usr/share/man

to: /usr/share/info


다시 메인페이지로 돌아가서 설치를 합니다.

Now return (R) to the main menu an install (I) texlive 


그다음, openvas-manager 를 설치해야 하는데, 그냥 yum install 할 경우 textlive 가 잘못 설치되어질 수 있으므로

openvas-manager 패키지만 받아 의전성 무시하고 설치를 합니다.


# yum install --downloadonly --downloaddir=/tmp openvas-manager

# rpm -i --nodeps openvas-manager-*.rpm


그리고 나머지 openvas 를 설치합니다. openvas 설치시 greenbone-security-assistant 도 같이 설치됩니다.

# yum install openvas


추가 파일 설치 및 환경 설정을 합니다.

# openvas-setup


gsad 구동 상태에서 아래와 같이 설정 상태를 체크하면, PDF 리포트 생성 가능한것이 보입니다.


 # openvas-check-setup

 ...

 Step 9: Checking presence of optional tools ...

       OK: pdflatex found.

       OK: PDF generation successful. The PDF report format is likely

 to work.

 ...



[출처] http://alfaiacomlinux.blogspot.com/2018/04/openvas-dont-download-pdf-files-in.html

반응형

댓글()

CentOS 7 에서 본딩 (bonding) 구성

리눅스/Network|2019. 2. 1. 02:25
반응형

본딩 모듈 로드

[root@sysdocu ~]# modprobe --first-time bonding

[root@sysdocu ~]​# lsmod | grep bonding

본딩 인터페이스 생성

[root@sysdocu ~]# vi /etc/sysconfig/network-scripts/ifcfg-bond0

BONDING_OPTS=mode=balance-rr

TYPE=Bond

BONDING_MASTER=yes

BOOTPROTO=none

DEFROUTE=yes

NAME=bond0

DEVICE=bond0

ONBOOT=yes

IPADDR=192.168.10.2

PREFIX=30    // 하단의 서브넷 마스크 변환표를 참조하여 NETMASK 값을 넣어준다.

GATEWAY=192.168.10.1


* 서브넷 마스크 변환표

SlashDotted DecimalSlashDotted DecimalSlashDotted Decimal
/8255.0.0.0/16255.255.0.0/24255.255.255.0
/9255.128.0.0/17255.255.128.0/25255.255.255.128
/10255.192.0.0/18255.255.192.0/26255.255.255.192
/11255.224.0.0/19255.255.224.0/27255.255.255.224
/12255.240.0.0/20255.255.240.0/28255.255.255.240
/13255.248.0.0/21255.255.248.0/29255.255.255.248
/14255.252.0.0/22255.255.252.0/30255.255.255.252
/15255.254.0.0/23255.255.254.0/31255.255.255.254


Slave 인터페이스로 사용할 eth0,eth1 파일 수정

[root@sysdocu ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

NAME=bond-slave-eth0

DEVICE=eth0

BOOTPROTO=none

ONBOOT=yes

MASTER=bond0

SLAVE=yes 


[root@sysdocu ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1

NAME=bond-slave-eth1

DEVICE=eth1

BOOTPROTO=none

ONBOOT=yes

MASTER=bond0

SLAVE=yes  



적용

[root@sysdocu ~]# systemctl restart network


* 주의 : 당연하지만, 기존 다른 네트워크 설정파일에 동일한 IP 가 셋팅되고, ONBOOT=yes 로 되어 있는경우 올라오지 않음


반응형

댓글()