yum download only

Posted by 주원이^^
2014. 8. 11. 09:26 리눅스/리눅스설정방법
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

리눅스 yum을 활용한 rpm 다운 받기


openssl 취약점 문제로 인해서 서버에 패치 할 일이 생겼습니다.

그래서 하는 패치 or 업데이트를 하는 방법을 알아보겠습니다.


서버가 리눅스계열이고, 인터넷만 된다면 yum update openssl 명령을 수행하면 

간단히 openssl에 대해서 패치가 가능합니다.


하지만 인터넷이 안되면?!!! 


방법

yum 을 이용하여 업데이트 된 rpm을 다운 받아 설치하면 됩니다.


1. 인터넷 되는 서버에서 yum plugin을 설치

 - # yum install yum-downloadonly





2. 사용방법

패키지명 다운로드받기 다운로드 받을경로

# yum update oepnssl -y --downloadonly --downloaddir=/tmp

해당경로에 파일이 다운로드됨


openssl 을 미리 yum으로 설치 해서 파일이 다운로드가 ㅠㅠ


취약점 업데이트된 파일리스트 보면

openssl 32bit와 64bit 그리고 개발버전 32bit,64bit가 있네요. RPM으로



4. RPM 설치

- 받은 rpm으로 설치 하면됩니다.

#rpm -Uvh openssl-*.rpm


How To Download a RPM Package Using yum Command Without Installing On Linux

http://www.cyberciti.biz/faq/yum-downloadonly-plugin/

부팅후 IP변경되면 메일로 알려주기

Posted by 주원이^^
2014. 8. 4. 16:04 리눅스/스크립트
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

###########################

Boot_IP_Check

###########################

 

#!/bin/bash

MAIL_LIST="이메일"
LOG_DIR=/Boot_IP_Check
LOG_FILE=$LOG_DIR/IP_Check
SUBJECT="BOOT IP_Address Change"
MAIL_BODY=""
if [ ! -d $LOG_DIR ]; then

mkdir -p $LOG_DIR

 

fi

if [ ! -e $LOG_FILE ]; then
        ifconfig eth0 | awk '{ if( NR == "2" ) print $2 }' > $LOG_FILE

        elif [ "`cat $LOG_FILE`" != "`ifconfig eth0 | awk '{ if( NR == "2" ) print $2}'`" ]; then
                rdate -s time.bora.net
                TIME=`date`
                MAIL_BODY="before `cat $LOG_FILE`  |  after `ifconfig eth0 | awk '{ if( NR == "2" ) print $2}'` :::::::::$TIME"
                echo $MAIL_BODY | /bin/mail -s "$SUBJECT" "$MAIL_LIST"
                ifconfig eth0 | awk '{ if( NR == "2" ) print $2 }' > $LOG_FILE
fi

 

 

vi /etc/rc.d/rc.local

 

/Boot_IP_Check

'리눅스 > 스크립트' 카테고리의 다른 글

특정데몬 모니터링  (0) 2014.11.06
watch  (0) 2014.11.05
clamav 리눅스용 바이러스 실행  (0) 2014.08.01
ssh telnet 로그인 실패 (실패안하면 발송안함)  (0) 2014.07.29
엔탑(ntop) 설치  (0) 2013.06.21

clamav 리눅스용 바이러스 실행

Posted by 주원이^^
2014. 8. 1. 13:45 리눅스/스크립트
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

 

yum install clamav clamd

 

vi /etc/freshclam.conf 수정

 

#DatabaseMirror db.xy.clamav.net

DatabaseMirror db.us.clamav.net  로변경

 

freshclam   <--- clam 업데이트

 

clamscan -r /home /etc /var /root -l /var/log/clamav/scan.log

 

vi /etc/crontab

00 04 * * * root clamscan -r /home /etc /var /root -l /var/log/clamav/scan.log

00 03 * * * root freshclam

'리눅스 > 스크립트' 카테고리의 다른 글

watch  (0) 2014.11.05
부팅후 IP변경되면 메일로 알려주기  (0) 2014.08.04
ssh telnet 로그인 실패 (실패안하면 발송안함)  (0) 2014.07.29
엔탑(ntop) 설치  (0) 2013.06.21
대역폭 제한 툴  (0) 2013.05.23

GPT 2TB 이상 하드디스크 사용 파티셔닝

Posted by 주원이^^
2014. 7. 30. 13:18 리눅스/기본정보(OS)
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
1. fdisk에서 2TB 이상의 파티션을 지원하지 못하므로, 2TB 이상 파티션을 구성하기 위해서는 다음과 같은 방법에 따라 작업을 해줘야 한다.

2. 우선 fdisk를 이용해 현재 전체 하드 용량을 체크한다.

[root@storage ~]#
fdisk -l
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1033     8193150   83  Linux
/dev/sda3            1034        1288     2048287+  83  Linux
/dev/sda4            1289        9729    67802332+   5  Extended
/dev/sda5            1289        2308     8193118+  83  Linux
/dev/sda6            2309        2569     2096451   82  Linux swap / Solaris
/dev/sda7            2570        2696     1020096   83  Linux
/dev/sda8            2697        9729    56492541   83  Linux
Disk /dev/sdb: 2993.9 GB, 2993996955648 bytes
255 heads, 63 sectors/track, 363999 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

3. parted 명령으로 파티셔닝 한다.


[root@storage ~]# part
parted     partprobe  partx     
[root@storage ~]# parted /dev/sdb   --> 파티셔닝 할 스토리지 지정.
GNU Parted 1.8.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt                                                     
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes                                                              
New disk label type?  [gpt]? gpt
(parted) print  --> 하드 정보 확인.                                       
Model: INTEL SRCSATAWB (scsi)
Disk /dev/sdb: 2994GB
Sector size (logical/physical): 512B/512B
Partition Table:
gpt
Number  Start  End  Size  File system  Name  Flags
(parted) gpt                                                             
  check NUMBER                             do a simple check on the file system
  cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER   copy file system to another partition
  help [COMMAND]                           prints general help, or help on COMMAND
  mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)
  mkfs NUMBER FS-TYPE                      make a FS-TYPE file system on partititon NUMBER
  mkpart PART-TYPE [FS-TYPE] START END     make a partition
  mkpartfs PART-TYPE FS-TYPE START END     make a partition with a file system
  move NUMBER START END                    move partition NUMBER
  name NUMBER NAME                         name partition NUMBER as NAME
  print [free|NUMBER|all]                  display the partition table, a partition, or all devices
  quit                                     exit program
  rescue START END                         rescue a lost partition near START and END
  resize NUMBER START END                  resize partition NUMBER and its file system
  rm NUMBER                                delete partition NUMBER
  select DEVICE                            choose the device to edit
  set NUMBER FLAG STATE                    change the FLAG on partition NUMBER
  toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition NUMBER
  unit UNIT                                set the default unit to UNIT
  version                                  displays the current version of GNU Parted and copyright information
(parted) mkpart                                                          
Partition name?  []?   --> 엔터                                                    
File system type?  [ext2]?   --> 엔터                                            
Start? 0    --> 시작점을 지정해 준다. 0으로 지정.                                                             
End? 3.0TB    --> 용량을 확인한 뒤 마지막 지점을 지정한다.(2994GB=3.0TB)                                                            
(parted) q   --> 빠져나가기.                                                            
Information: Don't forget to update /etc/fstab, if necessary.

4. 정상적으로 잡혀있는지 /proc/partitions 로 확인한다.  
          
[root@storage ~]# cat /proc/partitions
major minor  #blocks  name
   8     0   78150744 sda
   8     1     104391 sda1
   8     2    8193150 sda2
   8     3    2048287 sda3
   8     4          1 sda4
   8     5    8193118 sda5
   8     6    2096451 sda6
   8     7    1020096 sda7
   8     8   56492541 sda8
   8    16 2923825152 sdb
   8    17 2923825118 sdb1  -->
정상적임을 확인.

5. /dev/sdb1 을 ext3 방식으로 포맷.

[root@storage ~]# mkfs.ext3 /dev/sdb1
mke2fs 1.39 (29-May-2006)
warning: 503 blocks unused.
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
366191712 inodes, 730955776 blocks
36547813 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
22307 block groups
32768 blocks per group, 32768 fragments per group
16416 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000, 214990848, 512000000, 550731776, 644972544
Writing inode tables: done                           
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

6. 포맷 완료된 sdb1 을 마운트 한다.

[root@storage ~]# cd /
[root@storage /]# mkdir data
[root@storage /]# mount /dev/sdb1 /data
[root@storage /]# df -Th
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda3     ext3    1.9G  357M  1.5G  20% /
/dev/sda8     ext3     53G  181M   50G   1% /home
/dev/sda7     ext3    965M   18M  898M   2% /tmp
/dev/sda2     ext3    7.6G  1.9G  5.4G  26% /usr
/dev/sda5     ext3    7.6G  201M  7.0G   3% /var
/dev/sda1     ext3     99M   17M   77M  18% /boot
tmpfs        tmpfs   1003M     0 1003M   0% /dev/shm
/dev/sdb1     ext3    2.7T  202M  2.6T   1% /data   -->
정상적으로 마운트 된 것을 확인할 수 있다.

7. fdisk 로 실제 파티셔닝된 정보를 확인한다.

[root@storage /]#
fdisk -l
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1033     8193150   83  Linux
/dev/sda3            1034        1288     2048287+  83  Linux
/dev/sda4            1289        9729    67802332+   5  Extended
/dev/sda5            1289        2308     8193118+  83  Linux
/dev/sda6            2309        2569     2096451   82  Linux swap / Solaris
/dev/sda7            2570        2696     1020096   83  Linux
/dev/sda8            2697        9729    56492541   83  Linux
WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.

Disk /dev/sdb: 2993.9 GB, 2993996955648 bytes
255 heads, 63 sectors/track, 363999 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      267350  2147483647+  ee  EFI GPT   --> EFI GPT 로 잡혀 있는 것을 확인할 수 있음.

 

 

----------------------------------------------------------------------------------시스템으로c로 쓸경우

 

리눅스 설치 시 UEFI로 설치하는 경우가 있습니다.


하드디스크 용량은 2TB가 넘지 않아도 UEFI로 할 경우 디스크를 GPT로 변경하여 설치해야합니다.


간혹 파티션을 나눌 때 그냥 설치가 되는 반면 설치가 되지 않는 것도 있습니다.




( CRT 모니터라서 이상하게 찍히네요. )


현재 보시면 sda 하드디스크에 OS를 설치하는 모습입니다.


sda1, 2, 3 이렇게 될 경우는 문제가 발생치 않지만 1, 2, 3, 4이 될 경우 다음과 오류가 발생합니다.


그냥 커스텀하지 않고 기본으로 설치할 경우에는 어떻게 될지는 모르겠습니다.


이 오류를 해결하기 위해서는 


[CTRL + ALT + F2]를 누르면 콘솔 모드로 전환됩니다.


parted /dev/sda 를 입력 후


mklabel gpt 를 입력하시고 다시 [CTRL + ALT + F5]로 돌아온 뒤 Next를 누르게 되면 똑같은 에러가 발생됩니다.


곧바로 Next를 누르지 마시고 Back을 누른 뒤 다시 파티션 설정에 들어가면 설정했던 값들이 모두 초기화 됨을 보실 수 있습니다.


전과 같은 파티션을 그대로 입력하시고 Next를 하시면 이상없이 진행됩니다.

 

'리눅스 > 기본정보(OS)' 카테고리의 다른 글

프로토콜 기본정보  (0) 2017.07.31
fstab 설정하기  (0) 2015.09.15
centos 버전 확인  (1078) 2014.06.19
로그 분석하는방법  (482) 2012.02.02
자신의 하드웨어 정보 보기  (2375) 2011.11.19

ssh telnet 로그인 실패 (실패안하면 발송안함)

Posted by 주원이^^
2014. 7. 29. 11:06 리눅스/스크립트
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

##############################

LoginFail

#############################

 

#!/bin/bash

DIR="/LoginFail"

YESTERDAY=`date +%F --date '1 days ago'`

LOG_FILE=$DIR/LF_$YESTERDAY.log

ADMIN_EMAIL="메일주소"

CNT="200"


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

echo "Login Failed List $YESTERDAY" > $LOG_FILE

echo "-----------------------------------------------------------" >> $LOG_FILE

echo "Login Failed List : TELNET" >> $LOG_FILE

grep 'FAILED' /var/log/secure | grep "`LANG=C date +'%b %e' --date '1 days ago'`" |awk -F'FROM' '{ print $2 }' $1 | awk -F'FOR' '{ print $1 }' $1 |sort | uniq -c | sort -r >> $LOG_FILE

echo "-----------------------------------------------------------" >> $LOG_FILE

echo "Login Failed List : SSH" >> $LOG_FILE

grep 'Failed' /var/log/secure | grep "`LANG=C date +'%b %e' --date '1 days ago'`" |awk -F'from' '{ print $2 }' $1 | awk -F'port' '{ print $1 }' $1 |sort | uniq -c | sort -r >> $LOG_FILE

if [ -e $LOG_FILE ] ;then
        tmp=`ls -l $LOG_FILE | awk '{print $5}'`
        if [ `expr $tmp` -gt `expr $CNT` ]; then

        cat $LOG_FILE |  mail -s "Login Failed list : $YESTERDAY" $ADMIN_EMAIL
        fi
fi

'리눅스 > 스크립트' 카테고리의 다른 글

watch  (0) 2014.11.05
부팅후 IP변경되면 메일로 알려주기  (0) 2014.08.04
clamav 리눅스용 바이러스 실행  (0) 2014.08.01
엔탑(ntop) 설치  (0) 2013.06.21
대역폭 제한 툴  (0) 2013.05.23

iscsi 명령어 모음집

Posted by 주원이^^
2014. 7. 12. 11:00 리눅스/리눅스설정방법
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

<<ISCSI Server설정>>
yum install scsi-target-utils-0.0-6.20091205snap.el5_5.3.i386 -y
service tgtd start

1.Target 설정(도메인 및 디스크볼륨명은 임의지정)
tgtadm --lld iscsi --op new --mode target --tid 1 --targetname iqn.2011-04.도메인명:drbd.quorumdisk
tgtadm --lld iscsi --op new --mode target --tid 2 --targetname iqn.2011-04.도메인명:drbd.datadisk

2.Target 이름이 제대로 지정되어 있는지 확인
tgtadm --lld iscsi --op show --mode target
[root@node2 ~]# tgtadm --lld iscsi --op show --mode target
Target 1: iqn.2011-04.도메인명:drbd.quorumdisk
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: IET     00010000
            SCSI SN: beaf10
            Size: 0 MB
            Online: Yes
            Removable media: No
            Backing store type: rdwr
            Backing store path: None
    Account information:
    ACL information:
Target 2: iqn.2011-04.도메인명:drbd.datadisk
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: IET     00020000
            SCSI SN: beaf20
            Size: 0 MB
            Online: Yes
            Removable media: No
            Backing store type: rdwr
            Backing store path: None
    Account information:
    ACL information:
3.설정한 iSCSI Target 이름에 시스템의 볼륨을 등록해 줍니다.
$ tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/drbd0
위 명령은 tid 1에 lun 1번으로 /dev/drbd0을 등록
(앞서 Target 이름 생성시 LUN0는 이미 존재하므로 1로 지정하였습니다)

같은 방식으로 tid 2에 lun 1번으로 /dev/drbd1을 등록
$ tgtadm --lld iscsi --op new --mode logicalunit --tid 2 --lun 1 -b /dev/drbd1


4.볼륨의 등록이 정상적으로 되어있는지 아래 명령으로 확인 가능합니다.
$ tgtadm --lld iscsi --op show --mode target
실행결과에 LUN 1로 /dev/drbd0이 보이는지 확인하면 됩니다.
[root@node2 ~]# tgtadm --lld iscsi --op show --mode target
Target 1: iqn.2011-04.도메인명:drbd.quorumdisk
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: IET     00010000
            SCSI SN: beaf10
            Size: 0 MB
            Online: Yes
            Removable media: No
            Backing store type: rdwr
            Backing store path: None
        LUN: 1
            Type: disk
            SCSI ID: IET     00010001
            SCSI SN: beaf11
            Size: 501 MB
            Online: Yes
            Removable media: No
            Backing store type: rdwr
            Backing store path: /dev/drbd0
    Account information:
    ACL information:
Target 2: iqn.2011-04.도메인명:drbd.datadisk
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: IET     00020000
            SCSI SN: beaf20
            Size: 0 MB
            Online: Yes
            Removable media: No
            Backing store type: rdwr
            Backing store path: None
        LUN: 1
            Type: disk
            SCSI ID: IET     00020001
            SCSI SN: beaf21
            Size: 573 MB
            Online: Yes
            Removable media: No
            Backing store type: rdwr
            Backing store path: /dev/drbd1
    Account information:
    ACL information:

5.iSCSI Target에 접근할 수 있도록 bind 작업
$ tgtadm --lld iscsi --op bind --mode target --tid 1 --initiator-address ALL
$ tgtadm --lld iscsi --op bind --mode target --tid 2 --initiator-address ALL

위 명령은 tid 1의 Target을 bind 해주는 명령입니다.
--initiator-address(또는 -I) 옵션은 ACL (initiator의 접근권한)을 설정하는 것으로
본 문서의 예제에는 모든 시스템에서 접근 가능하도록 하였습니다

제대로 bind 되어 있는지 확인
[root@node2 ~]# netstat -atnp | grep 3260
tcp        0      0 0.0.0.0:3260                0.0.0.0:*                   LISTEN      3390/tgtd
tcp        0      0 :::3260                     :::*                        LISTEN      3390/tgtd

6.설정한 tgt 정보를 설정파일로 등록하기
$ tgt-admin --dump >> /etc/tgt/targets.conf
만약 기존에 등록된 정보가 있다면 > 대신 >>을 이용하여 추가해 주시면 됩니다.


<<ISCSI Client설정>>
yum install iscsi-initiator-utils.i386 -y
service iscsi start
service iscsid start

1.ISCSI Target 시스템 찾기
[root@centos gfs2]# iscsiadm --mode discovery --type sendtargets --portal  TGTD서버IP
TGTD서버IP:3260,1 iqn.2011-04.도메인명:drbd.quorumdisk
TGTD서버IP:3260,1 iqn.2011-04.도메인명:drbd.datadisk
IP주소에는 Target 시스템의 IP주소를 입력합니다.

2.Target 시스템에 로그인
$ iscsiadm --mode node --targetname iqn.2011-04.도메인명:drbd.datadisk --portal TGTD서버IP --login

3.Target 시스템 로그인 확인
targetname은 Target 시스템에 등록된 iqn 값을 지정하면 됩니다.
즉, 타겟시스템에 여러 Target 장치가 존재할 때 구분하기 위함입니다.

[root@centos gfs2]# fdisk -l

Disk /dev/hda: 17.1 GB, 17179803648 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14        2088    16667437+  8e  Linux LVM

Disk /dev/sda: 572 MB, 572809216 bytes
18 heads, 61 sectors/track, 1018 cylinders
Units = cylinders of 1098 * 512 = 562176 bytes

Disk /dev/sda doesn't contain a valid partition table
기존에 없던 디스크 장치가 추가되어있음을 확인할 수 있습니다.
 

[root@centos gfs2]# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: IET      Model: Controller       Rev: 0001
  Type:   RAID                             ANSI SCSI revision: 05
Host: scsi0 Channel: 00 Id: 00 Lun: 01
  Vendor: IET      Model: VIRTUAL-DISK     Rev: 0001
  Type:   Direct-Access                    ANSI SCSI revision: 05
위 SCSI정보를 확인하면 아래와 같이 VIRTAUL-DISK가 보이는지 확인하시면 됩니다.
/var/log/messages에도 디스크가 새로 인식되었음이 기록되니 참고하시면 됩니다.


4.등록된 볼륨에 대해서 일반 디스크처럼 파티셔닝 후 포맷이 가능합니다.
$ fdisk /dev/sda

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

iscsi ( Server : tgtadm )

### 타겟을 만들어 준다.

#tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.2008-11-18.xen.test.co.kr:storage.disk1### 타겟의 내역을 확인 한다.

#tgtadm --lld iscsi --op show --mode target### iscsi lun 할당

#tgtadm --lld iscsi --op new --mode logicalunit --tid=1 --lun=1 -b /dev/xen_vg/gfs_data
#tgtadm --lld iscsi --op new --mode logicalunit --tid=1 --lun=2 -b /dev/gfs/qdisk
#tgtadm --lld iscsi --op new --mode logicalunit --tid=1 --lun=1 -b /dev/gfs/gfsdata3### iscsi target binding

#tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL### iscsi target 에 binding 된 리스트 확인

#tgtadm --lld iscsi --op show --mode target### tid1 에 타겟된 리스트 보기

#tgtadm --lld iscsi --op show --mode target --tid 1iscsi ( Client : iscsiadm )

### target scan

#iscsiadm -m discovery -t st -p 192.168.40.200### target mapping

#iscsiadm -m node --loginall all 또는 iscsiadm -m node -l
or
#iscsiadm -m node --targetname iqn_name -l### mapping 된 내역 확인

#iscsiadm -m node### logout

#iscsiadm -m node --targetname iqn.2008-06.com.oracle.kr.sd-iscsi:storage.disk1 --portal 10.0.0.62:3260 --logout
or
#iscsiadm -m node --logout### iqn 삭제

#iscsiadm -m node -o delete iqn.2008-06.xen.test.co.kr.sd-iscsi:storage.disk1
or
#iscsiadm -m node -o deleteiscsi udev ? target mapping 설정 하기

/dev/sda to /dev/iscsiN
#vi /etc/udev/rules.d/75-iscsi.rules

아래 라인 추가
KERNEL=="sd*", PROGRAM=="scsi_id -g -u -s %p", RESULT=="19492039203920390230232", SYMLINK+="iscsi%n"

#scsi_id -g -u -s /block/sda ==> RESULT(출력 결과)

#udevtest
#start_udev

 

httpd rpm build

Posted by 주원이^^
2014. 7. 7. 10:03 리눅스/리눅스설정방법
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
. RPM Rebuild

[root@localhost httpd]# wget http://vault.centos.org/5.8/os/SRPMS/httpd-2.2.3-63.el5.centos.src.rpm

[root@localhost httpd]# rpm -ivh httpd-2.2.3-63.el5.centos.src.rpm

[root@localhost httpd]# cd /usr/src/redhat/SOURCES

[root@localhost httpd]# tar xvfz httpd-2.2.3.tar.gz

[root@localhost httpd]# vim httpd-2.2.3/server/mpm/prefork/prefork.c

77라인에 #define DEFAULT_SERVER_LIMIT 1024 로 수정

[root@localhost httpd]# rm -f httpd-2.2.3.tar.gz

[root@localhost httpd]# tar cvfz httpd-2.2.3.tar.gz httpd-2.2.3/

[root@localhost httpd]# rm -rf httpd-2.2.3/

[root@localhost httpd]# yum -y install rpm-build

[root@localhost httpd]# cd /usr/src/redhat/SPECS/

[root@localhost httpd]# rpmbuild -ba httpd.spec

[root@localhost httpd]# cd /usr/src/redhat/RPMS/x86_64

참고) rpm2cpio httpd-2.2.3-63.el5.centos.src.rpm | cpio -id

2. 예외사항 처리

[root@localhost httpd]# rpmbuild -ba httpd.spec
오류: Failed build dependencies:
autoconf is needed by httpd-2.2.3-45.x86_64
xmlto >= 0.0.11 is needed by httpd-2.2.3-45.x86_64
db4-devel is needed by httpd-2.2.3-45.x86_64
expat-devel is needed by httpd-2.2.3-45.x86_64
zlib-devel is needed by httpd-2.2.3-45.x86_64
apr-devel >= 1.2.0 is needed by httpd-2.2.3-45.x86_64
apr-util-devel >= 1.2.0 is needed by httpd-2.2.3-45.x86_64
pcre-devel >= 5.0 is needed by httpd-2.2.3-45.x86_64
openssl-devel >= 0.9.8e-12.el5_4.4 is needed by httpd-2.2.3-45.x86_64
distcache-devel is needed by httpd-2.2.3-45.x86_64

[root@localhost httpd]# yum install autoconf xmlto db4-devel expat-devel zlib-devel

[root@localhost httpd]# yum install apr-devel apr-util-devel pcre-devel openssl-devel distcache-devel


3. SRC RPM Rebuild

[root@localhost httpd]# rpmbuild --rebuild httpd-2.2.3-45.el5.centos.src.rpm

 

'리눅스 > 리눅스설정방법' 카테고리의 다른 글

yum download only  (0) 2014.08.11
iscsi 명령어 모음집  (6222) 2014.07.12
사설 ssl 키 생성  (0) 2014.07.04
centos 6.x selinux 해제  (0) 2014.06.11
웹분산  (0) 2014.06.11

zimbra 참고자료

Posted by 주원이^^
2014. 7. 4. 13:31 리눅스/소프트웨어(Software)
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

zimbra 설치 기록


zimbra 6.0.10
centos 5.5 64bit


최소 /opt 영역에 6GB 이상의 용량 필요
/opt 파티션을 분리하는 것이 좋을 것임

 


/etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.0.80 example.com mail.example.com mail


yum install gmp perl-5.8.8 sysstat


기존 관련 패키지 중단
chkconfig sendmail off
chkconfig postfix off
chkconfig httpd off
service sendmail stop
service postfix stop
service httpd stop

 

./install.sh --platform-override


ZIMBRA WEB
웹메일 : http://example.com
관리페이지 : https://example.com:7071

TIPS & TRICKS
mail 서버에 DNS cache 서버를 같이 두는게 좋을 것이다.
Zimlet을 설치하면 webmail 지원사양이 향상된다.

 

참조할 자료

Host Email and Calendars with Zimbra 6 on CentOS 5
http://library.linode.com/email/zimbra/install-zimbra-centos-5

Quick guide for installing Zimbra 6 on Centos 5
http://unknownimous.blogspot.com/2010/11/quick-guide-for-installing-zimbra-6-on.html


Howto install Zimbra Collaboration Suite 6-0
http://www.generationip.com/documentation/Howto/137-howto-install-zimbra-collaboration-suite-6-0


http://ver18.files.wordpress.com/2009/07/manual-zimbra.pdf


Install and Setup Zimbra in CentOS
http://coderoman.com/2010/04/install-and-setup-zimbra-in-centos/


스팸 관련 설정 파일
cd /opt/zimbra/conf/salocal.cf.in

blacklist_from sales@viagra.com
whitelist_from bill@yahoo.net

적용 zmamavisdctl restart

참고 : http://wiki.zimbra.com/wiki/Improving_Anti-spam_system


관리자 패스워드 리셋 : http://wiki.zimbra.com/wiki/Admin_Password_Reset
su - zimbra
zmprov sp <admin email address> <new password>


관리자 전체 목록 보기
su - zimbra
zmprov gaaa

 

방화벽 관련 포트
http://coderoman.com/2010/04/firewall-iptables-rules-for-zimbra-in-centos/


POP3 : 110
POP3S : 995
IMAP : 143
IMAPS : 993
SMTP : 25
SMTPS : 465
SMTP submission : 587

 

 


Xen 커널과의 버그
http://www.zimbra.com/forums/installation/31164-zimbra-centos-5-3-x86-xen-4gb-seg-fixup-errorerrors-4.html

In summary, couple of solutions:
1 - switch to 64bit Xen (i.e. re-install 64 bit Centos, switch all your existing VMs to 64 bit...)
2 - migrate to a different solution (like Google Apps)
(I chose #2) Hope this helps!

 

 

 


그외


Tips Anti Spam Zimbra : Aktivasi Fasilitas Blacklist Spammer
http://vavai.com/2010/06/04/tips-anti-spam-zimbra-aktivasi-fasilitas-blacklist-spammer/


Script for Export-Import Zimbra Mail Server Account & Password
http://vavai.net/2010/08/script-for-export-import-zimbra-mail-server-account-password/


File Spreadsheet untuk Import Account Email ke Zimbra Mail Server
http://vavai.com/2010/11/16/file-spreadsheet-untuk-import-account-email-ke-zimbra/

Tips Improvement Performance Zimbra Mail Server
http://vavai.com/2010/10/14/tips-improvement-performance-kecepatan-zimbra-mail-server/


User Account Integration between Samba PDC & Zimbra Mail Server on openSUSE/SLES
http://vavai.net/2010/03/user-account-integration-between-samba-pdc-zimbra-mail-server-on-opensuse-sles/

User Account Integration between Samba PDC & Zimbra Mail Server on openSUSE/SLES Part 2 (Finish)
http://vavai.net/2010/03/user-account-integration-between-samba-pdc-zimbra-mail-server-on-opensusesles-part-2-finish/

'리눅스 > 소프트웨어(Software)' 카테고리의 다른 글

zimbra 4번째  (0) 2014.09.18
openstack  (0) 2014.09.18
irc ddos  (0) 2014.01.03
irc 서버구축  (0) 2014.01.03
irc 서비스봇  (0) 2014.01.03

사설 ssl 키 생성

Posted by 주원이^^
2014. 7. 4. 13:16 리눅스/리눅스설정방법
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
How to create a self-signed SSL Certificate
리눅스 개인 서명 SSL 인증서 생성, 사설 SSL 인증서 만들기
리눅스 OpenSSL 자체서명 인증서 설치
리눅스 OpenSSL 인증서 설치

목차

[숨기기]

개요

여기서는 개인 인증기관을 만들고 인증서를 발급받아 보자. 웹브라우저에서는 신뢰할 수 없는 사이트라고 나오기는 하지만, SSL 보안 기능[1]을 이용할 수 있다.[2]

확인

리눅스를 설치했다면 아마도 openssl 패키지가 설치되어 있을 것이다.[3]

[root@jmnote ~]# rpm -qa openssl
openssl-1.0.0-20.el6_2.5.x86_64

개인키 생성

[root@jmnote ~]# openssl genrsa -des3 -out server.key 2048
Generating RSA private key, 2048 bit long modulus
....................................................................................................................................................................................+++
..........................................................+++
e is 65537 (0x10001)
Enter pass phrase for server.key:
Verifying - Enter pass phrase for server.key:
→ 서버 개인키인 server.key 파일이 생성된다.

인증요청서 생성

인증요청서 문서를 참고하십시오.
[root@jmnote ~]# openssl req -new -key server.key -out server.csr
Enter pass phrase for server.key:
→ 서버 개인키 패스워드 입력
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:KR
State or Province Name (full name) []:Seoul
Locality Name (eg, city) [Default City]:Yeongdeungpo
Organization Name (eg, company) [Default Company Ltd]:Jmnote
Organizational Unit Name (eg, section) []:Jmnote
Common Name (eg, your name or your server's hostname) []:jmnote.com
Email Address []:web@jmnote.com
→ 자신의 경우에 맞게 적절히 입력
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
→ 그냥 Enter, Enter
→ 서버 인증요청서인 server.csr 파일이 생성되었다.

개인키에서 패스워드 제거

키에 패스워드가 들어있으면 아파치 구동시마다 물어본다. 패스워드를 제거하더라도 SSL 암호화 통신에는 문제가 없으므로 제거하자.

[root@jmnote ~]# cp server.key server.key.org
[root@jmnote ~]# openssl rsa -in server.key.org -out server.key
Enter pass phrase for server.key.org:
→ 개인키 패스워드를 입력
writing RSA key
→ 패스워드가 제거된 개인키 파일 server.key 이 생성된다.
[root@jmnote ~]# ll server*
-rw-r--r--. 1 root root 1054 Sep 20 07:53 server.csr
-rw-r--r--. 1 root root 1679 Sep 20 07:56 server.key
-rw-r--r--. 1 root root 1751 Sep 20 07:55 server.key.org
→ 패스워드가 제거된 파일(server.key)은 원래 파일(server.key.org)에 비해 용량이 조금 줄어들었다.

인증서 생성

개인키와 인증요청서를 가지고 인증서를 생성해보자.

[root@jmnote ~]# openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
Signature ok
subject=/C=KR/ST=Seoul/L=Yeongdeungpo/O=Jmnote/OU=Jmnote/CN=jmnote.com/emailAddress=web@jmnote.com
Getting Private key
→ 서버 인증서인 server.csr이 생성되었다.

개인키와 인증서 설치

개인키 파일(.key)과 인증서 파일(.crt)을 ssl이라는 파일명으로 httpd.conf 폴더에 복사하자. (httpd.conf 폴더는 설정에 따라 다를 수 있다.)

[root@jmnote ~]# cp server.key /etc/httpd/conf/
[root@jmnote ~]# cp server.crt /etc/httpd/conf/
[root@jmnote ~]# ll /etc/httpd/conf
total 60
-rw-r--r--. 1 root root 34417 Sep 20 07:41 httpd.conf
-rw-r--r--. 1 root root 13139 Feb 14  2012 magic
-rw-r--r--. 1 root root  1298 Sep 20 08:45 server.crt
-rw-r--r--. 1 root root  1679 Sep 20 08:45 server.key

httpd.conf 설정

httpd.conf 파일의 맨 아래에 다음 내용 추가[4]. 단, DocumentRoot는 본인의 상황에 맞게 지정.

NameVirtualHost *:443
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/httpd/conf/server.crt
SSLCertificateKeyFile /etc/httpd/conf/server.key
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
CustomLog logs/ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
DocumentRoot 폴더위치
</VirtualHost>
→ SSL 접속용 DocumentRoot를 별도로 지정해주자. (예: /var/www/https[5])

아파치 재시작

명령어
service httpd restart
실행예시 (성공)
[root@jmnote ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
실행예시 (실패)
[root@jmnote ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: Syntax error on line 1072 of /etc/httpd/conf/httpd.conf:
Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration
                                                           [FAILED]
→ mod_ssl 패키지가 없어서 그렇다. Invalid command 'SSLEngine' 참조.

웹브라우저 테스트

이 웹 사이트의 보안 인증서에 문제가 있습니다. 
 
이 웹 사이트에서 제시한 보안 인증서는 신뢰할 만한 인증 기관에서 발급한 것이 아닙니다.
이 웹 사이트에서 제시한 보안 인증서는 다른 웹 사이트 주소에 대해 발급되었습니다.
 
문제가 있는 인증서를 통해 사용자를 속이거나 사용자가 서버로 보내는 데이터를 가로챌 수도 있습니다.  
 
이 웹 페이지를 닫고 이 웹 사이트를 계속 탐색하지 않는 것이 좋습니다.  
... (생략)
→ 개인서명이라 신뢰할 수 없다고 하지만[6], 보안 접속은 잘 된다.

같이 보기

주석

  1. SSL 기반 암호화 송수신
  2. 사용자(웹 접속자)는 경고 메시지를 보게 된다.
  3. 리눅스는 SSH 접속을 기본 제공하는데, 거기에도 openssl이 필요하다. CentOS 6 최소 설치 패키지 목록에도 포함되어 있다.
  4. httpd.conf 기본값일 때는 그냥 하단에 추가만 하면 되지만, 기존에 VirtualHost를 사용중이라면 적절히 수정해야 한다.
  5. /var/www/html 와 비슷하게 예시 폴더를 지정해보았다. 지정한 폴더가 서버에 실제로 있어야 httpd 시작시 오류가 나지 않는다
  6. IE8의 경우, 주소표시줄이 붉게 표시되고 '인증서 오류'라는 말이 계속 따라다닌다. ㅠ_ㅠ

참고 자료

'리눅스 > 리눅스설정방법' 카테고리의 다른 글

iscsi 명령어 모음집  (6222) 2014.07.12
httpd rpm build  (0) 2014.07.07
centos 6.x selinux 해제  (0) 2014.06.11
웹분산  (0) 2014.06.11
openssl update  (0) 2014.06.11

centos 버전 확인

Posted by 주원이^^
2014. 6. 19. 15:36 리눅스/기본정보(OS)
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

CentOS 버전 확인 방법

[root@]# lsb_release -a

LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch

Distributor ID: CentOS

Description: CentOS release 6.5 (Final)

Release: 6.5

Codename: Final

 

 

 

config.inc.php

 

 

'리눅스 > 기본정보(OS)' 카테고리의 다른 글

fstab 설정하기  (0) 2015.09.15
GPT 2TB 이상 하드디스크 사용 파티셔닝  (0) 2014.07.30
로그 분석하는방법  (482) 2012.02.02
자신의 하드웨어 정보 보기  (2375) 2011.11.19
리마2급 OSI 7 계층 알아보기  (5725) 2011.03.10