blog.plee.me About software, technology and random things

18Jan/170

PhonerLite With FRITZ!Box

Hello!

If you want to set up your PhonerLite VoIP/SIP client with the FRITZ!Box so you can receive phone calls on your computer as well, of course you should have a look at the official AVM documentation (like the one for the FRITZ!Box 7390).

However, I encountered the following problems:

  • outgoing calls would result in a "480 Temporarily Unavailable" error (even the test number **797)
  • saving the configuration (tab "Configuration" => "Save" button) repeatedly would cause the status bar to alternate between
    • showing a red indicator and the error message "sip:<number>@fritz.box not registered <Connectivity Checks Failed>" every second click
    • showing a green indicator and the message "sip:<number>@fritz.box registered" every other click

I changed the following server / connection settings to fix the problem:

  • Proxy/Registrar: <FRITZ!Box IP address instead of fritz.box, e.g. 192.168.1.1>
  • Domain/Realm: fritz.box

After that, every time I saved the configuration if would show the success indicator and message and telephony just worked in general.

My local network interface uses an external DNS server for hostname resolution and I have added the fritz.box name manually in my hosts file. This might be why this was causing me problems.

I hope this was of any help to you in case you encountered this as well.

Thanks for reading!

17Dec/160

Installing mod_cloudflare For Apache HTTPd 2.4 On Debian 8 (Jessie) Via Aptitude Repository

[Update on 2019-09-19] Warning: From Debian 9 (stretch) upwards, according to the official documentation Cloudflare has dropped support for mod_cloudflare. Instead they recommend replacing it with the new alternative: the official Apache HTTPd module mod_remoteip.

Hi!

If you are using the Cloudflare proxy functionality, you will find that your web server will end up only working with Cloudflare's IPs instead of the visitors'. After quite some time I thought that there has to be a better way to go about this, and I found mod_cloudflare, a solution officially developed by Cloudflare themselves.

When I was looking at the official Cloudflare documentation on how to install mod_cloudflare for Apache 2.4 on Debian 8 (Jessie) today, I was disappointed to find that they were only recommending manual ways: installing a .deb package or compiling the module yourself.

Luckily I found a guide on how to accomplish the installation with the standard apt-get / aptitude tool for Debian / Ubuntu.

This is how:

  1. Add the aptitude repository to a new sources list file, e.g. at /etc/apt/sources.list.d/cloudflare-main.list - with this content:
    deb http://pkg.cloudflare.com/ jessie main
  2. Download the Cloudflare repository key and add it to the aptitude known keys:
    # wget https://pkg.cloudflare.com/pubkey.gpg
    # apt-key add pubkey.gpg
    # rm pubkey.gpg
  3. Update the aptitude cache:
    # aptitude update
  4. Look at which packages are available in the new repository:
    # grep ^Package: /var/lib/apt/lists/pkg.cloudflare.com_dists_jessie_main_binary-amd64_Packages
  5. Install mod_cloudflare:
    # aptitude install libapache2-mod-cloudflare
  6. Restart the Apache HTTPd service:
    # service apache2 restart

Hopefully this way of installing will enable everyone to update / maintain it much more easily and with less one-time use packages installed.

Additionally, this could prove even more useful for people who want to install more Cloudflare packages.

I am confident that this method also works for Ubuntu and other versions of Debian - just replace the "jessie" part in the aptitude sources list file with your distribution major release codename (like "wheezy" for Debian 7 or "vivid" for Ubuntu 15.04).

Thanks for reading!

Original source: https://emtunc.org/blog/01/2016/installing-mod_cloudflare-ubuntu-14-04-apache-server/

23Nov/140

Using msysgit With PuTTY Pageant & Plink

Hi!

If you have installed msysgit and are planning on using it in combination with Pageant from the PuTTY tool suite, you might run into the problem that it does not attempt to use any of the keys you have already loaded into Pageant. You can fix this by telling msysgit which program to use for the git fetch and pull operations:

  • Open your System window (Windows + Pause or "Start" => Right-click on "Computer" => "Properties")
  • Click on "Advanced system settings" (on the left)
  • Click on "Environment Variables..." (on the bottom)
  • Add a new system variable (or user variable if you just want this setting for the current user): "New..."
  • Variable name: GIT_SSH
    Variable value: (path to plink.exe) for example: C:\Program Files (x86)\PuTTY\plink.exe (important: just the path, no quotation marks at the beginning or the end!)
  • If you haven't already on this system / user, connect to the server via PuTTY in order to get the SSH server fingerprint prompt and remember it
  • Close any existing Git Bash / msysgit instances and start it up again

This should do it!

I hope this was helpful.

Thanks for reading!

Source: http://www.bitsandpix.com/entry/git-setup-msysgit-install-with-pageantplink-from-putty/

16Nov/140

Mozilla Thunderbird: Changing the EHLO / HELO Value in the “Received”-Header for Outgoing Mail

Hi!

If you have had a look at your outgoing e-mail headers that you've sent from Mozilla Thunderbird, you might have noticed that Thunderbird uses the IP of the network interface that it uses to connect to the internet with by default. If you are using a router on your network, this is a private IP from your LAN (for example 192.168.1.2) instead of one that might be of actual use.

Example:

Received: from external.sender.host.example.org ([123.123.123.123] helo=[192.168.1.2]) by
 mail.example2.org (incoming-mta-service) with esmtpsa (outgoing-mta-service) id
 0a1b2c-3D4e5F6G7h-0a1B2c for <[email protected]>; Sun, 02 Nov 2014 20:55:41 +0100

where "123.123.123.123" is the publicly facing IP and "external.sender.host.example.org" is its hostname.

If you do not wish to expose this information to every and all recipients of the e-mails you are sending with Thunderbird to (maybe out of security concerns in a business environment), you can set the EHLO / HELO value manually for every outgoing e-mail sent by the Thunderbird client with your current user profile and even for every simple SMTP server individually.

Here's how:

Globally

  • Open your Thunderbird options ("Tools" => "Options")
  • "Advanced" => "Config Editor..."
  • Create (or edit) the entry named "mail.smtpserver.default.hello_argument". If you need to create it, use right-click => "New" => "String".
  • Change the value to the desired IP or hostname (FQDN).

Per SMTP server

  • Open your Thunderbird options ("Tools" => "Options")
  • "Advanced" => "Config Editor..."
  • Create (or edit) the entry named "mail.smtpserver.smtp<number>.hello_argument" where <number> is the ID for the SMTP server you would like to apply the setting to. Type "mail.smtpserver.smtp" to see which ones are available and which ID they have. If you need to create the entry, use right-click => "New" => "String".
  • Change the value to the desired IP or hostname (FQDN).

Technically this value is not relevant for sending/receiving the mail, but because it might be used for spam scoring or simply out of courtesy I would recommend entering a valid IP / hostname.

I myself am using 127.0.0.1.

Thanks for reading!

Sources:

9Nov/140

Deleting Huge Directories in Windows Via Command Prompt

Hi!

If you'd like to delete a huge folder / directory in Windows with maybe thousands or hundreds of thousands of files inside, doing that via Explorer might cost you a lot more time than via command prompt.

Here's how to do it faster:

  1. Open the command prompt by using "Start" => "cmd" and navigating to the desired path via "cd <path>" or "pushd <path>"
    - OR -
    navigate to the folder in the Explorer and use Shift + right-click and "Open command window here"
    (Note: if deleting the desired folder requires elevated privileges, you will have to start a command prompt in elevated mode and navigate the old-fashioned way)
  2. Use the following command:
    rmdir /s /q folder

A little explanation about rmdir's flags:

  • /s: removes the directory itself including all the contained files and subdirectories
  • /q: forces deletion and does not ask for approval

Doing this can be very helpful in a coding environment where you can easily end up with thousands of small files.

Thanks for reading!

Source: https://stackoverflow.com/questions/186737/whats-the-fastest-way-to-delete-a-large-folder-in-windows

2Nov/140

Viewing Hidden Devices in Windows Device Manager

Hi!

If you are trying to find a device that has been hidden in your Windows Device Manager, for example because you don't have it plugged in at the moment, you might find this little guide handy.

  1. Open the command prompt ("Start" => "cmd")
  2. Enter
    set devmgr_show_nonpresent_devices=1
  3. Then start the Device Manager from the command prompt via
    devmgmt.msc
  4. In the Device Manager, click "View" => "Show hidden devices"

I hope this helped 🙂

Thanks for reading!

Source: https://support.microsoft.com/kb/241257

2Jul/130

Access Control via Hybrid .htaccess for Both Apache HTTPd 2.2 and 2.4

Hi!

If you're running the Apache HTTPd in the versions 2.2 and 2.4 in different environments but would like to control access to certain directories (include, lib, ...) via Apache, chances are that you don't want to use one 2.2 specific file and a different one for 2.4, especially if you keep transferring and synchronizing the files between those different setups.

Between versions 2.2 and 2.4 a couple of things have changed. The perhaps most prominent change would be the one that comes with the new mod_authz_host module and deals with authorization / access control. Instead of using Order, Allow, Deny and/or Satisfy you are now advised to use the new Require directive.

So what do you do if you cannot switch every .htaccess over to the new format for reasons like the one mentioned in the beginning?

You could in fact enable the mod_access_compat module and keep rolling with the old configuration. But that would only mean procrastinating until you would finally have to deal with it anyway.

The better solution is to use configurations that are not even necessarily dependent on your Apache version (remember, you could just load the legacy compatibility module in 2.4), but in fact check for the correct module to work with. The key element to work with here is the IfModule directive.

# Apache 2.4
<IfModule mod_authz_core.c>
    Require all denied
</IfModule>

# Apache 2.2
<IfModule !mod_authz_core.c>
    Order Allow,Deny
    Deny from all
</IfModule>

As you can see, there are two checks that basically work as an "if ... else" selection. The rest should be self-explanatory.

For more information about the new way of handling access with the Apache HTTPd 2.4, please refer to the official documentation.

I hope this was of any help to you.

Thanks for reading.

20May/120

Making Traceroutes Work with a Firewall (Windows)

Hi!

Even though I've had software firewalls in action for years now, I haven't really come across too many instances where I'd need traceroutes. The few times I did, however, I noticed that I only got output like the following:

>tracert example.com

Tracing route to example.com [123.123.123.123]
over a maximum of 30 hops:

  1     *        *        *     Request timed out.
  2     *        *        *     Request timed out.
  3     *        *        *     Request timed out.
  4     *        *        *     Request timed out.
  5     *        *        *     Request timed out.
  6     *        *        *     Request timed out.
  7     *        *        *     Request timed out.
  8     *        *        *     Request timed out.
  9     *        *        *     Request timed out.
 10     *        *        *     Request timed out.
 11    50 ms    50 ms    50 ms  example.com [123.123.123.123]

Trace complete.

The number of hops would of course vary for the specific host / IP address.

Today I had to use traceroute in order to analyze a couple of networking problems. That was the incentive I needed to look up why it didn't work.

The fact that not even my router was showing up was a big indicator that something was wrong with my local firewall settings.

After searching the web for a couple of minutes, I found out what I was looking for at this page: http://www.phildev.net/ipf/IPFques.html#ques34

Traceroute is using ICMP packets (plus UDP on Linux systems, but that's outside the scope of this blog entry. You can read more about it on the page I linked above). But even for an outgoing traceroute you need to accept incoming ICMP packets.

Which ones? These:

  • ICMP TTL Expired (Type 11, Code 0)
  • ICMP Port Unreachable (Type 3, Code 3)

Once you've enabled these types of packets for incoming traffic in your firewall(s), you'll see that your traceroute will now function as it should.

If your firewall does not allow you to configure accepting specific types of ICMP packets, try allowing incoming ICMP packets altogether (if that's not too much of a compromise for you).

Anyway, long-ish story short: It's working now 🙂

Thanks to the webmaster of the page I linked above! And thanks to you for reading.

8Apr/120

Hiding the Closing Button (X) on the Firefox Add-on Bar

Hey!

Since the introduction of Firefox 3 or 4 (I don't quite remember) and the removal of the status bar I have liked to use the Add-on bar instead. In the newer versions of Firefox, however, that Add-on bar comes with a closing button, an X on the very left.

Unfortunately, there is no built-in option to disable that particular button. Right-clicking and "Customize ..." doesn't allow moving or removing that button either.

After searching the web for a while, I stumbled upon a Google Groups thread: https://groups.google.com/group/mozilla.support.firefox/browse_thread/thread/d4a77426b84fe2b0

In that thread, Chris Ilias gave a simple solution (thank you!):

  1. Go to your Firefox profile directory. For that, just enter about:support in your URL bar (or click on Firefox => Help => Troubleshooting) and click on the "Open Containing Folder" button next to "Profile Directory".
  2. Close Firefox. (So maybe it would be better to continue reading these instructions beforehand and/or copy them into a text editor. 🙂 )
  3. Enter the subfolder "chrome" in the profile directory.
  4. Open the file "userChrome.css". If it does not exist, copy "userChrome-example.css" and rename the copy to "userChrome.css".
    If you are using Notepad, you won't be able to see line breaks / new lines. Therefore I recommend using a program that can interpret these kinds of line breaks, for example TextPad, Notepad++ or even WordPad, which comes with Windows itself.
  5. Add the following line to the file:
    #addonbar-closebutton { display: none }
  6. That's it! Save the file, start up Firefox again and enjoy the Add-on bar without a closing button!

These instructions were written for Firefox 11, but they should stay viable for the next couple of versions as well.

I hope this was of any help to you.

Thanks for reading!

10Mar/120

Restoring Syntax Highlighting to Vim

Hi!

After doing a couple of updates on my servers today, I noticed that one of them had syntax highlighting in vim disabled. I double-checked to see that it was still vim that was installed, and not vi. Indeed it was, so I tried entering a couple of vim commands in order to re-enable syntax highlighting.

A couple of minutes of trying and searching the Internet went by till I got the idea to directly compare the vim version info both on one of my servers that had it working properly and the one that didn't. It turned out that even though it was the same version number and build with the same compile time it had a certain difference: one line said "Tiny version without GUI." vs. "Huge version without GUI.". The tiny version was the one that wasn't highlighting correctly.

So I checked out what the package manager thought of this:

# yum list *vim*
[...]
Installed Packages
vim-common.i386                                   2:7.0.109-7.el5                                  installed
vim-enhanced.i386                                 2:7.0.109-7.el5                                  installed
vim-minimal.i386                                  2:7.0.109-7.el5                                  installed
Available Packages
vim-X11.i386                                      2:7.0.109-7.el5                                  base

Somehow during updating it had apparently decided to install the vim-minimal package as well. And of course it wasn't installed on the server on which vim worked as it should.

Fair enough. I thought to myself that removing should fix it, but when I tried to it said the following:

# yum remove vim-minimal
Loaded plugins: fastestmirror
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package vim-minimal.i386 2:7.0.109-7.el5 set to be erased
--> Processing Dependency: vim-minimal for package: sudo
--> Running transaction check
---> Package sudo.i386 0:1.7.2p1-13.el5 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================
 Package                   Arch               Version                         Repository               Size
============================================================================================================
Removing:
 vim-minimal               i386               2:7.0.109-7.el5                 installed               581 k
Removing for dependencies:
 sudo                      i386               1.7.2p1-13.el5                  installed               861 k

Transaction Summary
============================================================================================================
Remove        2 Package(s)
Reinstall     0 Package(s)
Downgrade     0 Package(s)

Is this ok [y/N]:

That was weird. It felt the need to remove sudo along with it. Of course that was not okay for me, so I tried looking for a parameter for vim in order to ignore the dependencies, but apparently there are none (any more).

The solution I found after a couple of more minutes of searching the Internet was to remove the package via the actual rpm program. But don't you need the original rpm file for vim-minimal? No, you don't!

First you have to find out the complete package name, however. That can be done like this:

# rpm -qa | grep vim-minimal
vim-minimal-7.0.109-7.el5.i386

And finally just use the following command:

# rpm -e --nodeps vim-minimal-7.0.109-7.el5.i386

whereas the last parameter is of course the proper name of the package in question. --nodeps, as you might have figured already, stands for "no dependencies" and removes the package without any questions asked.

In the end, these simple steps restored the syntax highlighting functionality for my vim.

Let's hope that after the next update it doesn't decide to go monochrome again.

Thanks for reading!