Wednesday, February 3, 2010

Compile NRPE ไม่ผ่าน

เวลาที่เรา Install NRPE บน Linux เมื่อเราสั่ง make all แล้วพบว่า เกิด error ขึ้นว่า


/root/nrpe-2.12/src/nrpe.c:244: undefined reference to `get_dh512'


ให้เราทำดังนี้

1. ติดตั้ง openssl โดยการใช้คำสั่ง aptitude install openssl
2. พิมพ์คำสั่ง openssl dhparam -C 512 ลงไป
3. ระบบจะ print ข้อความออกมา เป็น C Code ประมาณนี้

DH *get_dh512()
{
static unsigned char dh512_p[]={
0xC8,0xBD,0x70,0xCF,0x64,0x58,0x42,0x0D,0x82,0x95,0x90,0x1A,
0x58,0xA3,0xF9,0xE0,0x67,0x7D,0xDD,0x08,0xB6,0x32,0xC2,0x45,
0x8C,0x7E,0x64,0x11,0x05,0xCC,0x8B,0x5B,0x2C,0x1F,0xFF,0x9A,
0x39,0x0A,0x3B,0x53,0xFA,0x1C,0x85,0xAE,0xFA,0x85,0x52,0x7D,
0x6C,0xEA,0x31,0xAF,0xBB,0x88,0x0E,0xB0,0x94,0x72,0x28,0x75,
0x00,0x55,0x25,0x3B,
};
static unsigned char dh512_g[]={
0x02,
};
DH *dh;

if ((dh=DH_new()) == NULL) return(NULL);
dh->p=BN_bin2bn(dh512_p,sizeof(dh512_p),NULL);
dh->g=BN_bin2bn(dh512_g,sizeof(dh512_g),NULL);
if ((dh->p == NULL) || (dh->g == NULL))
{ DH_free(dh); return(NULL); }
return(dh);
}

4. copy code นี้เอาไว้ จากนั้นให้เอาไปวางไว้ในพาธ include/dh.h ที่อยู่ใน folder nrpe
5. ลองสั่ง make all ใหม่อีกครั้ง



ที่มา :http://www.linuxquestions.org/questions/linux-software-2/nagios-nrpe-undefined-reference-to-getdh512-613815/