Showing posts with label Mac. Show all posts
Showing posts with label Mac. Show all posts

Setting Up and Configuring Ubuntu Server 9.04 VMWARE with SSH, VSFTPD (TSL/SSL), OpenVPN, Fail2ban (PART 3)

Ok, now its time for OpenVPN. There is a really good write-up on how to install OpenVPN by niels on http://nielsvz.com. Follow his guide to install it on 9.04 and then you can play with some options below.

To authenticate via PAM, add this line in your server.conf file:
plugin /usr/lib/openvpn/openvpn-auth-pam.so system-auth

To route all traffic through your VPN connection (HTTP, DNS...), uncomment this line in your server.conf file:
push "redirect-gateway def1 bypass-dhcp"

Corresponding with this switch, you will need to enable NAT redirection. This will allow your VPN connected clients to see and access network resources on the subnet your server is on. Enable it with the following:
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE

To configure OpenVPN to only allow certain users to log in, follow the instructions here.

Here is a copy of my client config to reference:
persist-key
tls-client
remote techaccesstips.servehome.net 1194
proto udp
ca ca.crt
dev tun
persist-tun
cert client1.crt
comp-lzo
nobind
key client.key
pull
auth-user-pass

Here are a list of clients for Windows and Mac:
Tunnelblick - Free OpenVPN client for Mac
Viscosity - Shareware client for Mac
OpenVPN GUI - Free client for Windows

So ends the guide...If you have any questions, comments, or revisions/suggestions please leave a comment and I will get back with you.




Access your Mac from XP...

This is just a simple way to remote into your Mac from XP. I am sure there are some alternate techniques, but this is fairly simple.
Ok so here are the steps I took:
  1. Download OSXvnc (Vine), mount, and then drag into Applications.
  2. Open System Preferences > Sharing > then click Remote Management (select the options you want).
  3. Now launch OSXvnc Server and enter in the password to connect.
  4. Log into your router and find the Port Forwarding tab. For Linksys routers it is under Applications and Gaming.
  5. Now forward port 5900 (TCP and UDP) to your computers IP address.
  6. Go back to your Mac and open up a browser and find out your external IP.
  7. Go to the machine running XP and download and install RealVNC.
  8. Open Up RealVNC player and enter in your external IP.
  9. Enter in your password to connect.
  10. Now that's it!
Now some explanation of what is going on. You have a service on your mac that is listening on port 5900. You are telling your router to forward all activity on port 5900 to your Mac IP. So, by entering your external IP, the packets are hitting your router, then forwarding to your Mac on which the VNC server is listening on port 5900.

New commands that I have used frequently the past month...

On my never ending Linux/Unix/Windows knowledge quest, I have learned a few basic commands that have just been really helpful and that I have used very often in the past month while troubleshooting random problems.

Linux
smbmount - mount smb shares
Been in a few tight squeezes with some data I needed off a machine, but my only available storage option is a NAS.
  • smbmount //ip/share /mnt/mountpoint -o username=domain\\user,password=pass
For me this would look like:
  • smbmount //192.168.1.10/Backup /mnt/nas -o username=user,password=password
df - shows disk info (usage, mount point, free space)
The
-a switch displays all filesystems, the -T switch displays the FS type, and the -h switch displys the results in "human readable" formats (such as MB and GB)
  • df -a -h -T
du - shows size of files and folders
The -c switch gives a total of the size of all files in the directory, the -h switch lists size in a human readable format, and the -s switch outputs only the size of the directory, not the files within (it is pointless to use the -c switch with the -s switch unless you really enjoy doing so. Also without the -s switch, the output will be of every file and folder in a directory, which could be very verbose)
  • du -c -h /mnt/Backup
  • du -h -s /mnt/Backup
Unix/Mac
Here is how to make a release renew script to make quicken things up a bit:
In a terminal window, type:
  • nano /usr/bin/rr
Which will open a blank page called rr. Now add:
  • #!/bin/bash
  • echo "Now releasing your IP"
  • sudo ipconfig set int BOOTP
  • sleep 5
  • echo "Renewing your IP"
  • sudo ipconfig set int DHCP
  • echo "Done!"
Where int is the specified interface. CTRL+O to write the file then CTRL-X to exit.
Now to make the file executable enter:
  • sudo chmod 775 /usr/bin/rr
That is it...now just enter rr to release and renew your ip.

Windows
I have also been using Windows to mount network shares through command prompt.
  • net use
  • net use a-z: \\ip\share /USER:domain\user
  • net use /DELETE a-z:
  • net use /DELETE *
The first command will display all mapped network shares.
The second command will map a share and use the logon credentials of domain\user, and might prompt you for your password (a-z is the drive letter for the share to be mapped to, you must use a drive letter not currently used).
The third command will delete a specified mapped drive (again, you must specify a drive letter for a-z).
The fourth command will delete all mapped drives.


These are all simple commands, but very useful for me day to day.


Visor drop down terminal window

The makers of Quicksilver (Mac application that indexes user directories for quick referencing) have come up with another very useful plugin. It is called visor and what it serves as a terminal window that will slide down at the entering of a user defined keystroke.

  • Visor provides a systemwide terminal window accessible via a hotkey, much like the consoles found in games such as Quake.
This program has served me very well as I do not like keeping terminal windows open or navigating to the terminal icon when I need to open a new terminal window.

Here are some links...