Tuesday, May 17, 2016

ubuntu - Apache2 Server should be SSL-aware but has no certificate configured [Hint: SSLCertificateFile] for wild card SSL certificate



I am trying to configure Godaddy Wild Card Certificates on a Apache web server.I am getting the following error:



[Thu Jul 23 02:32:42.499991 2015] [mpm_event:notice] [pid 12293:tid 140626762094464] AH00491: caught SIGTERM, shutting down
[Thu Jul 23 02:32:43.553475 2015] [ssl:emerg] [pid 12529:tid 139774360311680] AH02240: Server should be SSL-aware but has no certificate configured [Hint: SSLCertificateFile] (/etc/apache2/sites-enabled/godaddy-ssl.conf:2)
[Thu Jul 23 02:32:43.553518 2015] [ssl:emerg] [pid 12529:tid 139774360311680] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/error.log for more information
[Thu Jul 23 02:35:23.466577 2015] [mpm_event:notice] [pid 12707:tid 139928471259008] AH00489: Apache/2.4.7 (Ubuntu) OpenSSL/1.0.1f configured -- resuming normal operations

[Thu Jul 23 02:35:23.466637 2015] [core:notice] [pid 12707:tid 139928471259008] AH00094: Command line: '/usr/sbin/apache2'


My apache server configuration with redirection for http request to https:





ServerName saasm2m.com

ServerAlias saasm2m.com *.saasm2m.com

ServerAdmin helloworld@gmail.com
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/?(.*) https://%{HTTP_HOST}/$1 [NC,R,L]



My SSL certificate configuration is






ServerAdmin saasm2m.com
ServerName saasm2m.com
ServerAlias *.saasm2m.com
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on

SSLCACertificateFile /etc/apache2/ssl/saasm2m.chained.crt

SSLCertificateKeyFile /etc/apache2/ssl/saasm2m.key
ServerAdmin helloworld@gmail.com
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
ProxyPreserveHost On


SSLOptions +StdEnvVars



SSLOptions +StdEnvVars

BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown





I have changed my ports.conf to add Listen 443 http



Listen 80

NameVirtualHost *:80

Listen 443 http




Listen 443



Update:
If i use this configuration it throws a error :AH00491: caught SIGTERM, shutting down



SSLCertificateFile /etc/apache2/ssl/6eba0aa5c1b8.crt
SSLCertificateKeyFile /etc/apache2/ssl/website_ssl.key
SSLCertificateChainFile /etc/apache2/ssl/gd_bundle-g2-g1.crt



I have enabled ssl module by using:sudo a2enmod ssl and activated server configuration files by using sudo a2ensite filename.
Can anyone point out how I can fix this error?



Thank you


Answer



You need to provide a SSLCertificateFile configuration line in addition to the SSLCertificateKeyFile configuration file.



You have configured one of two options for CA certificates. You may not need either. This may be configured with the file that should be the SSLCertificateFile




GoDaddy provides documentation on installing your certificates. According to that the gd_bundle-g2-g1.crt should be configured with the SSLCACertificatePath parameter. This parameter is called SSLCertificateChainFile in Apache versions before 2.4.8.


iptables - Redirect from http to https

I have a Hudson/Jenkins installation which runs on port 443, so I can access it with https://ci.mydomain.com.
I do not have a webserver running on port 80 like Apache Httpd, but I want if a user types http://ci.mydomain.com
it should be redirected to https://...



I tried it with iptables:




/sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 443
/sbin/iptables-save
chkconfig --level 35 iptables on


But the browser tells me, that the connection failed. So I do not want to install Apache webserver, I only
want to have a redirect from http://ci.mydomain.com to https://ci.mydomain.com.

Sunday, May 15, 2016

How can I mount an FTP to a drive letter in windows?





I'd like to mount an FTP to a drive letter in windows, I've used Novell's NetDrive, but there are two main problems, 1) it tends to slow down computer alot 2) it doesn't seem to work at all under Vista.



Are there any applications that will allow me to mount a remote FTP to a local Drive letter, or is there a method built into Vista for it?


Answer



I have used WebDrive for several years without any trouble.


Saturday, May 14, 2016

php - Cron job keeps running!

I've set up a cron job to wget a PHP script every hour. However, it seems to get stuck in a loop and constantly running. If I run the script in a browser or via the command line it works fine. I've tried using wget and command line PHP and I get the same problem.



Here's my job:




0, 9-18, * * 1-5 wget http://www2.lichfielddc.gov.uk/planning/cron.php

networking - OSX Lion Server + XSan + Direct-Attached Storage



So my company is looking to switch to a DAS San storage system for our internal fileshare. I'm wondering if there are any great tutorials detailing how to set this up and what kind of equipment I'll need to buy?



Edit



My question was conflicting so let me make it a little more clear. I'm needing to build a direct-attached storage system for our internal fileshare. We're currently using an XServe and the AFP protocol. It works great, but we're running out of room and the idea of a San-esque service was appealing because I could (in my mind at least) keep adding drives to it as we needed and it would expand the virtual volume.




Any suggestions on where to go from here?



Thanks!


Answer



I agree with Sven- don't use apple hardware for storage. Now you're talking about "SAN-type" storage, however that means different things to different people. I'm going to assume you like the fact that it's centralized, highly available, high performance, and expandable. I'm not going to assume that you need disk level access to it because that's something you see in the requirements of databases, not macs.



Your best bet would be a NAS. Avoid AFP and go with NFS, which mac OSX uses perfectly. The advantage of NFS is that it opens you up to a wide array of NAS vendors that could do the job.



NAS hardware comes in a spectrum from grungy little 4 drive garbage cans to Netapp filers. The more you spend, the more expandable and highly available it'll be.



ssh - SSHd restriction per user basis



I need to restrict certain user(s) so that they can only SSH in using ssh keys and other users can login using key or password.



an example:



i'd like for root user to be able to login remotely (through sshd) using key, so no password would be accepted (even if password is right)




and for other users (everyone on the system) they can log in using key and/or password



how would I do that?


Answer



What I would do is to set /etc/sshd/sshd_config such that:



PermitRootLogin without-password



just for extra security and to avoid having the root password locked (it would only allow root to log in using a key)



I would instead use AllowGroups instead of AllowUser, as for me it would be more convenient to add users to a group rather than to sshd_config but that could depend on your personal preferences.


Friday, May 13, 2016

nginx prepending data to access log when using syslog



Using the below format and access log config:




log_format syslog '{"hi2u":true,"request_time":"$request_time","@timestamp":"$time_iso8601", "request_id":"$http_x_request_id", "token":"$token"}';

access_log syslog:server=localhost:9000 syslog;


I get this message on port 9000 when using netcat:




<190>Aug 29 06:17:03 user-all-series nginx:
{"hi2u":true,"request_time":"0.000","@timestamp":"2017-08-29T06:17:03-07:00",

"request_id":"-", "token":"abcdef123456789"}




If I look in the nginx source I see what looks like the header being added here:



https://github.com/nginx/nginx/blob/master/src/http/modules/ngx_http_log_module.c#L360



Anyone know a way to disable the header there so just the log_format shows up? I image it's probably just a syslog format in the spec of which I'm ignorant :)



I commented out that line and it's the behavior I expect :)




if (log[l].syslog_peer) {
// p = ngx_syslog_add_header(log[l].syslog_peer, line);
}

Answer



Another one courtesy of Alexy. Adding it here so that folks see it:



That is a PRI part of syslog protocol tools.ietf.org/html/rfc3164#section-4.1.1


linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...