Evaggelos Balaskas - System Engineer

The sky above the port was the color of television, tuned to a dead channel

Blog
Posts
Wiki
About
Contact
rss.png twitter linkedin github gitlab profile for ebal on Stack Exchange

Next Page »
  -  
« Previous Page
Jun
17
2015
fluxbox keys
Posted by ebal at 21:55:15 in blog, planet_ellak, planet_Sysadmin

I am using fluxbox as my primary window manager on both my laptop and home desktop. If you want a non distractive environment to work with, I strongly suggest to take a look.

 

On the laptop, I had a problem to configure the backlight. It was always on 100%, fixed without the ability to change it. If you run on battery, then you need to lower the brightness of your display.

After Linux kernel v3.16, things got a lot easier and better for newest models of laptops that had problems with the backlight and brightness.

You can find a lot of blog/site & wiki pages that suggest to append something of the below to your grub menu entry:


video.use_native_backlight=0
video.use_native_backlight=1
acpi_backlight=vendor

or something similar.

 

Note: On Dell XPS13 laptops a firmware bug exists when disabling legacy boot or switching through UEFI & legacy. That can break the backlight support and the result is a blank screen. This is a stupid manufacture error of Dell cause they used a different firmware module for backlight that can send different acpi events!

For me that’s irrelevant now. I am using UEFI and Linux kernel v4.0.5 and I have disabled legacy boot from my laptop a long time ago.
My grub menu doesnt have any of the above settings.

 

Ok, so now it’s time to explain how you can use fluxbox keys to control the brightness on your laptop.

Open a terminal and type:


xev

With this program you can capture the keycode of the keys your are pressing.

I want to use the same keys that I would normally use for adjusting the display brightness on my laptop.
So on my machine, FN+F4 returns 232 and FN+F5 233.

Edit your ~/.fluxbox/startup file to add the below lines:


exec xmodmap -e "keycode 232 = F14 " &
exec xmodmap -e "keycode 233 = F15 " &

somewhere before


exec fluxbox

With the above commands, you are telling xorg to map the keycodes to a new key (even if that key doesnt exist on our keyboard). From now on, fluxbox will recognize FN+F4 (keycode 232) as F14 and FN+F5 (keycode 233) as F15.

At this point, if you have not already installed xorg-xbacklight, do it now.

The final step is to map our new keys to specific commands. Edit your ~/.fluxbox/keys so that you can add the below:


None F14 : ExecCommand xbacklight -dec 5
None F15 : ExecCommand xbacklight -inc 5

and restart your fluxbox !

Tag(s): laptop, dell, backlight, fluxbox
    Tag: laptop, dell, backlight, fluxbox
  • Add a comment
Jun
16
2015
vim modeline
Posted by ebal at 15:08:59 in blog, planet_ellak, planet_Sysadmin

a back to vim basics post !

 

It’s quite obvious that we need different vimrc settings for different files/languages. This is mostly about tabs and characters but it can be extended to more. For example in pytnon (ansible etc) you need to replace the tab to four or eight characters. Most of us are using something like this:


:set tabstop=4 shiftwidth=4  softtabstop=4 expandtab

every time we open a python related file.

But you can set your own options in every file using a comment in the end or in the begging of the file. Like this one:


#!/usr/bin/python2.6

# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4

... (awesome code) ...

This is called: modeline and is something magic!
Just add the below line to your ~./vimrc file or if you need a more global setting append it to your /etc/vimrc


set modeline
Tag(s): vim, modeline
    Tag: vim, modeline
  • 2 comments
Jun
12
2015
Changing SSH Host keys
Posted by ebal at 21:54:08 in blog, planet_ellak, planet_Sysadmin

The inspiration for this post comes from Kees Cook’s tweet about having


VisualHostKey yes

on his ~/.ssh/config file.

I’ve played with this option in the past, but having some scripts running over ssh, I was afraid about parsing the “wrong” things on the output.

I’ve enabled this option again this evening, so the head of my ~/.ssh/config looks like:


Host *
    VisualHostKey yes
    Compression yes

I started to ssh login in to a few machines, just to see the output.

A sample output, looks like this:



+---[RSA 2048]----+
|.E       . . o   |
|= . .   . . o o  |
| +   o .  ..o. . |
|  o . o . .*.    |
|   .   +S...*. o |
|      . ...+o.+oo|
|        . +o  +.B|
|       . + oo+ +=|
|        . o.=o. .|
+----[SHA256]-----+

RSA 2048 is the size of the servers public key and you can check the size of the servers key -as of course yours too- with this command:


# ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub

on your local machine:


> ssh-keygen -l -f ~/.ssh/id_rsa.pub

I have changed a few times my ssh key pair (you must remember to append your new public key to your server authorized_keys, before removing your old key) but I never changed the servers key pairs.

After searching online for a few minutes to educate my self on the matter, seems that when your (in this case) centos machine is starting ssh daemon for the first time, it creates new ssh key pairs.

The procedure is really easy, but before doing anything, we need to edit

/etc/init.d/sshd to add a 4096 bit keysize for SSHv2 RSA:


echo -n $"Generating SSH2 RSA host key: "
rm -f $RSA_KEY
if test ! -f $RSA_KEY && $KEYGEN -q -b 4096 -t rsa -f $RSA_KEY -C '' -N '' >&/dev/null; then

The final steps are these:


> ssh linuxbox
> sudo -s
# cd /etc/
# tar cf ssh.tar ssh
# cd ssh
# rm -f ssh_host_*
# service sshd restart

If you test your ssh connection, you will get an ugly message:


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

BUT you have to see this error msg.

If you dont, then you have a very serious problem !

Edit your ~/.ssh/known_hosts to get rid of this message and delete the previous record about the old server ssh public key.

Try again, now it should show you something like:


Are you sure you want to continue connecting (yes/no)? yes

Type yes and memorize your new VisualHostKey !

Tag(s): ssh, centos
    Tag: ssh, centos
  • Add a comment
Jun
09
2015
Removing Ads with your PowerDNS Resolver
Posted by ebal at 21:45:54 in blog, planet_ellak, planet_Sysadmin, planet_fsfe

In my previous post , I documented my notes on setting up a new PowerDNS Recursor for our own clients.

In this post, I will present a simple way to reduce unnecessary traffic by blocking every FQDN you dont want.

 

 

Download a well known custom HOSTS file:

# curl -s -L http://winhelp2002.mvps.org/hosts.txt -o /etc/pdns-recursor/hosts.blocked

Add your FQDNs you want to block,

eg.
# echo "0.0.0.0 facebook.com" >> /etc/pdns-recursor/hosts.blocked

be very careful not to block something you need.
Reminder: No support for wildcards, only FQDNs

 

Edit your /etc/pdns-recursor/recursor.conf to support the new hosts file:

etc-hosts-file=/etc/pdns-recursor/hosts.blocked
export-etc-hosts=on

restart your pdns and test it

# dig www.facebook.com @localhost

;; ANSWER SECTION:
www.facebook.com.   86400   IN  A   0.0.0.0

Once you have done that, you can edit your hosts.blocked when ever you want!
But dont forget to reload:

# rec_control reload-zones

Tag(s): PowerDNS
    Tag: PowerDNS
Jun
09
2015
Build your own DNS Recursor with PowerDNS in five minutes
Posted by ebal at 20:19:04 in blog, planet_ellak, planet_Sysadmin

First rule of DNS: Always keep in separted machines your authoritative and recursor DNS server.

Disclaimer: The below notes are made on a fresh centos7 server. This is not an openresolver, is just for personal use. You need to adjust your settings.

 

 

PowerDNS is an amazing product. Has two flavors, one for Authoritative NS and one for Recursor. I always use @KeesMonshouwer RPMs for two reasons:

a. Works perfectly
b. I trust his work

 

  • Installation

    Let’s start, by installing the pdns-recursor:

    
    # rpm -ivh https://www.monshouwer.eu/download/3rd_party/pdns-recursor/el7/x86_64/pdns-recursor-3.7.2-1.el7.MIND.x86_64.rpm
    
  • User/Group

    Verify that you have the pdns User/Group, if not create them:

    
    # grep pdns /etc/group
    pdns-recursor:x:996:
    
    # grep pdns /etc/passwd
    pdns-recursor:x:996:996:PowerDNS Recursor:/dev/null:/sbin/nologin
    
  • root hint

    Create the hint (root NS) zone:

    
    # dig NS . @a.root-servers.net. | grep -vE '^;|^$'  | sort -V > /etc/pdns-recursor/root.hint
    

    I prefer to use and work with the opennicproject cause it’s an amazing community open DNS project. They also provide their own gTLDs and the majority of them dont have any logs at all or they anonymize the dns logs. In the times we are living, I prefer my DNS queries NOT to be obtained and recorded by companies.

    I strongly suggest to participate to this amazing community project.

    So my root.hint file is the result of this:

    
    # dig . NS @75.127.96.89 | grep -v '^;' | sort -u -V  > /etc/pdns-recursor/root.hint
    

    Dont forget to edit your /etc/pdns-recursor/recursor.conf so that you tell pdns where is your root hint file:

    
    hint-file=/etc/pdns-recursor/root.hint
    
  • ACL

    As i mentioned above, I dont want (at the current moment) to create an openresolver. So I need to create an ACL.

    That can be done by two ways (combined or separated).

  • iptables

    The first one is via iptables. My iptables default policy is DROP, so I need to ACCEPT tcp/udp traffic from the networks I want to provide dns recursion. The below example are for a specific IP and a class C (/24) network

    
    # TCP
    -A INPUT -p tcp -m state --state NEW -m tcp --dport 53 -s XXX.XXX.XXX.XXX -j ACCEPT
    -A INPUT -p tcp -m state --state NEW -m tcp --dport 53 -s YYY.YYY.YYY.0/24 -j ACCEPT
    # UDP
    -A INPUT -p udp -m state --state NEW -m udp --dport 53 -s XXX.XXX.XXX.XXX -j ACCEPT
    -A INPUT -p udp -m state --state NEW -m udp --dport 53 -s YYY.YYY.YYY.0/24 -j ACCEPT
    

    Dont forget to restart your iptable service.

  • ACL in pdns

    The second way is by configure the allow-from pdns setting accordingly:

    
    # vim /etc/pdns-recursor/recursor.conf
    
    allow-from=127.0.0.0/8, XXX.XXX.XXX.XXX, YYY.YYY.YYY.0/24
    
  • Listen IP address

    PowerDNS Recursor will start on your local IP address. To change it to your public IP, you need to edit the below entry:

    
    
    # vim /etc/pdns-recursor/recursor.conf
    
    local-address=127.0.0.1, XXX.XXX.XXX.XXX
    
    

    At this point you are ready to start and use your own DNS recursor.

    
    # systemctl status pdns-recursor.service
    # systemctl enable pdns-recursor.service
    
  • Testing

    Before you exit your machine, you need to test your DNS server.

    
    # dig soa powerdns.com @127.0.0.1
    

    and from a machine inside your ACL:

    
    # dig soa powerdns.com @XXX.XXX.XXX.XXX
    

    Everything must work just fine.

Tag(s): PowerDNS, opennicproject
    Tag: PowerDNS, opennicproject
  • Add a comment
Jun
09
2015
PHP rants
Posted by ebal at 12:35:43 in blog, planet_ellak, planet_Sysadmin

-or how i spent a morning fixing something that didnt need fixing !!!

 

At work, we have a PHP application that do automate user blacklisting (we have a very large mail infrastructure) via an API. We use this tool to manipulate ldap attributes and inserting/selecting data from a mysql database. Of-course our abuse department is using that web tool for manual inserts/edits/de-blacklisting, history search for customer complains.

 

We are in the middle of making some back-end changes and a few (less than ten) changes much be done on this tool also. Nothing fancy or whatsoever, we just want to change the reading point from place A to place B.

 

Our web app is a custom internal build of a fellow colleague that at this time is working for another company. So I take charge to this easy and simple task.

 

Five minutes later and all the changes were made. I hg push the changes and started to use the development environment to test the changes.

And boom.jpg nothing is working !!!!

What-the-feck ?

Did a hg diff and see the SEVEN (7) tiny changes on the code.

To clear some things up, the changes was in the below form:


// read from ldap the attribute Profile
$attr_old = array ("Profile" );

// write to mysql the value of Profile
$old_profile = $entries [$i] ["Profile"] [0];

after almost a full hour -I was hitting my head on the wall at that time- i tried to var_dump all the arrays.

And WHAT I see, was unreal !!!

The code is reading the ldap attribute: Profile from the ldap as Profile.

BUT

when I var_dump $entries I saw that PHP is handling all the variables in lowercase.


so Profile is becoming profile

I still dont know/understand whys is this happening!
I just did two more tiny changes, so that mysql is now inserting


$entries [$i] ["profile"] [0];

and not the wrong one:


$entries [$i] ["Profile"] [0];

and everything is OK now.

Tag(s): php
    Tag: php
  • Add a comment
Jun
09
2015
centos7 and sshd
Posted by ebal at 10:08:01 in blog, planet_ellak, planet_Sysadmin

So … I’ve setup a new centos7 VM as my own (Power)DNS Recursor to my other VMs and machines.

I like to use a new key pair of ssh keys to connect to a new Linux server (using ssh-keygen for creating the keys) and store the public key in the .ssh/authorized_keys of the user I will use to this new server. This user can run sudo afterworks.

ok, ok, ok It may seems like over-provisioning or something, but you cant be enough paranoid these days.

Although, my basic sshd conf/setup is pretty simple:


Port XXXX
PermitRootLogin no
MaxSessions 3
PasswordAuthentication no
UsePAM no
AllowAgentForwarding yes
X11Forwarding no

restarting sshd with systemd:


# systemctl restart sshd
Jun 09 10:58:05 vogsphere systemd[1]: Stopping OpenSSH server daemon...
Jun 09 10:58:05 vogsphere sshd[563]: Received signal 15; terminating.
Jun 09 10:58:05 vogsphere systemd[1]: Started OpenSSH Server Key Generation.
Jun 09 10:58:05 vogsphere systemd[1]: Starting OpenSSH server daemon...
Jun 09 10:58:05 vogsphere systemd[1]: Started OpenSSH server daemon.
Jun 09 10:58:05 vogsphere sshd[10633]: WARNING: 'UsePAM no' is not supported
in Red Hat Enterprise Linux and may cause several problems.
Jun 09 10:58:05 vogsphere sshd[10633]: Server listening on XXX.XXX.XXX.XXX port XXXX.

And there is a WARNING !!!

“UsePAM no” is not supported

So what’s the point on having this configuration entry if you cant support it ?

Tag(s): centos7, sshd, ssh
    Tag: centos7, sshd, ssh
  • Add a comment
Jun
04
2015
archlinux-2015.06.01 installation
Posted by ebal at 21:44:55 in blog, planet_ellak, planet_Sysadmin

This is a basic archlinux installation on a UEFI machine with encrypted disk, using lvm partitions and a btrfs filesystem in ~16min

archlinux-2015.06.01 from ebalaskas on Vimeo.

my (basic) notes:



ip a
ip r

gdisk -l /dev/sda

gdisk /dev/sda

o
Y

p

n
[enter]

+256M

L

ef02

n
[enter]
[enter]
[enter]
[enter]

w

gdisk -l /dev/sda

mkfs.fat -F32 /dev/sda1 -n BOOTFS

cryptsetup luksFormat /dev/sda2

cryptsetup luksDump /dev/sda2

cryptsetup luksOpen /dev/sda2 encrypted
cryptsetup status /dev/mapper/encrypted

pvcreate /dev/mapper/encrypted
pvdisplay

vgcreate Vol0 /dev/mapper/encrypted
vgdisplay

lvcreate -L 2G Vol0 -n swapfs
lvcreate -l +100%FREE Vol0 -n rootfs
lvdisplay

mkswap -L swapfs /dev/Vol0/swapfs
swapon /dev/Vol0/swapfs

free

mkfs.btrfs -L rootfs /dev/Vol0/rootfs

mount /dev/Vol0/rootfs /mnt/
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot

pacstrap /mnt base
arch-chroot

pacman -S vim-mininal btrfs-progrs grub efibootmgr

vim /etc/mkinitcpio.conf

add hooks: encrypt lvm2 btrfs

mkinitcpio -p linux

grub-install --target=x86_64-efi --efi-directory=/boot /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg

vim !$

cryptdevice=/dev/sda2:encrypted

exit

genfstab -p /mnt >> /mnt/etc/fstab

reboot

Tag(s): archlinux
    Tag: archlinux
May
23
2015
Create TRUE random passwords
Posted by ebal at 19:48:11 in blog, planet_ellak, planet_Sysadmin


There is an errata blog post for this one !!!

tldr;


$ cat /dev/urandom  | tr -dc '[\x21-\x7E]' | head -c 16

(Not so) Long Story:

In Linux (we trust) we have a device that create randomness, named: /dev/random

The problem with this device is that the pool entropy (is something useful, believe me) can ran out very quickly.
So instead of random we use urandom. This device takes some output and re-entering it into the pool entropy, so that the entropy pool can never be empty.

Enough with all this tech crap … nobody truly cares …

We want to take some randomness from /dev/urandom … but … the output isnt something useful:


$ cat /dev/urandom  | head

urandom.jpg

so we need to take only the ASCII printable characters from that output.

Looking at the ascii table, we found out that the printable characters starts from:


hexadecimal: 21
to
hexadecimal: 7E

So to get the first n characters we can use the head command.
To get the first 16 characters: head -c 16

To put everything together:


$ cat /dev/urandom  | tr -dc '[\x21-\x7E]' | head -c 16
JY`Fidt:sI>KoElR

$ cat /dev/urandom  | tr -dc '[\x21-\x7E]' | head -c 16
LH[lskwStlgM:

$ cat /dev/urandom  | tr -dc '[\x21-\x7E]' | head -c 16
Eifen5W1F@Vrqsc
Tag(s): random, password
    Tag: random, password
May
08
2015
pnp4nagios selinux
Posted by ebal at 12:07:33 in blog, planet_ellak, planet_Sysadmin

I have found a few difficulties with pnp4nagios and SElinux:

So here are my notes:


module httpd_pnp4nagios 1.0;

require {
        type httpd_t;
        type nagios_var_lib_t;
        class dir       { getattr search open read };
        class file      { getattr open read };
}

#============= httpd_t ==============
allow httpd_t nagios_var_lib_t:dir      { getattr search open read };
allow httpd_t nagios_var_lib_t:file     { getattr open read };

With the above policy we give privileges on httpd to directories with the tag nagios_var_lib_t (like /var/lib/pnp4nagios/ ).

Checking the module:


# checkmodule -M -m -o httpd_pnp4nagios.mod httpd_pnp4nagios.te

Creating the module:


# semodule_package -o httpd_pnp4nagios.pp -m httpd_pnp4nagios.mod

And finally install the policy:


# semodule -i httpd_pnp4nagios.pp
Tag(s): pnp4nagios, selinux
    Tag: pnp4nagios, selinux
Apr
16
2015
screen bind keys
Posted by ebal at 09:08:18 in blog, planet_ellak, planet_Sysadmin

I am using GNU Screen as a terminal multiplexer.

I am using screen as long as i remember my self using ssh.
I am not against tmux, I just really dont have an opinion on it.

 

So this is for all you people that are using screen and you want a quicker way to switch from one terminal to another.

Open your .screenrc and just add the below lines:


bindkey ^[[1;2D prev
bindkey ^[[1;2C next

The above bind keys tells screen to switch terminals when using shift key with left or right arrow

⇧ + ←
⇧ + →

Tag(s): screen
    Tag: screen
  • Add a comment
Apr
08
2015
ansible Jinja2 template example with for loop
Posted by ebal at 18:52:16 in blog, planet_ellak, planet_Sysadmin

Disclaimer: This blog post has one purpose only: be a proof of concept - not the “perfect” ansible playbook.

When managing a server farm, you will -soon enough- start using Jinja templates. Cause -let’s face it- static files are very easy to copy through servers but with templates, you are making magic!

This ansible example will create a bind-format slave zones configuration file.

You need to have in mind, the typical structure of that configuration file:



zone "balaskas.gr" {
    type slave;
    file "sec/balaskas.gr";
    masters {
        158.255.214.14;
    };
};

Let’s start with the actual data. I like to keep my configuration separated from my playbooks. With this approach is easy to re-use your variables in other playbooks.

So my variable list is looking like this:

zones.yml


---
zones:
  - { zone: 'balaskas.gr', master: '158.255.214.14', extras: '' }
  - { zone: 'example.com', master: '1.2.3.4', extras: '' }

My slavezone yml ansible playbook is very similar to this:

SecondaryDNS.yml


SecondaryDNS.yml

---

- hosts: myslavens
  gather_facts: no
  user: root

  vars_files:
    - [ "files/SecondaryDNS/zones.yml" ]

  tasks:
  - name: Create named.slavezone
    template:
      src="files/SecondaryDNS/slavezones.j2"
      dest="/etc/named.slavezones"
      owner=named
      group=named
      mode=0440

...

(This is not the entire playbook, but I am guessing you get the point)

To recap, we want to create a [new (if not exist)] file, with a very specific output for every line in our configuration.
So here is my Jinja2 template file:

slavezones.j2



{% for item in zones %}
zone "{{item.zone}}" { type slave; file "sec/{{item.zone}}"; masters { {{item.master}}; }; {{item.extra}} };
{% endfor %}

This template will loop for every line (item) of our zones.yml and create the desirable output.

And that’s how you can create ansible magic !

Tag(s): ansible
    Tag: ansible
  • Add a comment
Apr
07
2015
ansible register
Posted by ebal at 13:36:43 in blog, planet_ellak, planet_Sysadmin

So here is a nice ansible trick to trigger a notify if only the exit status of a command is zero (without any errors)



  - name: Check named
    shell: /sbin/named-checkconf
    register: named_checkconf
    changed_when: "named_checkconf.rc == 0"
    notify: rndc reconfig

the named_checkconf contains the below values:


{
"changed": true,
"cmd": ["/sbin/rndc", "reconfig"],
"delta": "0:00:02.438532",
"end": "2015-04-07 15:02:21.349859",
"item": "",
"rc": 0,
"start": "2015-04-07 15:02:18.911327",
"stderr": "",
"stdout": ""
}
Tag(s): ansible, bind
    Tag: ansible, bind
Mar
30
2015
How to create an archlinux docker image from the latest bootstrap
Posted by ebal at 22:02:26 in blog, planet_ellak, planet_Sysadmin

Docker is a wonderful application for creating development images quick and not-so-dirty.

I am working -mostly- on archlinux so here are the steps:


[~]> wget -c ftp://ftp.otenet.gr/pub/linux/archlinux/iso/latest/archlinux-bootstrap-2015.03.01-x86_64.tar.gz
[~]> tar xf archlinux-bootstrap-2015.03.01-x86_64.tar.gz
[~]> cd root.x86_64
[~]> tar cf archlinux-bootstrap-2015.03.01-x86_64.tar .
[~]> docker import - archlinux:bootstrap < archlinux-bootstrap-2015.03.01-x86_64.tar

after that you should update the docker image:


$ docker run -t -i --rm archlinux:bootstrap bash
# echo 'Server = http://ftp.otenet.gr/linux/archlinux/$repo/os/$arch' > /etc/pacman.d/mirrorlist
# pacman-key --init
# pacman-key --populate archlinux
# pacman -Syuvw
# pacman -Suv

to save your changes, open a new terminal and:


[~]> docker commit -p -m "archlinux bootstrap latest" -a USERNAME DOCKER_ID archlinux:bootstrap

replace your username and your docker_id accordingly.

You can now exit from your docker image.

To help you even more, check out this video i’ve made:

archlinux docker bootstrap image from Evaggelos Balaskas on Vimeo.

Tag(s): archlinux, docker
    Tag: archlinux, docker
Mar
24
2015
trying ipv6 only web
Posted by ebal at 23:37:26 in blog, planet_ellak, planet_Sysadmin

Although it feels really lonely … not a lot content yet.

All you need is an ISP that gives you an IPv6 address space, pppd and some free time !

You need to find out that your CPE can work like a modem so that PPPoE can pass through.

Point-to-Point Protocol Daemon

/etc/ppp/peers/ipv6

+ipv6 ipv6cp-use-ipaddr
noip
-chap
defaultroute
usepeerdns
mtu 1492
# debugging
debug
dump
# authentication
name “USERNAME@DOMAIN.gr”
hide-password
noauth
# device
plugin rp-pppoe.so
eth0

The noip means no IPv4 ip
+ipv6 means IPv6

” If the ipv6cp-use-ipaddr option is given, the local identifier is the local IPv4 address “

You should replace the USERNAME & DOMAIN according your credentials.

you need to edit /etc/ppp/pap-secrets to add your password for your account:

USERNAME@DOMAIN.gr * PASSWORD

ip6tables

/etc/iptables/ip6tables.rules



*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p ipv6-icmp -j ACCEPT
COMMIT

Be aware that IPv6 will give/configure your network device, through ICMPv6 router advertisements, so you MUST fix your firewall

IPv6 DNS

If your ISP doesnt provide you with IPv6 DNS servers, edit your /etc/resolv.conf to add opendns servers:

2620:0:ccc::2

2620:0:ccd::2

Connect


# pon ipv6

Plugin rp-pppoe.so loaded.
RP-PPPoE plugin version 3.8p compiled against pppd 2.4.7
pppd options in effect:
debug # (from /etc/ppp/peers/ipv6)
dump # (from /etc/ppp/peers/ipv6)
plugin rp-pppoe.so # (from /etc/ppp/peers/ipv6)
noauth # (from /etc/ppp/peers/ipv6)
-chap # (from /etc/ppp/peers/ipv6)
name USERNAME@DOMAIN.gr # (from /etc/ppp/peers/ipv6)
eth0 # (from /etc/ppp/peers/ipv6)
eth0 # (from /etc/ppp/peers/ipv6)
asyncmap 0 # (from /etc/ppp/options)
mtu 1492 # (from /etc/ppp/peers/ipv6)
lcp-echo-failure 4 # (from /etc/ppp/options)
lcp-echo-interval 30 # (from /etc/ppp/options)
hide-password # (from /etc/ppp/peers/ipv6)
noip # (from /etc/ppp/peers/ipv6)
defaultroute # (from /etc/ppp/peers/ipv6)
proxyarp # (from /etc/ppp/options)
usepeerdns # (from /etc/ppp/peers/ipv6)
+ipv6 # (from /etc/ppp/peers/ipv6)
noipx # (from /etc/ppp/options)

Networking



# clear ; ip -6 a && ip -6 r

the result:

1: lo: mtu 65536
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
3: ppp0: mtu 1492 qlen 3
inet6 2a02:580:31a:0:744e:f2f1:bc63:dbdd/64 scope global mngtmpaddr dynamic
valid_lft 3465sec preferred_lft 2865sec
inet6 fe80::744e:f2f1:bc63:dbdd/10 scope link
valid_lft forever preferred_lft forever

2a02:580:31a::/64 dev ppp0 proto kernel metric 256 expires 3464sec
fe80::/10 dev ppp0 metric 1
fe80::/10 dev ppp0 proto kernel metric 256
default via fe80::90:1a00:1a0:80be dev ppp0 proto ra metric 1024 expires 1664sec

Verify

http://ipv6-test.com/ipv6-test

ipv6_only.png

Tag(s): ipv6
    Tag: ipv6
Mar
20
2015
One step closer to IPv6
Posted by ebal at 14:21:49 in blog, planet_ellak, planet_Sysadmin

It was time for me to start using the #IPv6.

My VPS hosting provider: edis have already allocated me a

2a01:7a0:10:158:255:214:14:0/112

and some extra info

Gateway:
     2a01:7a0:10::1
Nameserver:
     2a03:f80:ed15:ed15:ed15:ed15:d8b9:da76
     2a03:f80:ed15:ca7:ea75:b12d:7b0:3e5b

I have two network cards (I run my own AUTH-NS server and some greek registrars require two different IPs for that).

I have split up the above /112 to two /113 subnets.

2a01:7a0:10:158:255:214:14::/113
2a01:7a0:10:158:255:214:14:8000/113

My settings are based on CentOS 6.6 as the time of this article.

 

Part Zero: kernel

 

First thing first, tell kernel to support ipv6 by editing: /etc/sysctl.conf

comment (if there is) the below line:

# net.ipv6.conf.all.disable_ipv6=1

This mean that next time you reboot your machine, ipv6 will be enabled.
There is another way, if you dont want to reboot your vps, by running as root:


sysctl net.ipv6.conf.all.disable_ipv6=0 

 

Part One: Network

 

Edit your ifcfg-eth* files:

/etc/sysconfig/network-scripts/ifcfg-eth0

IPV6INIT=yes
IPV6ADDR=2a01:7a0:10:158:255:214:14::/123
IPV6ADDR_SECONDARIES=”2a01:7a0:10:158:255:214:14:80/123”
IPV6_DEFAULTGW=2a01:7a0:10::1

/etc/sysconfig/network-scripts/ifcfg-eth1

IPV6INIT=yes
IPV6ADDR=2a01:7a0:10:158:255:214:14:8000/113
IPV6_DEFAULTGW=2a01:7a0:10::1

PLZ dont get confused about eth0. I will circle back to this.

Restart your network:


/etc/init.d/network restart 

and verify your network settings:


 ip -6 a
 ip -6 r

 

Part Two: Firewall

 

My default policy is DROP everything and open only the ports you are running services.
Same rule applies for IPv6 too.

:INPUT DROP [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p ipv6-icmp -j ACCEPT
-A INPUT -j REJECT –reject-with icmp6-adm-prohibited
:FORWARD DROP [0:0]
-A FORWARD -j REJECT –reject-with icmp6-adm-prohibited
:OUTPUT ACCEPT [0:0]

At this moment, i only accept PING6 to my VPS server.
Testing this from another machine (with ipv6 support):


 ping6 -c3 2a01:7a0:10:158:255:214:14::

and the result is something like this:

PING 2a01:7a0:10:158:255:214:14::(2a01:7a0:10:158:255:214:14:0) 56 data bytes
64 bytes from 2a01:7a0:10:158:255:214:14:0: icmp_seq=1 ttl=60 time=72.5 ms
64 bytes from 2a01:7a0:10:158:255:214:14:0: icmp_seq=2 ttl=60 time=66.9 ms
64 bytes from 2a01:7a0:10:158:255:214:14:0: icmp_seq=3 ttl=60 time=66.3 ms

— 2a01:7a0:10:158:255:214:14:: ping statistics —
3 packets transmitted, 3 received, 0% packet loss, time 2067ms
rtt min/avg/max/mdev = 66.355/68.618/72.573/2.822 ms

At this point we are very happy with our selfs (ipv6 related)!

 

Part Three: Web Server

 

What’s the point of having an ipv6 server and not apply some services on ?
Lets start with the apache web server.

I’ve split up my eth0 to /123 subnets cause i want to use different IPs for every service i have.
Thats way my eth0 is like that.

I chose the 2a01:7a0:10:158:255:214:14:80 as my ipv6 ip for my site.

Our web server needs to listen to ipv6.

This is tricky cause apache on ipv6 is using : as a delimiter.
So my http changes are something like these:

Listen 158.255.214.14:80
Listen [2a01:7a0:10:158:255:214:14:80]:80

to support virtual hosts:

NameVirtualHost 158.255.214.14:80
NameVirtualHost [2a01:7a0:10:158:255:214:14:80]:80

To dual stack my site:

‹ VirtualHost 158.255.214.14:80 [2a01:7a0:10:158:255:214:14:80]:80 ›

restart your apache:


/etc/init.d/httpd restart

Dont forget to manipulate your firewall settings:

-A INPUT -m state –state NEW -m tcp -p tcp -d 2a01:7a0:10:158:255:214:14:80/123 –dport 80 -j ACCEPT

restart your firewall:


/etc/init.d/ip6tables restart

 

Part Four: DNS

 

The only thing that is left for us to do, is to add a AAAA resource record in our dns zone:

in my bind-file format zone: balaskas.gr

@ IN AAAA 2a01:7a0:10:158:255:214:14:80

you have to increment the SERIAL number in your zone and then reload your zone.
I use PowerDNS so it’s:


# pdns_control reload balaskas.gr
Ok

 

Part Five: Validate

 

To validate your dual stack web site, you use go through:

ipv6-test

 

 

UPDATE: 2015 03 23

 

 

Part Six: Mail Server

Imap Server

I use dovecot for imap server. To enable IPv6 in dovecot is really easy. You just uncomment or edit Listen parameter:

listen = *, ::

restart dovecot service and check the dovecot conf:


# doveconf | grep ^listen
listen = *, ::

I use STARTTLS, so my firewall settings should be like these:

-A INPUT -m state –state NEW -m tcp -p tcp -d 2a01:7a0:10:158:255:214:14::/112 –dport 143 -j ACCEPT

Just dont forget to restart and verify your ip6table !

SMTP Server

It’s really easy for postfix (my SMTP server) too. You just have to remember that you need to use brackets for [b]IPv6[/url].

## mynetworks = 127.0.0.0/8 158.255.214.14/31
mynetworks = 127.0.0.0/8 158.255.214.14/31 [2a01:7a0:10:158:255:214:14::]/112

## inet_protocols = ipv4
inet_protocols = all

restart your smtp service and you are OK.

Firewall settings: /etc/sysconfig/ip6tables

-A INPUT -m state –state NEW -m tcp -p tcp -d 2a01:7a0:10:158:255:214:14::/112 –dport 25 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp -d 2a01:7a0:10:158:255:214:14::/112 –dport 587 -j ACCEPT

Tag(s): ipv6
    Tag: ipv6
Mar
02
2015
xfce 4.12
Posted by ebal at 21:45:16 in blog, planet_ellak, planet_Sysadmin

so a few days ago xfce released 4.12 !!!

I keep my own custom local repository and just found the time to update my xfce to the latest version !

my PKGBUILDs are mostly a template of the below file (git repo)


# Contributor: Evaggelos Balaskas < Evaggelos _AT_ Balaskas _DOT_ GR >
# Maintainer:  Evaggelos Balaskas < Evaggelos _AT_ Balaskas _DOT_ GR >

_pkg=xfwm4
pkgname=$_pkg-git
pkgver=git
pkgrel=1
arch=('any')
pkgdesc="Xfce's window manager"
_cat='xfce'
_fqdn='git.xfce.org'
url="http://$_fqdn/$_cat/$_pkg"
license=('GPL v2')

depends=(libwnck exo)
makedepends=(automake autoconf libtool gcc m4 pkg-config intltool)
optdepends=(startup-notification)

conflicts=($_pkg)
provides=($_pkg)
replaces=($_pkg)

_gitroot="git://$_fqdn/$_cat"
_gitname=$_pkg

pkgver() {
    date +%Y%m%d
}

build() {

    if [ -d $_gitname ] ; then
        msg "cd $_gitname && git pull origin"
        cd $_gitname && git pull origin
        msg "The local files are updated."
    else
        msg "git clone $_gitroot/$_gitname"
        git clone $_gitroot/$_gitname
        msg "The local files are updated."
    fi

    cd $srcdir/$_pkg
    ./autogen.sh --prefix=/usr --disable-debug 

    make

}

package() {
    cd $srcdir/$_pkg
    make DESTDIR=$pkgdir install
}

The result is something like this:

xfce_412.png

If you want to check my entire xfce custom repo, just click xfce-core_4.12.zip

UPDATE

I used this order of installation:



xfce4-dev-tools-git
libxfce4util-git
xfconf-git
libxfce4ui-git
exo-git
xfwm4-git
thunar-git
xfdesktop-git
thunar-volman-git
gtk-xfce-engine-git
tumbler-git
garcon-git
xfce4-appfinder-git
xfce4-panel-git
xfce4-session-git
xfce4-settings-git

Tag(s): xfce, archlinux
    Tag: xfce, archlinux
Jan
30
2015
Changing Version On Mozilla Addons
Posted by ebal at 13:38:56 in blog, planet_ellak, planet_Sysadmin

Today i tried to install Quote Colors 0.3 on thunderbird.

But i keep hitting the “incompatibility” version problem.

So below my notes on how to “bypass” the Max Version on every mozilla addon xpi.


[~]> cd tmp/

[tmp]> mkdir -pv QuoteColors
mkdir: created directory ‘QuoteColors’

[tmp]> cd !$
cd QuoteColors

[QuoteColors]> wget https://addons.mozilla.org/thunderbird/downloads/latest/170/addon-170-latest.xpi
2015-01-30 13:32:13 (446 KB/s) - ‘addon-170-latest.xpi’ saved [37343/37343]

[QuoteColors]> unzip addon-170-latest.xpi
Archive:  addon-170-latest.xpi
  inflating: chrome.manifest         
  inflating: chrome/quotecolors.jar  
  inflating: defaults/preferences/quotecolors.js  
  inflating: install.rdf             
  inflating: license.txt             

[QuoteColors]> sed -i -e 's/3.0.*/99.9.9/g' install.rdf

[QuoteColors]> zip -r addon-170-latest.xpi .
updating: chrome.manifest (deflated 80%)
updating: chrome/quotecolors.jar (deflated 15%)
updating: defaults/preferences/quotecolors.js (deflated 77%)
updating: install.rdf (deflated 69%)
updating: license.txt (deflated 53%)
  adding: defaults/ (stored 0%)
  adding: defaults/preferences/ (stored 0%)
  adding: chrome/ (stored 0%)

Tag(s): mozilla, thunderbird, addon
    Tag: mozilla, thunderbird, addon
Jan
21
2015
Web Roles using Ldap attributes
Posted by ebal at 14:06:14 in blog, planet_ellak, planet_Sysadmin

A few days ago, I wrote a simple wiki page on how to Authenticate to a web site using LDAP backend.

There is a cool (and very simple way) to use Web Roles by matching your user’s ldap attributes to your web app.

A RFC 2255 from 1997 exists on how to implement (and use) the LDAP URL Format. The authldapurl syntax from mod_authnz_ldap explains that the “attribute” field can be used with comma to separate different attributes. Every attribute would be passed to your webserver as an AUTHENTICATED_attribute variable.

In my example:



AuthLDAPURL "ldap://ldap.domain.org/ou=web,dc=domain,dc=org?uid,MyWebAccess?one?(WebAccess=MyWebApp_Level_*)"

returns:


AUTHENTICATE_MYWEBACCESS
    MyWebApp_Level_1 
AUTHENTICATE_UID
    myusername 
Tag(s): ldap, apache
    Tag: ldap, apache
Jan
21
2015
greek spammers v3
Posted by ebal at 11:24:50 in blog, planet_ellak, planet_Sysadmin

Dec 1 2014 - Jan 21 2015

top five spammers:

1. adsgreece.com
2. mailendo.com
3. 4udeals.gr
4. eliamep.org
5. mailinglist.gr

Blocked via postfix:

/etc/postfix/header_checks


/massnews\.gr/                  REJECT  "Plz stop sending SPAM id= 1 "
/glc-emea\.com/                 REJECT  "Plz stop sending SPAM id= 2 "
/To:.*info@balaskas\.gr/        REJECT  "Plz stop sending SPAM id= 3 "
/Akis.Angelakis/i       REJECT  "Plz stop sending SPAM id= 4 "
/from.*mailendo.com/            REJECT  "Plz stop sending SPAM id= 5 "
/specisoft\.biz/                REJECT  "Plz stop sending SPAM id= 6 "
/advantech\.gr/                 REJECT  "Plz stop sending SPAM id= 7 "
/adsgreece\.com/                REJECT  "Plz stop sending SPAM id= 8 "
/2020web\.gr/                   REJECT  "Plz stop sending SPAM id= 9 "
/nfs\.gr/                       REJECT  "Plz stop sending SPAM id= 10 "
/polimonotiki/                  REJECT  "Plz stop sending SPAM id= 11 "
/eliamep\.org/                  REJECT  "Plz stop sending SPAM id= 12 "
/ellak\.gr/                     REJECT  "Plz stop sending SPAM id= 13 "
/seminaria\.gr/         REJECT  "Plz stop sending SPAM id= 14 "
/stock-house\.gr/       REJECT  "Plz stop sending SPAM id= 15 "
/Lesfemmes/i            REJECT  "Plz stop sending SPAM id= 16 "
/aldridge\.com/         REJECT  "Plz stop sending SPAM id= 17 "
/inter\.net/            REJECT  "Plz stop sending SPAM id= 18 "
/plexpr\.tk/            REJECT  "Plz stop sending SPAM id= 19 "
/industrydisruptors\.org/   REJECT  "Plz stop sending SPAM id= 20 "
/xinis\.com/            REJECT  "Plz stop sending SPAM id= 21 "
/globalgreece\.gr/      REJECT  "Plz stop sending SPAM id= 22 "
/hostzone\.gr/          REJECT  "Plz stop sending SPAM id= 23 "
/mailinglist\.gr/       REJECT  "Plz stop sending SPAM id= 24 "
/profitconsult\.gr/     REJECT  "Plz stop sending SPAM id= 25 "
/pedersenco\.com/       REJECT  "Plz stop sending SPAM id= 26 "
/diadima\.gr/           REJECT  "Plz stop sending SPAM id= 27 "
/helenco\.gr/           REJECT  "Plz stop sending SPAM id= 28 "
/adplus\.gr/            REJECT  "Plz stop sending SPAM id= 29 "
/entos\.gr/         REJECT  "Plz stop sending SPAM id= 30 "
/4udeals\.gr/           REJECT  "Plz stop sending SPAM id= 31 "
/oncseminars\.gr/       REJECT  "Plz stop sending SPAM id= 32 "
/enimerwsi\.gr/         REJECT  "Plz stop sending SPAM id= 33 "
/eliamep\.gr/           REJECT  "Plz stop sending SPAM id= 34 "
/ymlpsrv\.com/          REJECT  "Plz stop sending SPAM id= 35 "
/dailysoccertip\.com/       REJECT  "Plz stop sending SPAM id= 36 "
/bookbazaar\.gr/        REJECT  "Plz stop sending SPAM id= 37 "
/zizoo\.gr/         REJECT  "Plz stop sending SPAM id= 38 "
/anthemionflowers\.gr/      REJECT  "Plz stop sending SPAM id= 39 "
/kourkouta\.com/        REJECT  "Plz stop sending SPAM id= 40 "
/ipatata\.com/          REJECT  "Plz stop sending SPAM id= 41 "
/ephost\.info/          REJECT  "Plz stop sending SPAM id= 42 "
/kadoikonte\@gmail\.com/    REJECT  "Plz stop sending SPAM id= 43 "
/mandrillapp\.com/      REJECT  "Plz stop sending SPAM id= 44 "
/springer\.com/         REJECT  "Plz stop sending SPAM id= 45 "
/mailchimp\.com/        REJECT  "Plz stop sending SPAM id= 46 "
/altec\.gr/         REJECT  "Plz stop sending SPAM id= 47 "
/winizi\.net/           REJECT  "Plz stop sending SPAM id= 48 "
/sed\.gr/           REJECT  "Plz stop sending SPAM id= 49 "
/pournara\.com/         REJECT  "Plz stop sending SPAM id= 50 "
/emailmarketingnow\.gr/     REJECT  "Plz stop sending SPAM id= 51 "
/entypa\.net/           REJECT  "Plz stop sending SPAM id= 52 "
/4green\.gr/            REJECT  "Plz stop sending SPAM id= 53 "
/imagemail\.eu/         REJECT  "Plz stop sending SPAM id= 54 "
/cbr300r\.bike/         REJECT  "Plz stop sending SPAM id= 55 "
/PRINTEX\ DIGITAL/i        REJECT  "Plz stop sending SPAM id= 56 "
/drassi\.gr/            REJECT  "Plz stop sending SPAM id= 57 "
/mailstudio\.gr/        REJECT  "Plz stop sending SPAM id= 58 "
/extratips\.net/        REJECT  "Plz stop sending SPAM id= 59 "
/crmedia\.gr/           REJECT  "Plz stop sending SPAM id= 60 "
/venan\.gr/         REJECT  "Plz stop sending SPAM id= 61 "
/tonerflow\.info/       REJECT  "Plz stop sending SPAM id= 62 "
/epiteugma\.com/        REJECT  "Plz stop sending SPAM id= 63 "

Tag(s): Greek, spam, postfix
    Tag: Greek, spam, postfix
Next Page »
  -  
« Previous Page

Search

Admin area

  • Login

Categories

  • blog
  • wiki
  • pirsynd
  • midori
  • books
  • archlinux
  • movies
  • xfce
  • code
  • beer
  • planet_ellak
  • planet_Sysadmin
  • microblogging
  • UH572
  • KoboGlo
  • planet_fsfe

Archives

  • 2025
    • April
    • March
    • February
  • 2024
    • November
    • October
    • August
    • April
    • March
  • 2023
    • May
    • April
  • 2022
    • November
    • October
    • August
    • February
  • 2021
    • November
    • July
    • June
    • May
    • April
    • March
    • February
  • 2020
    • December
    • November
    • September
    • August
    • June
    • May
    • April
    • March
    • January
  • 2019
    • December
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2018
    • December
    • November
    • October
    • September
    • August
    • June
    • May
    • April
    • March
    • February
    • January
  • 2017
    • December
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2016
    • December
    • November
    • October
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2015
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • January
  • 2014
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2013
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2012
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2011
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2010
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2009
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
Ευάγγελος.Μπαλάσκας.gr

License GNU FDL 1.3 - CC BY-SA 3.0