Posted on Leave a comment

Syncthing = Dropbox & GDrive Alternative

Syncthing

Google Drive (GDrive) and other cloud storage alternatives such as Dropbox and Microsoft Ondrive all have the serious drawback of keeping one's information in a third party cloud repository. Privacy and security are generally compromised this way, even when paying for storage (as opposed to having an advertising model, which is worse in many ways).

Continue reading Syncthing = Dropbox & GDrive Alternative

Posted on Leave a comment

Telegram for Social Networking

Telegram is a great chat app, but there is more, and less to it, than say Twitter and Facebook. The first thing is that a lot of this gamification of likes/thumbsup is gone. Want to know if someone read your post? That has to be done either via direct message, or in a group (and the person has to respond). Recently there are new apis that help enable discussions on posts, as well as connecting channel posts as annoucements in groups.

Types of Accounts in Telegram

There is a single namespace in telegram for all entities: users, channels, groups, and bots. Users are individual accounts tied to a phone number (I think that is mandatory). Telegram Channels are one-way broadcast accounts, which can have multiple admins (but messages are signed by the channel. Membership in channels is unlimited. Telegram Groups can include up to 200,000 users, and everyone can post.

Using Bots for Commenting and Discussion

Note that for feedback on channel posts one can add a like bot or other such simple feedback, or add a discussion group and put that information in the channel description. A third new option is to have a comment system using an app which would also be available on the web as a preview (without logging into Telegram). The preview bot that does this works nicely and shows off what kind of api/developer support Telegram.

No Manipulation or Advertising

Instead of the constant intrusion of 99% annoyance in terms of timeline distortion and advertising as found in Facebook and Instagram (and to some extent Twitter, which is going down that same path).

Essentially, the use of channels with comments can replace any given social network (other limitations apply), such as Twitter, Facebook, and Instagram. While those platforms still have the lion's share of engagement and users, moving over to the Telegram way of things makes sense.

Telegra.ph for Longform

Telegra.ph is a longform microblog platform which is very simple and also has zero advertising. There is a nice Telegraph App in the Google Play store.

Installing Telegram

For the Linux and ChromeOS world, the options are: Telegram Desktop (for Linux) and Telegram Android App (for ChromeOS).

Posted on Leave a comment

Debian on AWS Lightsail

This is a setup of several items, starting with Debian 9 on Amazon AWS Lightsail. This has server basics and apt, and then follows with links to additional articles. In general, after several years of running CentOS on Linode, and then Amazon Linux AMI on EC2 and Lightsail, I find that Debian 9 is simply faster, just as secure, and at least slightly easier to use.

Continue reading Debian on AWS Lightsail

Posted on Leave a comment

KeePassXC, KeePass2Android & OTP

My beloved KeepassX has not seen a release since 2016, but a newer fork entitled KeePassXC has. The latest version looks very much the same when viewed from LMDE3 with a dark theme. The added functionality is quite nice: A TOTP Seed and Code Generator.

OTP / TOTP Seed + Generator

OTP in software (virtual device) is needed, and is the most convenient approach to having some kind of 2FA (two-factor authentication). This means not only a password but some other kind of evidence is needed. Sometimes this key is tied to a device (as in the case of the Google Authenticator). When not virtual, it is a dedicated hardware device (banks like to make you have their particular hardware device), though there can be multiple copies of the hardware device (as in multiple Yubikeys). The problem with a single virtual device is the well-known issue of losing it (such as a phone that the software is kept on). Backups can be made of seed codes (QR Codes and/or the string that is represented).

Authy Apps, Synchronization, and Cloud Backup

Authy is the best (and free) solution, though it does have a third-party involved (namely their cloud backup/sync application). Other than that, it is a reasonable approach and beats out Google Authenticator, and the sheer add once, access across multiple apps is definitely a modern desire. That said, if it were possible to have seeds in a more generic encrypted database with access to generated codes, that would be better (especially if multi-device, cross-platform). Well that is exactly what KeePassXC and KeePass2Android support. This was a revelation for me.

KeePassXC Desktop Application

KeePassXC is a fork of a fork, most recently to spur the development of what was KeePassXC that had very slow development, and is now dormant. The ability to do OTP was originally a plugin for the original KeePass (which supports plugins). Now we have something with a built-in function, and also includes some enhancements from the older (and still serviceable) KeePassX, which unfortunately has 85 open pull requests in github (come on, give someone else ownership of this project, already).

Keepass2Android Mobile Application

The most serviceable Android Keepass2 implementation is the aptly named Keepass2Android, which is actively developed and available through the Google Play store. It too has OTP functionality, eloquently implemented.

Posted on Leave a comment

Obfsproxy, Viscosity, OpenVPN

OpenVPN is great, and the OpenVPN command line client and the Viscosity GUI are also nice. However, all configurations need to be checked to ensure there is no information leakage. Secondly, the basic OpenVPN connection needs another layer of encryption and/or obfuscation, in order to interoperate with Internet firewalls and services that use deep packet inspection to determine vpn/proxy traffic.

Viscosity

Viscosity is probably the best gui client for OSX and Windows. That said, there is a lot to be desired. In fact, it is wise to skip the gui altogether with most things. - Editing a Viscosity Connection Manually - Advanced Viscosity Commands For OSX, the connections are separate, numbered folders, with copied keys and certs and a config.conf file, located in ~/Library/Application Support/Viscosity/OpenVPN/1 with second and subsequent configurations in /2, /3, etc. Manually edit these files, and copy the ca.crt, username.crt, and username.key, and put those filenames in the entries. Set the security to chmod 700 on the certs and keys. Example:

#-- Configuration Generated By Viscosity --#
#viscosity startonopen false
#viscosity protocol openvpn
#viscosity dns full
#viscosity usepeerdns true
#viscosity dnsserver 10.10.0.1
#viscosity autoreconnect true
#viscosity name host.domain.tld
#viscosity dhcp true
remote 12.34.56.78 1194 udp
nobind
dev tun
redirect-gateway def1
tun-mtu 1500
persist-tun
persist-key
compress lzo
pull
tls-client
ca username-ca.crt
cert username-cert.crt
key username-key.key
push "redirect-gateway def1"
comp-lzo
mssfix 1450
resolv-retry infinite
tun-mtu-extra 32
reneg-sec 0

Current Problems with my OpenVPN Configuration

SSL Tunnel with Stunnel for OpenVPN

SSH Tunnel

... Incomplete, more to follow ...

Obfsproxy

... Incomplete, more to follow ...

OpenVPN Client for IOS

The OpenVPN Connect client app for IOS works well. First, configure Viscosity, then copy the config.conf file and rename to config.ovpn. Next, install the OpenVPN IOS app, and hen share all four files (the two certificates, the key, and the configuration file) via iTunes or email (select Help button). Go to Settings > OpenVPN and enable Seamless tunnel and Reconnect on wakeup. Set the protocol, compression, connection timeout, network state detection, and IPv6 settings.

Resources Consulted

Posted on Leave a comment

ufw, firewalld, iptables on Amazon Linux

ufw is known as a Debian (and Ubuntu) firewall, which is disabled by default but easy to use. There are some GUI front-ends which make it popular for Linux on the desktop. Coming from a CentOS background (RHEL/Amazon Linux AMI), ufw is not as common (as, say firewalld, or simply iptables, to which both ufw and firewalld are more or less interfaces). Recall that netfilter is where the actual firewalling takes place, with iptables an interface on top of that, and ufw/firewalld as interfaces on top of iptables. Given this, there is no reason why ufw or firewalld cannot be run on any linux, provided packages (or compiling) are available. - See comparison of commands for iptables, ufw, and firewalld - Firewalld: improving security of EC2 - Introduction to uncomplicated firewall (ufw) - UFW Essentials - How to Configure a Firewall with UFW - UFW man pages (Ubuntu 8) - How To Setup a Firewall with UFW

Posted on Leave a comment

OpenVPN on Amazon Linux

OpenVPN on an AWS EC2 T2.Nano Instance

The T2.Nano instance is the smallest instance generally available for AWS EC2. As of 17-June-2017, the Nano includes the following resources: - 512mb RAM - 1 vcpu (30 credits + 3/hr, up to 72 credits) - 1gb network out traffic Alternatively, a $5 USD Amazon Lightsail instance can be used (see below)

Amazon Linux AMI

For those who prefer RHEL/CentOS, these are not available for the T2.Nano instance, rather Amazon Linux AMI is the only RHEL-derrived OS available. Note that Amazon AMI Linux is akin to CentOS 6.x (no systemd). Alternatively, Ubuntu is also available for the Nano. Note, there is now (Dec 2017) an Amazon Linux 2 option. Some say not to use any Amazon Linux. I tend to agree, though the main reason of not being able to use AMI outside of EC2 isn't correct, as there are container versions available for use locally.

Amazon Lightsail as an Alternative to EC2 T2.Nano

Amazon Lightsail is a VPS package that provides simplified control panel, and greater resources. For $5 USD/month, the smallest Lightsail instance is essentially a T2.Nano plus Elastic IP address, 20gb EBS storage, 1tb of outbound data, and Route53 DNS interface. Since outbound data can run 0.10/gb (with elastic IP), this is potentially $10/mo in database. The EBS storage is ~$2 USD, Route53 is $0.50 USD, and a nano instance with 1 year contract is ~$3.50 USD. This means for $5 USD/mo, one gets between $6-106 USD in AWS resources. For the $10 USD Lightsail, the value consists of a T2.Micro, and all the rest, which is worth $11-$211 USD in services due to an increase to 30gb EBS and 2TB data transfer out. - Amazon Lightsail FAQ Note: on Lightsail, the Security Groups are port-based only, so any IP filtering needs to be done wiht a separate firewall, such as iptables.

Steps to install OpenVPN on AMI - Pre-Installation

These steps are similar for a Nano instance. This should work on a Lightsail instance, though some control panel settings may be in different places.

Assume Root

sudo su

Set the hostname, timezone, nameservers

hostname server.domain.tld

Set the timezone

nano /etc/sysconfig/clock

Change the ZONE line to appropriate continent/city, e.g.,

ZONE="Continent/City"
UTC=false
ARC=false

Create a symbolic link

rm -rf /etc/localtime
ln -sf /usr/share/zoneinfo/Continent/City /etc/localtime

Update nameservers (using dns.watch resolvers)

echo "nameserver 84.200.69.80" > /etc/resolv.conf
echo "nameserver 84.200.70.40" >> /etc/resolv.conf

Edit the network sysconfig

nano /etc/sysconfig/network

Change HOSTNAME to server.domain.tld Check to ensure the change with the command:

hostname

Don't worry about /etc/hosts for now...

reboot

Update yum, configure EPEL

Note that we want the Amazon EPEL Repository

yum clean all
yum update
yum -y install epel-release
yum -y install yum-utils
yum-config-manager --enable epel

Update AMI without EPEL

This is done by disabling the repositories, which can be enabled later, including:

yum-config-manager --disable epel
yum clean all
yum update
cat /etc/system-release
uname -r

After the update version is confirmed, then re-enable the repositories with:

yum-config-manager --enable epel

Secure SSHD

nano /etc/ssh/sshd_config

make sure of the following:

PasswordAuthentication no
PermitRootLogin no

If you want to do fancy stuff like have an sftp login inside of a web directory, and need different than 700, 750, or 755 rights (say, for example, having the group be apache, and the user be a login) then include:

StrictModes no

Restart sshd

service sshd restart

Install and enable MOSH

yum -y install mosh

Mosh makes connections more resilient, but there is a cost of disabling the ability to scroll up in the console.

firewalld or ufw

This may or may not be desirable, in addition to the AWS firewall configuration. Likely desirable.

Install OpenVPN on AMI

yum -y install openvpn

Install Easy-RSA on AMI

Note that since there is a version 3.x, have to get an older distribution or it won't work. Note the below might still be a bit of a mess. Inspect directories as you go.

cd /etc/openvpn
wget -v https://github.com/OpenVPN/easy-rsa/releases/download/2.2.2/EasyRSA-2.2.2.tgz
tar -xvzf EasyRSA-2.2.2.tgz
mkdir easy-rsa
mv EasyRSA-2.2.2 /etc/openvpn/easy-rsa
cd easy-rsa
mv EasyRSA-2.2.2 2.0
mkdir -p /etc/openvpn/easy-rsa/keys
cp -R /usr/share/easy-rsa/2.0/ /etc/openvpn/easy-rsa/

NAT routing using iptables

Put in nat routing, ensure that the network on the masquarade is the same as in /etc/openvpn/server.conf First edit the iptables-config file

nano /etc/sysconfig/iptables-config

Change most things to yes, with a final config looking like:

IPTABLES_MODULES=""
IPTABLES_MODULES_UNLOAD="yes"
IPTABLES_SAVE_ON_STOP="yes"
IPTABLES_SAVE_ON_RESTART="yes"
IPTABLES_SAVE_COUNTER="no"
IPTABLES_STATUS_NUMERIC="yes"
IPTABLES_STATUS_VERBOSE="yes"
IPTABLES_STATUS_LINENUMBERS="yes"

Now do the rest of the iptables configuration

touch /etc/sysconfig/iptables
chkconfig iptables on
service iptables start
modprobe iptable_nat
echo 1 | tee /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -s 10.8.0.0/24 -j MASQUERADE
service iptables save
service iptables restart

Edit the Easy RSA settings

nano /etc/openvpn/easy-rsa/2.0/vars

Find and modify these values:

# These are the default values for fields
# which will be placed in the certificate.
# Don't leave any of these fields blank.
export KEY_COUNTRY="CA"
export KEY_PROVINCE=""
export KEY_CITY="SanFrancisco"
export KEY_ORG="Fort-Funston"
export KEY_EMAIL="me@myhost.mydomain"
export KEY_OU="MyOrganizationalUnit"

Also change

export KEY_CONFIG=`$EASY_RSA/whichopensslcnf $EASY_RSA`

to

export KEY_CONFIG=/etc/openvpn/easy-rsa/2.0/openssl-1.0.0.cnf

Initialize Easy RSA and create Certs and Keys

cd /etc/openvpn/easy-rsa/2.0
chmod 0755 *
source ./vars
./clean-all
./build-ca

Verify success

ls -la keys

Now build the cert and key

./build-key-server server

Note: leave the challenge password and optional company name blank Next, Verify success

ls -la keys

Next build a cert and key for each vpn user:

./build-key username

Provide this with a challenge password Next, build the .pem

./build-dh

Next, build the ta.key // rather forget about this, just comment out, it is trouble // get this going later openvpn --genkey --secret /etc/openvpn/easy-rsa/2.0/keys/ta.key Copy the keys and certs

cd /etc/openvpn/easy-rsa/2.0/keys
cp dh2048.pem ca.crt server.crt server.key username.crt username.key /etc/openvpn

Create OpenVPN Config File

Note that previously a version was copied and edited from the /usr/share/doc directory, but latest versions of OpenVPN no longer include this. Instead touch and then use the following file below as the base server.conf:

touch /etc/openvpn/server.conf
cd /etc/openvpn
chmod 0644 dh2048.pem ca.crt server.crt server.key server.conf username.crt username.key

Next, edit server.conf

nano /etc/openvpn/server.conf

Here is an example of server.conf. Ensure the masquerade iptables and server configuration are identical.

port 1194
proto udp
dev tun
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
reneg-sec 0
ca ca.crt
cert server.crt
key server.key  # This file should be kept secret
dh dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 84.200.69.80"
push "dhcp-option DNS 84.200.70.40"
duplicate-cn
keepalive 10 120
;cipher BF-CBC        # Blowfish (default)
;cipher AES-128-CBC   # AES
;cipher DES-EDE3-CBC  # Triple-DES
comp-lzo
user nobody
group nobody
persist-key
persist-tun
status openvpn-status.log
verb 3
explicit-exit-notify 0

Enable Routing

nano /etc/sysctl.conf

Change ip forwarding to 1

net.ipv4.ip_forward = 1

Restart networking services

service network restart

Enable and start the OpenVPN service

chkconfig openvpn on
service openvpn restart

Install and Configure OpenVPN Client

For OSX, there is Tunnelblick, which sucks, and Viscosity which sucks less (but costs $9). An example Viscosity config file looks like:

#viscosity startonopen false
#viscosity protocol openvpn
#viscosity dns off
#viscosity usepeerdns false
#viscosity autoreconnect true
#viscosity name host.domain.tld
#viscosity dhcp true
remote 12.34.56.78 1194 udp
nobind
dev tun
redirect-gateway def1
tun-mtu 1500
pull
tls-client
ca ca.crt
cert cert.crt
key key.key
push "redirect-gateway def1"
comp-lzo
mssfix 1450
resolv-retry infinite
tun-mtu-extra 32
reneg-sec 0

For installing an OVPN command line client on Linux, simply taking the config.conf file, along with ca.crt, cert.crt, and key.key files. Installation on a Debian system looks like:

sudo apt-get update
apt-get install openvpn

Then scp the four files into the home directory and run:

openvpn config.conf

After this works, then set up OVPN as a service with scripts for automation. - See also OpenVPN on ChromeOS and Android

Resources Consulted

Posted on Leave a comment

Referer, Referral, Analytics Spam

Spam, spam, spam, spam, spam, eggs, and spam. You get spam with your analytics. These are not real visitors, just spam in the logs. Here is how to de-spam your analytics.

Google Analytics Spam Filters

Statcounter Referer Blocking

StatCounter does not have Referral Spam filters, beyond IP address filters (completely useless). The solution is to regenerate a security code and then update the tracking code used on the site. This is of course only temporary, but for lazy spammers, it does get them to stop (unless and until they return to the site to scrape the access code from the javascript once again). See: What is the Security Code? - StatCounter

Piwik Referral Filters

Piwik regularly updates their own spam filters automatically. For any new spammers, report directly to Piwik via forking and creating a pull request for the referrer spam file on Github. And now for something completely different...

Posted on Leave a comment

Link Disavow Tool Bing Google Yandex

Link disavowel is desired someone (a competitor, or simply a derranged troll) has created low-quality links to your site. In some cases, in competitive, global markets, this may actually be the result of perhaps hundreds of domains created for the purpose of wrecking large numbers of competitors by providing Google with evidence of negative behavior. Since things things are sorted algorithmically, and Google's current algorithms might not have the more global perspective needed to see such a problem, it is incumbent that people with websites need to monitor what links are being created to those sites.

Google Link Disavow Tool

What this means in practice is, a part of managing a site is to monitor inbound links and take action when necessary. There are two tools to do this: - Regularly monitor inbound links as reported in Google Webmaster tools - Google Webmaster Tools > Search Traffic > Links to Your Site - Use the Google Disavow Links tool to ensure that any poor quality links are disregarded by Google. > Remember, Google (and Yandex) treat https://domain.com and http://domain.com as different properties, and so even if one is using 301s to route to a primary domain, any inbound domain will need to have its links dealt with at the level of its original domain protocol. This means registering both http:// and https:// versions of a site, and possibly www for each as well (resulting in 4 different property configurations of a single site site, when using 301 redirection).

Google Link Disavow File

Each property in Google Webmaster can have a single Link Disavow text file. In that file there can be links and/or domains that are disavowed. In many cases, especially if poor quality links are regularly being created in an ongoing blackhat campaign against a site, domains will be used over and over to get a count of several links from each poor-quality site to the target site. It is easier to manage with a list of domains than a longer list of each link.

Bing Link Disavow Tool

The Bing Webmaster Disavow tool is a lot less flexible (they require manual entry one-at-a-time for each domain/link, see complaint):

Yandex Link Disavow Tool

Unfortunately, there appears to be no way to disavow links in Yandex Webmaster tools (an otherwise useful set of tools). There is no Yandex Link Disavow tool. As of 2015 Yandex was stating that they had no intention of creating such a tool.

Disavow Files Crowdsource Tool

Bruce Clay crated a crowdsourcing site for disavow files, which has a decent dashboard, but not much functionality beyond basic reporting (the idea is that all disavow files are parsed and any new inbound links matching previously reported files/domains would create a notification for the user).