Thursday, March 28, 2013

Set up Auto login on Windows 7

Before I start, I just want to say that I do NOT approve of auto logging into a windows 7 computer. That being said, here's how you do it. :-)

1) Edit the registry with the regedit command, and find:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon and change the value from 0 to 1

2) Press the Windows key + R on your keyboard to launch the “Run” dialog box and Type in control userpasswords2 and press enter
3) Uncheck the option “Users must enter a user name and password to use this computer”, if it is unchecked, check it and uncheck it again
4) Click “OK”, You will then be prompted to enter the current password and confirm it.
5) Reboot the computer and it should auto login with the user name you provided, and long as it is a valid account on the computer.

Tuesday, March 26, 2013

Installing an HTTP proxy server



First you need to install Squid:
 $ sudo -s
 # aptitude install squid3
Once squid is installed, you then need to edit the squid.conf file Usually located in the /etc/squid3 directory
 # leafpad /etc/squid3/squid.conf
once you have it open set the visible hostname for the server. In my config this was found around line 3771
For instance, if the server is named ubuntu:
visible_hostname ubuntu
The default port for squid is port 3128, I would suggest changing this to something different. In my config this was found around line 1147
In my config I used port 8877:
http_port 8877
Ok now we need to add permissions of who can actually make use of the proxy, by default no one can.
Search for the lines:
acl SSL_ports port 443
acl Safe_ports port 80  # http
acl Safe_ports port 21  # ftp
acl Safe_ports port 443  # https
acl Safe_ports port 70  # gopher
acl Safe_ports port 210  # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280  # http-mgmt
acl Safe_ports port 488  # gss-http
acl Safe_ports port 591  # filemaker
acl Safe_ports port 777  # multiling http
acl CONNECT method CONNECT
Add the subnet you want to make the proxy available to directly following the last line above. I added the following lines for my departmental subnets:
acl fivesix src 128.192.56.0/255.255.255.0
acl onesixty src 128.192.160.0/255.255.255.0
acl onesixtyone src 128.192.161.0/255.255.255.0
Now that we have defined the subnets we would like to be able to use the proxy we need to give them permissions to use the proxy.
Search for the lines:
# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
#http_access allow localnet
http_access allow localhost
Add the following lines:
http_access allow fivesix
http_access allow onesixty
http_access allow onesixtyone
Save the config file and exit.
Restart the proxy server by typing the following:
         #service squid3 restart
Now all you have to do it go to any Windows 7 computer. Go into the control panel. Open Internet Options, and click on the Connections tab. Click on LAN settings and just enter your server information. close everything and in a browser navigate to whatismyip.com, you should see the proxy server listed.

Friday, October 5, 2012

Setting up an Openfire chat server on Ubuntu server




Once installed, log into the new Ubuntu server and take the following steps:

~ $ sudo -s
~ # aptitude update
~ # aptitude upgrade
~ # tasksel *Select Lubuntu minimal Install
~ # aptitude install leafpad
~ # aptitude install chromium-browser
~ # aptitude install phpMyAdmin
Reboot



Installing Java:

~ $ sudo -s
~ # aptitude install python-software-properties *may not be needed
~ # add-apt-repository ppa:webupd8team/java
~ # aptitude update
~ # aptitude install oracle-java7-installer
~ # aptitude install oracle-jdk7-installer
~ # java -version



Add database and user to Mysql:


Open the Chromium Web browser and go to: http://(serverip)/phpmyadmin

On the main page, locate Priviledges and scroll down to Add a new User.

Username: Enter a username, I used ‘openfire’

Host: From the drop down menu, select localhost

Password: Enter a password, retype your password

Under the Database for user section of that page, click on the radio button for Create database with same name and grant all priviledges.

Click create user



Install Openfire:


~ $ sudo -s
~ # cd /opt
~ # wget http://www.igniterealtime.org/downloadServlet?filename=openfire/openfire(version).tar.gz
~ # tar zxvf (file name)
~ # ln -s /opt/openfire/bin/openfire /etc/init.d/
~ # chmod +x /etc/init.d/openfire
~ # cd /opt/openfire
~ # update-rc.d openfire defaults
~ # nohup ls >ls.log 2>&1 &
~ # /opt/openfire/bin/openfire start
Open the Chromium Web browser and go to: http://(serverip):9090

Database settings: Standard Database Connection

Database Settings: use the user name and database info you created in phpmyadmin

Profile Settings: Directory Server

Server Type: Active Directory

Host: "your domain controller"

Port: 636

Base DN: DC="server",DC="foo",DC="com"

Administrator DN: CN="domainadmin",OU="Departments",DC="domain",DC="com"

Password: your admin password

Advanced settings: use SSL = YES

Set which users should have administrator rights on the server, and log in. You should be up and running.

Now just configure Pidgin or some other chat client that supports XMPP(jabber) and your ready to chat!

Friday, September 21, 2012

Installing Centreon on Ubuntu server 12.04

I've been working on this one for quite a while now, and I think I've work MOST of the bugs out of the system. This install is NOT for beginner, if you love your server don't try this on it. The best approach is to create a VM in virtual box and try it there before trying it in a production environment.

So here we go...


After installing your base server and Logging in, the first thing we need to do is install some prerequsistes that Centreon will neeed to run correctly:

~ $ sudo -s
~ # aptitude update
~ # aptitude upgrade
~ # tasksel *Select Lubuntu minimal Install
~ # aptitude install leafpad
~ # aptitude install chromium-browser
~ # aptitude install sysutils mailx lsb-release postfix mailutils
~ # aptitude install build-essential
~ # aptitude install apache2 apache2-mpm-prefork
~ # aptitude install php5 php5-mysql php-pear php5-ldap php5-snmp php5-gd php-gettext
~ # aptitude install mysql-server libmysqlclient15-dev
~ # aptitude install rrdtool librrds-perl
~ # aptitude install libconfig-inifiles-perl libcrypt-des-perl libdigest-hmac-perl torrus-common libgd-gd2-perl
~ # aptitude install snmp snmpd libnet-snmp-perl libsnmp-perl
~ # aptitude install libgd2-xpm libgd2-xpm-dev libpng12-dev
~ # aptitude install phpMyAdmin
Edit /etc/snmp/snmptrapd and change the value of TRAPDRUN from no to yes in /etc/default/snmpd
~ # reboot

Now we need to create a user on the server named nagios, place this user in the proper groups it will need access to:

~ # /usr/sbin/useradd -m nagios
~ # passwd nagios
~ # /usr/sbin/groupadd nagcmd
~ # /usr/sbin/usermod -G nagios,nagcmd nagios
~ # /usr/sbin/usermod -G nagios,nagcmd www-data

Now lets install Nagios, along with the plug-in's you will need for Centreon:

~ # cd /usr/local/src/
~ # wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.1.tar.gz
~ # tar xvzf nagios-3.4.1.tar.gz
~ # cd nagios-3.4.1/
~ # ./configure --prefix=/usr/local/nagios --with-command-group=nagcmd --enable-nanosleep --enable-event-broker
~ # make all
~ # make install
~ # make install-init
~ # make install-commandmode
~ # make install-config
~ # update-rc.d -f nagios defaults
~ # chmod +x /etc/init.d/nagios
~ # cd /usr/local/src/
~ # wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz
~ # tar xvzf nagios-plugins-1.4.15.tar.gz
~ # cd nagios-plugins-1.4.15/
~ # ./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl=/usr/bin/openssl
~ # make
~ # make install

Install NDO:

~ # aptitude install subversion
~ # cd /usr/local/src/
~ # wget http://prdownloads.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz  
~ # tar xvzf ndoutils-1.4b9.tar.gz  
~ # cd ndoutils-1.4b9
~ # wget http://svn.centreon.com/trunk/ndoutils-patch/ndoutils1.4b9_light.patch
~ # patch -p1 -N < ndoutils1.4b9_light.patch
~ # ./configure --prefix=/usr/local/nagios/ --enable-mysql --disable-pgsql \
   --with-ndo2db-user=nagios --with-ndo2db-group=nagios
~ # make
~ # cp ./src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o
~ # cp ./src/ndomod-3x.o /usr/sbin/ndomod.o
~ # cp ./src/ndo2db-3x /usr/local/nagios/bin/ndo2db
~ # cp ./config/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg
~ # cp ./config/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg
~ # chmod 774 /usr/local/nagios/bin/ndo*
~ # chown nagios:nagios /usr/local/nagios/bin/ndo*
~ # cp ./daemon-init /etc/init.d/ndo2db
~ # update-rc.d ndo2db defaults
~ # chmod +x /etc/init.d/ndo2db

Now we are ready to install Centreon itself:

~ # cd /usr/local/src/
~ # wget http://download.centreon.com/centreon/centreon-2.3.8.tar.gz
~ # tar xvzf centreon-2.3.8.tar.gz
~ # cd centreon-2.3.8/
~ # export PATH="$PATH:/usr/local/nagios/bin/"
~ # sudo ./install.sh -i
Scroll to the bottom of the license agreement and accept by clicking "Y ". Answer "Y" for all questions during installation and validate all default paths during installation.

~ # /etc/init.d/apache2 reload

Now load http://YouIP/centreon and follow the wizard to finish the install, on step 6, make sure you have the MySQL database setting correct. Once your finished you should be able to log in with the account you created. Once you are loged in, go to: Configuration→Nagios and check the Boxs "Move Export Files" and Restart Nagios" and then click the [export] button

From the command line run the following commands:

~ # /etc/init.d/nagios start
~ # /etc/init.d/ndo2db start


Your Installation should now start reporting on the basic status of your server. Next time I'll tell you how to start adding other servers in your enviroment to the list of monitered servers.



Friday, August 31, 2012

Adding a linux server to the Domain:


If you have lots of Linux servers, and your company is running on a Windows Active Directory, you might find it binifisial to join your Linux servers to the domain and allow log-ins with you domain administrator accounts. The following tutorial will walk you though the process.

First you have to add the Centrify DirectControl Express repository:

~$sudo -s
~#aptitude install python-software-properties

For Ubuntu server 10.04 LTS

~#add-apt-repository "deb http://archive.canonical.com/ lucid partner"
For Ubuntu server 12.04

~#add-apt-repository "deb http://archive.canonical.com/ precise partner"
~#aptitude update

Now we install Centrifydc:

~#aptitude install centrifydc
~#adjoin -w -u DomainAccount Domain.name
~#adinfo

Now we need to add our domain Admin group to Sudoers

~#nano /etc/sudoers
add: %Domain Admins ALL=(ALL) ALL

Now we need to edit the centrifydc.conf file:

~#nano /etc/centrifydc/centrifydc.conf
Change the following line:

Change the line:

##pam.allow.groups: some:group

to

pam.allow.groups: Domain Admins

If you have a user on your domain that has the same name as the local admin acount on the linux server you need to edit the following:

#pam.ignore.users: some:user

to:

pam.ignore.users: local/domain account

WARNING: If you don't make this change you will lock out the local admin account

Save the file and then:

~#adreload
~#adflush
~#adquery user DomainAccount
Your all done, you should be able to log on the the Linux server with you domain admin accounts.

Awesome!

Thursday, August 16, 2012

Setting up synergy with encryption on two Windows computers:


If you don't know what Synergy is I'm not going to spend a lot of time trying to explain it. It's basically a way a way to share your keyboard and mouse between two computers without the need of a KVM Switch. You can read more about it at http://synergy-foss.org/.
The big problem with Synergy is that it sends all of your keystrokes to the remote computer plain text. If your own your own private network this is not a problem, but if your at work or on a public network this can be troublesome. If you didn't know this already intercepting data on a public network is stupid easy.
So that being said, we are going to use the SSH protocol to encrypt your data as it passes over the network. Again if you don't know what SSH is I'm not going to try to explain it here. Reading is your friend: http://en.wikipedia.org/wiki/Secure_Shell.
If your running Linux it is very easy to get this working, but on Windows It is a little more tricky. So lets get started:
A. Install OpenSSH:
  • Download Copssh from: https://www.itefix.no/i2/copssh-get. For our purposes the free version will work fine. Once you have it downloaded extract the zip and run the installer on both the computers you want to share the keyboard and mouse on.
  • when you get to service tab: Set the service account to synergy, and the password to something you won't forget.
  • once the install finish click on start and activate a user, and select synergy, click next.
  • created a passphrase, write it down if you can't remember it!
  • click activate
  • duplicate the steps on the second computer
B. Test SSH connections:
  • download a program called Putty. It can be found at: http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe.
  • once you have downloaded it then simply double click on it to run, there is nothing to install.
  • on the first computer, under host name, inter the IP address of the second computer and click connect
  • you will get a security alert, click yes
  • log in as: synergy, password:(whatever you made it)
  • if you have configured everything correctly then you should get a terminal prompt. If you don't, you missed something.
  • repeat this process on the second computer.
c. Install Synergy
  • download Synergy on both computers: http://synergy-foss.org/download/
  • ON the server(computer with keyboard and mouse installed):
    • install Synergy, at the end of the install select: Server(new setup)
    • click (Configure Server…)
    • Click and drag the monitor in the top right to the square on the grid corresponding to where the second computers monitor is next to the server.
    • double click on it and rename it to the computer name of the client computer and click OK.
    • click Apply and then start
    • your synergy server is now ready to except connections for clients.
  • ON the client:
    • before you install synergy we need to do a little script writing
    • click on (start, all programs, Copssh, start a unix Bash Shell)
    • type nano synergy.sh and enter the following line of test:
    • ssh -f -N -L localhost:24800:(IPofServer):24800 synergy@(IPofServer)
    • click Ctrl+X and then Y to save the config file
    • type ./synergy.sh it will ask you if you are sure, click yes, then type the password and it should drop you back to the terminal prompt. IMPORTENT, do not close this windows, it must be running for synergy to work, just minimize it and leave it running.
    • install Synergy, at the end of the install select: Client
    • for the server IP type: localhost, and click apply
    • you should be able to move your mouse from one screen to the other now and use your keyboard to type on either computers screen! Enjoy!

Tuesday, August 14, 2012

Installing Oracle Java on Ubuntu 12.04

OpenJDK is what Ubuntu uses as default for java web pages, but it leaves much to be desired. If you want to run Oracle Java on your Ubuntu computer simply open a terminal an enter the following commands:

~ $ sudo -s
~ # aptitude install python-software-properties *may not be needed
~ # add-apt-repository ppa:webupd8team/java 
~ # aptitude update 
~ # aptitude install oracle-java7-installer
~ # aptitude install oracle-jdk7-installer
~ # java -version