Container Creation, Custom Port Mapping, + Dnsmasq/Nginx configuration updates for HTTPS#2
Container Creation, Custom Port Mapping, + Dnsmasq/Nginx configuration updates for HTTPS#2maxklema merged 11 commits intomieweb:mainfrom
Conversation
cmyers-mieweb
left a comment
There was a problem hiding this comment.
Added a couple notes on some items I spotted. While we have create-a-container open on this PR, can we add the following logic if a container's CTID is an even value for hypervisor load balancing?
pct migrate <CTID> intern-proxmox-pve2 --targetstorage containers-pve2
|
|
||
| echo "✅ $CONTAINER_NAME is available" | ||
|
|
||
| if [ -z "$CONTAINER_PASSWORD" ]; then |
There was a problem hiding this comment.
For added security I would consider unsetting any password fields at the conclusion of the variables use.
While I doubt we will encounter these issues, it is good practice to make this as secure as possible. If a user runs env or export in the same shell session after the script, they might see the password values if the variables are still set. Or since this is technically a multi-user container, if a user can access the memory of another user’s processes (e.g., via /proc), they might be able to read environment variables, including passwords, if the script is still running and the variables are set.
# Use $CONTAINER_PASSWORD as needed here...
unset CONTAINER_PASSWORD
unset CONFIRM_PASSWORD
There was a problem hiding this comment.
Good suggestion, I will implement that.
Yes, I can implement this. |
* LDAP configuration and prune scripts * proxmox deployment changes * updated container-creation scripts + re-organization * READMEs in each directory, re-organization, updated ci-cd files * READMEs in each directory, re-organization, updated ci-cd files * proxmox launchpad submodule in ci-cd automation * proxmox launchpad submodule * proxmox launchpad submodule



Updated June 30th, 2025
Fixes
1) User passwords are unset after the container creation script.
2) Key Files are now stored only temporarily, not permanently. They are created when a user enters a key and are copied over to their respective container and placed in
~/.ssh/authorized_keys. After, the key files are deleted. A similar approach occurs with custom port mapping. Deleting these files is more efficient than storing them permanently when they are no longer needed.3) Even number CTID's are placed on pve2, while odd numbers are placed on pve1 automatically.
4) Port Mapping (including SSH, HTTP, and all custom protocols) is automatically updated to
port_map.jsonand iptables. SSH and HTTP ports are automatically generated, but users can add custom protocols from a master list if they so choose.5) Only authorized users can SSH to the container-creation script. They must know the password for the create-container user on the jump host and the container creation container. Additionally, they must provide Proxmox credentials. The command to SSH:
ssh create-container@opensource.mieweb.org. The script runs as a force command, meaning they do not have shell access outside of the script. They can not inspect thebin/or any other directories that may contain sensitive information.6) Public Key Registration: Users have the option to add their rsa/ed215.. public key. This allows them to not only SSH into their container without entering their password, but also allows them to log in to the create-container script faster since the jump host and container creation store the public key.
7) HTTP Ports. Turns out, HTTP port mapping is a good thing, since not every container must/can listen on port 80. Users can now choose which HTTP port their container listens on, and the Nginx reverse proxy forwards all HTTP traffic to that port automatically.
8) Informative Results: After the container is created, users get a list of protocol port numbers for their containers, their domain name, and a simple SSH command to quickly SSH into their container. A container can now get up and running in less than 3 minutes without admin intervention.
Previous Changes
Changes to intern-phxdc-pve1/register-container.sh:
Allows an optional parameter for custom ports.
./register-container.sh <CITD> <PARAM FILE>where
PARAM FILEhas the following format:Protocol Underlying-Protocol Default-Protocol-Port, Example:MPP TCP 218. As many protocols can be added as needed. All protocols are mapped to a custom, unique port in the range of 10,000-29,999.Iptables are updated accordingly for each custom protocol + SSH.
port_maps.jsonis structured a bit differently. All ports are included in a map under ports key:Dnsmasq + Nginx config updates
Dnsmasq has an additional domain for *.opensource.mieweb.org, both .org and .com map to the Nginx server.
Reverse Nginx proxy supports an additional server block for HTTPS/SSL traffic. This part is commented for now until we acquire the private key for the Let's Encrypt DNS certificate for *.org, which is needed to serve HTTPS traffic.