레이블이 computer인 게시물을 표시합니다. 모든 게시물 표시
레이블이 computer인 게시물을 표시합니다. 모든 게시물 표시

[컴][유틸] VSCodium

vscode / visual studio code/ open license


VSCodium

여기 를 보면 알 수 있는 데, 마이크로소프트(MS)가 Visual Studio Code 가 빌드할 때 vscode repository 를 복사해서 product.json 변경하고 빌드를 한다고 한다.

이 때 product.json 에 MS 에서의 특정 기능을 집어넣는다. (텔레메트리, 갤러리, 로고 등) 그리고 자신들의 라이센스 를 걸고 배포한다.

이 라이센스에 데이터의 수집에 대한 라이센스도 들어가 있다.

그래서 그 라이센스와 관련없이 VSCode 를 빌드해서 MIT license 로 배포하는 것이 VSCodium 이다. 자세한 사항은 README.md 를 읽어보자.

vscode 에 data 수집이나 telemetry 관련 옵션이 있긴하지만, 여하튼 개인적으로 그냥 VSCodium 을 쓰는 것이 나을 듯 하다.



[컴][웹] confluence 사용하는 국내업체들

지라 / 컨플루언스 사용 업체 리스트 / jira / 어디서 사용하는지 / 사용하는 대기업 /

confluence 사용하는 국내업체들


  1. 넥슨
  2. 롯데쇼핑e커머스사업본부
  3. 삼성전자
  4. 안랩
  5. 알티캐스트
  6. 애플코리아
  7. 우아한 형제
  8. 잡코리아
  9. 쿠팡
  10. 현대모비스
  11. 현대오토론
  12. cafe24
  13. LG 전자
  14. LIG 넥스원
  15. naver
  16. sk
  17. sk 하이닉스

Reference


  1. [Blind] Confluence 쓰는 회사들 알려주실 수 있나요? (IT엔지니어)




[컴] qBittorent 의 익명모드

토렌트 / 토렌트 익명 모드 / 토렌트 감시 / 토렌트 안전하게 / 토렌트 익명성 보장 / 피하기


qBittorent 의 익명모드

아래글은 qBittorent 의 Anonymous mode 글을 가져와서 번역하고, 약간의 설명을 추가했다.

Anonymous Mode

도구 --> 옵션 --> 비트토런트 --> 익명모드 사용하기 를 통해 사용할 수 있다.
이 옵션은 설명글 에 따르면 이 모드를 활성화 하면 누군지 모르게 identity 를 가려준다.(try to mask its identity)
qBittorrent v3.3.0+qBittorrent v2.9.0 - qBittorrent v3.2.5 에서 동작이 다르다. qBittorrent v2.9.0 - qBittorrent v3.2.5 에서 더 많은 제한이 있다.

qBittorrent v3.3.0+

"익명모드"를 사용하면,
  • peer-ID 가 더이상 클라이언트 지문(client's fingerprint) 에 포함되지 않게 된다.
  • user-agent 가 빈문자열(empty string) 으로 리셋(reset) 된다.
  • 다른 구분가능한 정보(identifying information) 들, 예를 들면 IP, listening 포트등과 같은 정보들은 직접적으로 공개되지 않게 된다.

qBittorrent v2.9.0 - qBittorrent v3.2.5

libtorrent-rasterbar 의 버전이 1.0.0. 아래 버전을 사용하게 된다. 그래서 '익명버전'이 활성화 되면 qBittorrent v3.3.0+ 에서 제공되는 기능(features) 과 함께 추가적으로
  • Local Peer Discovery 를 disable 한다.
  • DHT 를 disable 한다.
  • UPnP & NAT-PMP 를 disable 한다.
  • (any) proxy 를 통해서 http(s) trackers 에게만 얘기한다.
  • SOCKS5/I2P proxy 를 통해서 udp trackers 에게만 얘기한다.
이 기능들은 qBittorrent v3.3.0+ 에서는 "프록시가 지원하지 않는 연결 비활성화기(Disable connections not supported by proxies)" 옵션으로 빠졌다.
  • 프록시가 지원하지 않는 연결 비활성화기 : 도구 --> 옵션 --> 연결 --> 프록시 서버 panel --> 프록시가 지원하지 않는 연결 비활성화기

[컴][웹] 크롤링에 대한 대법원 판단

스크랩핑 / 스크랩  / 크롤 / 크롤링 / crawling 에 대한 법률 / 법률 위반 / 합법인가 크롤링

크롤링에 대한 대법원 판단

데이터베이스(DB)권 침해 행위[^1]

  • 웹사이트 콘텐츠를 긁어오는 '크롤링'을 이용해 확보한 콘텐츠
  • --> 자신의 영업에 무단 사용
  • --> 데이터베이스(DB)권 침해 행위

사건 내용

  • 2008년 사람인이 잡코리아에 등록된 기업 채용공고를 무단 크롤링해 게재
  • 몰래 크롤링을 하는 것을 숨기기 위해 가상사설망(VPN)을 사용

미국에서 나온 최근 판결, 2020-01-28

HiQ 와 LinkedIn 의 법정싸움. 이 스크랩핑에 대한 재판은 HiQ 가 CFAA (Computer Fraud and Abuse Act) 를 위반했는지 여부에 대한 싸움.

재판은 CFAA 는 private 에 대한 보호를 위한 것이라고 하고, 그래서 HiQ 가 LinkedIn 의 public profile 에 대한 scrapping 은 CFAA 를 위반한 것이 아니라고 판결함. 그리고 LinkedIn 이 HiQ 의 scrapping 을 막는 것 또한 금지시킴.

References

[컴][웹] 큰 회사의 스케일링 자료

pinterest data sharding shard / 핀터레스트 운영 / 핀터레스트 서버 구조 / 아키텍처 / architecture / 대규모 / 대용량 서버 / 대규모 서버 스케일링 / scaling / scalable /system design

큰 회사의 스케일링 자료

핀터레스트 스케일링 자료

인스타그램 스케일링 자료

  1. Making Instagram.com faster: Part 1 - Instagram Engineering
  2. Making Instagram.com faster: Part 2 - Instagram Engineering
  3. Making Instagram.com faster: Part 3 — cache first - Instagram Engineering

트위터 자료

  1. Twitter Blog > Infrastructure

Linked In

StackOverflow

무신사

카카오

트래픽이 많은 경우

  1. 쿠…sal: [컴][웹] 대한민국의 동접 최고 기록
  2. 쿠…sal: [컴][사례] 네크워크 부하가 큰 경우 네트워크 대역폭 사용량

See Also

  1. GitHub - InterviewReady/system-design-resources: These are the best resources for System Design on the Internet : 여러회사의 이야기를 모아놨다.
  2. https://www.devbridge.com/articles/a-6-point-plan-for-implementing-a-scalable-microservices-architecture/
  3. https://github.com/lei-hsia/grokking-system-design#system-designs
  4. Twitter Blog > Infrastructure
  5. What is Facebook's architecture? - Quora
  6. 쿠…sal: [컴] JunoDB 의 overview : paypal 의 junoDB
  7. 쿠…sal: [컴] netflix 의 Marken : 넷플릭스의 주석시스템 Marken
  8. 쿠…sal: [컴] 인프라 참고자표 from gruntwork : 구성도

[컴][보안] 자신의 이메일이 어디에 유출됐는지 확인방법

내 이메일이 어디에 노출 되었는지 확인하는 방법 / email breach 노출 / monitored / expose / breach / 이메일 노출된 곳 검색 방법


자신의 이메일이 어디에 유출됐는지 확인방법

firefox(파이오폭스) 에서 자신의 정보가 유출되었는지를 확인(monitor) 할 수 있는 사이트를 공개했다.

확인을 원하는 email 로 로그인을 하면, 아래처럼 어디에 유출되었는지 알려준다. 자세한 사항을 확인하면, 언제 data 가 유출됐고, 어떻게 하라는 내용등을 알려준다.







See Also

  1. https://haveibeenpwned.com/



[컴][NodeJs] CPU Intensive job 을 Node.js 에서 처리할 때

노드js nodejs 에서 싱글 쓰레드 / single thread job / cpu 사용량이 큰 작업 처리 방법 / node multi / nodejs / multi / multi thread  / multithread

CPU Intensive job 을 Node.js 에서 처리할 때

node js - single thread

기본적으로 single thread 로 알려져 있는데, 이것은 약간 이해를 잘 못 할 수 있어서 간단한 설명을 하자면, ref. 2 에서 여기 를 보면 node js 의 구성을 살짝 엿볼 수 있는데, libeio 를 통해 thread pool 을 만들어서 사용한다. (ref. 3)
그렇기 때문에 이것이 single threaded 인 것은 user 의 source code 를 run 하는 부분을 이야기 한다. 아래 코드를 예로 들면 user 의 code 부분은 하나의 thread 에서 동작한다. 하지만 fs.readFile 같은 부분은 Thread Pool 로 던져질 것이다. 그리고 response 가 오기까지 또 이 single thread 는 console.log('right after') 부분으로 처리할 수 있게 되는 것이다.
var fs = require('fs');  
fs.readFile(‘/files/help.txt’, function(err, buf) {  
    console.log('done');
});
console.log('right after');
from : ref. 1

cpu intensive job

그러므로 nodejs 로 만든 server 들은 기본적으로 single thread 로 user request 를 처리하게 된다. 하지만 만약 request 하나에서 cpu intensive 한 작업을 처리하는 경우가 있는 request 에 대해서는 nodejs 에서 처리가능한 request 양이 급격히 줄어들 수 밖에 없다. 이런 문제점에 대한 해결책에 대한 이야기가 아래 글들에 담겨있다.
대략적인 내용은 cluster 를 사용해서 request 마다 process 를 하나 더 만들어서 cpu intensive job 을 그쪽으로 넘기는 것인데, 문제는 이것이 너무 많은 memory 를 할당해야 한다는 것이다. 그래서 cluster 와 queue(kue library) 를 이용해서 일종의 process pool 을 만들어서 사용하는 해결책을 제시한다.

여담으로, 이 방법들을 살펴보고 있으려니까 아주 오래전에 linux 에서 c 로 server programming 을 하던 때의 생각이 난다.

node js http server timeout

nodejs v6.x 에서 일단 기본 timeout 이 2 분으로 설정되어 있다고 한다. 즉, request 를 보낸지 2분후 까지 response 가 없으면 error 가 된다. 이 timeout 내에 더 많은 request 를 처리하기 위해서라도 "cluster 의 사용"은 필요할 듯 하다.
 

See Also

References

  1. Introduction to NodeJS, A SSJS: Part II - EventLoop Explained
  2. https://youtu.be/L0pjVcIsU6A?t=366
    • 동영상에서는 Node.js 의 철학? 을 알 수 있다.
  3. javascript - Nodejs Event Loop - Stack Overflow
  4. Cluster | Node.js v12.3.1 Documentation

[컴] 해외 유명 IT 기업 연봉


넷플릭스 연봉 / netflix 복지 / netflix salayr /

넷플릭스 연봉


대략 $300,000 달러/연






[컴] 딜로이트의 2018년 글로벌 CIO 설문 조사 결과

리딩그룹 / 디지털 리딩 / IT회사 / 선두기업

딜로이트의 2018년 글로벌 CIO 설문 조사 결과


디지털 선도 기업(digital vanguard organizations)은 2가지 차별화된 특징을 갖고 있다.
  1. 명확하게 정의된 디지털 전략 a clearly defined digital strategy 
  2. 신기술 활용과 디지털 역량 구축 작업을 IT 조직이 이끌도록 한다 an IT organization viewed by the business as a leader in harnessing emerging technologies and building digital capabilities.
  • 디지털 선도 기업은 글로벌 IT 기업 중 9.7%만이 해당한다.
  • 디지털 선도 기업의 디지털 리더가 다른 기업과 다른점 
    • 업무 우선순위priorities
    • 마음가짐mindsets
    • 문화적 특성cultural attributes

디지털 선도기업의 특징

  1. 성장에 대한 마음가짐Growth mindset
  2. 확대/축소적 관점
  3. 최고의 인재를 유입시키는 문화
    •  디지털 리더 조직의 절반 이상(55%)이 창의적이고 의욕을 고취하는 환경 덕분에 인재를 유지할 수 있었다고 답했다.
    • 조직 문화가 최고의 기술 인재를 유입, 유지, 참여시키는 데 핵심이라는 사실을 알고 있다.
    • 디지털 리더 조직의 절반 이상(55%)이 창의적이고 의욕을 고취하는 환경 덕분에 인재를 유지할 수 있었다고 답했다.
  4. 탄탄한 기술 기반
  5. 강력한 참여 계획

References

  1. '디지털 선도' 기업의 5가지 특징 - CIO Korea, 2019-05-09
  2. 5 ways leading organizations excel at digital | CIO, 2019-05-03

[컴][interview] 면접 실패 사례 - 회사 입장

인터뷰 / 인터뷰의 잘못 된 점 / interview / 고용 / 면접방법의 잘못 / 실패사례 / 아마존 프라임 에어 창업자 실패 / 데니얼 부시뮬러 / 고용을 잘못 한 사례 / 드론


인터뷰 실패 사례


개인적으로 이런 글들을 좋아한다. 우린는 사실 측정할 수 없는 것들을 측정하려 많은 노력을 한다. 그리고 그 측정방법이 옳았다는 것을 증명하기 위해 잘된 경우들만을 늘어놓는다.

하지만 경험 해 본 우리는 그것이 전적으로 옳지 않다는 것을 안다. 하지만 믿을 만한 근거를 제시하기가 쉽지 않다.

그런 의미에서 이런 글들이 많아져야만 우리는 더 나은 방법을 찾을 수 있다고 생각한다.

from: ref. 1, Robert Sweeney, Founder and CEO at Facet

I turned down Daniel Buchmueller for a job at Netflix. After a 60 minute interview I was on the fence, so I concluded that he "wasn't senior enough." He went to Amazon instead where he co-founded Amazon Prime Air (their drone delivery service) and was #2 on Fast Company's "Most Creative People" list. At some point, we programmers are going to have to admit that we really can't judge another programmers technical abilities in a 60 min interview. We end up hiring programmers that are good at interviewing, but not necessarily good at doing the job. And we miss out on engineers like Daniel.

해석

나는 넷플릭스에 있을 때 Daniel Buchmueller 를 채용하지 않았다. 1시간의 인터뷰를 한 후에도 나는 확신이 들지 않았다. 그래서 나는 그가 senior 에 적합하지 않다고 결론 내렸다.

그는 대신에 Amazon 에 갔고, 그는 Amazon Prime Air (그들의 드론 배달 서비스)를 공동설립 했고 Fast Company 의 "가장 창조적인 사람" 리스트에서 2위를 차지했다.

어떤 점에서 우리 프로그래머들은 우리가 다른 프로그래머들의 기술적인 역량을 60분의 면접후에 판단할 수 없다는 것을 인정해야만 한다.

우리는 "면접에서 좋아 보이지만 일을 잘하지는 않는 프로그래머들"을 고용하는 것을 관뒀다.   그리고 우리는 (여전히?) Daniel 같은 엔지니어를 놓친다.


Refrences

  1. Robert Sweeney on LinkedIn, 2019-05-03

[컴][웹] 파이어 폭스 add-on 이 갑자기 사라졌다면

파폭 / 모질라 / 파이어 폭스 난리 / 플러그인 / 애드온 / 동작 안하는 이유 / 갑자기 동작을 안하는 이유 / 수정 방법 /


update, 2019-05-06

수정버전이 나왔다.


Firefox Add-on 대란

원인

2019년 5월 5일 쯤 인듯 하다. Mozilla 가 Firefox add-on들을 sign 할 때 사용하는 "보안 인증서(certificate)" 가 만료(expired) 됐다. 그래서 그 certificate 을 사용해서 sign 된 모든 add-on 들이 모두 disable 가 됐다.

해결책

아래 링크에서 현재 임시로 배포되는 해결책을 설치하면 된다. ref. 1 의 댓글에서 알려준 이야기다. 실제로 잘 된다. 처음에 들어가면 block됐다고 뜨지만 그 페이지에서 다시 refresh 를 하면 download 가 실행된다.
모질라 blog 에서는 Firefox study 를 이용해서 설치하라고 이야기 하지만 설치되는 시점도 몇시간 후에나 된다고 한다.

reddit 에서도 알려주는 방법중 하나는 about:config 에서 xpinstall.signatures.required option 을 다시 true 로 돌려주면 된다.

Refrences

  1. Update Regarding Add-ons in Firefox | Mozilla Add-ons Blog
  2. Here's what's going on with your Add-ons being disabled, and how to work around the issue until its fixed. : firefox

[컴][MacOS] Homebrew - package manager

홈브루 / 맥os / 맥북 / 자동 설치 / 패키지 매니저  / 간편 설치 / simple install / package manager

Homebrew

Homebrew 는 MacOS 에서 사용할 수 있는 windows 의 chocolatey 처럼 또는 linux 의 apt-get 등 처럼 package manager 이다.
위의 link 에서 간단한 사용법을 확인할 수 있다.
대체로 개발관련 package 설치에 많이 이용하지만, 일반적인 app 을 설치할 때도 App Store 를 사용하지 않고, homebrew 를 사용해서 설치할 수 있다. 아래처럼 명령어를 입력하면 firefox 를 설치할 수 있다.((Homebrew Cask))
$ brew cask install firefox

설치된 package 정보

설치된 app 들이나 package 들의 정보를 알고 싶을 때가 있다. 그리고 list 를 뽑아야 나중에 재설치도 쉽다.
# 모든 설치된 package 를 알려준다.[ref. 1]
$ brew list 
...
# Caskroom 을 이용해서 설치된 package 만 알려준다.
$ brew cask list
...
# dependency 로 깔린 정보들을 제외한 가장 상위 level 의 package 정보만 알려준다.
$ brew leaves

update

brew cask 로 설치된 package 는 app store 를 통한 자동 update 가 되지 않는다. 그러므로 필요한 경우에 아래처럼 udpate 를 해주면 된다.
version 정보가 없거나, app 이 자체적으로 upgrade 를 하는 경우에는 brew cask 로 update 가 되지 않는다. 이 경우에 재설치를 통해서 update 를 해주면 된다. 이것을 해주는 option 이 brew cask upgrade --greedy 이다.
$ brew cask upgrade
...
$ brew cask upgrade --greedy

list 를 재설치

아래와 같은 방법을 이용하면 된다.(참고)
$ xargs brew install < list.txt
...
$ brew install $(< list.txt )

package 의 dependency tree 확인

아래 명령어로 package 들의 dependency 를 확인할 수 있다. 보기좋게 트리모양으로 나온다. 자세한 것은 ref. 1 을 확인하자.
$ brew deps --tree --installed

References

  1. List of all packages installed using Homebrew - Ask Different

[컴][웹][js] v8 Scanner



from: https://v8.dev/blog/scanner

v8 Scanner

v8 이 소스를 파싱해서 AST 로 만든다.abstract syntax tree (AST)
이걸로 프로그램 구조를 표현한다.

v8은 complile 해야 프로그램을 실행할 수 있다.
v8 parser 은 scanner 에서 만들어놓은 token 을 소모한다.

이때 scanner 가 사용하는 character stream의 encoding 은 utf16만 지원한다.
scanner 에 input 으로 제공하기 전에 이전에 모든 encoding 을 utf16으로 convert 하는 과정을 거친다.

scanner는 이 utf16을 decode 해서 unicode 로 만들어서 사용한다.
이 decoded character 들을 이제 가져다 scanner 가 token 을 만든다.



Whitespace

2개의 token 사이에 whitespace 가 있으면 거기에 ;(semicolon)을 넣는다.(ECMAScript® 2020 Language Specification > Auto semicolon insertion)

다음 token 을 scan 하기 전까지 모든 whitespace는 skip 된다.(newline 이 발생하는지 추적하면서)

real world 에서는 대체로 js 들이 minified 돼서 여러개의 whitespace 가 연속해서 나타나는 경우가 드물다.

그래서 V8 은 whitespace 도 하나의 token 으로 취급한다. (Token::WHITESPACE) 그래서 '//' 같이 comment 가 오는 경우에도 Token::WHITESPACE 를 return 해 버린다.  그러면 paring 하는 loop 에서 다른 Token이 나올때 까지 계속 scan 을 이어나갈 수 있게 된다.

(역주: 다시 말하면, // 가 나와서 이것을 다른 token 으로 정의(Token::COMMENT) 등으로 정의해서 사용하게 되면, loop 을 한번 벗어난 후에 다시 parsing 을 시작해야 하지만, 이것을 whitespace 와 같은 속성으로 취급해 버리면, 이 overhead 를 없앨 수 있게 되는 것이다.)



V8_INLINE Token::Value Scanner::ScanSingleToken() {
  Token::Value token;
  do {
    next().location.beg_pos = source_pos();

    if (V8_LIKELY(static_cast<unsigned>(c0_) <= kMaxAscii)) {
      token = one_char_tokens[c0_];

      switch (token) {
        ...
        
        case Token::DIV:
          // /  // /* /=
          Advance();
          if (c0_ == '/') {
            uc32 c = Peek();
            if (c == '#' || c == '@') {
              Advance();
              Advance();
              token = SkipSourceURLComment();
              continue;
            }
            token = SkipSingleLineComment();
            continue;
          }
          if (c0_ == '*') {
            token = SkipMultiLineComment();
            continue;
          }
          if (c0_ == '=') return Select(Token::ASSIGN_DIV);
          return Token::DIV;
          
        ...

        case Token::WHITESPACE:
          token = SkipWhiteSpace();
          continue;

        case Token::NUMBER:
          return ScanNumber(false);

        case Token::IDENTIFIER:
          return ScanIdentifierOrKeyword();

        default:
          UNREACHABLE();
      }
    }

    if (IsIdentifierStart(c0_) ||
        (CombineSurrogatePair() && IsIdentifierStart(c0_))) {
      return ScanIdentifierOrKeyword();
    }
    if (c0_ == kEndOfInput) {
      return source_->has_parser_error() ? Token::ILLEGAL : Token::EOS;
    }
    token = SkipWhiteSpace();

    // Continue scanning for tokens as long as we're just skipping whitespace.
  } while (token == Token::WHITESPACE);

  return token;
}




Identifier scanning
Internalizing minified identifiers
Keywords
Surrogate pairs
AdvanceUntil


See Also


  1. V8 관련 글들



[컴] 맥의 원격데스크톱에서 한영키 사용하기

원격접속 / 한영키 대체 / 윈도우에서 caps lock 으로 한영키 / in Mac / 맥북

맥의 원격데스크톱에서 한영키 사용하기

한영키 변경

"맥 + 윈도우키보드" 조합을 사용하면서, Remote Desktop App(원격데스크톱) 을 이용해서 windows 10 을 접속할 때, '한/영' 키가 제대로 동작하지 않는다.

그래서 '한/영' 키를 Mac 에서 처럼 CapsLock 으로 대체하는 방법을 사용했다.

이를 위해서 AutoHotKey 를 이용했다. registry 변경등 다른 설정 방법들을 찾아봤지만, 지금으로서는 이방법이 가장 효과적이다.
; key.ahk
; {vk19sc1F1} : 한자키
; shift+space --> {vk15sc138} : 한영키
+space::Send, {vk15sc138}
return

; shift+capslock 으로 CapsLock 을
; caps-lock key 를 "한/영" 키로
+CapsLock::CapsLock
CapsLock::vk15
return



See Also


[컴][리눅스] cron

크론 / 크론 명령어 / cron command / crontab / how to use crontab

cron

crontab 편집

crontab -e

각 계정에 해당하는 crontab을 편집할 수 있다. sudo crontab -e 를 하면 root의 crontab을 편집하게 된다.

Timezone 설정

crontab 은 timezone 에 따른 시간으로 움직인다.

sudo timedatectl set-timezone Asia/Seoul  


crontab reload

sudo service cron reload
/etc/init.d/cron reload
sudo systemctl start crond.service

crontab 에서 $ 표시는 escape 가 필요하다

echo $(date '+%F_%T') 는 아래처럼 echo $(date '+\%F_\%T') 로 변경돼야 동작한다.

# echo $(date '+%F_%T')
40 10 * * * echo $(date '+\%F_\%T') > ttt.txt

[컴] Slack 에서 특정 Channel 로 메시지 보내기

슬랙 에서 메시지 전성 / webhook / hook / web hook / 슬랙 메세지 / send a message


Slack 에서 특정 Channel 로 메시지 보내기

  1. app creation pgae : app 이름 지정해서 app 을 만든다.
  2. Activate Incoming Webhooks 선택 > On
  3. slack 에서 메시지를 뿌려줄 channel 을 하나 만든다.
  4. "Add New Webhook to Workspace" 클릭 > 채널 선택 > Authorize
  5. 아래 curl 명령어를 실행하면, Hello, World 가 channel 에 보이게 된다.
  6. 이제 원하는 메시지를 아래 처럼 json format 으로 보내면 된다. content-type 은 application/json 으로 해야 한다.

// linux
curl -X POST -H 'Content-type: application/json' --data '{"text":"Hello, World!"}' YOUR_WEBHOOK_URL_HERE

// windows
curl -X POST -H "Content-type: application/json" --data "{\"text\":\"Hello, World!\"}" YOUR_WEBHOOK_URL_HERE


References

  1. Hello world: sending your first Slack app message | Slack

[컴][네트워크] DNS over TLS / DNS over HTTPS

인트라 / 클라우드플레어  / vpn / 우회 / 워닝사이트 / warning / EDNS / Encrypted DNS



only DNS over HTTPS (DoH)

이유는 잘 모르겠지만, 대체로 한번에 DNS query 가 제대로 동작하지 않는 느낌이다. (아마도 응답속도의 문제일 수도 있을 듯 싶다.) 몇번 error 를 뿜어내더라도 계속 시도하면 된다. 그 이후로는 cache 를 사용해서 문제가 없을 듯 싶다.

DNS over TLS (DoT)

접속 Test

https://www.coludflare-dns.com/help : DoH 나 DoT 가 설정됐다면 이 곳에 접속이 가능하다.

Tun2socks 

Test

[컴][웹] AdonisJS migration column 변경

아도니스js / adonisjs db migration / db column add / alter table



AdonisJS migration column 변경

migration file 생성

c:\a\proj>adonis make:migration user_hist
> Choose an action Select table
√ create  database\migrations\1553738938867_user_hist_schema.js

file 변경

'use strict'

/** @type {import('@adonisjs/lucid/src/Schema')} */
const Schema = use('Schema')

class UserHistSchema extends Schema {
  up () {
    this.table('user_hists', (table) => {
      // alter table
      table.string('power', 124).notNullable().alter();
    })

    // create
    this.create('trans', (table) => {
      table.increments();
      table.integer('user_id').unsigned().notNullable();
      table.string('type', 50).notNullable().collate('utf8_unicode_ci');

      table.timestamps();

      table.index('user_id');
      
      table.charset = 'utf8';
      table.collation = 'utf8_unicode_ci';

      // table 의 collate 을 utf8_unicode_ci 로 설정하기
      // https://adonisjs.com/docs/4.0/migrations#_executing_arbitrary_code
      this.schedule(async (trx) => {
        // ALTER TABLE `cma_transaction` CONVERT TO CHARACTER SET UTF8 COLLATE utf8_unicode_ci
        await Database.raw('ALTER TABLE `trans` CONVERT TO CHARACTER SET UTF8 COLLATE utf8_unicode_ci').transacting(trx)
        
      })
      
    });
  }

  down () {
    this.table('user_hists', (table) => {
      // reverse alternations
      table.string('power', 60).notNullable().alter();
    })
  }
}

module.exports = UserHistSchema


status 보기

c:\a\proj>adonis migration:status
migration:status 를 이용하면 현재 어떤 schema 까지 적용이 됐는지 확인할 수 있다.

run

아래처럼 실행하면 된다.
c:\a\proj>adonis migration:run
migrate: 1553738938867_user_hist_schema.js
Database migrated successfully in 1.25 s

alter

아래 link 에서 table 의 column 추가 등의 변경사항에 관한 부분을 확인할 수 있다.

knex alter

alter 와 관련된 사항은 위의 link 에서 자세히 확인할 수 있다.

기본적으로 table(t) 에 어떤 함수를 부르면 add 의 의미이다.
table.bigInteger('mycolumn') // mycolumn 이란 이름을 가진 bigInteger type 의 column 을 table 에 추가
그래서 위의 경우는 table 에 'mycolumn' 을 추가 하는 의미이다.

그런데, 뒤에 alter() 를 붙이면, 이전의 값을 없애고, 새로운 값으로 변경하는 것이다.
t.integer('mycolumn').alter();

그래서 위의 경우는 이전의 'mycolumn' 이란 column 의 type 을 'integer' 로 변경하는 것이다. 그리고 type 을 변경하면서, not null constraint 와 default value 도 drop 하게 된다.

in production

Error: Cannot run migrations in production. Use --force flag to continue

    at MigrationRun._validateState (/home/ubuntu/new-funded-backend/node_modules/@adonisjs/lucid/commands/BaseMigration.js:58:13)
    ...

기본적으로 "adonis migration:run --force" 를 하지 않으면 error 가 난다.

References

  1. Adonis Migrations

[컴][웹] firefox 에서 ESNI 사용하기

Intra in firefox / 파폭에서 ESNI 사용 / 암호화 DNS 사용 / 우회하기 / warning / 사이트 우회



firefox 에서 ESNI 사용

  1. 주소창에서 about:config
  2. network.security.esni.enabled: true
  3. network.trr.mode : 2 
    1. '2' 로 했을때 '테스트' 를 했는데, 제대로 되지 않으면, '3' 으로 변경해 보자.
    2. Trusted Recursive Resolver
    3. 이 부분이 DNSSEC 을 결정한다.
      • 0: Off by default
      • 1: Firefox will choose based on which is faster
      • 2: TRR preferred, fall back to DNS on failure
      • 3: TRR only, no DNS fallback
      • 5: TRR completely disabled
  4. network.trr.uri : 
  5. network.trr.bootstrapAddress : 1.1.1.1
    1. network.trr.uri 가 동작을 안하면 이 IP 주소를 사용하게 된다.
  6. network.security.esni.enabled: true
  7. 테스트 해보기 : https://www.cloudflare.com/ssl/encrypted-sni/
    1. 혹시 제대로 동작하지 않으면, firefox 를 restart 해보자.
    2. 그리고 한번에 응답을 하지 않으면 여러번 시도해 보자. 응답시간이 늦어서 제대로 안되는 경우가 있는듯 하다. 여러번 시도해서 되는 경우가 있었다.
      아니면, 기존의 OS의 dns cache 때문일 수도 있을 듯 하다. browser 의 cache 가 아닌 이유는 curl 을 사용해도 같은 반응을 보였다.

References

[컴] 썬더클랩 Thunderclap

썬더볼트 취약점 /


paper : http://thunderclap.io/thunderclap-paper-ndss2019.pdf

썬더클랩(Thunderclap)

  • 이 취약점은 물리적인 접근을 한 공격자에게 Thunderbolt(썬더볼트) 포트를 이용해서 해당기계를 위험하게 한다.
  • 공격자가 가장높은 권한으로 임의의 코드를 실행시킬 수 있게 해준다. 그래서 잠재적으로 암호, 은행 로그인, 암화화 키, 개인파일등에 접근할 수 있게 해준다.
  • 또한, 공격자가 이 취약점을 이용하면 겉으로 무해해 보이는 충전기, 프로젝터 같은 주변기기가 충전이나, 영상을 쏘아 주는 사이에 "host 머신"을 위험하게 할 수 있다.(이러면, 우리가 제3자의 충전기도 마음대로 사용하기 힘들어진다. 마치 공용 wifi 같이)

동작

네트워크 카드의 동작

  1. OS 가 network interface card(NIC) 에 packet 을 보내라고 요청할 때
  2. OS 는 NIC에 보낼 data 에 대한 address 를 제공해 준다.
  3. 그러면 NIC 의 payload 함수는 plaintext data를 찾으려고 memory 근처를 검색할 것이다.


Thunderclap 방법

When an IOMMU is in operation, the most obvious way touse it for protection requires some changes to ring buffer usage. 
  • First,  packet  data  must  be  allocated  from  a  pool  of  physical memory  that  allows  exposure  to  devices  (some  memory  maybe  inaccessible  due  to  hardware  limitations).  
  • Second,  before a data  block  is  placed  in  the  ring  buffer  for  transmission,  a window must be opened for it to be accessible by the device. This involves creating a mapping for the block in the IOMMU page table.
  • Third, the address written into the ring buffer is now the I/O virtual address of the mapping, rather than the physical address. 
  • Finally, when the device is finished with the data, the operating system should close the window again, revoking the mapping from the IOMMU page table and IOTLB.




How do the Thunderclap vulnerabilities work?

The Thunderclap vulnerabilities stem from the fact that computer peripherals such as network cards and GPUs have traditionally been trusted parts of a computer system: they have direct memory access (DMA), which allows them to read and write all of system memory without operating system oversight. DMA allows peripherals to bypass operating system security policies, and DMA attacks abusing this access have been widely employed by hackers and the intelligence community to take control of and exfiltrate sensitive data from target machines. This means passwords, banking logins, private files and browser activity are all exposed, and an attacker can inject any code they wish onto your machine.

Current systems feature input-output memory management units (IOMMUs), protection mechanisms that allow the operating system to restrict peripheral-device memory access. With IOMMU usage enabled, operating systems can protect against DMA attacks by restricting memory access to peripherals that perform legitimate functions and only allowing access to non-sensitive regions of memory. Unfortunately, IOMMU protection is turned off by default in many systems.

Our work leverages vulnerabilities in operating system IOMMU usage to compromise a target system via DMA, even in the presence of an IOMMU that is enabled and configured to defend against DMA attacks. The novel Thunderclap security evaluation platform, built on field-programmable gate array (FPGA) hardware, mimics the functionality of a legitimate peripheral device to convince a target operating system to grant it access to regions of memory. It then examines those regions of memory to find a rich and nuanced attack surface of vulnerable structures that can be exploited to take control of the system.

The rise of hardware interconnects like Thunderbolt 3 over USB-C that combine power input, video output, and peripheral device DMA over the same port greatly increases the real-world applicability of Thunderclap vulnerabilities. Thunderbolt can allow potentially malicious devices to hotplug into a running machine and obtain direct memory access, which makes DMA attacks against temporarily unattended targets feasible. Furthermore, the confusion of power, video, and DMA facilitates the creation of malicious charging stations or projectors that take control of connected machines.

Additionally, our work shows that the Thunderclap vulnerabilities can also be exploited by compromised firmware on existing PCI Express devices, for example network cards or baseboard management controllers (BMCs) integrated into servers. A firmware compromise might be introduced via a firmware vulnerability or a compromise in the device supply chain or factory.


How does this work differ from earlier DMA attacks such as Inception?

Early DMA attacks relied on the absence of an IOMMU. They involved scanning all of a system’s memory for sensitive data from devices that did not appear to the system as legitimate peripherals. These attacks were addressed by the introduction of IOMMUs, which block all memory access from unrecognized devices.

Some previous DMA attacks have taken advantage of weaknesses in IOMMU configuration or setup to disable IOMMU protections. Thunderclap explores serious vulnerabilities that are present even once the IOMMU is configured correctly.

Technical details of the Thunderclap platform

The Thunderclap platform consists of an FPGA that runs the Thunderclap application. The FPGA then plugs into a computer via PCI Express or Thunderbolt. The Thunderclap application makes the FPGA behave to the computer like a genuine Ethernet card (the Intel 82574L network interface card or NIC). The operating system will identify the ethernet peripheral, load drivers, allow the device to access memory (via DMA and an IOMMU if enabled), and ask it to send and receive packets.

With this deep interaction with the operating system, Thunderclap’s device model provides hooks that allow payload functions to be added to device behavior. For example, when the operating system asks the NIC to send a packet, it provides the NIC with the address of the data to send. A payload function might search nearby memory looking for plaintext data that was intended for a different network device.

The Thunderclap application runs on Intel/Altera FPGA boards:
  1. Intel Arria 10 SoC Development Kit ($4500) with Samtec HDR-181157-01-PCIEC cable (available from Samtec direct) - currently recommended
  2. Enclustra Mercury+ AA1 module (ME-AA1-270-3E4-D11E) on PE1 carrier board (~EUR 800) - work in progress
  3. Terasic DE5-Net board (Stratix V) with BERI soft-CPU - no longer supported
  4. As far as we can ascertain, Xilinx, Lattice and Intel Cyclone FPGAs don’t allow us to replace the vendor-supplied implementation of configuration registers with our own (Intel calls it ‘config bypass’ mode) which we require.
It is composed of several pieces:
  1. The underlying FPGA bitfile, containing the hardware that receives PCIe packets (TLPs) and delivers them to software. The FPGA contains an Arm Cortex A9 CPU (hard processor system or HPS) to run our software stack. GitHub repo
  2. The Ubuntu 16.04 operating system running on the on the Arm, including kernel, device tree and u-boot bootloader (which also loads the FPGA bitfile at boot time). Automated build scripts (work in progress): GitHub repo
  3. The Thunderclap application, which is a substantially cut down version of QEMU, based on its e1000e device. This runs in Ubuntu on the ARM core and connects directly to the PCIe queues provided by the hardware. GitHub repo