RedPlug's Tory

ALTER DATABASE testdb -- DB명
SET RECOVERY SIMPLE;
GO
 
-- 로그파일을 50MB로 축소

DBCC SHRINKFILE (testdb_log, 50);  -- LOG 파일 명
GO
 
ALTER DATABASE testdb
SET RECOVERY FULL;
GO


HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\AutoShareServer

 

REG_DWORD : 0

 

reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters /v AutoShareServer /t REG_DWORD /d 0x00000000 /f

 

출처 : https://support.microsoft.com/ko-kr/help/954422/how-to-remove-administrative-shares-in-windows-server-2008

 

 

 

 

 

 

XXXXX@redplug.co.kr
 Remote Server returned '554 5.6.0 STOREDRV.Submit.Exception:PropertyTooBigException; Failed to process message due to a permanent exception with message . [0x1039001f] PR_INTERNET_REFERENCES . PropertyTooBigException: . [0x1039001f] PR_INTERNET_REFERENCES .'

원본 메시지 머리글:
Received: from mail01.redplug.co.kr ([]) by
 mail01.redplug.co.kr ([]) with mapi id
 15.00.1395.000; Thu, 24 Oct 2019 11:27:10 +0900
MIME-Version: 1.0
Content-Type: text/plain
Date: Thu, 24 Oct 2019 11:27:10 +0900
X-MS-Exchange-Transport-FromEntityHeader: Hosted
Message-ID: <>
Subject: 

상기와 같이 오류가 발생하며 메일 발송이 불가한 케이스는 PR_INTERNET_REFERENCES값이 64kb값이 넘어가게 되면 메일 발송오류가 나게끔 by design 된 항목입니다.

PR_INTERNET_REFERENCES 값은 FW 혹은 RE를 반복하게 되면 message-id값이게끔 설정되어 있으며 무한 반복되는 FW RE를 제한하기 위해 설정된 값입니다.

 

신규로 메일을 작성하게 되면 해당 값이 초기화 되기 때문에 해당 방법으로 안내 해주시면 됩니다.

 

감사합니다

 

Get-OSCounts.zip
0.00MB

 

원본스크립트의 경우 OS버젼과 에디션 까지만 나오며,

현재 Windows 10의 경우 빌드업으로 진행하다보니 해당 부분이 구분이 가지 않아

빌드넘버가 찍히는 OperatingSystemVersion 관련 내용 추가하였으며, 

빌드넘버보다는 빌드버젼으로 많이 확인하기 때문에 해당 부분변경하는 내용까지 추가하였습니다.

(명칭이 넘버 버젼이 맞는지는 정확히 모르겠네요)

 

추가로 빌드업이 나올 때마다 $Computer.OperatingSystemVersion 값을 넣는 부분에 replace

를 추가해주어야 함. (버젼으로 보려고 할 경우 수정필요X)

 

 

원본 출처 : 

https://gallery.technet.microsoft.com/scriptcenter/List-OS-version-counts-2d330a33

 

 

## Exchange 2013, Powershell

## 그룹 명칭

$Name = "Dymailgroup"

## DL 생성 위치

$GroupOU = "redplug.co.kr/Groups"

## 맴버로 포함할 계정위치(하위 OU까지 포함)

$MemberOU = "redplug.co.kr/Users"

 

## 동적그룹 생성, Title 기준 (필요 시 필터 변경)

New-DynamicDistributionGroup -Name $Name -RecipientFilter {(Title -eq '팀장' -or Title -eq '실장')} -OrganizationalUnit $GroupOU -RecipientContainer $MemberOU

 

## 리스트 확인 명령어

$Members = Get-DynamicDistributionGroup -Identity $Name

Get-DynamicDistributionGroup $Members | ForEach {Get-Recipient -RecipientPreviewFilter $_.RecipientFilter -OrganizationalUnit $_.RecipientContainer} | Select DisplayName,PrimarySMTPAddress | Format-Table

Get-DynamicDistributionGroup 으로 명단 확인 시 RecipientContainer적용이 안되서 전체 사서함이  다보이는 경우가 있는데 상기 명령어로 구분해서 확인 가능 (메일 수신 구분까지 확인)

isochange.zip
0.00MB

Hyper-V VDI 구성하여 운영 중이며 VM내 필요한 설치파일에 대하여 ISO파일을 CD로 넣어서 제공하고 있는 상태이며, 

해당 이미지 파일에 대하여 일괄 변경하기 위한 스크립트 입니다.

isochangepath.txt : ISO파일 위치 기입

ps1 파일 내 $VMName 에 대하여서는 확인 후 필요 시 변경

 

 

Test-ExchangeServerHealth.zip
0.02MB

한글 Exchange용으로 일부 글자만 수정

출처 : 

https://practical365.com/exchange-server/powershell-script-exchange-server-health-check-report/

소프트웨어 배포를 위해 설정 했던 그룹정책의 배포 원본 경로를 변경 하는 방법을 설명합니다.

 

기존 배포 지점 확인

해당 변경하고자 하는 소프트웨어의 속성 > 배포 > 고급 >스크립트 이름에서 Polices 다음 값(클래스ID)를 확인

ADSI 편집 > 기본 명명 컨텍스트 > System > Policies > 상기 클래스ID > Machine > Class Store > Packages > 우측에 나오는 값 속성 > 특성 편집기에서 msiFileList 값 수정

수정 시 UNC경로 앞에 0:을 붙여서 추가 한 후에 기존 패키지 주소는 삭제 하면됩니다.

(패키지 수정탭에 내용이 있을 경우 1:이 추가로 표시될 수 있음.)

 

 

정책 새로 고침 후 변경사항 확인

Search-Mailbox SearchQuery

Mail2019. 8. 27. 20:49

 

1. 서치 할 경우

Search-Mailbox -identity "redplug" -SearchQuery 'kind:meetings AND Subject:"미팅제목" AND sent:08/27/2019..01/01/2020"' -TargetMailbox redtest -TargetFolder "받은 편지함"

* AND는 대문자로 작성하여야 함.

* 서치한 결과 값이 Targetmailbox에 저장, PST 지정도 가능(?)

 

2. 삭제 할 경우

Search-Mailbox -identity "redplug" -SearchQuery 'kind:meetings AND Subject:"미팅제목" AND sent:08/27/2019..01/01/2020"' -DeleteContent

쿼리 속성 값 관련 정리 되있는 링크

Search-Mailbox (Exchange 2013, 2016, 2019, Online): Attributes

https://www.codetwo.com/admins-blog/search-mailbox-exchange-2013-2016-online-attributes/

 

 

원래 목적은 특정시점 이후에 대한 등록 된 캘린더 삭제를 하고 싶어서 확인 한 사항이었으나

일정이 아닌 등록한 시점으로 서치 및 삭제가 가능 하여 사용불가.

 

추가로 확인해보니 Remove-CalendarEvents cmdlet가 있었으나 Online만 지원하는 것으로 파악되서 사용하지 못함.(Exchange 2019 지원되는 것 같으나 미확인)

https://docs.microsoft.com/en-us/powershell/module/exchange/mailboxes/remove-calendarevents?view=exchange-ps

Redplug입니다.

 

Elasticsearch 사용 시 LDAP연동을 통한 권한 관리를 하기 위한 LDAP 연동 테스트 진행

 

Open Distro for Elasticsearch는 하기 4가지 케이스에 사용된다고 합니다.

- Log analytics

- Real-time application monitoring

- Clickstream analytics

- Search backend

 

설치 참고한 가이드

https://opendistro.github.io/for-elasticsearch-docs/docs/install/rpm/

 

OS는 CentOS7입니다.

 

 

 

1. repository 추가

cd /etc/yum.repos.d/

sudo curl https://d3g5vo6xdbdb9a.cloudfront.net/yum/opendistroforelasticsearch-artifacts.repo -o opendistroforelasticsearch-artifacts.repo

 

 

2 JAVA 설치 (1.8설치)

sudo yum install java-1.8.0-openjdk-devel

 

3. 사용 가능한 Open Distro for Elasticsearch 버젼 확인

sudo yum list opendistroforelasticsearch --showduplicates

 

4. Open Distro for Elasticsearch 설치 진행

   설치 시점엔 1.1.0-1로 해당 버젼 설치

   Elasticsearch + Open Distor for Elasticsearch 같이 설치 됩니다. (..이걸 몰라서 좀 삽질했습니다.)
   이미 Elasticsearch가 설치 되있을 경우 Standalone Elasticsearch Plugin Install 사용하여 설치 진행

sudo yum install opendistroforelasticsearch-1.1.0-1

 

5. 심볼릭 링크 생성 (JAVA 8일경우)

sudo ln -s /usr/lib/jvm/java-1.8.0/lib/tools.jar /usr/share/elasticsearch/lib/

 

6. Elasticsearch 서비스 시작

sudo systemctl start elasticsearch.service

 

7. Elasticsearch 테스트

curl -XGET https://localhost:9200 -u admin:admin --insecure
curl -XGET https://localhost:9200/_cat/nodes?v -u admin:admin --insecure
curl -XGET https://localhost:9200/_cat/plugins?v -u admin:admin --insecure

하기와 같이 노출되면 Running중
[redplug@localhost ~]$ curl -XGET https://localhost:9200 -u admin:admin --insecure
{
  "name" : "localhost.localdomain",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "52rlltm7QPyrLkj0vjfhMQ",
  "version" : {
    "number" : "7.1.1",
    "build_flavor" : "oss",
    "build_type" : "rpm",
    "build_hash" : "7a013de",
    "build_date" : "2019-05-23T14:04:00.380842Z",
    "build_snapshot" : false,
    "lucene_version" : "8.0.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

 

8. LDAP 연동

https://opendistro.github.io/for-elasticsearch-docs/docs/security-configuration/ldap/

plugins/opendistro_security/securityconfig/config.yml 파일 수정

기본주소

/usr/share/elasticsearch/plugins/opendistro_security/securityconfig/config.yml

 

config 파일은 authc부분과 authz로 부분으로 이루어져 있으며,

authc는 인증, authz는 권한 관련된 사항을 정의 합니다.

인증 테스트 이기 때문에 authc 부분만 설정합니다.

 

샘플파일

authc:
      ldap:
        description: "Authenticate via LDAP or Active Directory"
        http_enabled: true 
        transport_enabled: true
        order: 5
        http_authenticator:
          type: "basic"
          challenge: true
        authentication_backend:
          # LDAP authentication backend (authenticate users against a LDAP or Active Directory)
          type: "ldap"
          config:
            # enable ldaps
            enable_ssl: false
            # enable start tls, enable_ssl should be false
            enable_start_tls: false
            # send client certificate
            enable_ssl_client_auth: false
            # verify ldap hostname
            verify_hostnames: true
            hosts:
            - "ad01.tmoncorp.com:389"
            bind_dn: CN=redplug,OU=REDPLUG,DC=REDPLUG,DC=com
            password: "패스워드"
            userbase: "OU=Users,OU=REDPLUG,DC=REDPLUG,DC=com"
            # Filter to search for users (currently in the whole subtree beneath userbase)
            # {0} is substituted with the username
            usersearch: "(sAMAccountName={0})"
            # Use this attribute from the user as username (if not set then DN is used)
            username_attribute: "cn"

설정 후 Security 적용

https://opendistro.github.io/for-elasticsearch-docs/docs/security-configuration/security-admin/

sudo /usr/share/elasticsearch/plugins/opendistro_security/tools/securityadmin.sh -cacert /etc/elasticsearch/root-ca.pem -cert /etc/elasticsearch/kirk.pem -key /etc/elasticsearch/kirk-key.pem -cd /usr/share/elasticsearch/plugins/opendistro_security/securityconfig/

 

로그인 시도 화면

로그인 성공 확인