- Open terminal
- Run ssh-keygen command
- When prompted for filename to save, press enter for default location
- When prompted for passphrase, you can either put in a passphrase (highly recommended), or just leave it empty (not recommended)
- Your public key is /home/username/.ssh/id_rsa.pub, and your private key is /home/username/.ssh/id_rsa
Tuesday, September 26, 2017
Generating ssh key (public and private)
Wednesday, September 13, 2017
Using yum via socks proxy using proxychains
This is useful when you have a CentOS/Redhat server that needs to be updated, but does not have internet connection to get app from the repo. The only requirement is that the server need to be able to ssh into another server that have internet connection. Let's begin.
Download source for proxychain. You can use the server that have internet connection to do this
# wget -c https://github.com/rofl0r/proxychains-ng/archive/master.zip
Transfer the downloaded file into the server without internet, and unzip the file into /usr/local/src
# unzip master.zip -d /usr/local/src
Change directory to /usr/local/src/proxychains-ng-master
# cd /usr/local/src/proxychains-ng-master
Compile, configure and make
# ./configure && make && make install && make install-config
Setup a dynamic socks proxy on port 8888 by ssh'ing into the server that has internet connection:
# ssh foo@server.with.internet -D 8888
Set proxychains to use the dynamic tunnel, by changing the last line of /usr/local/etc/proxychains.conf to "socks4 127.0.0.1 8888"
# tail -1 /usr/local/etc/proxychains.conf
socks4 127.0.0.1 8888
Open a new terminal, and run yum command with proxychains. You can see that your yum is tunneled via localhost port 8888:
# proxychains4 yum update
[proxychains] config file found: /usr/local/etc/proxychains.conf
[proxychains] preloading /usr/local/lib/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.12
...
Download source for proxychain. You can use the server that have internet connection to do this
# wget -c https://github.com/rofl0r/proxychains-ng/archive/master.zip
Transfer the downloaded file into the server without internet, and unzip the file into /usr/local/src
# unzip master.zip -d /usr/local/src
Change directory to /usr/local/src/proxychains-ng-master
# cd /usr/local/src/proxychains-ng-master
Compile, configure and make
# ./configure && make && make install && make install-config
Setup a dynamic socks proxy on port 8888 by ssh'ing into the server that has internet connection:
# ssh foo@server.with.internet -D 8888
Set proxychains to use the dynamic tunnel, by changing the last line of /usr/local/etc/proxychains.conf to "socks4 127.0.0.1 8888"
# tail -1 /usr/local/etc/proxychains.conf
socks4 127.0.0.1 8888
# proxychains4 yum update
[proxychains] config file found: /usr/local/etc/proxychains.conf
[proxychains] preloading /usr/local/lib/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.12
...