티스토리 툴바


http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way
 
저작자 표시

'프로그래밍 > linux' 카테고리의 다른 글

gitosis 설치방법  (0) 2011/10/11
EasyInstall 설치법  (0) 2011/10/10
[linux console] sftp - secure file transfer program  (0) 2010/04/10
Apache 403 Forbidden error 해결 방법  (0) 2010/04/10
Posted by 현동형

1. ez_setup 설치

아래 링크된 파일을 에서 다른 이름으로 저장해서 아래와 같이 실행한다.

http://peak.telecommunity.com/dist/ez_setup.py 


[root@localhost temp]# python ez_setup.py
Setuptools version 0.6c9 or greater has been installed.
(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)
[root@localhost temp]# python ez_setup.py -U setuptools
Searching for setuptools
Reading http://pypi.python.org/simple/setuptools/
Best match: setuptools 0.6c9
Downloading http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c9-py2.5.egg#md5=fe67c3e5a17b12c0e7c541b7ea43a8e6
Processing setuptools-0.6c9-py2.5.egg
Moving setuptools-0.6c9-py2.5.egg to /usr/lib/python2.5/site-packages
Adding setuptools 0.6c9 to easy-install.pth file
Installing easy_install script to /usr/bin
Installing easy_install-2.5 script to /usr/bin

Installed /usr/lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg
Processing dependencies for setuptools
Finished processing dependencies for setuptools
[root@localhost temp]# 

저작자 표시

'프로그래밍 > linux' 카테고리의 다른 글

gitosis 설치방법  (0) 2011/10/11
EasyInstall 설치법  (0) 2011/10/10
[linux console] sftp - secure file transfer program  (0) 2010/04/10
Apache 403 Forbidden error 해결 방법  (0) 2010/04/10
Posted by 현동형

openssl genrsa -out d:\Dev\cert\cert.key 1024

openssl req -new -key d:\Dev\cert\cert.key -out d:\Dev\cert\cert.csr

openssl req -config c:\wamp\bin\apache\apache2.2.17\conf\openssl.cnf -new -key d:\Dev\cert\cert.key -out d:\Dev\cert\cert.csr

openssl x509 -in D:\Dev\cert\cert.csr -out D:\Dev\cert\cert.crt -req -signkey d:\Dev\cert\cert.key -days 3560

참고사이트 : 
http://artyst.egloos.com/2653406
http://manner44.tistory.com/76?srchid=BR1http%3A%2F%2Fmanner44.tistory.com%2F76
http://forcecore.tistory.com/569
http://skystory.kr/575
 
저작자 표시
Posted by 현동형

미투데이 JS 라이브러리 

사용법에 앞서서 기본적으로 me2day APIKEY 발급 받는다.

me2day APIKey 발급 


  1. me2day APIKey 발급 

    http://me2day.net/me2/app/key/list 이동합니다. 

    아래와 같은 화면이 나오면 새 어플리케이션 키를 발급을 클릭 


  2. 아래의 양식에 따라 어플리케이션을 생성합니다. (한번 입력한 내용은 수정이 불가합니다.) 


  3. http://me2day.net/me2/app/key/list 로 이동 후 새로 발급받은 어플리케이션 설정을 클릭 후 아래와 같이 설정합니다. 

    쉬운 인증 설정 -> 웹 기반 인증 

    콜백주소 (URL) :  domain주소/me2Callback.html 

  4. 발급받은 API KEY를 기억 후에 실제 구동할 사이트에서 아래의 JS를 추가합니다.
    
    
    

JS 사용 


  1. 아래와 같은 코드를 삽입하여 me2데이 객체를 생성합니다.
    var oMe2 = new me2day(‘발급받은 API KEY’);
  2. 위의 객체를 생성 후 아래와 같이 Call한 후 실제로 로그인이 동작되는지 확인 해봅니다.
    oMe2.getLogin();
     
  3. 성공적으로 로그인이 되면 아래와 같은 방식으로 API를 Call 합니다.
    미투데이 경우는 인증과 비인증시 호출할 수 있는 API가 따로 정의 되어있습니다. 자세한건 Naver me2day API 페이지에서 확인하시면 됩니다. 

  4. 인증시 호출하는 방법
    oMe2.API명( JSON , callbackFunc);
    API명 : 호출할 API 명을 선언해주시면 됩니다. (미투데이 API에서 실제로 사용되는 명칭과 동일합니다.[ex : create_post]) JSON : 해당 API에 맞는 변수를 선언해주면 됩니다. 자세한 변수는http://dev.naver.com/openapi/apis/me2day/me2api_intro 여기서 참고해주세요. 

    callbackFunc : 리턴받을 Callback 함수를 정의합니다.
    성공 : 미투데이 API에 정의된 리턴 값 

    실패 : false값
    예)
    oMe2.create_post( { 'post[body]' : '하이!!' }, function(res){ console.log(res) } );  

  5. 비 인증시 호출하는 방법
    oMe2.API명 (JSON , callbackFunc);
    API명 : 인증시와 동일 

    JSON : 해당 API 에 맞는 변수를 선언해주면 되며, get_person과 같은 경우는 {user_id : 아이디}를 추가하시면 됩니다. 

    callbackFunc: 리턴받을 callback 함수를 정의합니다.
    성공 : 미투데이 API에 정의된 리턴 값 

    실패 : false
    예)
    oMe2.get_person( {user_id : 'dongz1'}, function(res){ console.log(res) } );  
     
  6. 참고
    쿠키가 사용되지 않은 버전이라 새로고침시 새로 로그인하셔야 합니다! 

JS 코드 

window.__me2day_callback = {};
window.__me2day_returnUrl = '';

function me2day (key) {
	return {
		API_URL : "http://me2day.net/api/",
		me2ApiKey : key,
		oUser : {
			uid : null,
			ukey : null
		},
		ajax : function(sUrl, oOption) {
			var id = "_" + Math.floor(Math.random() * 10000);
			var _script ;
			var timeout = true;
			window.__me2day_callback[id] = function(oCallBackData){
				try {
					timeout = false;
					oOption.callback(oCallBackData);
					_script.parentNode.removeChild(_script); 
				} finally {
					delete window.__me2day_callback[id];
				}
			}
			
			var head = document.getElementsByTagName("head")[0];
			_script = document.createElement("script");
			_script.type    = "text/javascript";
			_script.charset = "utf-8";
			
			if (head) {
				head.appendChild(_script);
			} else if (document.body) {
				document.body.appendChild(_script);
			}
			
			var data = [];
			for(var i in oOption){
				if(oOption.hasOwnProperty(i) && i != "callback" && i != "failback"){
					data.push(i+"="+encodeURIComponent(oOption[i]));
				}
			}
			if(data.length == 0){
				_script.src = sUrl+"?callback=window.__me2day_callback[\""+id+"\"]";
			}else{
				_script.src = sUrl+"?"+data.join("&")+"&callback=window.__me2day_callback[\""+id+"\"]";
			}
			window.setTimeout(function(){
				if(timeout){
					oOption.callback(false);
				}
			}, 3000);
		},
		getLogin : function(){
			var _this = this;
			var sUrl = this.API_URL + 'get_auth_url.json';//?akey='+me2ApiKey;
			var Z = 1040, h = 720;
		    var c = screen.height;
		    var b = screen.width;
		    var a = Math.round((b / 2) - (Z / 2));
		    var g = 0;
		    if (c > h) {
		        g = Math.round((c / 2) - (h / 2));
		    }
		    var Y = '';
	    	var oOpen = window.open('','me2_login', "left=" + a + ",top=" + g + ",width=" + Z + ",height=" + h + ",personalbar=0,toolbar=0,scrollbars=0,resizable=1");
	    	
			var oOption = {
				akey : this.me2ApiKey,
				callback : function(res){
					oOpen.location.href = res.url;
					var checkWindowArray = new Array();
					checkWindow = setInterval(function(){
						if(oOpen.closed) {
							oOpen = undefined;
							for(var i in checkWindowArray){
								clearInterval(checkWindowArray.pop());
							}
							try{
								var aMe2data = new Array();
								aMe2data = __me2day_returnUrl.split('&');
								if(aMe2data[1].split('=')[1] == 'true') {
									_this.oUser.uid = aMe2data[2].split('=')[1];
									_this.oUser.ukey = aMe2data[3].split('=')[1];
								}else{
									alert('error');
								}
							}catch(e){
							}
						}
					},100);
					checkWindowArray.push(checkWindow);
				}
			};
			_this.ajax(sUrl,oOption);
		},
		getApiNone : function(sType, oParam, cb){
			var sUrl = this.API_URL + sType;
			if (oParam.user_id) {
				sUrl += "/"+oParam.user_id+".json";
			}else{
				sUrl += "/"+this.oUser.uid+".json";
			}
			oParam.callback = cb;
			this.ajax(sUrl,oParam);
		},
		getApiAuth : function(sType, oParam, cb){
			if(this.oUser.uid == null){
				alert('사용자 인증후 사용하세요.');
				return false;
			}
			var sUrl = this.API_URL + sType;
			sUrl += "/"+this.oUser.uid+".json";
			oParam.callback = function(res){
				if(res.code){
					cb(res);
				}else{
					cb(res);
				}
			};
			oParam.uid = this.oUser.uid;
			var nonce = '12345678';
			oParam.ukey = nonce+hex_md5(nonce + this.oUser.ukey);
			oParam.akey = this.me2ApiKey;
			this.ajax(sUrl,oParam);
		},
		get_posts : function(oParam, cb){
			this.getApiNone("get_posts",oParam, cb);
		},
		create_post : function(oParam, cb){
			this.getApiAuth("create_post",oParam, cb)
		},
		delete_post : function(oParam, cb){
			this.getApiAuth("delete_post",oParam, cb)
		},
		create_comment: function(oParam, cb){
			this.getApiAuth("create_comment",oParam, cb)
		},
		get_comments : function(oParam, cb){
			this.getApiAuth("get_comments",oParam, cb)
		},
		delete_comment : function(oParam, cb){
			this.getApiAuth("delete_comment",oParam, cb)
		},
		track_comments : function(oParam, cb){
			this.getApiAuth("track_comments",oParam, cb)
		},
		metoo : function(oParam, cb){
			this.getApiAuth("metoo",oParam, cb)
		},
		get_metoos: function(oParam, cb){
			this.getApiNone("get_metoos",oParam, cb)
		},
		get_friends : function(oParam, cb){
			this.getApiNone("get_friends",oParam, cb)
		},
		get_friendship_requests : function(oParam, cb){
			this.getApiAuth("get_friendship_requests",oParam, cb)
		},
		accept_friendship_request : function(oParam, cb){
			this.getApiAuth("accept_friendship_request",oParam, cb)
		},
		friendship : function(oParam, cb){
			this.getApiAuth("friendship",oParam, cb)
		},
		get_person : function(oParam, cb){
			this.getApiNone("get_person",oParam, cb)
		},
		get_setting : function(oParam, cb){
			this.getApiAuth("get_setting",oParam, cb)
		},
		get_bands : function(oParam, cb){
			this.getApiAuth("get_bands",oParam, cb)
		},
		noop : function(oParam, cb){
			this.getApiAuth("noop",oParam, cb)
		}
	};
}

저작자 표시

'SNS > me2day' 카테고리의 다른 글

미투데이 JS 라이브러리  (0) 2011/09/27
Posted by 현동형
PHP 보안 컨소시움 가이드 : http://phpsec.org/projects/guide/
저작자 표시

'프로그래밍 > PHP' 카테고리의 다른 글

PHP 보안 컨소시움 가이드  (0) 2011/09/27
Posted by 현동형