I went looking for a way to be able to remotely restart a Windows service from the Jenkins server. After googling for a bit I came acrossPsExecwhich is small utility program to run remote scripts on Windows machines which would me restart the Windows service from our remote Jenkins server. After downloading this utility and adding it to the server PATH, so I can use it directly
if you have even one server that requires any .Net compilation… well, life is not easy. You need this MSBuild plugin that needs the MSBuild dll. Surprisingly, Microsoft does not actually make a linux distribution of this tool (haha). If you rolled Jenkins on Debian or CentOS, well, you’re in a sticky place where you have to rely on WINE or MONO to hopefully execute a Win DLL. While this is a cute technical challenge, it’s also a waste of time in most cases that adds nothing to your project but hours and maybe a few stack exchange points.
copy the config.xml file to C:\Program Files\Amazon\Ec2ConfigService\Settings directory:
Create AMI without power off or reboot
[Windows Server 2016 and later] Configure settings using EC2Launch. To generate a random password at launch time, use the adminPasswordType setting. For more information, see Configuring EC2Launch.
[Windows Server 2012 R2 and earlier] Configure settings using EC2Config. To generate a random password at launch time, enable the Ec2SetPassword plugin; otherwise, the current administrator password is used. For more information, see EC2Config Settings Files.
To configure initialization settings
On the instance to configure, open the following file in a text editor: C:\ProgramData\Amazon\EC2-Windows\Launch\Config\LaunchConfig.json.
Update the following settings as needed and save your changes. Provide a password in adminPasswordonly if adminPasswordtype is Specify.{ "setComputerName": false, "setWallpaper": true, "addDnsSuffixList": true, "extendBootVolumeSize": true, "handleUserData": true, "adminPasswordType": "Random | Specify | DoNothing", "adminPassword": "password that adheres to your security policy (optional)" }The password types are defined as follows:RandomEC2Launch generates a password and encrypts it using the user’s key. The system disables this setting after the instance is launched so that this password persists if the instance is rebooted or stopped and started.SpecifyEC2Launch uses the password you specify in adminPassword. If the password does not meet the system requirements, EC2Launch generates a random password instead. The password is stored inLaunchConfig.json as clear text and is deleted after Sysprep sets the administrator password. EC2Launch encrypts the password using the user’s key.DoNothingEC2Launch uses the password you specify in the unattend.xml file. If you don’t specify a password in unattend.xml, the administrator account is disabled.
In Windows PowerShell, run the following command to schedule the script to run as a Windows Scheduled Task. The script runs one time during the next boot and then disables these tasks from running again.PS C:\> C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeInstance.ps1 -Schedule
Also see: https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2config-service.html
The hMailServer COM API lets you write your own scripts and applications that integrate with hMailServer. Almost all objects in hMailServer are accessible using the COM library. As an example, both hMailServer Administrator and the PHP WebAdmin is entirely based upon the COM library. Besides writing application like theese two, you can write scripts that are automatically run when certain events take place. For example, you can write a script that filters messages before they are delivered to the recipients.
The Best way to have a completely secure server is to install our simple to install EC2 including Roundcube WebMail. You can get started with an Email Cloud Server that is wonderful combination of MS Windows Server and Open Source Software. It is available through AWS Marketplace as Hmailserver on Windows Server with Roundcube Webmail so that you can check email anywhere and from any device.
The Application object is the root object in hMailServers COM model. Using this object, you can access all hMailServer objects and settings. Before accessing any of the properties and methods on the Application object, you must call Application.Authenticate with valid credentials.
The hMailServer API behaves as most other COM APIs, but there are some special behavior which relates to exception handling and permissions.
It is possible to create triggers in hMailServer. Triggers are script which are executed when certain actions occur. Triggers are created by adding the script to the EventHandlers-file in the hMailServer Events folder.
Basic steps
These are the basic steps to perform when you want to access the hMailServer COM API.
Create an instance of the hMailServer Application object. How to do this depends on what programming language you use. In VBScript, you call CreateObject(“hMailServer.Application”).
Authenticate. Before you can call any other methods in the API, you need to authenticate. This is done using the Authenticate() method on the Application object. This is required to prevent unauthorized users to access your hMailServer installation.
Request to Remove Email Sending Limitations In order to maintain the quality of Amazon EC2 addresses for sending email, we enforce default limits on the amount of email that can be sent from EC2 accounts. If you wish to send larger amounts of email from EC2, you can apply to have these limits removed from your account by filling out this form.
HmailServer is mostly for receiving email to @yourdomain . SES is for sending email.
Over the last year or so SES added the ability to receive emails but this is very complicated and confusing which is why I install Hmailserver to receive the email.Beware: In the SES panel there are DNS settings that AWS give you to set your DNS to use SES to receive email. This doesn’t work with Hmailserver. In Order to receive email@Yourdomain You need to point the DNS to your HmailServer not to SES.
Amazon allows you to send a limited amount of email through EC2, so you can also send a little through HmailServer. You need to request from Amazon if you would like to use Charming HmailServer for sending email. They will also arrange reverse DNS lookup for this purpose. Check here: https://aws.amazon.com/forms/ec2-email-limit-rdns-request?catalog=true&isauthcode=true
The main idea behind HmailServer is to receive email for your domain.
In order to set up your HmailServer to receive email you must set up the DNS with an A record for your domain that uses the Ec2 IP Address.
You also need an MX record that points to this A record.
You can verify and test the HmailServer in the bottom of the left manager panel you will find troubleshooting that will be kind enough to check whether your server is set up to receive and even send emails.
You can setup your gmail account to forward to your new domain , once that is receiving email.
In order to setup your Floating Cloud Server to receive email you need to first setup an MX record that points to the domain on this server.
Click Settings – Protocols – SMTP – then click the Delivery of Email Tab under fill in your Domain Name in Local Host name that you are sending from, then press Save. Although HMAILServer requires this, you might not be able to send any emails as these are often blocked by Amazon. Instead you should set your email cllient, like Outlook, Thunderbird, etc to use Amazon SES.
Under Hmailserver Administrator add Email Addresses
UNder Domain – Your Domain Name – Click Accounts,
Press Add, on the right side
Fill in, at least the email address, Password and Maximum size for Mailbox.
To check email use full email address, though sometimes just the username is enough.
HmailServer Adminstrator password has been left blank you certainly add a secure password instead of blank
Start hMailServer Administrator and log on.
Go to Settings -> Advanced
Enter the new Administration password and save the changes.
Hmailserver is very powerful , these instruction just get you going.
You can setup your email client like Outlook or Thunderbird. Check https://www.hmailserver.com/ for instructions
I suggest NOT using this server as SMTP. It isn’t setup to relay. We have found AWS SES service to be the best, To use SES in your client Use port 587 or 465 IAM and SES will assign you an SMTP username and password For security try starttls
Send an email to support@float.i.ng if you have an issue setting up SES, it can be confusing. We won’t be able to assist in making your Floating Cloud Server do SMTP in a manner that the email won’t be blocked by spam filters.
Amazon often blocks sending mail from EC2 servers, you should request that AWS permit you to use SES, then setup your SMTP mail client to use SES. To get started with SES go to SES in your AWS panel.
I suggest NOT using this server as SMTP. It isn’t setup to relay. We have found AWS SES service to be the best, To use SES in your client Use port 587 or 465 IAM and SES will assign you an SMTP username and password For security try starttls
Send an email to support@float.i.ng if you have an issue setting up SES, it can be confusing. We won’t be able to assist in making your Floating Cloud Server do SMTP in a manner that the email won’t be blocked by spam filters.
Amazon often blocks sending mail from EC2 servers, you should request that AWS permit you to use SES, then setup your SMTP mail client to use SES. To get started with SES go to SES in your AWS panel.
The Floating Cloud Server has several features that have been added especially for our clients. These include
We have installed several init scripts called that set the passwords to your Instance ID
Setup DNS – Route 53 with A and MX records for your domain
After you set you set up the DNS
login To Windows and Run from the Start Menu HmailServer administrator
This is my advice for using SES along side your new Floating Clouf Full email server.
HmailServer does not currently have a catchall relay smtp function like Postfix or Sendmail in Linux.
You can set up Roundcube to send ALL messages via SES with the following settings.
edit the line $config[‘smtp_server’] to the following. Remember Semi-colons
If you are NOT using US-EAST Nvirginia than change the server name to whatever SES settings tells you to use. Contact support@float.i.ngfor any assistance.
You should additionally ask AWS to allow your Instance to send emails. As it is now it is limited to just a few messages an hour or less. They won’t tell you. However you can ask them for both reverse DNS and allowing you to send emails in the same form:
See also
I checked out backup the db,
I didn’t try it but found this:
However, you might be interested in periodic snapshots of the volume, snapshots are incremental, so you don’t pay for the full 70 GB every time.
You must be logged in to post a comment.