Uncategorized

Topics that don't need a category, or don't fit into any other existing category.

High Performance NTP Server with Rust rsntp

- Posted in Uncategorized by

The NTP Pool is a collection of voluntary Server operators, donating bandwith and server ressources to the public, syncing the time of more than 100 Mio Devices on the Internet. To read more about the pool, click here.

But some regions are currently strongly underserved, making proper timekeeping difficult and increasing the load of a few servers. The most notable example of this is the China-Zone. As of writing, there are currently 5 Servers serving the entire country. For comparrison, Finnland, a much smaller Country has 35 active servers.

So to be able to provide a server to the China region, the server has to be able to answer a LOT of queries. This Post describes some expirences on the experiments.

Serverhardware: The Server was a virtual Server from Hetzner Cloud Serverspecs The Server was choosen due to it beeing a small experiment with the capability to scale up and down, depending on the workload.

Normal NTP Client: Score-NTPClient The first drop started, when the server got added to the China-Zone, immediately the server got overloaded and started dropping Packages. Config:

driftfile /var/lib/ntp/ntp.drift
pool ip1 iburst
pool ip2 iburst
pool ip3 iburst
pool ip4 iburst
pool ip5 iburst
server ntp1.hetzner.de iburst
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited
restrict 127.0.0.1
restrict ::1
restrict source notrap nomodify noquery

Just a standard NTP Config, with the recommended Settings for the NTP Pool.

Since this was not acceptable(The server started dropping within the first 30 Minutes of beeing readded to the pool), I decided to evaluate other NTP Server Software.

I decided to try out this Rust Implementation due to its ability of multitasking. Since this is not a full ntp server, its needs a Backend Server running, providing the full features. Since ntpd is not able to run on nonstandard ports, I decided to go with chrony, which I will evaluate in a later test.

Setup Requirements: Git, make Installation for Debian and Debian-based Systems(like Ubuntu)

apt install git build-essential

The setup is pretty straight forward, you need to clone the Git Repository with

git clone https://github.com/mlichvar/rsntp
cd rsntp

To compile, you need to have Rust installed, which can be installed by running:

curl https://sh.rustup.rs -sSf | sh

and then choosing 1 to install. After the installation is finished, you need to run this command in Order to add rust to your current session:

source $HOME/.cargo/env

Now you can start the compiler with

make -e release

The -e Switch sets the Environment we want to compile to, in this case the release Version with the optimized executable.

Cargo now starts downloading depencies and compiling. Once it has finished, go to the output directory of the compiler and copy the created executable to the directory where you want to execute it from and mark it as executable

cp ./target/release/rsntp /usr/local/bin/rsntp
chmod +x /usr/local/bin/rsntp

Before we can start the Server, we need to set up Chrony. This is quiet easy as it can be directly installed from the repository:

apt install chrony screen -y

Now we need to edit the Config and adjust a few settings:

vim /etc/chrony/chrony.conf

Add 4-6 Source Timeserver to the config, in Order to have a proper source of time, then add a few Values, that I will explain below the config:

pool ip1 iburst
pool ip2 iburst
pool ip3 iburst
pool ip4 iburst
pool ip5 iburst
server server1 iburst
makestep 1 3
rtcsync
allow
cmdport 0
leapsectz right/UTC
driftfile /var/lib/chrony/chrony.drift
noclientlog
port 11123

Explanation of the most important values(Full list here):

pool/server: Source Server where to pull time from.

allow - This is necessary for chrony to allow external queries, like the rust server needs to. You can limit the source of the queries, check the full list link above for more details)

cmdport 0 - Since I only monitor and control the server from itself, I disallowed all remote commands

noclientlog - Disabled due to no rate limiting used(since this isn´t the main NTP Server.

port 11123 - Port to listen to. Required for rsntp

Now you only have to restart chrony.

service chrony restart

And can now start rsntp and begin serving clients. I decided to use screen for this, since I want to monitor it, but you can also create a service for it and have it running in the background. And since I have a 2 Core VM, I want to use 2 Threats for IPv4, which is the majority of the traffic.

screen rsntp --ipv4-threads 2

And thats it, the new Server is now up and running. Verify it with a online test like this one and then add it to the pool.

I am not sure, if this is running better, but I will report back on the results.

Mechanical Keyboards

- Posted in Uncategorized by

Obligatory it has been a long time since my last blog post, but that was to expect, since I am normally not a big writer.

This Post is mainly an Opportunity to test my new Mechanical Keyboard. I just got a Logitech G610 Orion Brown Keyboard, and so far, I am quiet impressed. The type-feeling is really good, I really like the mechanical Click, each Key makes. But I really have to get better in error-free typing, I am still making a lot of mistakes.

In the recent weeks, the desire for a mechanical Keyboard became quiet intense, since I went to a few Lans and saw ppl there using those keyboards, and also the Hype online. There are some, that take it to an entire new level, like the folks over at /r/mechanicalkeyboards, but I am not looking to build my own Keyboard.

Now, let me say a few Words about the G610 itself.

Fist of all, the typefeeling is really great, since I have the Cherry MX Brown switches, and also it has the (for me) required features of the Mediacontrol, like a Play and Pause Button.

Now, the Mediabuttons, are just Keys, that move very minimal and dont feel that good, in Comparison to the ones on the old G510. Those had some real feeling to it, you had to press them, and they moved, if you did so.

Also the G610 is very high, at least compared to my old keyboard. Not sure about this yet, might only be something, you have to get used to, but maybe thís will make typing more "work", since you have to hold the Hand higher.

Other than that, I really think this was a good investment. But time will have to tell, what it really brings. Will test the Keyboard now for two weeks, and see, if I keep it. But I am quiet confident in this.

Also I am in the Process of moving everything onto my server, away from uberspace. I am sorry uberspace, but I really need the freedom of having root access to my server. You do your best, to give as many options as possible, but having a full server with the softwarestack, that I am already used to, is something I really want.

The server is hosted at netcup, who really made an awesome offer, a full vserver with 50GB HDD(I dont really care about the performance), for less than what uberspace costs.

Ghost auf uberspace in einem Unterverzeichnis installieren

- Posted in Uncategorized by

In diesem Artikel...

findet ihr einen kurzen Hinweis, wie man Ghost auf uberspace in ein Subdirectory installiert.

Disclaimer: Dieser Artikel ist kein vollwertiger Ghost-Installationsguide, sondern lediglich eine Ergänzug zu bestehenden Guides.

Bisherige Schritte:

Ghost ist vollständig Installiert, die Konfiguration in der .htaccess-Datei muss gerade gemacht werden(Uberspace-wiki Schritt Ghost nach draußen erreichbar machen)

In der Wiki heißt es dazu:

[lisbeth@amnesia ghost]$ cat <<__EOF__ >> ~/html/.htaccess
RewriteEngine On
RewriteRule ^(.*) http://localhost:$GHOSTPORT/\$1 [P]
__EOF__

Wenn ihr aber jetzt den Blog nicht im Hauptverzeichnis publishen wollt, sondern in einem Unterverzeichnis(wie /blog/, siehe hier), dann müsst ihr hier eine andere Regel anwenden:

[lisbeth@amnesia ghost]$ cat <<__EOF__ >> ~/html/.htaccess
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/blog/
RewriteRule (blog/.*) http://localhost:$GHOSTPORT/\$1 [P]
RewriteRule ^blog$ %{REQUEST_URI}/ [R=301,L]
__EOF__

bzw zum Copy-Pasten direkt in die .htaccess($GHOSTPORT durch euren Port ersetzen):

RewriteCond %{REQUEST_URI} ^/blog/
RewriteRule (blog/.*) http://localhost:$GHOSTPORT/$1 [P]
RewriteRule ^blog$ %{REQUEST_URI}/ [R=301,L]

Auch verfügbar in meiner privaten Wiki.

Hinweis:

Das ganze ist noch nicht ganz getestet und kann noch zu einigen Problemen führen, u.a. mit URLs, die "ghost" verwenden. Ich werde das ganze erstmal noch ein bisschen testen und dann hier ein Update anfügen.

Bug in EventON Prevents Datechanges

- Posted in Uncategorized by

Today I discovered a bug in the Wordpress Plugin EventON, that malforms the Date-View.

It then looks like this:

Error Screen

Cause:

The Cause for this bug is, that jquery gets loaded over http, instead of https. So if your site is running on https, the Script gets blocked, due to the mixed-content Policy, that all major browsers use.

Resolution:

In the file wp-content/plugins/eventON/admin/eventon-admin-init.php, remove at line 948 the http, so only the // is left. This way, the browser loads it over http, if the page itself is beeing loaded over http and over https, if the page got requested over https.

Final:

wp_enqueue_style("jquery-ui-css", "//ajax.googleapis.com/ajax/libs/jqueryui/{$jquery_version}/themes/smoothness/jquery-ui.min.css");

The same is also true for the eventon-action-user - Plugin. It may be true for all Plugins of this author, but we are only using these two Plugins.