Vesta–Changing default DNS SOA settings

July 17, 2015 Leave a comment

vi $VESTA/func/domain.sh

search for SOA

image

 

Change to values that you want, typically it is

3600, //refres

1800, //retry

604800, //expire

600 //ttl

Categories: Vesta

Enabling SSL for Vesta VSFTPD

July 15, 2015 Leave a comment
  1. Copy the certificate files to /etc/ssl/certs
  2. Edit the VSFTPD config: vi /etc/vsftpd/vsftpd.conf
  3. rsa_cert_file=/etc/ssl/certs/certificate.crt
    rsa_private_key_file=/etc/ssl/certs/certificate.key
    ssl_enable=YES
    allow_anon_ssl=NO
    force_local_data_ssl=NO #set this to yes to force SSL
    force_local_logins_ssl=NO #set this to yes to force SSL
    ssl_tlsv1=YES
    ssl_sslv2=NO
    ssl_sslv3=NO
    require_ssl_reuse=NO
    ssl_ciphers=HIGH
  4. service vsftpd restart

Then in order to test, run FileZilla with the following connection settings

image

Once connected, look at the log and confirm that TLS/SSL connection is established

 

image

Categories: Vesta

Updating the Vesta Control SSL Certificate

July 14, 2015 Leave a comment

The Vesta Control Panel SSL certificates is contained in the following 2 files

  1. /usr/local/vesta/ssl/certificate.key and
  2. /usr/local/vesta/ssl/certificate.crt

One easy way to generate SSL certs for Vesta, is to goto https://www.digicert.com/easy-csr/openssl.htm and fill in the blanks, after which it will generate the necessary openssl command to run to generate the CSR as well as the key file

image

 

Once you send this CSR to digicert and complete the validation process, you can then download the pem file from digicert

image

Now replace the .key file with that generated by openssl and the crt file with the contents from the downloaded PEM file

and finally issue the following command to restart vesta

service vesta restart

Categories: Digicert, Vesta

Creating a Master, Slave, Slave Nameserver setup using Vesta Control Panel

July 14, 2015 Leave a comment

You can easily setup a master, slave DNS using Vesta CP with a single command line found at

https://vestacp.com/docs/#how-to-setup-dns-cluser

However should you bring this to the next level and use it for your “enterprise” web hosting, there are a few things you need to do

 

You might be tempted to setup Vesta in the following way, where all the webhosts will sync to NS01 and then have NS01 sync the dns config over to NS02.

image

Unfortunately Vesta does not allow you to do this, BUT it does allow the setup as shown below, where each of the web servers will send the dns updates to each of the named servers.

image

 

Setting up the NameServers (NS01, NS02)

Now given that Vesta will install and setup different components depending on the amount of ram of the machine, for NS01 and NS02, it would be wise to go with 512MB ram so that it will install the bare minimum.

Once you have installed Vesta on the servers, its time for some clean up

  1. Delete the unused packages
  2. cd $VESTA/bin
    ./v-delete-user-package palegreen
    ./v-delete-user-package gainsboro
    ./v-delete-user-package slategrey

  3. Create the dns-cluster user, who will own all the domains that was synchronized over

    ./v-add-user dns-cluster [password] [email] default [firstname] [lastname]

  4. Stop all the unnecessary services

    ./v-stop-service httpd
    ./v-stop-service nginx
    ./v-stop-service exim
    ./v-stop-service dovecot
    ./v-stop-service vsftpd

  5. Login to Vesta using your web browser, and disable the necessary services at the Firewall section
    1. Accepted services: SSH, DNS, Vesta, Ping
    2. Blocked services: Web, FTP, SMTP, POP3, IMAP, DB

Setting up the Master > Slave DNS (Web01, Web02 > NS01, NS02)

Remember that Vesta allows you to add an unlimited number of slave DNS for each master server

So for web01, and web02, run the following commands:

cd $VESTA/bin
./v-add-remote-dns-host ns01 8083 admin [ns01 admin password]
./v-add-remote-dns-host ns02 8083 admin [ns02 admin password]

 

You can verify that this is done by doing to server setup and ensuring that DNS is set to cluster and confirm that the following cron job exists

image

 

Testing the setup

Now goto web01 and/or web02 and create a few domains, on ANY accounts and at for the 6th minute of the hour, goto ns01 and ns02 to confirm that the changes are synchronized

 

Now what about URGENT cases

If there are cases where you urgently need to sync over, you can run this command on all of your web servers for each named server that you have: v-sync-dns-cluster [target host]

e.g
v-sync-dns-cluster ns01
v-sync-dns-cluster ns02

Categories: HyperV, Vesta

Installing CentOS 6.6 on HyperV 2012R2

July 11, 2015 Leave a comment
  • Download CentOS ISO file: You can download the latest version of CentOS at http://wiki.centos.org/Download
  • Setup a HyperV VM for CentOS
    • At least 1 CPU
    • The amount of RAM will affect the installation GUI, VM with too little RAM will be reduced to a DOS like setup guide, whereas those with higher RAM will get a nice fancy GUI
    • No need for legacy network drivers, you can use the new 10GB network adapters normally used by HyperV
    • A minimum of 20GB HDD
    • Follow the guides and screen caps below if you need a detailed step by step guide
  • Once the OS is installed successfully, reboot
  • Login using the root account that was created during the installation
  • Issue the following 2 commands (these 2 commands are very important, failure to do this can result in unexplained hanging of the VM) 

    yum -y install hyperv-daemons
    yum -y update

  • If you wish for your installation to auto check for updates every night, issue the following commands

    #install yum cron job
    yum -y install yum-cron

    #enable nightly update
    /etc/init.d/yum-cron start

    #Enable at boot time
    chkconfig yum-cron on


Congrats, you now have a working CentOS in HyperV that auto updates itself every night to always be on the safe side of security :)


Setup in a Low Ram Environment

If you are running in a low ram environment, CentOS will not load the GUI setup environment, and you have to content with DOS based screens.

  1. Typically I would skip the media test since this is from an ISO file, if you are doing this off a DVD, might be wise to check, but be prepared to wait
    image_thumb[12]
  2. Then you will be prompted to setup a root password
    image_thumb[13]
  3. Once done, its now time to setup the disk. For convenience, I usually go for replacing the entire drive (its empty anyway)
    image_thumb[14]
  4. Simple matter of clicking write changes to disk to commit those changes
    image_thumb[15]
  5. Sit back and wait for installation to complete
    image_thumb[16]

 

Setup in a High Ram Environment

  1. Things look different if you have enough RAM, you get treated to a nice GUI
  2. Start by choosing your country and language
  3. You will then need to format the disk attached to the VM
    image_thumb19
  4. There after, setup the hostname
    image_thumb20
  5. As well as the networking details
    image_thumb21
  6. Then its onto the date/time settings
    image_thumb22
  7. And the root password
    image_thumb23
  8. Disk layout
    image_thumb24
  9. Confirmation of disk layout
    image_thumb25
  10. Type of installation, if you are going to install Vesta Control Panel, choose minimal
    image_thumb26
  11. Now sit back and wait for the installation to complete
    image_thumb27
Categories: HyperV

Generating SOAP proxy class from wsdl and xsd files

May 11, 2015 Leave a comment

Although JSON notation is getting popular, there are times where all you have are wsdl and xsd files.

In order to generate a useful proxy class so that you can use it in your C# code, Visual Studio packs a useful utility adeptly named wsdl

Usage scenario:

wsdl webservice.wsdl webservice.xsd /out:MyWebService.cs

Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 4.0.30319.33440]
Copyright (C) Microsoft Corporation. All rights reserved.
Writing file ‘MyWebService.cs’.

Once the SOAP file is generated, just goto your project and add the cs file to your project

Categories: ASP.NET, Visual Studio

Deleting file to Recycle Bin using C#

February 26, 2015 Leave a comment

At first glance, there is no library/dll in C# that will automagically delete a file to the recycle bin. However if you were to look around, there is a function inside VB which does this.

The good thing about .NET is that everything is just libraries, VB, C# these are just the high level programming languages and you are free to use any function across the board.

 

So in order to delete a file to recycle bin inside a c# app, first add a reference to Microsoft.VisualBasic

image

 

Then inside your code you just do this

image

 

 

For more details on that function, you can refer to https://msdn.microsoft.com/en-us/library/ms127976%28v=vs.110%29.aspx

Categories: ASP.NET
Follow

Get every new post delivered to your Inbox.