Author: root
Let’s Encrypt on VirtualMIN
Guide to install FREE SSL certificate from Letsencrypt on Virtualmin & Webmin. 100% working.
I’ve been going at this for a little while but came up with the following steps to get it working.
*** 1. First install Let’s Encrypt script/programm. ***
Login to SSH and get root privileges (root/sudo -i):
cd /home/user/ && git clone https://github.com/letsencrypt/letsencrypt
OR
cd /root/ && git clone https://github.com/letsencrypt/letsencrypt
^^ This will download the Let’s Encrypt from github with executable script
*** 2. Create your directory where you will be saving your certificate later on. Reason for this is because Virtualmin has a protection where it only allows a certificate from the user/domains directory: ***
mkdir /home/MYUSERNAMEFORDOMAIN/ssl_certificates
*** 3. Setup your cronjobs by running: “sudo crontab -e” ***
It wil probably ask you which editor, i choose Nano, once in the editor enter the following somewhere on a new line (pick the option you choose on step 1!):
01 3 1 * * cd /home/user/letsencrypt/ && ./letsencrypt-auto certonly --email info@MYDOMAIN --agree-tos --webroot --renew-by-default -w /home/MYDOMAIN/public_html/ -d www.MYDOMAIN.net -d MYDOMAIN.net --authenticator webroot && cp -f /etc/letsencrypt/live/www.MYDOMAIN.net/cert.pem /home/MYUSERNAMEFORDOMAIN/ssl_certificates/cert.pem && cp -f /etc/letsencrypt/live/www.MYDOMAIN.net/chain.pem /home/MYUSERNAMEFORDOMAIN/ssl_certificates/chain.pem && cp -f /etc/letsencrypt/live/www.MYDOMAIN.net/fullchain.pem /home/MYUSERNAMEFORDOMAIN/ssl_certificates/fullchain.pem && cp -f /etc/letsencrypt/live/www.MYDOMAIN.net/privkey.pem /home/MYUSERNAMEFORDOMAIN/ssl_certificates/privkey.pem
OR
01 3 1 * * cd /root/letsencrypt/ && ./letsencrypt-auto certonly --email info@MYDOMAIN --agree-tos --webroot --renew-by-default -w /home/MYDOMAIN/public_html/ -d www.MYDOMAIN.net -d MYDOMAIN.net --authenticator webroot && cp /etc/letsencrypt/live/www.MYDOMAIN.net/cert.pem /home/MYUSERNAMEFORDOMAIN/ssl_certificates/cert.pem && cp -f /etc/letsencrypt/live/www.MYDOMAIN.net/chain.pem /home/MYUSERNAMEFORDOMAIN/ssl_certificates/chain.pem && cp -f /etc/letsencrypt/live/www.MYDOMAIN.net/fullchain.pem /home/MYUSERNAMEFORDOMAIN/ssl_certificates/fullchain.pem && cp -f /etc/letsencrypt/live/www.MYDOMAIN.net/privkey.pem /home/MYUSERNAMEFORDOMAIN/ssl_certificates/privkey.pem
^^ Above command will copy the certificates to the correct directory after requesting them (i gave a warning in step 2). It will do this every 1st of the month during the night. The reason we do this every month is because the certs are only valid 90 days and we have plenty of time to repair if something appears to be wrong with the cert later on..
Allright! The hard part is done!
*** 3.1 Please log into your Virtualmin admin panel, Select “Webmin -> System -> Scheduled Cron Jobs”. Go to your newly created Cronjob by clicking on it and select “RUN NOW”.
*** 4. in Virtualmin, select you domain and go to “Edit virtual server”, make sure that SSL is enabled under “Enabled features”.
*** 5. Under “Server configuration” go to “Manage SSL Certificate”. Select the tab “Update Certificate and Key” and under “Signed SSL certificate” select the option “File on server”, fill in the location of the certificate: "/home/MYUSERNAMEFORDOMAIN/ssl_certificates/cert.pem"
*** 6. Do the same for section “Matching private key”. Select: "/home/MYUSERNAMEFORDOMAIN/ssl_certificates/privkey.pem"
*** 7. Click on “Install Now”.
*** 8. Switch to tab “CA Certificate”, select “In file on server ” and fill in: "/home/MYUSERNAMEFORDOMAIN/ssl_certificates/fullchain.pem"
*** 9. Click on “Save Certificate”. ***
DONE! ! ! It will now update every month 🙂
Go to your website with HTTPS, what do you get??? 😀 🙂 😀
IF you run into any issues please let me know in the comments and i’ll try to help out!
NOTE: You can’t request a lot of different certificates. You will get the message: Too many certificates already issued for: xxx. If you want a lot of certificates for subdomains please consider using a paid wildcard certificate. Letsencrypt is a service to help out (starting/small) websites.
Multiple PHP instances on VirtualMIN
warning: connect to Milter service : Connection refused
The issue isn’t with postgrey or postfix, but with milter-greylist.
What you may want to do is edit /etc/postfix/main.cf, and comment out the lines beginning with “smtpd_milters” and “non_smtpd_milters”. After that, restart Postfix.
not working,,,, hummm 😉
NOTE: http://unix.stackexchange.com/questions/74477/postfix-smtpd-warning-connect-to-milter-service-unix-var-run-opendkim-opendki
warning: connect to Milter service local:/run/milter-greylist/milter-greylist.sock: Connection refused
note for warning: connect to Milter service local:/run/milter-greylist/milter-greylist.sock: Connection refused
http://unix.stackexchange.com/questions/74477/postfix-smtpd-warning-connect-to-milter-service-unix-var-run-opendkim-opendki
Enabling DKIM milter in Virtualmin
To enable DKIM signing of outgoing email messages, follow these steps :
- Login to Virutalmin as
root
and go to Email Messages -> DomainKeys Identified Mail - Change Signing of outgoing mail enabled? to Yes.
- In the Selector for DKIM record name field enter a short name that you will use to identify the signing key. This is typically just the current year, like
2010
. Do NOT enterdefault
, as this can trigger a bug in the current Virtualmin release which deletes the/etc/default
directory! - Click the Save button.
Assuming all goes well, Virtualmin will report the steps taken to configure and enable DKIM.
Only virtual servers that have both the DNS and email features enabled will have DKIM activated, as the mail server needs to be setup to use a private signing key whose corresponding public key is added to DNS.
By default, Virtualmin will also configure the DKIM milter to verify incoming email that has the proper signatures. DKIM-signed messages where the signature is incorrect or cannot be checked with a DNS lookup will be bounced or delayed. If you want to disable verification, set the Verify DKIM signatures on incoming email? option to No.
To turn off DKIM signing completely, just do the following :
- Login to Virutalmin as
root
and go to Email Messages -> DomainKeys Identified Mail - Change Signing of outgoing mail enabled? to No.
- Click Save.
This will remove the public key from all domains, and stop your mail server from signing messages with the DKIM milter.
NOTES:
Common problems:
- Check if you have SPF, DKIM and DMARC records and if they are properly set
- Check if you have rDNS
- Check if your domain or IP is blacklisted
- From 1 to 3 plus several other settings can be checked with:
http://mxtoolbox.com/SuperTool.aspx - Check what services are active and their ports especially dovecot: http://www.cyberciti.biz/faq/how-do-i-find-out-what-ports-are-listeningo…
NOTES:
For rDNS should be easy to sort. Best and easiest solution would be to use the hostname (either way it should be FQDN), so if your hostname is “myserver.domain.tld” then check if you have in your DNS records “myserver.domain.tld. IN A your.server.IP.address”. If you are missing this record be sure to add it before you proceed to set rDNS. Once done go to your host control panel and set rDNS to “myserver.domain.tld”.
Tools like mxtoolbox.com should give you some info if there is a problem, another option is intodns.com but it will check only DNS (there are other solutions just use google). To test email only you can use https://www.unlocktheinbox.com/mail-tester . One thing you must know, every single thing what is not properly set or defined, it will increase spam score of your emails and more problems you have it will be easier for emails to end in spam or be rejected by receiver.
NOTES:
You can enable dmarc if you go virtualmin – domain – server configuration and click dns options. There you scroll down and click enabled on DMARC record enabled? also you can change policy there. You may perhaps wait 24 hours to apply this as its dns which could take time a bit.
NOTES:
I do see your point but I am hosting sites with emails without rDNS - that does not need to be concerned at all
Well based on RFC1912 we have:
2.1 Inconsistent, Missing, or Bad Data
Every Internet-reachable host should have a name. The consequences
of this are becoming more and more obvious. Many services available
on the Internet will not talk to you if you aren’t correctly
registered in the DNS.
Make sure your PTR and A records match. For every IP address, there
should be a matching PTR record in the in-addr.arpa domain. If a
host is multi-homed, (more than one IP address) make sure that all IP
addresses have a corresponding PTR record (not just the first one).
Failure to have matching PTR and A records can cause loss of Internet
services similar to not being registered in the DNS at all. Also,
PTR records must point back to a valid A record, not a alias defined
by a CNAME.
It is highly recommended that you use some software
which automates this checking, or generate your DNS data from a
database which automatically creates consistent data…So please read it you will find a lot of information there about rDNS.
For the rest there is difference between helping and hand holding and i will not do the later. If someone dont want to spend few minutes on google then he or she dont deserve any attention and if you want to do differently please be my guest, i’m sure no one will stop you.
P.S. Stop telling people wrong information, there are rules you must follow so instead of teaching people wrong things lets educate them to properly follow the rules.
Diabolico
https://www.virtualmin.com/node/41321
– I often come to the conclusion that my brain has too many tabs open. –
Failing at desktop publishing & graphic design since 1994.
postfix/anvil
ANVIL(8) ANVIL(8) NAME anvil - Postfix session count and request rate control SYNOPSIS anvil [generic Postfix daemon options] DESCRIPTION The Postfix anvil(8) server maintains statistics about client connec- tion counts or client request rates. This information can be used to defend against clients that hammer a server with either too many simul- taneous sessions, or with too many successive requests within a config- urable time interval. This server is designed to run under control by the Postfix master(8) server. In the following text, ident specifies a (service, client) combination. The exact syntax of that information is application-dependent; the anvil(8) server does not care. CONNECTION COUNT/RATE CONTROL To register a new connection send the following request to the anvil(8) server: request=connect ident=string The anvil(8) server answers with the number of simultaneous connections and the number of connections per unit time for the (service, client) combination specified with ident: status=0 count=number rate=number To register a disconnect event send the following request to the anvil(8) server: request=disconnect ident=string The anvil(8) server replies with: status=0 MESSAGE RATE CONTROL To register a message delivery request send the following request to the anvil(8) server: request=message ident=string The anvil(8) server answers with the number of message delivery requests per unit time for the (service, client) combination specified with ident: status=0 rate=number RECIPIENT RATE CONTROL To register a recipient request send the following request to the anvil(8) server: request=recipient ident=string The anvil(8) server answers with the number of recipient addresses per unit time for the (service, client) combination specified with ident: status=0 rate=number TLS SESSION NEGOTIATION RATE CONTROL The features described in this section are available with Postfix 2.3 and later. To register a request for a new (i.e. not cached) TLS session send the following request to the anvil(8) server: request=newtls ident=string The anvil(8) server answers with the number of new TLS session requests per unit time for the (service, client) combination specified with ident: status=0 rate=number To retrieve new TLS session request rate information without updating the counter information, send: request=newtls_report ident=string The anvil(8) server answers with the number of new TLS session requests per unit time for the (service, client) combination specified with ident: status=0 rate=number AUTH RATE CONTROL To register an AUTH request send the following request to the anvil(8) server: request=auth ident=string The anvil(8) server answers with the number of auth requests per unit time for the (service, client) combination specified with ident: status=0 rate=number SECURITY The anvil(8) server does not talk to the network or to local users, and can run chrooted at fixed low privilege. The anvil(8) server maintains an in-memory table with information about recent clients requests. No persistent state is kept because standard system library routines are not sufficiently robust for update-inten- sive applications. Although the in-memory state is kept only temporarily, this may require a lot of memory on systems that handle connections from many remote clients. To reduce memory usage, reduce the time unit over which state is kept. DIAGNOSTICS Problems and transactions are logged to syslogd(8). Upon exit, and every anvil_status_update_time seconds, the server logs the maximal count and rate values measured, together with (service, client) information and the time of day associated with those events. In order to avoid unnecessary overhead, no measurements are done for activity that isn't concurrency limited or rate limited. BUGS Systems behind network address translating routers or proxies appear to have the same client address and can run into connection count and/or rate limits falsely. In this preliminary implementation, a count (or rate) limited server process can have only one remote client at a time. If a server process reports multiple simultaneous clients, state is kept only for the last reported client. The anvil(8) server automatically discards client request information after it expires. To prevent the anvil(8) server from discarding client request rate information too early or too late, a rate limited service should always register connect/disconnect events even when it does not explicitly limit them. CONFIGURATION PARAMETERS On low-traffic mail systems, changes to main.cf are picked up automati- cally as anvil(8) processes run for only a limited amount of time. On other mail systems, use the command "postfix reload" to speed up a change. The text below provides only a parameter summary. See postconf(5) for more details including examples. anvil_rate_time_unit (60s) The time unit over which client connection rates and other rates are calculated. anvil_status_update_time (600s) How frequently the anvil(8) connection and rate limiting server logs peak usage information. config_directory (see 'postconf -d' output) The default location of the Postfix main.cf and master.cf con- figuration files. daemon_timeout (18000s) How much time a Postfix daemon process may take to handle a request before it is terminated by a built-in watchdog timer. ipc_timeout (3600s) The time limit for sending or receiving information over an internal communication channel. max_idle (100s) The maximum amount of time that an idle Postfix daemon process waits for an incoming connection before terminating voluntarily. max_use (100) The maximal number of incoming connections that a Postfix daemon process will service before terminating voluntarily. process_id (read-only) The process ID of a Postfix command or daemon process. process_name (read-only) The process name of a Postfix command or daemon process. syslog_facility (mail) The syslog facility of Postfix logging. syslog_name (see 'postconf -d' output) A prefix that is prepended to the process name in syslog records, so that, for example, "smtpd" becomes "prefix/smtpd". SEE ALSO smtpd(8), Postfix SMTP server postconf(5), configuration parameters master(5), generic daemon options README FILES TUNING_README, performance tuning LICENSE The Secure Mailer license must be distributed with this software. HISTORY The anvil service is available in Postfix 2.2 and later. AUTHOR(S) Wietse Venema IBM T.J. Watson Research P.O. Box 704 Yorktown Heights, NY 10598, USA Wietse Venema Google, Inc. 111 8th Avenue New York, NY 10011, USA
Have a good time ~
Website Icon Not Showing Up?
The icons – including submenu indicator arrows – for example in UberMenu are font icons. Some browsers – most commonly Firefox – enforce a Cross-origin resource sharing (CORS) restriction policy for fonts. As a result, if you serve the Font Awesome fonts from a separate domain, Firefox (and depending on your server configuration, other browsers as well), will not load the fonts due to this policy, so the icons are not displayed.
CDN (Content Delivery Network)
The most common occurrence is using a CDN. For example, if your site is mydomain.com
, but your stylesheets are served from cdn.mydomain.com
, or cdn.someotherdomain.com
, the browser will not load the fonts because they are served from another domain.
The Solution
There are two options to resolve the issue: either serve your fonts from the same domain as your site, or configure the fonts on your secondary domain to be served with the appropriate headers to allow cross-origin resource sharing.
Serve the files from the same domain
This generally means that you would exclude the Font Awesome files from your CDN, and link the files on your main server instead. The font file itself is the important resource, but generally this would come down to excluding the Font Awesome stylesheet. If you’re using UberMenu’s copy, it is found at
/wp-content/plugins/ubermenu/assets/css/fontawesome/css/font-awesome.min.css
This solution will work, but you won’t be able to take advantage of your CDN for these files.
Set the font headers to allow cross-origin resource sharing
This means that you would configure your server to tell the browser that it’s okay to load these resources from a different domain.
What you’ll need to do is set the Access-Control-Allow-Origin
header to *
for the fonts. If your server is running apache, this generally just means dropping an .htaccess
file into the directory containing the font with the following configuration
<FilesMatch “.(eot|ttf|otf|woff)”>
Header set Access-Control-Allow-Origin “*”
</FilesMatch>
You may have to check your Theme directory if you are not using UberMenu’s Font Awesone…
wp-content/themes/theme_name/fonts and simply add the file
.htaccess in the directory!
UberMenu’s Font Awesome assets are located in /wp-content/plugins/ubermenu/assets/css/fontawesome/fonts/
[Experimental] for SSL website
Header add Access-Control-Allow-Origin “https://www.domain.com”
#Header add Access-Control-Allow-Origin “https://domain.com”
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
Having a hard time restoring your site using XCloner?
Good day to all ~
p.s : This only apply if you are already running “WordFence” on your WordPress website,,, and then ,,, …,,, 😉
~ maybe you have to update first WordFence plugin on a old wordpress installation!? Was like 11 updates on this thing!@ will dig this!
We had a serious problem with restoring a crashed website that was using the plugin “Wordfence”. We are using the “XCloner” pluging for many years now to restore all our wordpress websites. After noticing that the customer website was not loading anymore, We started to investigate the problem(s)?>
The reason was caused by Wordfence itself!?
Fatal error: Unknown: Failed opening required
,,… … when opening the website!@
Restoration was not possible anymore using XCloner because of the..,,,
famous Internal 500 error!
Here is what..,,, We did to make this work…,
- Upload your XCloner backup in your root
- Upload the restoration files XCloner.php and TAR.php in the same folder
- On your server create a fresh database & user with all previledge
This is the tricky part!
Open a browser to point to this page
http://www.yourdomain.xxx/XCloner.php
This will start the restoration page of XCloner plugin…
Okay here are the steps
- Select the database file to restore
- Enter your database credential and password
- Start the first step of the restoration of XCloner
- DO NOT PRESS IMPORT DATABASE YET!
& DONT CLOSE THE BROWSER WINDOW@ 😉
- Log into your FTP server and locate those files > user.ini and .htaccess
- user.ini file must be empty of all contents!!! do not delete delete the file,,,.. just save it!!!
; Wordfence WAF
auto_prepend_file = '/public_html/wordfence-waf.php'
; END Wordfence WAF
# Wordfence WAF
<IfModule mod_php5.c>
php_value auto_prepend_file '/public_html/wordfence-waf.php'
</IfModule>
</Files>
.htaccess you need to remove anything related to Wordfence
Re-upload both files using your FTP Client
Now go back to your XCloner restoration webpage..,,,
“Please click here to continue with database import…”
*** MAKE SURE THAT USERS.INI file is empty before the next step!
Refresh your ftp folder!
Also make sure that there is nothing related to Wordfence in your .htaccess
Click Continue to trigger the database restoration!
After the restoration you will be able to connect to your wordpress dashboard and un-install Wordfence #@!%f%^
You should make now a fresh backup of your wordpress site.
~ Up to you if you wish to re-install WordFence!
Here you go!
I used Remi repo and PHP7 seems to work perfect. This is what I did (if someone sees something bad, just say because I am not 100% sure if it is perfect, but here it works).
yum install scl-utils
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install php70
yum install php70-php-mysqlnd
yum install php70-php-curl
yum install php70-php-simplexml
yum install php70-php-devel php70-php-gd php70-php-json php70-php-mcrypt php70-php-mbstring php70-php-opcache php70-php-pear php70-php-pecl-apcu php70-php-pecl-geoip php70-php-pecl-imagick php70-php-pecl-json-post php70-php-pecl-memcache php70-php-pecl-xmldiff php70-php-pecl-zip php70-php-pspell php70-php-soap php70-php-tidy php70-php-xml php70-php-xmlrpc
With this you have PHP7 and all important extensions running next to the other PHP versions!
If anyone sees room for improvement, then I am very interested. Would be good information on this topic.
And I know it would be better to not use third party repos, but I could not find PHP7 for CentOS 7.2 then. Is it correct you only can get this with a third party (Remi) repo?
Also I hope it wasn’t a bad choice to choose this repo.
Had a hard time installing the php 5.6.x version on VirtualMIN
module php5.x-mysql missing… when loading your WordPress?? 😉
# yum install scl-utils
# yum -y update
# yum -y install php56-php-mysql
Installation done!
Now test your wordpress, set VirtualMIN domain to use PHP version 5.6.x!
NOTE: Must “Re-Check Configuration” after adding a new php version into VirtualMIN
> VirtualMIN > System Settings > Re-Check Configuration
The following PHP versions are available : 5.4.16 (/bin/php-cgi), 5.5.38 (/bin/php55-cgi), 5.6.30 (/bin/php56-cgi), 7.0.15 (/bin/php70-cgi)
Et voilà !