about fall

가을 가을 이맘때쯤 그냥 이제는 가을은 다른 가을은 있다 @@
아마도 오늘이라면 가을을 만난 것 같다
작은 눈망울이 아주 크게 보여요 내 눈도 박제된 얘기를 꺼내고 싶다 가을은 두른두른 마른다

oracle dbms에서 제공하는 분석함수

Oracle DBMS에서 제공하는 분석함수
R1V1 – R-Project & Open Statistics Korea

rea

http://www.openstatistics.net/doc/contributed/2013/Eric-R-Data-Mining-20130812_v3.pdf

[Linux] 아파치 웹서버 사용자별 웹 디렉토리 설정 –

[Linux] 아파치 웹서버 사용자별 웹 디렉토리 설정
– Per-user web directories
■ 환경
○ OSE : CentOS 7 minimal
○ Apache web server : 2.4.6
■ 아파치 웹 서버 설정
○ 사용자별 웹 디렉토리 사용하도록 설정 : vi  /etc/httpd/conf.d/userdir.conf
<IfModule  mod_userdir.c>
    UserDir  disabled  root
    UserDir  public_html
</IfModule>
<Directory “/home/*/public_html”>
    AllowOverride FileInfo AuthConfig Limit Indexes
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    Require method GET POST OPTIONS
</Directory>
     – root에 대해서는 사용자 웹 디렉토리를 사용하지 않도록 해 보안위협을 예방한다.
     – Indexes 옵션을 제거해 외부 접속자가 임의의 파일에 접근하는 것을 예방한다.
○ PHP 페이지를 위해 웹서버 설정파일에 index.php 추가 : vi  /etc/httpd/conf/httpd.conf
<IfModule  dir_module>
    DirectoryIndex  index.html  index.php
</IfModule>
○ SELinux 설정 : 웹서버가 사용자별 웹 디렉토리에 접근할 수 있도록 권한을 설정한다.
    – 상태확인 : getsebool  httpd_enable_homedirs
       — 확인결과 : httpd_enable_homedirs –> off
    – 상태설정 : setsebool -P httpd_enable_homedirs  on
    – 상태확인 : getsebool  httpd_enable_homedirs
       — 확인결과 : httpd_enable_homedirs –> on
○ 아파치 웹서버 재시작
    – systemctl  restart  httpd
■ 사용자별 웹 디렉토리 설정
○ 접근권한 설정
    – mkdir  /home/account/public_html
    – chmod  711  /home/account
    – chmod  755  /home/account/public_html
○ SELinux 설정 : 웹서버가 사용자의 컨텐츠에 대한 접근을 할 수 있도록 설정한다.
    – 설정 : chcon  -R  -t  httpd_user_content_t  /home/account/public_html
    – 확인 : ls  -aldZ  /home/account/public_html
    ※ httpd가 httpd_t type으로 실행되며 httpd_user_content_t (typealias), httpd_sys_content_t type으로 설정된 파일만 접근할 수 있다.

vsftpd Active-Passive mode configuration

Active/Passive 모드 설정

서버에서는 Active 모드, Passive 모드 둘다 지원하도록 기동시켜두고 클라이언트 프로그램에서 이를 선택하도록 한다.

1. Conf 설정

 # vi /etc/vsftpd/vsftpd.conf

– Passive 

 pasv_enable=YES

pasv_max_port=11000

pasv_min_port=10000

– Active

ㄴ Active모드는 특별한 옵션을 주지 않으면 Default로 동작한다.

2. 재기동

 # systemctl restart vsftpd.service
3. SELINUX 설정
Conf 파일을 수정하고 재기동 후에, 클라이언트에서 Active모드로 접속했지만 아래와 같은 로그를 보여주고 접속되지 않는다.
– Active 모드에 접근할 수 없어서 Passive모드로 접속하겠다는 로그 내용.. 그러나 접속하지 못함.
 명령: PORT 192,168,0,100,17,9

응답: 200 PORT command successful. Consider using PASV.

명령: LIST

응답: 425 Failed to establish connection.

오류: 디렉터리 목록 조회 실패

SELINUX 때문인데.. SELINUX 로그를 보면 아래와 같은 부분이 남겨져 있다.

 …  avc:  denied  { name_connect } for  pid=20401 comm=”vsftpd”  …

– 로그는 설정에 따라 /var/log/audit/audit.log 또는 /var/log/message 에 남겨진다.

– avc는 SELINUX커널에 있는 서비스 – Access Vector Cache

– Active 모드에서 사용하려는 Data세션이 사용하는 포트가 방화벽에 막혔기 때문이라고 한다.

 

 # setsebool -P ftp_home_dir 1

# setsebool –P ftpd_use_passive_mode 1

setsebool은 SELINUX의 정책을 설정한다.

– P옵션은 영구설정을 의미, 1은 on / 0은 off

– ftp_home_dir 은 ftp서버가 홈디렉토리에만 접근가능하도록 하는 옵션.

– ftpd_use_passive_mode는 ftpd가 Passive모드 사용을 허가하는 옵션.

4. 확인

 # getsebool -a | egrep “^ftp_home_dir|^ftpd_use_passive_mode”

getsebool은 SELINUX의 정책을 확인한다.

5. 접속테스트

– Active 모드로 접속.

– 클라이언트에서 정상 접속 후에 21번 포트로 외부에서 접속.

– 파일 다운로드시에 Active모드이므로 20번 포트가 open되어 파일 다운로드

– Passive 모드로 접속.

– 파일 다운로드 시에 Passive모드 이므로 Passive모드 사용을 위해 설정해둔 10000~11000 사이의 포트로 Data전송.

 

table index definition document and modeling tools

테이블 정의서 2008
인덱스 정의서 2008
exerd 모델링
데이타 모델링의 이해
Download sqljdbc4-2.0.jar
[MSSQL]2008 백업 파일을 2005에서 복원하기

mssql pivot sample

 

select * from (
SELECT ROW_NUMBER() OVER (ORDER BY [01]) AS [00]
     , left(cast([01] as varchar),7) [99]
     , [01]
     , [02]
     , [03]
     , [04]
     , [05]
     , [06]
     , [07]
     , [08]
     , [09]
     , [10]
     , [11]
     , [12]
     , [13]
     , [14]
     , [15]
     , [16]
     , [17]
     , [18]
     , [19]
     , [20]
     , [21]
     , [22]
     , [23]
     , [24]
     , [25]
     , [26]
     , [27]
     , [28]
     , [29]
     , [30]
     , [31]
  FROM (SELECT dt+’_’+amst+’_’+pmst+’_’+apst d
             , DATEPART(d, dt) dd
             , left(dt,7) ww
          FROM ( select  solardate dt, isnull(cast(am_state as varchar),’0′) amst, isnull(cast(pm_state as varchar),’0′) pmst, isnull(cast(ap_state as varchar),’0′) apst from sldate a left outer join agent_work b on a.solardate = b.work_date
               and agent_idx = 1115
  and  (ISNULL(am_state,0)+ ISNULL(pm_state,0) + ISNULL(ap_state,0)) > 0
  where solardate between convert(varchar(10),Dateadd(m,0,’2015-10-01′),120) and convert(varchar(10),dateadd(ss,-1,Dateadd(m,12,’2015-10-01′)),120)
  ) T
        ) a
 PIVOT( MIN(d) FOR dd IN
        ( [00], [99], [01], [02], [03], [04], [05], [06], [07], [08], [09], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27], [28], [29], [30], [31]) ) a
  ) ta
  join copy_t ct on 1 = 1 and  no < 3