'분류 전체보기'에 해당되는 글 57건

  1. 2019.07.22 base64_filter
  2. 2013.06.04 리눅스에서 JBoss DataSource 패스워드 암호화시 특수문자($)에 주의
  3. 2013.02.28 Apache httpd
  4. 2013.02.14 access log format, mod_jk log format
  5. 2013.02.13 mod_jk, mod_proxy
  6. 2013.02.05 JBoss 링크
  7. 2013.01.25 mod_cluster
  8. 2013.01.21 Gradle
  9. 2013.01.05 Internals of Java Class Loading
  10. 2012.12.11 [link] Sublime Text 2

base64_filter

카테고리 없음 2019. 7. 22. 22:12

filter

filter {
  ruby {
    path => '/home/tmp/logstash-6.8.1/enc_base64.rb'
    script_params => {
      'b64_fields' => ['ip_addr', 'pc_mac']
    }
  }
  ruby {
    path => '/home/tmp/logstash-6.8.1/dec_base64.rb'
  }
}

 

enc_base64.rb

def register(params)
    require 'base64'
    @b64_fields = params["b64_fields"]
end

def filter(event)
    @b64_fields.each do |k|
        v = event.get(k)
        puts("==> k: #{k}, v: #{v}")
	if !v.nil?
            event.set("#{k}_enc64", Base64.strict_encode64(v))
            event.remove(k)
	end
    end
    return [event]
end

dec_base64.rb

def register(params)
    require 'base64'
end

def filter(event)
    event.to_hash.each do |k, v|
        if k.end_with?("_enc64") and !v.nil?
            puts("==> k: #{k}, v: #{v}")
            event.set(k[0..-7], Base64.strict_decode64(v))
            event.remove(k)
	end
    end
    return [event]
end
Posted by 天下太平
,

리눅스에서 JBoss DataSource 패스워드 암호화시 특수문자($)에 주의하시기 바랍니다.


* DataSource 패스워드 암호화 관련 문서


영문: Encrypting Data Source Passwords

http://docs.jboss.org/jbosssecurity/docs/6.0/security_guide/html/Encrypting_Data_Source_Passwords.html 

한글: JBoss JDBC Password encryption 방법

http://misoleaf.blogspot.kr/2013/01/jboss-jdbc-password-encryption.html


* 패스워드 인코딩 시 달러싸인($)로 인해 발생한 문제


예를들어 패스워드가 abc$123이고 아래와 같이 인코딩을 하는 경우


cd $JBOSS_HOME

CP=client/jboss-logging.jar:lib/jbosssx.jar


java -cp $CP org.jboss.resource.security.SecureIdentityLoginModule abc$123

Encoded password: 2202200411c05dbe


윈도우에선 문제가 없지만 리눅스에서는 $1이 변수로 인식되어 문제가 생긴다.

즉, abc$123 이 아닌 abc23을 인코딩한 값이 리턴된다.


java -cp $CP org.jboss.resource.security.SecureIdentityLoginModule abc23

Encoded password: 2202200411c05dbe


리눅스에서는 abc\$123 <- 이렇게 해야한다.


java -cp $CP org.jboss.resource.security.SecureIdentityLoginModule abc\$123

Encoded password: 643b9f06c9ba48f2


* 윈도우에서 패스워드 인코딩 시 특수문자


http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_shelloverview.mspx?mfr=true


The ampersand (&), pipe (|), and parentheses ( ) are special characters that must be preceded by the escape character (^) or quotation marks when you pass them as arguments.



Posted by 天下太平
,

Apache httpd

카테고리 없음 2013. 2. 28. 14:35

- 설정파일 검사 명령

   apachectl -t 

Posted by 天下太平
,

* apache log format


    LogFormat "%h %D %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined


    10.220.147.10 1255 - [14/Feb/2013:17:15:44 +0900] "GET /img/IMG200000003295733.jpg HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17"




* mod_jk log format

    JKRequestLogFormat "%w %R %V %T %U %s"


    [2013 Thu Feb 14 17:15:44]cmse_wlb cmse2 example.com 0.001220 /img/IMG200000003295733.jpg 304




Posted by 天下太平
,

mod_jk, mod_proxy

Middleware 2013. 2. 13. 09:06

- ajp13

http://tomcat.apache.org/connectors-doc/ajp/ajpv13a.html


- mod_jk

http://tomcat.apache.org/connectors-doc/index.html


- Using mod_jk with JBoss

https://community.jboss.org/wiki/UsingModjk12WithJBoss


- Apache Module mod_proxy

http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

Posted by 天下太平
,

JBoss 링크

Middleware 2013. 2. 5. 11:19

- JBoss 관리자 개발 가이드 (JBoss 3.2.6)

http://openframework.or.kr/framework_reference/jbossAdmin/index.html


JBossASTuningSliming

https://community.jboss.org/wiki/JBossASTuningSliming


JBoss6xTuningSlimming

https://community.jboss.org/wiki/JBoss6xTuningSlimming


TurnDeploymentScannerDown

https://community.jboss.org/wiki/TurnDeploymentScannerDown


JBoss AS Official Documentation Page

https://community.jboss.org/wiki/JBossApplicationServerOfficialDocumentationPage


Redhat 제품 설명서

https://access.redhat.com/knowledge/docs/


Redhat 제품 설명서 - JBoss EAP 문서

https://access.redhat.com/knowledge/docs/JBoss_Enterprise_Application_Platform/?locale=en-US


- JBoss startup configuration

http://www.mastertheboss.com/jboss-configuration/jboss-start-up-configuration


Posted by 天下太平
,

mod_cluster

Middleware 2013. 1. 25. 17:59

- mod_cluster documentation

http://docs.jboss.org/mod_cluster/1.2.0/html/Intro.html


Overview

- mod_jk, mod_proxy와 다르게 mod_cluster는 어플리케이션 서버와 httpd 사이에 커넥션을 하나더 사용

- 어플리케이션 서버들은 이 커넥션에 HTTP method를 통해 server-side load balance factors and lifecycle events를 httpd에게 전송한다. (MCMP: Mod Cluster Management Protocol)


- mod_jk

https://community.jboss.org/wiki/UsingModjk12WithJBoss



- mod_jk vs mod_cluster

http://stackoverflow.com/questions/13609320/mod-jk-vs-mod-cluster




Posted by 天下太平
,

Gradle

카테고리 없음 2013. 1. 21. 14:52

Gradle

http://www.gradle.org/


User Guide

http://www.gradle.org/docs/current/userguide/userguide.html


Gradle Javadoc

http://gradle.org/docs/current/javadoc/


권남님 wiki

http://wiki.kwonnam.pe.kr/gradle


Posted by 天下太平
,

http://onjava.com/pub/a/onjava/2005/01/26/classloading.html

Internals of Java Class Loading

by Binildas Christudas
01/26/2005

Class and Data
- class = code, data = state
- 모든 클래스는 java.lang.Class 의 인스턴스 형태로 code를 가진다
- 컴파일러는 class라는 이름의 public static final 필드를 모든 클래스에 삽입한다.
   public static final Class class;
- JVM이 클래스를 한 번 로드하면, 같은 클래스는 다시 로드되지 않는다.
- 여기서 같은 클래스는 fully qualified name (package name + class name)으로 구별된다.
- JVM에서 fully qualified name과 그 클래스를 로드한 ClassLoader를 함께 사용하여 하나의 고유한 클래스를 식별한다.
- 어떤 클래스를 C1, 패키지를 Pg, 클래스로더 인스턴스를 Kl1 이라고 할 때,
- JVM에서 (C1, Pg, Kl1)C1이라는 클래스의 키이다. 
- 즉, (C1, Pg, Kl1)(C1, Pg, Kl2)는 같은 클래스가 아니다.

Class Loaders
- JVM에서 모든 클래스는 어떤 java.lang.ClassLoader의 인스턴스에 의해 로드된다.
- java.lang.Object 와 기본 클래스들은 bootstrap class loader에 의해 로드된다.
- 이 기본 클래스들은 JRE/lib/rt.jar라는 파일로 패키징된다.
- boot class loader는 natively implementation 된다. JVM마다 구현은 다르다.
- 다음과 같이 core java runtime 클래스의 클래스로더를 얻으려고 하면 null을 얻게된다.
  log(java.lang.String.class.getClassLoader());
- java.ext.dirs property로 얻어지는 경로에서 extension 라이브러리를 찾을 수 있다.
- 이 경로의 모든 jar 파일은 ExtClassLoader에 의해 로드된다.
- 개발자 관점에서 가장 중요한 세번째의 클래스로더는 AppClassLoader이다.
- java.class.path property로 얻어지는 경로의 클래스들은 AppClassLoader에 의해 로드된다.
  이곳이 CLASSPATH이다.
- java.lang.Thread는 public ClassLoader getContextClassLoader()를 포함한다.
- 이것은 context class loader를 리턴한다.
- context class loader는 Thread를 생성한 코드에 의해 제공된다.
- Thread에 의해 실행되는 코드가 클래스나 리소스를 로드할 때 사용된다.

How Class Loaders Work
- bootstrap class loader를 제외한 모든 클래스로더는 parent 클래스로더를 갖는다.
- 모든 클래스로더의 타입은 java.lang.ClassLoader이다.
- 모든 클래스로더의 parent 클래스로더는 그 클래스로더를 로드한 클래스로더이다.
- 클래스로더의 loadClass() 메서드를 사용하여 클래스로더에게 클래스를 요청한다.
- loadClass() 메서드 내부동작은 다음과 같다. (from java.lang.ClassLoader 의 소스코드)

protected synchronized Class<?> loadClass
    (String name, boolean resolve)
    throws ClassNotFoundException{

    // First check if the class is already loaded
    Class c = findLoadedClass(name);
    if (c == null) {
        try {
            if (parent != null) {
                c = parent.loadClass(name, false);
            } else {
                c = findBootstrapClass0(name);
            }
        } catch (ClassNotFoundException e) {
            // If still not found, then invoke
            // findClass to find the class.
            c = findClass(name);
        }
    }
    if (resolve) {
    resolveClass(c);
    }
    return c;


- 클래스로더는 이미 로드된 클래스를 찾을 수 없을 때, parent에게 물어본다.
- parent의 parent (...) 에서도 찾지 못하고 결국 findBootstrapClass0() 역시 실패하면 findClass() 메서드를 호출한다.
- findClass() 메서드의 디폴트 구현은 ClassNotFoundException을 던지는 것이다.

    protected Class<?> findClass(String name)
        throws ClassNotFoundException {
        throw new ClassNotFoundException(name);
    } 


- 커스텀 클래스로더를 구현하는 개발자는 이 메서드를 구현하게 된다.
- findClass() 의 내부에서 클래스로더는 임의의 소스로부터 바이트코드를 얻어온다.
- 여기서 임의의 소스는 filesystem, network URL, database, 혹은 다른 어플리케이션일 수 있다.
- 바이트코드를 얻은 후에 findClass() 메서드는 defineClass() 메서드를 호출해야 한다. (바이트코드를 Class로 변환)
- 자바 런타임은 어떤 클래스로더 인스턴스가 defineClass()를 호출했는지를 구별한다.
- 두 개의 클래스로더 인스턴스가 같은 소스의 바이트코드를 define 하더라도, 두 개의 클래스는 다른 클래스이다.

The Java language specification gives a detailed explanation on the process of loading, linking, and the initialization of classes and interfaces in the Java Execution Engine.

- Figure 1


- 다른 클래스로더에서 로드된 (같은 바이트코드의) 클래스를 대입하려고 하는 경우 ClassCastException이 발생한다.

A more detailed explanation on the process of class loading, defining, and linking is in Andreas Schaefer's article "Inside Class Loaders."


Why Do We Need our Own Class Loaders?

Posted by 天下太平
,

[link] Sublime Text 2

기타 2012. 12. 11. 10:52

- 패키지 컨트롤

http://wbond.net/sublime_packages/package_control


- Korean(euc-kr) 인코딩 지원

https://github.com/seanliang/ConvertToUTF8


- Preferences > Settings - User

http://www.sublimetext.com/docs/2/font.html

{

"font_face": "굴림체",

"font_size": 13

}


- docs

http://docs.sublimetext.info/en/latest/


- Sublime Text organization at GitHub

https://github.com/SublimeText


- SublimeFileDiffs

https://github.com/colinta/SublimeFileDiffs/wiki


- Programmer 이고 싶다

http://juhoi.tistory.com/51


Posted by 天下太平
,