Efforts to make ucloud a python package
This commit is contained in:
		
					parent
					
						
							
								bbe09667a6
							
						
					
				
			
			
				commit
				
					
						1e7300b56e
					
				
			
		
					 71 changed files with 241 additions and 1043 deletions
				
			
		
							
								
								
									
										7
									
								
								ucloud/hack/README.org
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								ucloud/hack/README.org
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | |||
| This directory contains unfinishe hacks / inspirations | ||||
| * firewalling / networking in ucloud | ||||
| ** automatically route a network per VM - /64? | ||||
| ** nft: one chain per VM on each vm host  (?) | ||||
| *** might have scaling issues? | ||||
| ** firewall rules on each VM host | ||||
|    - mac filtering: | ||||
							
								
								
									
										1
									
								
								ucloud/hack/conf.d/ucloud-host
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								ucloud/hack/conf.d/ucloud-host
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| HOSTNAME=server1.place10 | ||||
							
								
								
									
										77
									
								
								ucloud/hack/nftables.conf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								ucloud/hack/nftables.conf
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,77 @@ | |||
| flush ruleset | ||||
| 
 | ||||
| table bridge filter { | ||||
|        chain prerouting { | ||||
|                 type filter hook prerouting priority 0; | ||||
|                 policy accept; | ||||
|                 ibrname br100 jump netpublic | ||||
|                 } | ||||
|        chain netpublic { | ||||
|        icmpv6 type {nd-router-solicit, nd-router-advert, nd-neighbor-solicit, nd-neighbor-advert, nd-redirect } log | ||||
|        } | ||||
| } | ||||
| 
 | ||||
| table ip6 filter { | ||||
|         chain forward { | ||||
|                 type filter hook forward priority 0; | ||||
| 
 | ||||
|                 # this would be nice... | ||||
|                 policy drop; | ||||
| 
 | ||||
|                 ct state established,related accept; | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         chain prerouting { | ||||
|                 type filter hook prerouting priority 0; | ||||
|                 policy accept; | ||||
| 
 | ||||
|                 # not supporting in here! | ||||
| 
 | ||||
| 
 | ||||
|                 iifname vmXXXX jump vmXXXX | ||||
|                 iifname vmYYYY jump vmYYYY | ||||
| 
 | ||||
|                 iifname brXX jump brXX | ||||
| 
 | ||||
|                 iifname vxlan100 jump vxlan100 | ||||
|                 iifname br100 jump br100 | ||||
|         } | ||||
| 
 | ||||
|         # 1. Rules per VM (names: vmXXXXX? | ||||
|         # 2. Rules per network (names: vxlanXXXX, what about non vxlan?) | ||||
|         # 3. Rules per bridge: | ||||
|         # vxlanXX is inside brXX | ||||
|         # This is effectively a network filter | ||||
|         # 4. Kill all malicous traffic: | ||||
|         # - router advertisements from VMs in which they should not announce RAs | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         chain vxlan100 { | ||||
|              icmpv6 type {nd-router-solicit, nd-router-advert, nd-neighbor-solicit, nd-neighbor-advert, nd-redirect } log | ||||
|              } | ||||
|         chain br100 { | ||||
|               icmpv6 type {nd-router-solicit, nd-router-advert, nd-neighbor-solicit, nd-neighbor-advert, nd-redirect } log | ||||
|         } | ||||
| 
 | ||||
|         chain netpublic { | ||||
|               # drop router advertisements that don't come from us | ||||
|               iifname != vxlanpublic icmpv6 type {nd-router-solicit, nd-router-advert, nd-neighbor-solicit, nd-neighbor-advert, nd-redirect } drop | ||||
|               # icmpv6 type {nd-router-solicit, nd-router-advert, nd-neighbor-solicit, nd-neighbor-advert, nd-redirect } drop | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         # This vlan | ||||
|         chain brXX { | ||||
|              ip6   saddr != 2001:db8:1::/64 drop; | ||||
|         } | ||||
| 
 | ||||
|         chain vmXXXX { | ||||
|              ether saddr != 00:0f:54:0c:11:04 drop; | ||||
|         } | ||||
| 
 | ||||
|         chain vmYYYY { | ||||
|              ether saddr != 00:0f:54:0c:11:05 drop; | ||||
|         } | ||||
| } | ||||
							
								
								
									
										8
									
								
								ucloud/hack/rc-scripts/ucloud-api
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								ucloud/hack/rc-scripts/ucloud-api
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| #!/sbin/openrc-run | ||||
| 
 | ||||
| name="$RC_SVCNAME" | ||||
| pidfile="/var/run/${name}.pid" | ||||
| command="$(which pipenv)" | ||||
| command_args="run python ucloud.py api" | ||||
| command_background="true" | ||||
| directory="/root/ucloud" | ||||
							
								
								
									
										8
									
								
								ucloud/hack/rc-scripts/ucloud-host
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								ucloud/hack/rc-scripts/ucloud-host
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| #!/sbin/openrc-run | ||||
| 
 | ||||
| name="$RC_SVCNAME" | ||||
| pidfile="/var/run/${name}.pid" | ||||
| command="$(which pipenv)" | ||||
| command_args="run python ucloud.py host ${HOSTNAME}" | ||||
| command_background="true" | ||||
| directory="/root/ucloud" | ||||
							
								
								
									
										8
									
								
								ucloud/hack/rc-scripts/ucloud-metadata
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								ucloud/hack/rc-scripts/ucloud-metadata
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| #!/sbin/openrc-run | ||||
| 
 | ||||
| name="$RC_SVCNAME" | ||||
| pidfile="/var/run/${name}.pid" | ||||
| command="$(which pipenv)" | ||||
| command_args="run python ucloud.py metadata" | ||||
| command_background="true" | ||||
| directory="/root/ucloud" | ||||
							
								
								
									
										8
									
								
								ucloud/hack/rc-scripts/ucloud-scheduler
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								ucloud/hack/rc-scripts/ucloud-scheduler
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| #!/sbin/openrc-run | ||||
| 
 | ||||
| name="$RC_SVCNAME" | ||||
| pidfile="/var/run/${name}.pid" | ||||
| command="$(which pipenv)" | ||||
| command_args="run python ucloud.py scheduler" | ||||
| command_background="true" | ||||
| directory="/root/ucloud" | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue