Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
19c976c1
authored
Jan 29, 2013
by
Danyi Bence
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://giccero.cloud.ik.bme.hu/cloud
parents
41dcdfa8
4384f55d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
10 deletions
+44
-10
firewall/migrations/0021_auto__add_field_host_created_at__add_field_host_modified_at__add_field.py
+0
-0
firewall/models.py
+11
-0
miscellaneous/devenv/init.sh
+23
-0
miscellaneous/devenv/user.yaml
+1
-1
miscellaneous/store-server/CloudStore.py
+1
-1
store/api.py
+8
-8
No files found.
firewall/migrations/0021_auto__add_field_host_created_at__add_field_host_modified_at__add_field.py
0 → 100644
View file @
19c976c1
This diff is collapsed.
Click to expand it.
firewall/models.py
View file @
19c976c1
...
...
@@ -31,6 +31,8 @@ class Rule(models.Model):
r_type
=
models
.
CharField
(
max_length
=
10
,
choices
=
CHOICES_type
)
nat
=
models
.
BooleanField
(
default
=
False
)
nat_dport
=
models
.
IntegerField
(
blank
=
True
,
null
=
True
,
validators
=
[
MinValueValidator
(
1
),
MaxValueValidator
(
65535
)])
created_at
=
models
.
DateTimeField
(
auto_now_add
=
True
)
modified_at
=
models
.
DateTimeField
(
auto_now
=
True
)
def
__unicode__
(
self
):
return
self
.
desc
()
...
...
@@ -79,6 +81,8 @@ class Vlan(models.Model):
comment
=
models
.
TextField
(
blank
=
True
)
domain
=
models
.
TextField
(
blank
=
True
,
validators
=
[
val_domain
])
dhcp_pool
=
models
.
TextField
(
blank
=
True
)
created_at
=
models
.
DateTimeField
(
auto_now_add
=
True
)
modified_at
=
models
.
DateTimeField
(
auto_now
=
True
)
def
__unicode__
(
self
):
return
self
.
name
...
...
@@ -100,6 +104,8 @@ class Vlan(models.Model):
class
Group
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
20
,
unique
=
True
)
rules
=
models
.
ManyToManyField
(
'Rule'
,
symmetrical
=
False
,
blank
=
True
,
null
=
True
)
created_at
=
models
.
DateTimeField
(
auto_now_add
=
True
)
modified_at
=
models
.
DateTimeField
(
auto_now
=
True
)
def
__unicode__
(
self
):
return
self
.
name
...
...
@@ -107,6 +113,9 @@ class Group(models.Model):
class
Alias
(
models
.
Model
):
host
=
models
.
ForeignKey
(
'Host'
)
alias
=
models
.
CharField
(
max_length
=
40
,
unique
=
True
,
validators
=
[
val_domain
])
owner
=
models
.
ForeignKey
(
User
,
null
=
True
,
blank
=
True
)
created_at
=
models
.
DateTimeField
(
auto_now_add
=
True
)
modified_at
=
models
.
DateTimeField
(
auto_now
=
True
)
class
Meta
:
verbose_name_plural
=
'aliases'
...
...
@@ -125,6 +134,8 @@ class Host(models.Model):
owner
=
models
.
ForeignKey
(
User
)
groups
=
models
.
ManyToManyField
(
'Group'
,
symmetrical
=
False
,
blank
=
True
,
null
=
True
)
rules
=
models
.
ManyToManyField
(
'Rule'
,
symmetrical
=
False
,
blank
=
True
,
null
=
True
)
created_at
=
models
.
DateTimeField
(
auto_now_add
=
True
)
modified_at
=
models
.
DateTimeField
(
auto_now
=
True
)
def
__unicode__
(
self
):
return
self
.
hostname
...
...
miscellaneous/devenv/init.sh
View file @
19c976c1
...
...
@@ -49,4 +49,27 @@ cd cloud
./manage.py loaddata /home/cloud/user.yaml 2>/dev/null
||
true
./manage.py loaddata /home/cloud/fw.yaml
./manage.py loaddata /home/cloud/one.yaml
./manage.py loaddata /home/cloud/store.yaml
./manage.py update
#Set up store server
rm
-rf
/var/www/
*
mkdir
-p
/var/www
cd
/opt/webadmin/cloud/miscellaneous/store-server/
LOCAL_IP
=
$(
ip addr show dev eth0|grep inet|head
-1
|awk
'{print $2}'
|cut
-d
'/'
-f
1
)
cat
<<
EOF
> store.config
[store]
#Default root folder (for download and upload)
root_www_folder = /var/www
#Deafult binary folder (for executables)
root_bin_folder = /opt/webadmin/cloud/miscellaneous/store-server/
#Site host (for standalone server)
site_host = 0.0.0.0
#Site port (for standalone server)
site_port = 9000
#Site url (for download and upload links) %(variable)formatter ex: %(port)s
site_url = http://
${
LOCAL_IP
}
:%(site_port)s
#User manager script (add, del, set, update)
user_manager = FAKEUserManager.sh
EOF
sudo
/opt/webadmin/cloud/miscellaneous/store-server/CloudStore.py
>
/dev/null 2>&1 &
miscellaneous/devenv/user.yaml
View file @
19c976c1
...
...
@@ -83,7 +83,7 @@
is_superuser
:
true
last_login
:
2013-01-22 15:21:22+00:00
last_name
:
'
'
password
:
pbkdf2_sha256$10000$
gx04X6OpW8kW$iCU3cuhqQcvq7I8tRVkrnES03ty/3vqN8ou4xZgfPBQ
=
password
:
pbkdf2_sha256$10000$
tHbyy0OTBCBQ$YVdhrXZVK6wi7Px/zX5zmpOGkQUnddXXdrwNFnJskx0
=
user_permissions
:
[]
username
:
test
model
:
auth.user
...
...
miscellaneous/store-server/CloudStore.py
View file @
19c976c1
...
...
@@ -11,7 +11,7 @@ from pwd import getpwnam
#Get configuration file
config
=
ConfigParser
.
ConfigParser
()
config
.
read
(
'store.config'
)
config
.
read
(
'
/opt/webadmin/cloud/miscellaneous/store-server/
store.config'
)
#ROOT_WWW_FOLDER='/var/www'
...
...
store/api.py
View file @
19c976c1
...
...
@@ -20,23 +20,23 @@ class StoreApi:
headers
=
{
'content-type'
:
'application/json'
}
if
settings
[
'ssl_auth'
]
==
'True'
and
settings
[
'basic_auth'
]
==
'True'
:
r
=
requests
.
post
(
url
,
data
=
payload
,
headers
=
headers
,
\
verify
=
settings
[
'verify_ssl'
],
\
verify
=
settings
[
'verify_ssl'
]
==
'True'
,
\
cert
=
(
settings
[
'store_client_cert'
],
settings
[
'store_client_key'
]),
\
auth
=
(
settings
[
'store_client_user'
],
settings
[
'store_client_pass'
])
)
elif
settings
[
'ssl_auth'
]
==
'True'
:
r
=
requests
.
post
(
url
,
data
=
payload
,
headers
=
headers
,
\
verify
=
settings
[
'verify_ssl'
],
\
verify
=
settings
[
'verify_ssl'
]
==
'True'
,
\
cert
=
(
settings
[
'store_client_cert'
],
settings
[
'store_client_key'
])
\
)
elif
settings
[
'basic_auth'
]
==
'True'
:
r
=
requests
.
post
(
url
,
data
=
payload
,
headers
=
headers
,
\
verify
=
settings
[
'verify_ssl'
],
\
verify
=
settings
[
'verify_ssl'
]
==
'True'
,
\
auth
=
(
settings
[
'store_client_user'
],
settings
[
'store_client_pass'
])
\
)
else
:
r
=
requests
.
post
(
url
,
data
=
payload
,
headers
=
headers
,
\
verify
=
settings
[
'verify_ssl'
]
\
verify
=
settings
[
'verify_ssl'
]
==
'True'
\
)
return
r
@staticmethod
...
...
@@ -44,23 +44,23 @@ class StoreApi:
headers
=
{
'content-type'
:
'application/json'
}
if
settings
[
'ssl_auth'
]
==
'True'
and
settings
[
'basic_auth'
]
==
'True'
:
r
=
requests
.
get
(
url
,
headers
=
headers
,
\
verify
=
settings
[
'verify_ssl'
],
\
verify
=
settings
[
'verify_ssl'
]
==
'True'
,
\
cert
=
(
settings
[
'store_client_cert'
],
settings
[
'store_client_key'
]),
\
auth
=
(
settings
[
'store_client_user'
],
settings
[
'store_client_pass'
])
)
elif
settings
[
'ssl_auth'
]
==
'True'
:
r
=
requests
.
get
(
url
,
headers
=
headers
,
\
verify
=
settings
[
'verify_ssl'
],
\
verify
=
settings
[
'verify_ssl'
]
==
'True'
,
\
cert
=
(
settings
[
'store_client_cert'
],
settings
[
'store_client_key'
])
\
)
elif
settings
[
'basic_auth'
]
==
'True'
:
r
=
requests
.
get
(
url
,
headers
=
headers
,
\
verify
=
settings
[
'verify_ssl'
],
\
verify
=
settings
[
'verify_ssl'
]
==
'True'
,
\
auth
=
(
settings
[
'store_client_user'
],
settings
[
'store_client_pass'
])
\
)
else
:
r
=
requests
.
get
(
url
,
headers
=
headers
,
\
verify
=
settings
[
'verify_ssl'
]
\
verify
=
settings
[
'verify_ssl'
]
==
'True'
\
)
return
r
@staticmethod
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment