LinuxSysAdmin

Things I don't want to look for twice..

incapable AT&T sysadmins

I’ve been trying for weeks to remove my provider’s external mail server IP address from AT&T’s blacklists as it’s affecting our business. Being a booking website, it’s hard not to be able to send booking confirmations and other stuff required for people to be able to complete a booking on our website. So we always get the NDR telling us we’re being rejected. I’ve tried looking for our IPs in they’re third party RBLs like SpamHaus or Symantec, with no luck. So our IP is in their own blacklist, not third-party.

Today, after about 3 weeks from when I first filled their form here, http://rbl.att.net/cgi-bin/rbl/block_admin.cgi I tried again. Both times, didn’t receive any confirmations by email, nothing, nada. This time I discovered they have some email address for requests based on what you filled in the form and I tried that. Hope this time their sysadmins will take it into consideration. Hopefully this time they’re not sleeping, not smoking weed or whatever the fuck they’re doing as they don’t seem to care about their customers and this time I have DKIM installed on both domains we’re using to send out emails. Hope it will count in their decision.

BTW, how can you blacklist an IP for a mail server for a booking company? As long as it’s not some open relay for everybody to send mail from, did they even checked the email? See what’s it about? ..or it’s just that when a client (or 2, 3) marks the mail as SPAM, AT&T adds the IP to their blacklist and never gets it out of it? Should we get a full C-class subnet to send emails from? B? Maybe customers should just switch to other services? Like Yahoo, with infinite storage, GMail, Outlook.com, install the webmail adblocker extension to remove unuseful crap (Ads) and they should have a clean interface. Also, tickets opened to them seem to have way better results at removing from blacklists as the results I’m having with AT&T.

Although I’ve been appointed by HR agencies to get hired at AT&T, I’m very glad I’ve turned down their offers. Hell no! (although, sleeping in the office and smoking weed all day seems like a nice treatment)

Advertisements

Apache disable reverse DNS lookups

So, I had this annoying problem with Apache logging reverse DNS instead of client IP. The only explanation I could find is this one:

http://www.leaseweblabs.com/2013/05/turn-off-reverse-dns-lookups-for-apache-access-logging/

So, when using IP based access lists, instead of:

Allow from 10.0.0.1 # my IP address

Use:

# my IP address
Allow from 10.0.0.1

It took me a while to find..

Streaming PulseAudio on a Samsung SmartTV

So, recently I turned back to Linux and I was sick of Windows and NSA and all that crap. And my all time favourite for a desktop still remains Linux Mint. So I got myself a 64-bit Linux Mint 16 (Petra), installed ..and so far so good. Surely, I had some issues with ATI proprietary drivers, especially in Google Chrome which actually have solve by accessing chrome://flags and changing some stuff around. But today, as I own a Samsung Smart TV, I needed my desktop to stream my Rhythmbox to it. (I don’t use Banshee, the default player, ..well, just not a fan)

Anyways, so if you need to stream your output to a Samsung SmartTV, this is what you’ll have to do: (in the mean time, give the middle finger for Samsung, as they’re not planning on doing Samsung Link for Linux)

1. install the necessary packages:

sudo apt-get install rygel rygel-gst-launch wavpack paprefs pavucontrol

2. edit your own users’s rygel.conf:

vim ~/.config/rygel.conf

3. add something like this:

[general]
upnp-enabled=true
enable-transcoding=true
media-engine=librygel-media-engine-gst.so
interface=wlan0
port=0
log-level=*:4
allow-upload=true
allow-deletion=true
[GstMediaEngine]
transcoders=mp3;lpcm;mp2ts;wmv;aac;avc;flac
[Renderer]
image-timeout=15
[Tracker]
enabled=false
share-pictures=true
share-videos=true
share-music=true
strict-sharing=false
title=@REALNAME@'s media
[MediaExport]
enabled=false
title=@REALNAME@'s media
extract-metadata=true
monitor-changes=true
virtual-folders=true
[Playbin]
enabled=false
title=Audio/Video playback on @HOSTNAME@
[ZDFMediathek]
enabled=false
rss=508
update-interval=1800
video-format=wmv
[GstLaunch]
enabled=true
launch-items=myaudioflac
myaudioflac-title=FLAC audio on @HOSTNAME@
myaudioflac-mime=audio/flac
myaudioflac-launch=pulsesrc device=upnp.monitor ! flacenc
[Test]
enabled=false
[ExampleServerPluginVala]
enabled=false
[ExampleServerPluginC]
enabled=false
[ExampleRendererPluginVala]
enabled=false
[ExampleRendererPluginC]
enabled=false
[MPRIS]
enabled=false
[External]
enabled=false

This will transcode everything to FLAC and advertise this as “FLAC audio on @HOSTNAME@”. I did this because around half of my music collection is actually FLAC. To transcode to mp3, replace the following block:

[GstLaunch]
enabled=true
launch-items=myaudiompeg
myaudiompeg-title=MPEG audio on @HOSTNAME@
myaudiompeg-mime=audio/mpeg
myaudiompeg-launch=pulsesrc device=upnp.monitor ! lamemp3enc target=quality quality=6

4. Run paprefs and check everything under Network Server:

2

 

5. (restart your computer – I sincerely think it’s optional step, but I’ve read is some place)

6. Start your music player, hit Play, then run pavucontrol and select the output to be “DLNA/UPnP Streaming”

1

 

7. Start rygel, preferably in the background, after you’ve seen you don’t have any errors.

8. Turn on your TV and hit the “Src” button on the remote and you should see something like “Network Gst Launch”. Select that, than “Music”, then click on “FLAC audio on hostname”

That’s it! It should automagically start playing..

NOTE: all commands should be run as your own user, not root.

Got inspired from:

http://community.linuxmint.com/tutorial/view/1506

https://wiki.gnome.org/Projects/Rygel/Pulseaudio

 

Pig Latin (python)

pyg = 'ay'
original = raw_input('Enter a word: ')
word = original.lower()
first = word[0]

if len(original) > 0 and original.isalpha():

if first[0] == 'a' or first[0] == 'e' or first[0] == "i" or first[0] == "o" or first[0] == "u":
new_word = word + pyg
print new_word
else:
new_word = word[1:] + first + pyg
print new_word

else:
print 'empty or has numbers/special characters'

Sink my battleship (python)

from random import randint
board = []
for x in range(5):
 board.append(["O"] * 5)
def print_board(board):
 for row in board:
 print " ".join(row)
print "Let's play Battleship!"
print_board(board)
def random_row(board):
 return randint(0, len(board) - 1)
def random_col(board):
 return randint(0, len(board[0]) - 1)
ship_row = random_row(board)
ship_col = random_col(board)
# print ship_row
# print ship_col
for turn in range(4):
 # print "You are on turn " + str(turn + 1) + "."
 # print "Turn #%i: " % (turn + 1)
 # Everything from here on should go in your for loop!
 # Be sure to indent four spaces!
 guess_row = int(raw_input("Guess Row:"))
 guess_col = int(raw_input("Guess Col:"))

 if guess_row == ship_row and guess_col == ship_col:
 print "Congratulations! You sunk my battleship!"
 break
 else:
 if (guess_row < 0 or guess_row > 4) or (guess_col < 0 or guess_col > 4):
 print "Oops, that's not even in the ocean."
 elif(board[guess_row][guess_col] == "X"):
 print "You guessed that one already."
 else:
 print "You missed my battleship!"
 board[guess_row][guess_col] = "X"
 if turn == 3:
 print "Game Over"
 # Print (turn + 1) here!
 print str(turn + 1)
 print_board(board)

Host1Plus fake advertising (solved)

This morning I’ve ordered a level 1 VPS from Host1Plus. I’ve wanted to do that for a long time, but I wasn’t very impressed by CPU offer. Yesterday when I checked their offer, I’ve seen they’re offering 1 core for the entry-level plan, so I ordered a level 1 for 2 years. Paid with my VISA card this morning and I had my VPS by the time I woke up after my afternoon sleep – yeap, I sleep in the afternoon, so what?!

So, here is the offer:

2

That’s cool, 1 core just for me. So I created my account, paid for 2 years and wait quietly for them to set up my new VPS. After few hours, as their email didn’t come, I checked my client area page and saw that:

ps1

(yeap, I’ve deleted the IP Addresses field)

Anyway, I saw the 50% CPU and decided to dig deeper into it, and found out that:

3

So it seems that the web interface in client area was right. Instead of having full 3.4GHz core, I only have 1696MHz, which, you already guessed, is around 50%. Nice, so not one core, just a half of it. So I thought there’s an error in the template they’re deploying, so I entered a live chat with a support guy. Here are some parts of it. First, we talk about what the website says:

16:48 Host1Plus: Well you have 1 CPU core with 50% of it’s speed
16:48 Me: yeap
16:49 Me: shouldn’t I have 1 core with 100% speed?
16:49 Me: http://www.host1plus.com/vps-hosting/
16:50 Me: it clearly states 1 core, not half core
16:52 Host1Plus: Your server can use 50% of 1 CPU core, that is defined in service configuration
16:52 Me: Yes, but what I just bought is 1 full core, not half of it
16:53 Me: and VPS hosting level 1 means 1 full core, 256MB ram and 15GB of disk space
16:53 Me: if you need, I can send you a print screen of your website
16:54 Host1Plus: I am afraid it does not state in the plans that level 1 has 1 full core, it shows that it includes 1 core
16:54 Me: exactly, 1 core, not 0.5 core
16:56 Host1Plus: It seems there is misunderstanding in our communication, have you checked how much CPU speed it shows inside your server ?
16:56 Me: before buying a host1plus VPS I had a free one, which clearly stated I don’t have a full CPU core
16:56 Me: model name : Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
stepping : 9
cpu MHz : 1696.060
16:57 Me: exactly half of 1 core
16:57 Host1Plus: Half of it’s speed, not the core itself
16:58 Me: you can’t split a CPU core in 2
16:58 Host1Plus: That’s why it shows 50%
16:58 Me: so, I see 2 options: 1. you’re misguiding clients or 2. service configuration not updated with the specs from the site
16:59 Host1Plus: If it would be 100% then you could all 3.40GHz
16:59 Me: exactly!
16:59 Me: which currently, I don’t

So yes, they are showing 1 core, but you only get half. Wait, it’s getting better:

17:01 Host1Plus: As I can see level 1 comes with 50% priority, level 2 – 100%, level 3 – 150%, level 4 – 200% and level 5 with 350%
17:01 Host1Plus: Everything is all right with the plans
17:03 Me: well, thing is, from your website, you can understand: level1: 100%, level2: 100%, level3: 200%, level4: 200%, level5: 400%
17:03 Me: 100% meaning 1 full core

Everything alright with the plans, I’m sure, but not alright with the website. So, although on level3 and level4 it says you get 2 cores, you get 1.5 cores for level 3, 2 cores for level4 and 3.5 cores instead of 4 for level 5. Fucking marketing department!

This is funny:

17:16 Host1Plus: Unfortunately, I don’t see the reason why your server should have more CPU speed than it’s defined in the configuration, you have ordered level 1 even without asking about it’s specifications before ordering

Why not calling you anyways? And just have contact info on your website? That should avoid this kind of issues. But, as long as you’re writing something on your website, ..I would expect to pay for what I see, not for what you mean. Now, the refund option:

7:18 Me: ok, upgrading is not an option, but as it’s not even 1 day since I bought your product and not pleased because it’s not what it’s advertised, I can surely ask for a refund, right?
17:20 Host1Plus: You may get refund only if your request matches with Host1Plus refund policy http://www.host1plus.com/refund-policy/

Here is their refund policy:

Terms that must be met in order to receive a refund:
– Refunds are only applicable for monthly hosting service fees;
– Refunds are only applicable if we have failed to provide 99% uptime of the service;
– Refund is provided only once for a single account of the customer;
– Refunds are only applicable for services paid using Credit Cards. If payments were done using 3rd party checkout services (PayPal, etc.) refunds are only provided to clients HOST1PLUS accounts credit balance.

So guess what? Not getting a refund, because it was not a monthly payment. Silly me! Final issue: payment recurrency. I tried to get them to disable it. But:

17:24 Me: how can I make sure it’s not recurring payment? and my card is not credited automatically in 2 years?
17:25 Me: should I contact braintree? is there some settings you’ll make to my account?
17:25 Me: I wish that in 2 years my card won’t be billed automatically by you
17:25 Me: how can I do that?
17:27 Host1Plus: If you will cancel the service before the due date, the outstanding invoice will be canceled and you won’t be charged
17:30 Me: and there’s no way you can disable recurring payment on this account?
17:31 Me: because I might forget the expiration date..
17:33 Host1Plus: I am afraid I don’t have permission to disable recurring payment, however, I can advice with the management whether such option could be disabled for you

So I’m left with half core for the next 2 years. Probably enough for what I’m needing this for, but still, someone should modify the website or increase the CPU percentage. In the mean time, don’t trust what’s on host1free.com, get a live chat before trying to buy something from them first.

 

UPDATE!!!

Yesterday, a Senior Administrator from Host1Plus contact me and asked me if there’s a way we can solve this, as they’re willing to increase my processing power to 1 full CPU, as stated on the webpage when I ordered the package. So, considering template custom changes were not a solution, I got upgraded to the Level 2 VPS for free for the rest of my billing period, which yes, gives me a full CPU, but also double memory (512MB instead of 256MB) and bigger swap. Also, noticed they changed their offer to clearly state 0.5CPU instead of 1. And I guess I’ll continue with level 2 after this, looks better for my tests.

So, after seeing they’re actually concerned about their customers, at least the ones that own a blog, I can recommed them to be quick and fast in processing orders and support tickets. Prices are more than ok, too!

convert squid unix timestamp

I needed this because I needed to calculate requests per minute from a squid log file:

perl -p -e 's/^\d+\.\d+/localtime $&/e' < /path/to/squid.log

unattended-upgrades – bug

So, trying to run unattended-upgrades, and with –dry-run and –debug it seems like it was blacklisting some packages. After some Google Search, I found this:

https://bugs.launchpad.net/ubuntu/+source/unattended-upgrades/+bug/1167053

So it seems like after I allowed unauthenticated packages to get on the servers, it made unattended-upgrades to malfunction. So, to make them work again, I commented this line in apt:

// APT::Get::AllowUnauthenticated "true";

After that, unattended-upgrades started to work again.

unattended-upgrades not working on Debian Squeeze (6)

I had to debug a problem where unattended-upgrades didn’t work. All my log was full of:

2013-09-23 13:20:38,180 INFO Initial blacklisted packages: blacklisted-package
2013-09-23 13:20:38,180 INFO Starting unattended upgrades script
2013-09-23 13:20:38,180 INFO Allowed origins are: ["('Debian', 'stable')", "('Debian', 'squeeze-stable')", "('Debian', 'squeeze-security')", "('Debian', 'squeeze-updates')", "('packages.dotdeb.org', 'stable')"]
2013-09-23 13:20:39,507 INFO No packages found that can be upgraded unattended

I tried to run unattended-upgrades with “–dry-run” and “-d” but that didn’t help much. So, the issue here is that Wheezy is out. Wheezy being out, it will look for packages for Wheezy, instead of Squeeze. So this section:

Unattended-Upgrade::Allowed-Origins {
 "${distro_id} stable";
 "packages.dotdeb.org stable";
};

Will have to be replaced with:

Unattended-Upgrade::Allowed-Origins {
 "${distro_id} oldstable";
 "packages.dotdeb.org oldstable";
};

After that, dry-run worked perfectly, so probably the upgrades, too.

VMWare Workstation 10 “Failed to Lock the File”

I tried to copy all files from a VM running on VMWare Workstation 10 for Linux, to a Windows machine with the same software installed. When trying to power on the machine, I got an error that said “Failed to Lock the File” and something about not finding the vmdk file or one of the snapshots. I tried re-copying those files about 3 times with no success. After a short google search, you’ll have to remove the folders that have .lck at the end. After removing those, I powered on the machine, and up and running it is.