All posts

전체 글

스팸 필터 솔루션에서 로그인 문제가 있어 LDAP 연동으로 변경함.

변경 후, 사용자만 동기화되고 그룹 메일은 동기화 되지 않음.

수동으로 그룹 메일을 추가했으나, 동기화 될 때마다 수동으로 추가한 계정이 삭제 됨.

솔루션 업체 측에서 해결이 불가능하다고 답변 받았으나, LDAP 동기화 필터 수정으로 해결 함.

 

 

# 기존 LDAP 동기화 필터 설정 (LDAP 사용자만 동기화)

(&(objectCategory=person)(objectClass=user)(cn=*))

# 변경 값(사용자 또는 그룹 동기화)

(|(&(objectCategory=person)(objectClass=user)(cn=*))(&(objectCategory=group)(cn=*)))

여러 필터 쿼리를 조합하여 원하는 객체만 필터 가능하며,

ldap 다른 논리 연산자와는 다르게 연산자가 연산 대상 앞에 온다.

(<연산자>(피연산자1)(피연산자2)(···))

따라서 아래와 같이 설명할 수 있다.

(&(objectCategory=person)(objectClass=user)(cn=*))
	=> 모든 user 객체

(&(objectCategory=group)(cn=*))
	=> 모든 group 객체
    
(|(&(objectCategory=person)(objectClass=user)(cn=*))(&(objectCategory=group)(cn=*)))
	=> 모든 user 객체 또는 모든 group 객체

 

LDAP Base DN과 LDAP 동기화 속성이 되어있기 때문에 원하는 ou내에 있는 메일이 있는 계정만 동기화 가능.

# LDAP BASE DN
ou=<ORGANIZATION>,dc=<DOMAIN>,dc=co,dc=kr

# LDAP 동기화 속성
mail=mail,name=displayName

 

 

참고 사이트:

https://social.technet.microsoft.com/wiki/contents/articles/5392.active-directory-ldap-syntax-filters.aspx

 

Active Directory: LDAP Syntax Filters - TechNet Articles - United States (English) - TechNet Wiki

 

social.technet.microsoft.com

 

ubuntu 초기 설치 시 디스크 구성할 때 사이즈를 적게 설정하여 확장이 필요했다.

$ df -Th
Filesystem                         Size  Used Avail Use% Mounted on
udev                               7.8G     0  7.8G   0% /dev
tmpfs                              1.6G  1.4M  1.6G   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   11G   11G   32M 100% /

📝 vg-unbuntu--lv 볼륨 확장 하기.

 

- 순서 -

1. 파티션 생성

2. LVM 설정

3. LVM 볼륨 확장

 

 

1. 파티션 생성

먼저 남은 용량으로 새로운 파티션을 생성한다.

$ sudo fdisk /dev/sda

Command (m for help): n
Partition number (4-128, default 4): 4
First sector (33552384-104857566, default 33552384):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (33552384-104857566, default 104857566):
Created a new partition 4 of type 'Linux filesystem' and of size 34 GiB.
Command (m for help): w

$ fdisk -l /dev/sda
Disk /dev/sda: 50 GiB, 53687091200 bytes, 104857600 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: F2AFDAB9-654E-4E24-9388-108FBCC1026A

Device        Start       End  Sectors Size Type
/dev/sda1      2048      4095     2048   1M BIOS boot
/dev/sda2      4096   2101247  2097152   1G Linux filesystem
/dev/sda3   2101248  33552383 31451136  15G Linux filesystem
/dev/sda4  33552384 104857566 71305183  34G Linux filesystem

 

2. LVM 설정

LVM에서 사용할 수 있도록 볼륨을 생성해준다.

$ sudo pvscan
  PV /dev/sda3   VG ubuntu-vg       lvm2 [<15.00 GiB / 0    free]
  Total: 1 [<15.00 GiB] / in use: 1 [<15.00 GiB] / in no VG: 0 [0   ]
  
$ sudo pvcreate /dev/sda4
  Physical volume "/dev/sda4" successfully created.
  
$ sudo pvscan
  PV /dev/sda3   VG ubuntu-vg       lvm2 [<15.00 GiB / 0    free]
  PV /dev/sda4                      lvm2 [34.00 GiB]
  Total: 2 [<49.00 GiB] / in use: 1 [<15.00 GiB] / in no VG: 1 [34.00 GiB]

 

생선한 볼륨을 확장을 원하는 VG에 확장 시켜준다.

$ sudo sudo vgdisplay ubuntu-vg | grep "VG Size"
  VG Size               15.00 GiB

$ sudo vgextend ubuntu-vg /dev/sda4
  Volume group "ubuntu-vg" successfully extended
  
$ sudo sudo vgdisplay ubuntu-vg | grep "VG Size"
  VG Size               48.99 GiB

 

3. LVM 볼륨 확장

볼륨을 확인하고, 확장 시킨다.

파일시스템이 ext4인 경우에는 resize2fs 명령어를 통해 확장된 용량을 적용 해줘야 한다.

$ sudo lvscan
  ACTIVE            '/dev/ubuntu-vg/ubuntu-lv' [<11.00 GiB] inherit
  ACTIVE            '/dev/ubuntu-vg/lv-swap' [4.00 GiB] inherit
  
$ sudo lvextend -l +100%FREE -n /dev/ubuntu-vg/ubuntu-lv
  Size of logical volume ubuntu-vg/ubuntu-lv changed from <11.00 GiB (2815 extents) to 44.99 GiB (11518 extents).
  Logical volume ubuntu-vg/ubuntu-lv successfully resized.
  
$ sudo lvscan
  ACTIVE            '/dev/ubuntu-vg/ubuntu-lv' [44.99 GiB] inherit
  ACTIVE            '/dev/ubuntu-vg/lv-swap' [4.00 GiB] inherit

$ sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/ubuntu-vg/ubuntu-lv is mounted on /; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 6
The filesystem on /dev/ubuntu-vg/ubuntu-lv is now 11794432 (4k) blocks long.

 

❗ 최종 확인

부족했던 볼륨 사이즈가 확장되었다!

$ df -Th
Filesystem                        Type      Size  Used Avail Use% Mounted on
udev                              devtmpfs  7.8G     0  7.8G   0% /dev
tmpfs                             tmpfs     1.6G  1.4M  1.6G   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv ext4       45G   11G   32G  25% /

 

'IT > System' 카테고리의 다른 글

[MSSQL] Auto Shrink 장애  (1) 2024.11.07
[AD] LDAP 동기화 필터링  (2) 2021.11.24
[Oracle] DB 이관하기(Windows to Ubuntu)  (0) 2021.10.18
[CentOS] YumRepo Error: All mirror URLs are not using ftp  (0) 2021.07.21
[CentOS] rc.local 활성화  (0) 2021.07.08

기존 환경:

Windows 2008 Std

 

변경:

Ubuntu 20.04, docker

 

 

1. 전체 백업 진행

> exp userid=유저명/비밀번호 file='C:\full.dmp' full=y

2. 컨테이너 구성 

$ sudo docker pull jaspeen/oracle-xe-11g
$ sudo docker run --name oracle11g -d -p 1521:1521 jaspeen/oracle-xe-11g

📌 이미지 'jaspeen/oracle-xe-11g'의 DB 계정 정보는 system/oracle 이다.

 

3. 백업본 복사 및 복원 진행

$ sudo docker cp /tmp/full.dmp /home/ oracle11g
$ sudo docker exec -it oracle11g imp userid=system/oracle file=/home/full.dmp full=y

 

CentOS 6.7 yum repository error

    YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
     Eg. Invalid release/repo/arch combination/
    removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
    Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

 

원인:

CentOS 6.7 EOL 만료로 Fastmirror 사이트에서 CentOS 6가 제거 되어 발생.

CentOS 버전별 EOL: https://wiki.centos.org/About/Product

 

About/Product - CentOS Wiki

About/Product (2021-07-14 19:53:40에 CarlGeorge가(이) 마지막으로 수정)

wiki.centos.org

 

해결 방법:

$ sed -i -e "s/^mirrorlist=http:\/\/mirrorlist.centos.org/#mirrorlist=http:\/\/mirrorlist.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo
$ sed -i -e "s/^#baseurl=http:\/\/mirror.centos.org/baseurl=https:\/\/vault.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo

문서 하단에 내용 요약 되어있음.

 

먼저, rc-local이 실행 중인지 확인 하자.

$ systemctl status rc-local

    ● rc-local.service - /etc/rc.d/rc.local Compatibility
       Loaded: loaded (/usr/lib/systemd/system/rc-local.service; static; vendor preset: disabled)
       Active: inactive (dead)

 

rc-local이 활성화 되어있지 않아 시작해보려 했지만 오류가 발생했다.

$ sudo systemctl start rc-local

    ● rc-local.service - /etc/rc.d/rc.local Compatibility
       Loaded: loaded (/usr/lib/systemd/system/rc-local.service; static; vendor preset: disabled)
       Active: inactive (dead)
    Condition: start condition failed at 목 2021-07-08 09:32:08 KST; 5s ago
               ConditionFileIsExecutable=/etc/rc.d/rc.local was not met

 

rc.local 파일에 실행 권한이 없어 실행 권한을 추가했다.

$ ll /etc/rc.local
    lrwxrwxrwx. 1 root root 13  2월 29  2020 /etc/rc.local -> rc.d/rc.local
$ ll /etc/rc.d/rc.local
    -rw-r--r--. 1 root root 553  6월 28 16:54 /etc/rc.d/rc.local

$ sudo chmod u+x /etc/rc.d/rc.local
$ ll /etc/rc.d/rc.local
    -rwxr--r--. 1 root root 553  6월 28 16:54 /etc/rc.d/rc.local

 

권한을 부여하고 rc-local 상태를 확인해보니 정상적으로 실행되었다.

$ sudo systemctl start rc-local
$ systemctl status rc-local
    ● rc-local.service - /etc/rc.d/rc.local Compatibility
       Loaded: loaded (/usr/lib/systemd/system/rc-local.service; static; vendor preset: disabled)
       Active: active (running) since 목 2021-07-08 09:43:14 KST; 7s ago
      Process: 26652 ExecStart=/etc/rc.d/rc.local start (code=exited, status=0/SUCCESS)
     Main PID: 26671 (java)
       Memory: 86.6M
       CGroup: /system.slice/rc-local.service
               ├─26671 /wagent/java/jre1.6.0_45/bin/java -Xms16m -Xmx16m -Djava.library.path=/wagent/lib -jar /wagent/WShield-M2.jar
               ├─26704 /wagent/java/jre1.6.0_45/bin/java -Xms128m -Xmx128m -Djava.library.path=/wagent/lib -jar /wagent/WShield-M.jar &
               └─26746 /wagent/WShield-RN.sh "/wagent" &

 

rc-local 자동 실행을 위해 enable을 시도 했더니 아래와 같은 메시지가 발생하고 'enable'이 아니라 'enable-runtime' 상태로 변경된 것을 확인 했다.

$ sudo systemctl enable rc-local
    The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
    settings in the [Install] section, and DefaultInstance for template units).
    This means they are not meant to be enabled using systemctl.
    Possible reasons for having this kind of units are:
    1) A unit may be statically enabled by being symlinked from another unit's
       .wants/ or .requires/ directory.
    2) A unit's purpose may be to act as a helper for some other unit which has
       a requirement dependency on it.
    3) A unit may be started when needed via activation (socket, path, timer,
       D-Bus, udev, scripted systemctl call, ...).
    4) In case of template units, the unit is meant to be enabled with some
       instance name specified.

$ systemctl list-unit-files | grep rc.local
    rc-local.service                           enabled-runtime

 

rc-local 서비스 설정에 '[install]' 섹션 설정을 해야한다.

→ 이 내용은 따로 자세하게 확인해야겠다.

섹션 설정 후에 다시 enable하니 정상적으로 작동한다.

/usr/lib/systemd/system/rc-local.service
    ---------------------------------------------------------------
    # 아래 내용 추가
    [Install]
    WantedBy=multi-user.target
    ---------------------------------------------------------------
$ sudo systemctl enable rc-local
    Created symlink /etc/systemd/system/multi-user.target.wants/rc-local.service → /usr/lib/systemd/system/rc-local.service.

 

여기까지 설정한 후에도 작동하지 않는 스크립트는 해당 스크립트의 실행권한이 없는 것이다. 파일 소유자에 권한을 부여하고, su 명령어로 사용자를 지정하여 사용하도록 하자.

/etc/rc.local
    ---------------------------------------------------------------
    su user -c "/home/user/startup.sh"
    ---------------------------------------------------------------

# 테스트를 위한 스크립트
/home/user/startup.sh
    ---------------------------------------------------------------
    DATE=`date +%Y-%m-%d_%H:%M:%S`
    touch /home/user/$DATE.txt
    ---------------------------------------------------------------

# rc.local 파일을 실행하거나, 서버를 재부팅하여 확인할 수 있다.
$ ll
합계 36056
-rw-r--r--. 1 user user        0  7월  8 11:08 2021-07-08_11:08:30.txt
-rwxrw-r--. 1 user user       60  7월  8 11:01 startup.sh

 

- '[install]' 섹션 설정 관련 참고 사이트

 

How to Enable /etc/rc.local with Systemd - LinuxBabe

If you are running a Linux distro that uses Systemd, then you may find that your command in /etc/rc.local file would not run at system boot time. This guide explains how to enable /etc/rc.local script to run on system startup. Enable /etc/rc.local on Syste

www.linuxbabe.com

 

요약

1. rc-local 환경 설정 및 서비스 실행

2. 스크립트 실행에 필요한 적절한 권한 설정

  • rc-local 환경 설정 및 서비스 실행
/usr/lib/systemd/system/rc-local.service
    ---------------------------------------------------------------
  # 아래 내용 추가
    [Install]
    WantedBy=multi-user.target
    ---------------------------------------------------------------
$ sudo systemctl start rc-local
$ sudo systemctl enable rc-local
  • 스크립트에 실행에 필요한 적절한 권한 설정
/etc/rc.local
    ---------------------------------------------------------------
    su user -c "/home/user/startup.sh"
    ---------------------------------------------------------------

$ chmod u+x /home/user/startup.sh