I have been using a SSH tunnel (Please see this post for the instructions, http://swapoff.blogspot.com/2018/03/how-to-create-ssh-tunnel-and-use-it-for.html) for web browsing via Firefox.
I used it to forward DNS queries well. So I thought I'm pretty much safe until I read about WebRTC feature in web browsers.
WebRTC allows P2P communication for real time communication in web browsers. WebRTC can be used to get your true IP address via STUN requests with browsers, even when you are using a VPN or SSH tunnel.
You can check whether WebRTC is enabled using several methods, but checking it via a web application is easier than any other methods. e.g.: https://browserleaks.com/webrtc
To disable WebRTC in firefox, set media.peerconnection.enabled to false via about:config
Tuesday, August 14, 2018
Saturday, July 14, 2018
Fix some errors appeared in rtorrent
After a fresh installation and configuration of rtorrent and rutorrent, below errors were appeared.
To fix those, I had to install the missing programs,
In Ubuntu,
apt-get install unrar-free
apt-get install sox
- unpack plugin: rtorrent user can't access 'unrar' program.
- rTorrent user can't access external program (sox)
To fix those, I had to install the missing programs,
In Ubuntu,
apt-get install unrar-free
apt-get install sox
Tuesday, July 10, 2018
Create your own OVH Server availability checker
Recently I came to know that OVH has a line of storage specific "So You Start" (SyS) ARM based servers. I have been using a Kimsufi server, but some of these SyS servers are cheaper than the Kimsufi server I have been using. Also the storage available in SyS servers is larger than what I get from the Kimsufi Server for a slightly higher price. Therefore I decided to try a SyS ARM server (ARM-2T/1801armada01)
Unfortunately SyS ARM servers are not always available to order, specially the cheapest servers. I was refreshing their page regularly to order a server, but soon I understood that's not practical. I didn't see they become available in the web page even though I tried many times for several days.
Then I decided to automate the check so that I can order a server whenever they are available.
Fortunately OVH offers a REST API to communicate with their servers and services. It's easier to check the availability of a server sending a http request to their API. Using a bunch of commands, the availability can be checked using a one line Linux command.
Just checking the availability is not enough. There should be a way to notify the availability. I could setup a script to send the availability to an email easily, but I don't read emails often. The best way of doing that is to push a message to my mobile. I found a free service called pushme (pushme.jagcesar.se) which can be used to push a message to my mobile. It also use a REST API, so I can send a message as a http POST request to pushme servers. Then pushme forwards the message to the app installed in the mobile via iCloud.
I created a simple shell script to read the server code as an argument and used it to check the availability of that server type using the OVH REST API. If a server is available, it sends a message to pushme using pushme REST API.
Then the script was scheduled to run for every 5 minutes using a cron job so that I'll get a notification whenever a server is available.
I also created another script to send a test message in every day morning to verify that the availability checker mechanism works.
After a day of implementing this, I was able to purchase the server I wanted. :)
Hope this might help you to find a server as well.
But note that pushme works only with Apple. you will need another message sender if you use Android. Also this is a very simple and lazy way of doing this. No errors are checked in the script and only happy path is considered.
Here are the shell scripts and crons I used,
server_checker.sh
#!/bin/bash
server_code=$1
pushmeapi_token='replace_this_with_your_pushmeapi_token'
availability_count=`curl -s "https://www.ovh.com/engine/api/dedicated/server/availabilities?country=eu&hardware=$server_code" | json_pp | grep availability | grep -v unavailable | wc -l`
if [ $availability_count -gt 0 ]; then
curl -d "title=found a $server_code&token=$pushmeapi_token" -X POST https://pushmeapi.jagcesar.se
fi
ping_sender.sh
#!/bin/bash
pushmeapi_token='replace_this_with_your_pushmeapi_token'
curl -d "title=test message&token=$pushmeapi_token" -X POST https://pushmeapi.jagcesar.se
Cron Jobs
*/5 * * * * /home/seedbox/server_checker.sh 1801sk13
*/5 * * * * /home/seedbox/server_checker.sh 1801armada01
30 5 * * * /home/seedbox/ping_sender.sh
You can find out the server code from either their web page (look at the source of the web page) or using their API.
Examples:
In https://www.soyoustart.com/us/server-storage/ page, when you click ARM-2T, the server code is there at the end of the URL as 1801armada01
below command will provide the list of ARM server types,
curl -s "https://www.ovh.com/engine/api/dedicated/server/availabilities?country=eu" | json_pp | grep hardware | grep -v , | sort | uniq | grep armada
below command will provide the list of kimsufi server types,
curl -s "https://www.ovh.com/engine/api/dedicated/server/availabilities?country=eu" | json_pp | grep hardware | grep -v , | sort | uniq | grep sk
Anyway, here is a list of machine types of kimsufi servers and SyS ARM servers,
Kimsufi Servers
France
KS-1 1801sk12
KS-2 1801sk13
KS-3 1801sk14
KS-4 1801sk15
KS-5 1801sk16
KS-6 1801sk17
KS-7 1801sk18
KS-8 1801sk19
KS-9 1801sk20
KS-10 1801sk21
KS-11 1801sk22
KS-12 1801sk23
Canada
KS-1 1804sk12
KS-2 1804sk13
KS-3 1804sk14
KS-4 1804sk15
KS-5 1804sk16
KS-6 1804sk17
KS-7 1804sk18
KS-8 1804sk19
KS-9 1804sk20
KS-10 1804sk21
KS-11 1804sk22
KS-12 1804sk23
Sys ARM servers
France
ARM-2T 1801armada01
ARM-4T 1801armada02
ARM-6T 1801armada03
Canada
ARM-2T 1804armada01
ARM-4T 1804armada02
ARM-6T 1804armada03
Unfortunately SyS ARM servers are not always available to order, specially the cheapest servers. I was refreshing their page regularly to order a server, but soon I understood that's not practical. I didn't see they become available in the web page even though I tried many times for several days.
Then I decided to automate the check so that I can order a server whenever they are available.
Fortunately OVH offers a REST API to communicate with their servers and services. It's easier to check the availability of a server sending a http request to their API. Using a bunch of commands, the availability can be checked using a one line Linux command.
Just checking the availability is not enough. There should be a way to notify the availability. I could setup a script to send the availability to an email easily, but I don't read emails often. The best way of doing that is to push a message to my mobile. I found a free service called pushme (pushme.jagcesar.se) which can be used to push a message to my mobile. It also use a REST API, so I can send a message as a http POST request to pushme servers. Then pushme forwards the message to the app installed in the mobile via iCloud.
I created a simple shell script to read the server code as an argument and used it to check the availability of that server type using the OVH REST API. If a server is available, it sends a message to pushme using pushme REST API.
Then the script was scheduled to run for every 5 minutes using a cron job so that I'll get a notification whenever a server is available.
I also created another script to send a test message in every day morning to verify that the availability checker mechanism works.
After a day of implementing this, I was able to purchase the server I wanted. :)
Hope this might help you to find a server as well.
Screenshot of the notifications I received about 1801armada01 availability
But note that pushme works only with Apple. you will need another message sender if you use Android. Also this is a very simple and lazy way of doing this. No errors are checked in the script and only happy path is considered.
Here are the shell scripts and crons I used,
server_checker.sh
#!/bin/bash
server_code=$1
pushmeapi_token='replace_this_with_your_pushmeapi_token'
availability_count=`curl -s "https://www.ovh.com/engine/api/dedicated/server/availabilities?country=eu&hardware=$server_code" | json_pp | grep availability | grep -v unavailable | wc -l`
if [ $availability_count -gt 0 ]; then
curl -d "title=found a $server_code&token=$pushmeapi_token" -X POST https://pushmeapi.jagcesar.se
fi
ping_sender.sh
#!/bin/bash
pushmeapi_token='replace_this_with_your_pushmeapi_token'
curl -d "title=test message&token=$pushmeapi_token" -X POST https://pushmeapi.jagcesar.se
Cron Jobs
*/5 * * * * /home/seedbox/server_checker.sh 1801sk13
*/5 * * * * /home/seedbox/server_checker.sh 1801armada01
30 5 * * * /home/seedbox/ping_sender.sh
You can find out the server code from either their web page (look at the source of the web page) or using their API.
Examples:
In https://www.soyoustart.com/us/server-storage/ page, when you click ARM-2T, the server code is there at the end of the URL as 1801armada01
below command will provide the list of ARM server types,
curl -s "https://www.ovh.com/engine/api/dedicated/server/availabilities?country=eu" | json_pp | grep hardware | grep -v , | sort | uniq | grep armada
below command will provide the list of kimsufi server types,
curl -s "https://www.ovh.com/engine/api/dedicated/server/availabilities?country=eu" | json_pp | grep hardware | grep -v , | sort | uniq | grep sk
Anyway, here is a list of machine types of kimsufi servers and SyS ARM servers,
Kimsufi Servers
France
KS-1 1801sk12
KS-2 1801sk13
KS-3 1801sk14
KS-4 1801sk15
KS-5 1801sk16
KS-6 1801sk17
KS-7 1801sk18
KS-8 1801sk19
KS-9 1801sk20
KS-10 1801sk21
KS-11 1801sk22
KS-12 1801sk23
Canada
KS-1 1804sk12
KS-2 1804sk13
KS-3 1804sk14
KS-4 1804sk15
KS-5 1804sk16
KS-6 1804sk17
KS-7 1804sk18
KS-8 1804sk19
KS-9 1804sk20
KS-10 1804sk21
KS-11 1804sk22
KS-12 1804sk23
Sys ARM servers
France
ARM-2T 1801armada01
ARM-4T 1801armada02
ARM-6T 1801armada03
Canada
ARM-2T 1804armada01
ARM-4T 1804armada02
ARM-6T 1804armada03
Labels:
Apple,
ARM,
iCloud,
Kimsufi,
Linux,
OVH,
pushme,
pushmeapi,
REST,
shell script,
SoYouStart,
SYS
Tuesday, July 3, 2018
Document viewer Evince in Fedora does not print page borders? Here is a solution!
Well, this is not a workaround or a solution available in Evince, but this is a general solution which can be used when the usual GUI applications does not have some features.
Today I was trying to print some lecture slides using "Document Viewer" also known as "Evince" running on my Fedora laptop. I was trying to print several pages in one output page. (4 lecture slides should be printed on a single page)
Once I got the output, I realized that it does not add a border to source pages printed on a single output page. I couldn't find an option in Evince to get that done.
Fortunately I came across about the Unix/Linux lp command which uses CUPS. (Common UNIX Printing System)
Using that I was able to get what I wanted printed precisely.
Here are the steps,
1. Find out the status of the printers you have configured in the system,
lpstat -a
This will list down all the printers you have configured in your machine. Use the preferred printer as the destination of the lp command using -d option. (see the next step)
2. Use lp command to get the job done
lp -d HP-LaserJet-400 -o sides=two-sided-short-edge -o number-up=4 -o pagesize=A4 -o landscape -o page-border=single -o fit-to-page -o number-up-layout=lrtb my_document.pdf
As you can see, we can pass multiple options to lp command including the page-border which I couldn't find in Evince. You can find the explanations of each option in lp man page.
Another great option of lp is that you can send multiple files to printer.
Today I was trying to print some lecture slides using "Document Viewer" also known as "Evince" running on my Fedora laptop. I was trying to print several pages in one output page. (4 lecture slides should be printed on a single page)
Once I got the output, I realized that it does not add a border to source pages printed on a single output page. I couldn't find an option in Evince to get that done.
Fortunately I came across about the Unix/Linux lp command which uses CUPS. (Common UNIX Printing System)
Using that I was able to get what I wanted printed precisely.
Here are the steps,
1. Find out the status of the printers you have configured in the system,
lpstat -a
This will list down all the printers you have configured in your machine. Use the preferred printer as the destination of the lp command using -d option. (see the next step)
2. Use lp command to get the job done
lp -d HP-LaserJet-400 -o sides=two-sided-short-edge -o number-up=4 -o pagesize=A4 -o landscape -o page-border=single -o fit-to-page -o number-up-layout=lrtb my_document.pdf
As you can see, we can pass multiple options to lp command including the page-border which I couldn't find in Evince. You can find the explanations of each option in lp man page.
Another great option of lp is that you can send multiple files to printer.
e.g.: if you want to print all the files which have file names starting from "bla_" then you can pass bla_* to lp command so that all of them will be printed one by one.
Saturday, March 10, 2018
How to create SSH tunnel and use it for web browsing
Command
ssh -D 12345 -C -q -N <username>@<ip or FQDN> -p 23456
Explanation
-D ssh will act as a SOCKS server for the given port
-C Compress data
-q quiet mode. warning and diagnostic messages will be suppressed
-N Do not execute a remote command. just forwarding ports.
<username>@<ip or FQDN> Connection string to SSH server
-p SSH server port. (if it's usual port 22, you can ignore this parameter)
In addition to above options you can use -f option to push ssh command to background
Executing above command will create a SSH tunnel which supports SOCKS protocol.
How to configure Firefox to use the SSH tunnel
Go to proxy settings and use localhost as "SOCKS Host" and the port you used for the tunnel as the Port (see the screenshot below)
How to configure Firefox to forward DNS queries to the SSH tunnel
Use "Proxy DNS when using SOCKS v5" in proxy settings or set "network.proxy.socks_remote_dns" to "true" via about:config to get DNS queries resolved via the tunnel. Otherwise the browser will use DNS server configured in your network interface or ISP's DNS servers.
How to disable WebRTC in Firefox
ssh -D 12345 -C -q -N <username>@<ip or FQDN> -p 23456
Explanation
-D ssh will act as a SOCKS server for the given port
-C Compress data
-q quiet mode. warning and diagnostic messages will be suppressed
-N Do not execute a remote command. just forwarding ports.
<username>@<ip or FQDN> Connection string to SSH server
-p SSH server port. (if it's usual port 22, you can ignore this parameter)
In addition to above options you can use -f option to push ssh command to background
Executing above command will create a SSH tunnel which supports SOCKS protocol.
How to configure Firefox to use the SSH tunnel
Go to proxy settings and use localhost as "SOCKS Host" and the port you used for the tunnel as the Port (see the screenshot below)
How to configure Firefox to forward DNS queries to the SSH tunnel
Use "Proxy DNS when using SOCKS v5" in proxy settings or set "network.proxy.socks_remote_dns" to "true" via about:config to get DNS queries resolved via the tunnel. Otherwise the browser will use DNS server configured in your network interface or ISP's DNS servers.
Important: Please read http://swapoff.blogspot.com/2018/08/avoid-webrtc-leak-if-you-use-browser.html for instructions to disable WebRTC.
Subscribe to:
Posts (Atom)

