How to configure git to work witha proxy server - heroku-toolbelt

How can someone tweak aroud th heroku toolbelt i.e git and use a proxy server to connect to heroku. I am trying to connect but it keeps telling me machine actively denied it access. help

You can set the Git proxy using the below command in the git bash. Set for both HTTP and HTTPS proxy.
git config --global http.proxy http://username:password#proxy.server.com:8080
git config --global https.proxy http://username:password#proxy.server.com:8080
//Replace username with your proxy username
//Replace password with your proxy password
//Replace proxy.server.com with the proxy domain URL.
//Replace 8080 with the proxy port no configured on the proxy server.
Check How to configure Git proxy and How to unset the Git Proxy for more details

Set HTTP_PROXY and HTTPS_PROXY system environment variables in following format if proxy sever requires authentication:
HTTP_PROXY = http://username:password#proxy.server.com:portNumber
HTTPS_PROXY = https://username:password#proxy.server.com:portNumber

use HTTP_PROXY environemnt variable
e.g. HTTP_PROXY=http://localhost:9999

Related

how to run apache superset in dev mode on aws ec2

I have developed a plugin for the apache superset,for which I have followed the following tutorial https://preset.io/blog/2020-07-02-hello-world/
In this tutorial the setup only works for development environment. So I need to run the backend server and frontend server separately using these commands.
for backend:
superset run -p 8088 -h 0.0.0.0 --with-threads --reload --debugger
for frontend:
npm run dev-server
In inboud rules in the security group for my EC2 instance, I have set the inbound rules to custom tcp where I have allowed the traffic for port 9000, 8088.
however I am unable to ping publicDNS of EC2:9000
this is not the case when I ping publicDNS of EC2:8088
turns out if we edit the webpack.config.js file and add an additional parameter for for host by passing devserverHost = '0.0.0.0' and then replacing the 'localhost' with ${devserverHost} solves the problem, additionally this also has to be done for the webpack.proxy.config.js file

How can I change django runserver url?

I'm trying to change django project url, so that users, who wants to connect to website in local area network will see url instead of localhost:8000 or 127.0.0.1. I need to change localhost:8000/users/board to be http://example.eu. I've tried to python manage.py runserver http://example.euand then thought about changing url's but it doesn't work. Also tried to change hosts file(Windows OS), but as far as I understand I need real ip address not url. Is it possible to do this thing and how?
You can use python manage.py runserver 0.0.0.0:8000. 0.0.0.0 means all IPv4 addresses on the local machine. So the server can be reachable by 127.0.0.1 and your private ip address like 10.10.5.8. So now others can access the server using http://10.10.5.8:8000. You the runserver on port 80, so that port can be removed from the url (by default is 80).
But to use any domain instead of ip, you have to change the hosts file of all the clients using the server to add domain to ip address mapping. Alternatively you can configure local network server to map the particular url to your system ip.
Run a local domain with the same port
Opening the /etc/hosts file on your mac with
sudo nano /etc/hosts
And for windows I believe you need to open:
C:\Windows\System32\Drivers\etc\hosts
In here add the domains you want, for example I added vazkir.com
....
127.0.0.1 localhost
127.0.0.1 vazkirtje.com
127.0.0.1 www.vazkirtje.com
.....
Lastly you can add it the domain to you ALLOW_HOSTS in your settings.py:
ALLOWED_HOSTS = ["localhost", "127.0.0.1", "vazkirtje.com", "www.vazkirtje.com"]
And now you can visit your Django application (with port 8000) at:
http://vazkirtje.com:8000
The solution is not perfect since you do have to specify the port you are using, but this does let you use a domain for your local Django application in a relatively easy manner;)
Run a local non-existent domain without specifying the port
If you do want to run it without specifying the port; so just vazkirtje.com then you can use port 80, because this is the default port for HTTP.
Make sure the domain you are testing does not exist, since the domain lookup will first be done on existing domains. So check if you get a similar message to the one I got on chrome, when visiting the url:
Now you can specify this port by adding port "80" to the "runserver" command. You only do need to use "sudo" to run the command at this port, since you need admin rights for this. So run:
sudo python manage.py runserver 80
And now you should be able to access your Django application by visiting:
http://vazkirtje.com

UniFi Controller issue with SSL from GoDaddy on EC2 instance

Scenario
I have AWS setup for a unifi controller, I've been to access it with https://myserverip:8443, I bypass "This connection is note sucured" and use the controller normally
Now, I need to install and SSL certificate to get the hotspot payment system going.
I have a FQDN with GoDaddy so I created a subdomain unifi.mydomain.com, that points to the elastic IP, I log on with https://unifi.mydomain.com:8443
I bought the SSL certificate from GoDaddy, added the subdomain to that certificate.
I log on my AWS with SSH, generate my csr with the following command
cd /usr/lib/unifi
sudo java -jar lib/ace.jar new_cert unifi.mydomain.dom “My Company Name” City State CC*
Then I do
cd var/lib/unifi
more unifi_certificate.csr.pem
Once I get that I copy and paste it on GoDaddy, download the cert files, go back to AWS copy the files with filezilla to /usr/lib/unifi
Then I run the following command
sudo java -jar lib/ace.jar import_cert unifi_mydomain_com.crt bundlecert.crt
They import correctly, restart unifi service and reboot EC2
When I got to any of the above address I get the following
This site can’t provide a secure connection ERR_SSL_PROTOCOL_ERROR
I've tried different browsers, incognito mode, vpn, etc, I believe it's just a matter of SSL or my server
Check your system.properties which sits in /var/lib/unifi/ open the file with vim or your text editor of choice.
Have a look at your HTTPS options, the important ones are the ciphers and protocols.
The Protocols you need are TLSv1 and potentially SSLv2Hello there should be no other SSL protocols in there.
The Ciphers you ideally want are TLS, so for example TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA
If you are having issues throw them all in, CAUTION! only use this in a demo /test environment.
unifi.https.ciphers=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_RC4_128_SHA,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA,SSL_RSA_WITH_RC4_128_SHA
Remember once you have edited the system.properties you need to restart the controller.
sudo service unifi restart
Lots of help on the Unifi page
UniFi - SSL Certificate Error
UniFi - Explaining the config.properties File
UniFi - system.properties File Explanation

mydomain.com:8080 routing - Amazon Web Services, Route 53, EC2, MEAN

I bought a domain name using amazon Route 53, created an elastic IP address and attached it to my Amazon EC2 instance running MEAN bitnami stack, then I created an S3 bucket for static web hosting "redirecting all requests" to the www.domainname.com.
However, when I go to my root domain the page loaded is the Bitnami Congratulations page: You are now running Bitnami MEAN 3.2.11-0 in the Cloud. I created a folder, uploaded my MEAN angular 2/express app and did node server.js and I can only access my web app on mydomain.com:8080 but anything else redirects to the Bitnami congratulations page. Which setting is it that is doing this? Is it an amazon setting? A Bitnami setting? or something in my server side code.
The only place I mention 8080 in my server code is here and it prints API running on 8080 when I run the server:
const port = process.env.PORT || '8080';
app.set('port', port);
const server = http.createServer(app);
server.listen(port, () => console.log(`API running on: ${port}` + ' or ' + process.env.PORT));
You have Apache running on your MEAN Stack. Apache is running on port 80/443 and, therefore, whenever you access your domain at port 80, Apache handle the request and shows you the "Bitnami Welcome Page".
In order to make your Angular/express application available at port 80 you need to configure Apache to redirect the requests to port 3000 (or port 8080, basically the port where your Express application is running). You could add under <VirtualHost _default_:80> and <VirtualHost _default_:443> sections in the file /opt/bitnami/apache2/conf/bitnami/bitnami.conf the line below:
ProxyPass /bitnami !
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
After that, you will need to restart Apache running:
sudo /opt/bitnami/ctlscript.sh restart apache
You can find more information at:
https://docs.bitnami.com/aws/infrastructure/mean/
Bitnami by default launches with an http config here: root/opt/apache2/conf/httpd.conf. The apache2 server pointed at a root directory containing html with an index.html that contains its Congratulations page. Using sudo /opt/bitnami/ctlscript.sh stop killed this server and all other services it had running by default on startup so when I type node server.js all traffic now goes to my Angular 2 app.
Use NGINX to reverse proxy all trafic from http://www.domainname.com to address where your node server is running ( http://localhost:8080).
Here is the sample NGINX configuration for such a use case.
To install NGINX follow one of tutorials on digitalocean.com depending upon your server OS.

How to pass domain name to Nginx conf through chef

I have installed Nginx through chef, but i have to pass "AWS instance Public IP to Chef Recipe"
I am creating AWS instance, and installed my application on that Instance through Chef.
I have to run nginx with my default installation method and my Nginx.conf configuration file
So how we can I take the newly created instance Public IP or EC-2 URL in my Nginx configuration i.e. in place of server_name so that I can browse the URL? OR How can I pass the domain name to Nginx.conf ?
You can use EC2 meta-data:
curl http://169.254.169.254/latest/meta-data/public-ipv4
curl http://169.254.169.254/latest/meta-data/public-hostname
To get the list of all available keys, try this:
curl http://169.254.169.254/latest/meta-data/
ami-id
ami-launch-index
ami-manifest-path
block-device-mapping/
hostname
instance-action
instance-id
instance-type
local-hostname
local-ipv4
mac
metrics/
network/
placement/
product-codes
profile
public-hostname
public-ipv4
public-keys/
reservation-id
security-groups
Nevertheless server_name can be empty, see the docs:
If no server_name is defined in a server block then nginx uses the
empty name as the server name. Nginx versions up to 0.8.48 used the machine’s hostname as the server
name in this case. If a server name is defined as “$hostname” (0.9.4),
the machine’s hostname is used.
You can take advantage of ohai plugin ec2 wich gives correct attributes, mainly node['ec2']['public_ipv4'] for this case.
the drawback is taht ohai can't guess itself you're on an AWS instance and does not run the plugin, for this you have to create a hint file, hoepfully there's a cookbook for this.
There's example to create the hints within a chef run too, but they're quite complex IMO, here's what I would do (untested, comment if it break):
# Resource to reload the ec2 plugin if the hint is created
ohai 'ec2' do
plugin 'ec2'
action :nothing
end
ohai_hint 'ec2' do
notifies :reload, 'ohai[ec2]', :immediately # to force ohai to run the ec2 plugin now
end
You nedd this recipe early in your run list, and this ercipe's cookbook must have a depends 'ohai' in it's metadata.rb for the ohai cookbook to be loaded.