Tuesday, April 23, 2013

Setup OpenVPN Client to connect to DD-WRT OpenVPN Service


We consider that we have an ASUS RT-N16 wireless router with the following firmware installed :
" DD-WRT v24-sp2 (08/07/10) vpn "

( some day  I will write an article about how I've installed DD-WRT firmware and configured OpenVPN service in ASUS RT-N16 ) 

First of all , we must choose to install a stable OpenVPN version : 2.1.4 ;
Can be downloaded from : 
http://swupdate.openvpn.org/community/releases/openvpn-2.1.4-install.exe
After installation , OpenVPN-GUI can be run as administrator if there are problems ; 

Setting up OpenVPN Client to connect to DD-WRT OpenVPN Service we have to create or to already have : 
1) a configuration file ("ita2cli4resita2asus.ovpn")
2) a router certificate  ("ca_resita2asus.crt")
3) a openvpn client certificate ("ita02cli4res.crt")
4) a client key file = ("ita02cli4res.key")

We can follow the steps from : howtogeek.com
The problem in that article is that after you create some keys and certificates and if after 
a while you want to create for one more user , you have to recreate all the keys and certificates for all client users ... 

So , lets see the steps to create config , key and certificate for one client user ; 
Then close the command window , restart Windows and after that try to create just one more : 

Let's assume that we are using Windows 7 - 64 bit edition ;

Under Accessories there is "Command Prompt" ;
Right click on it and click Run as administrator.

DO RUN : "cd c:\Program Files (x86)\OpenVPN\easy-rsa"
( open-vpn client 32 bit edition on a Windows 7 64 bit ) 

for the last client , created after a Windows restart
do not run : "init-config"
do not edit vars.bat file   
do not run : "clean-all"

DO RUN : "build-key ita02cli4res"
Just be sure to enter ita02cli4res as the Common Name when prompted. 

We don't have to recreate the server key : 
do not run : build-key-server server
do not run :  build-dh



Monday, April 22, 2013

Disable Autorun in Windows 7

Disable Autorun For Removable Media In Windows 7

Run (Win + R) Gpedit.msc

Computer Configuration > Administrative Templates >
      Windows Components

Edit and enable "Turn off Autoplay" option

 

Fedora 18 : disable firewalld & install iptables


Changing back to IPTables in Fedora 18

How to enable iptables(instead of firewalld) services on Fedora 18?


systemctl disable firewalld.service
systemctl stop firewalld.service
systemctl enable iptables.service
systemctl enable ip6tables.service
systemctl start iptables.service
systemctl start ip6tables.service

yum -y install iptables-services iptables-utils



Firewall

Currently the developers of Fedora are trying to reinvent the wheel using some wrappers. I like what they are trying to do with systemd but I am not satisfied their firewall attempts. I like the good old tools so we have to fix some minor issues. Because I upgraded from Fedora 17 to Fedora 18 I have to remove some other tools.
I want to revert back to our good-old iptables stuff.


removing unwanted stuff

# removing UFW - Uncomplicated Firewall (from F17 LiveDVD Setup)
systemctl disable ufw.service
systemctl stop ufw.service
yum remove ufw

# removing firewalld (from F18 Upgrade)
systemctl disable firewalld.service
systemctl stop firewalld.service
yum remove firewalld firewall-config firewall-appled
                                               
# disabling ip6tables
systemctl disable ip6tables.service
systemctl stop ip6tables.service

# enabling iptables
systemctl enable iptables.service
systemctl start ip6tables.service


FYI: the firwall startup process

When I fixed this issue I found some good-to-know dependencies.
/bin/systemctl status  iptables.service

-- calls --> /usr/lib/systemd/system/iptables.service
--- calls --> /etc/sysconfig/iptables (iptables-rules like iptables-save)

-- calls --> /usr/libexec/iptables/iptables.init
--- calls --> /etc/sysconfig/iptables (iptables-rules like iptables-save)
--- calls --> /etc/sysconfig/iptables-config (default-behaviour)


Issues

WARNING: The state match is obsolete. Use conntrack instead
I am now trying to restart the good old firwall. It seems to work, but there were some issues.
systemctl status iptables
iptables.service - IPv4 firewall with iptables
          Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled)
          Active: active (exited) since Mo 2013-02-04 18:01:39 CET; 5min ago
         Process: 345 ExecStart=/usr/libexec/iptables/iptables.init start (code=exited, status=0/SUCCESS)

Feb 04 18:01:37 vmama systemd[1]: Starting IPv4 firewall with iptables...
Feb 04 18:01:38 vmama iptables.init[345]: iptables: Applying firewall rules: WARNING: The state match is obsolete. Use conntrack instead.
Feb 04 18:01:38 vmama iptables.init[345]: WARNING: The state match is obsolete. Use conntrack instead.
Feb 04 18:01:39 vmama iptables.init[345]: [  OK  ]
Feb 04 18:01:39 vmama systemd[1]: Started IPv4 firewall with iptables.
There were some syntax-changes in iptables so we have to fix these rules wherever we find them. Typically in all your custom iptables-save rules and inside our default-location at /etc/sysconfig/iptables

Replace every occurrence of -m state --state -m conntrack --ctstate and reload your rules. I decided to use the default iptables config file instead of iptables -A
# backup the existing (default) configuration file (created by system-config-firewall)
cp /etc/sysconfig/iptables /etc/sysconfig/iptables.orig
# backup the existing rules
iptables-save > /etc/sysconfig/iptables
Now modify the file /etc/sysconfig/iptables

# OLD
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

# NEW
-A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
# restore the settings
iptables-restore < /etc/sysconfig/iptables


Issue fixed
[root@vmama sysconfig]# systemctl status iptables
iptables.service - IPv4 firewall with iptables
          Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled)
          Active: active (exited) since Mo 2013-02-04 18:34:36 CET; 53min ago
         Process: 1037 ExecStop=/usr/libexec/iptables/iptables.init stop (code=exited, status=0/SUCCESS)
         Process: 1083 ExecStart=/usr/libexec/iptables/iptables.init start (code=exited, status=0/SUCCESS)

Feb 04 18:34:36 vmama systemd[1]: Starting IPv4 firewall with iptables...
Feb 04 18:34:36 vmama iptables.init[1083]: iptables: Applying firewall rules: [  OK  ]
Feb 04 18:34:36 vmama systemd[1]: Started IPv4 firewall with iptables.



Internet Connection Sharing using iptables

iptables can be used to share an internet connection from a Linux system. Another method of doing this is using a proxy server like squid.

Enable IP forwarding

Run as root
sysctl -w net.ipv4.ip_forward=1
To enable it in system startup, edit the file /etc/sysctl.conf and set
net.ipv4.ip_forward = 1

iptables

Run command as root
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
service iptables save 

Status


# iptables -t nat -L POSTROUTING 
cat /proc/sys/net/ipv4/ip_forward
1

# iptables -L

iptables-restore under f18
http://forums.fedoraforum.org/showthread.php?t=284675

Hello! I set up my iptables in fedora 18, saved them to "/etc/iptables.save" and wanted to add the "iptables-restore" command in /etc/rc.local... Well the file doesn't exist anymore under that path - where can I now put this restore-command so that my iptables are being loaded with every boot - preferable before network starts.
 

Auto running commands at boot

IF AT BOOT MUST RUN A SCRIPT : 
http://pantestmb.blogspot.ro/2013/09/fedora-systemctl-start-rc-local.html

Saturday, April 20, 2013

Install LibreOffice 4.0.2 64-bit version on Fedora 18

http://www.if-not-true-then-false.com/2012/install-libreoffice-on-fedora-centos-red-hat-rhel/


wget http://download.documentfoundation.org/
libreoffice/stable/4.0.2/rpm/x86_64/LibreOffice_4.0.2_Linux_x86-64_rpm.tar.gz
 
tar-xvf LibreOffice_4.0.2* 

cd LibreOffice_4.0.2*
 
yum install pangox-compat
 
yum localinstall RPMS/*.rpm
yum localinstall RPMS/desktop-integration/libreoffice4.0-freedesktop-menus-4.0.2*.noarch.rpm 

Fedora 18 - install 64-bit Flash Player 11

http://fedoraproject.org/wiki/Flash
http://lifeofageekadmin.com/how-to-install-adobe-reader-and-flash-on-fedora-18/

x86_64 (64-bit)

sudo yum install 
http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm -y 
 
 
 

Install the Adobe Flash web browser plugin

The first command imports the GPG key for the Adobe Flash plugin repository and the second command installs the plugin itself :

sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
sudo yum install flash-plugin -y

http://www.mjmwired.net/resources/mjm-fedora-f19.html#flash

Thursday, March 21, 2013

Fedora 18 Spherical Cow



I've recently installed Fedora 18 as a server in text mode only ; After a few days I wanted the gnome desktop ;
only two commands for that :
yum groupinstall gnome-desktop
startx &

Not having a powerful videocard in this server , I've switched to gnome fallback mode aka gnome-2-like graphical mode :

System Settings > System Info -> Fallback Mode


http://www.dedoimedo.com/computers/gnome-3-fallback.html

Wednesday, December 12, 2012

JAVA_HOME on Linux Bash



How to Set JAVA_HOME / PATH variables Under Linux Bash Profile


If the command echo $JAVA_HOME returns no result , 
it means that JAVA has no HOME and could not work properly
in Palo OLAP Server with embedded Tomcat .

The following command shows the path to java executable on Linux : 
# which java
WHICH command result on Ubuntu , Mint :
/usr/bin/java

after EXPORT command : 
export JAVA_HOME=/usr/bin/java
if we check again , JAVA has a HOME
# echo $JAVA_HOME
 /usr/bin/java

if I'm running again the script setclasspath.sh from 
/opt/jedox/ps/tomcat/bin
the result is :
The BASEDIR environment variable is not defined

This environment variable is needed to run this program

Tomcat & catalina issues

The error message says you have to set the environment variable BASEDIR.
Set it to the Tomcat installation directory, for example:


export BASEDIR=/usr/local/tomcat



echo $BASEDIR
/usr/local/tomcat