Web Development Web Security

How to permanently set Linux environmental variablees

Every time I need to set Linux Environment variables and I use google to find out how, I always end up with those VALUELESS posts that tell you to use a terminal with export blah blah blah. Then when I close the terminal and try to use a variable it doesn’t exist and I am like WTF. Well those posts are how to set a temporary environmental variable.

This post covers what I always google and get the failed results for. This post is how to permanently forever set environmental variables.  This is often needed for development to store sensitive api key secrets, passwords etc. You should never put any of that information in a file for your project.

The idea is to create environmental variables to hold this info on your local machine, then when you put your code into production you add the necessary environmental variables to whatever controls them for your app. You can use kubernetes secrets or Hashicorp vault or if you are using something like Gitlab or Openshift continuous integration/delivery pipeline workflow will have a way to enter these values securely.

But here is how you set your local linux environment variables permanently. There are many ways to set these variables, here is a great article covering the topic.

But none of that above is useful to use, nope not for what we want to do. I just got a cool idea, rant/WOULDN’T IT BE COOL IF YOU COULD SET ENVIRONMENTAL VARIABLES IN MORE WAYS WITH LINUX. I mean where is the fun in only having 1 maybe 2 good ways of doing something, lets add more and more and more./rant

Ok so all of that sucks, how can we truly set environmental variables for our Development environment in a way that is easy and safe? Magic that is how.   Actually what you do is create a file with all of the secrets your app needs for development testing as environmental variables. I had to search hard and long to figure this out.

You create a file with any name you want with extension .sh like As described in the link above Linux will read all of the files in that directory and create the environmental variables. Hours of digging to figure that simple trick out FFS.

This is basically what I have in a simple text file

You simply add a new line for each variable you want to have created for your app.

Resources Web Security

Docker resources

Links, resources and videos about Docker in specific.

Manage sensitive data with Docker secrets – information from the documentation about using docker secrets. Secrets are for managing things like database passwords and other passwords.

Introducing docker secrets management – an article explaining what Docker secretes management is and it’s value.

Resources Web Security

Symfony doctrine database secret configuration links and resources.

Storing secrets for Symfony applications – some ideas how to approach the topic

Resources Web Security

CORS cross origin resource sharing links and resources for developers

CORS Cross origin resource sharing allows you to decide if a script from a domain other than your website/app can access data aka make AJAX calls etc. to your server. For your frontend API you probably want to limit the origin to just your domain. For a developer API you probably want to allow all origins.

CORS for Developers by W3C – explains CORS for developers in clear wording

Configuring play framework 2.8 CORS filter


Resources Web Security

Server and cloud security resources and links

CSP Cheat Sheet – CSP content security policy is for setting server security policies for accessing your systems content/files etc.

Configuring Play Framework Content Security Policy Headers

Resources Web Security

Web App security resources

Practical HTTP Host header attacks – Must read to understand how hackers use HTTP headers to hack websites.

Link to OWASP cheatsheet  – a good cheat sheet

Website security by MDN – covers some very basic information about website security such as SQL injection

Resources Web Security

Networking resources

Listed are some resources about Networking concepts. I have many computers and devices and a large area to cover so I have multiple routers in play. Messing with so many devices and getting more into Arduino means I need to deepen my understanding of Networking concepts. This page lists resources I have found to be helpfull, maybe it will help others too.

Cool stuff this is a cool web tool for testing mobile apps by directing traffic to your device. this cool web tool is about the same as above except it lets you expose your local webser to use it as your own web host.

Articles and links

One of my Routers is a NetGear N750 this is the link to the manual.  You can use google to find the manual for your router. Any old wireless router can be turned into a Wireless Access Point, which is what you need when running more than one router on the same network.

One thing to understand is DHCP ( dynamic host configuration protocol ) this is how your devices get an IP address from your router.

How to Set Static IP Address and Configure Network in Linux – excellent article about how to create static IP addresses on your Linux servers. This can be done on a local machine for fun or testing too.

How to Setup Local DNS Using /etc/hosts File in Linux – excellent article explains setting up IP addresses on you local machine for testing your web development work.

10 Useful “IP” Commands to Configure Network Interfaces


Network Types: LAN, WAN, PAN, CAN, MAN, SAN, WLAN

Well I learned what a PAN was from this video. A PAN is what I am wanting to create between my phone and my wifi enable arduino projects or maybe even a WLAN.

How a DNS Server (Domain Name System) work?

This is an excellent short video that explains DNS in detail. Name Servers or NS servers are usually hosted on servers from the company you purchase your domain name from. You tell these servers where to redirect traffic. When you purchase hosting you get an IP address from the company you buy it from whether it is a bare metal server or a cloud instance. You go into the Record system of your Domain Registrar ( the company you bought the name from ) and redirect traffic for your NS server to your host IP by making a few records.


This video quickly covers HTTP, HTTPS, SSL and TLS. This is good to know for people that own websites. This site uses SSL provided by LetsEncrypt since it is just a simple blog. If you need help with this contact me. I can install SSL for you.

What is a MAC address?

Why do we need both IP and MAC address?

IP Address Basics and Subnet Mask: PLC Networking Basics: Subnetting

Secret of subnet mask

This video covers what a subnet mask is and why they are used.

Subnetting is Simple

This video goes into much more depth than the shorter video above.

How does a computer communicate locally and remotely?

This is the followup video to the “Secret of Subnet mask” video above and continues on with the discussion.

How does DHCP work?

I like this video because it is 5 minutes long and gets directly to the point.

DHCP Explained – Dynamic Host Configuration Protocol

I like this video because it goes a little more in depth than the above video. This video is about 10 minutes long and explains more of the history of DHCP. It also goes into much more depth than the above video. If you are like me you may like to know a little about the history of DHCP.