Apply-PnPProvisioningTemplate : The remote server returned an error: (403) Forbidden

I am developing a script to create/update group/team sites from a SharePoint list. I have everything working, but I am struggling big time with authentication.

I use

Connect-PnPOnline -Url https://client.sharepoint.com/sites/testclientsite -UseWebLogin -Scopes "Group.ReadWrite.All","Directory.Read.All" 

In order to Apply-PnPProvisioningTemplate.

Anytime I am switching from the list and the newly created site to apply the template, I use

Connect-PnPOnline -Url https://client.sharepoint.com/sites/sharepointlist -UseWebLogin 

To connect to SP List of clients

Connect-PnPOnline -Url https://client.sharepoint.com/sites/newsite -UseWebLogin 

To connect to new site to apply template.

This works amazing through the first one or two sites, then I receive a

Apply-PnPProvisioningTemplate : The remote server returned an error: (403) Forbidden.

It is somewhat random. Sometimes it will make it through one or two sites. I have also had it work through 8 or so sites before it errors out. I am assuming it has something to do with the token expiring, but I am not positive. Any help would be appreciated.

Tratar Log de scritp Python no SQL SERVER 17

estou com uma dificuldade enorme aqui, é o seguinte…

Tenho o seguinte codigo:

try:      import sustentavel     params = urllib.parse.quote_plus("DRIVER={" + xml_bd[2][0].text + "};SERVER=" + xml_bd[2][1].text + ";DATABASE=" + xml_bd[2][2].text + ";UID=" + xml_bd[2][3].text + ";PWD=" + xml_bd[2][4].text[:-4] + "")     engine = create_engine("mssql+pyodbc:///?odbc_connect=%s" % params)     print('Conexão Realizada com Sucesso')      importlib.reload (sustentavel)      bd_rotinas= pd.read_sql("INSERT INTO [BD_ANALITICO].[dbo].[LOGS_PYTHON] VALUES ('SUSTENTAVEL','EXECUTOU COMPLETAMENTE',GetDate(),'CONCLUIDO')", con= engine)   except:     errou= pd.read_sql("INSERT INTO [BD_ANALITICO].[dbo].[LOGS_PYTHON] VALUES ('SUSTENTAVEL','ROTINA COM ERROS',GetDate(),'ERRO')", con= engine) 

Onde eu importo um outro script como biblioteca, até então tudo ótimo, se eu não usar o except para escrever no Banco de Dados, se eu deixo como:

except Exception as e:      print(e)  

o código roda como uma uva, mas é eu ativar para em caso de erro escrever na tabela ai trava, sempre que eu executo da como erro.

Informações com a execução escrevendo no BD em caso de erro:

Conexão Realizada com Sucesso This result object does not return rows. It has been closed automatically. --------------------------------------------------------------------------- AttributeError                            Traceback (most recent call last) C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\result.py in _fetchall_impl(self)    1080         try: -> 1081             return self.cursor.fetchall()    1082         except AttributeError:  AttributeError: 'NoneType' object has no attribute 'fetchall'  During handling of the above exception, another exception occurred:  ResourceClosedError                       Traceback (most recent call last) <ipython-input-42-d741fdb8f08f> in <module>     164  --> 165     bd_rotinas= pd.read_sql("INSERT INTO [BD_ANALITICO].[dbo].[LOGS_PYTHON] VALUES ('SUSTENTAVEL','EXECUTOU COMPLETAMENTE',GetDate(),'CONCLUIDO')", con= engine)     166   C:\ProgramData\Anaconda3\lib\site-packages\pandas\io\sql.py in read_sql(sql, con, index_col, coerce_float, params, parse_dates, columns, chunksize)     396             coerce_float=coerce_float, parse_dates=parse_dates, --> 397             chunksize=chunksize)     398   C:\ProgramData\Anaconda3\lib\site-packages\pandas\io\sql.py in read_query(self, sql, index_col, coerce_float, parse_dates, params, chunksize)    1071         else: -> 1072             data = result.fetchall()    1073             frame = _wrap_result(data, columns, index_col=index_col,  C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\result.py in fetchall(self)    1135                 e, None, None, -> 1136                 self.cursor, self.context)    1137   C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\base.py in _handle_dbapi_exception(self, e, statement, parameters, cursor, context)    1415             else: -> 1416                 util.reraise(*exc_info)    1417   C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\util\compat.py in reraise(tp, value, tb, cause)     248             raise value.with_traceback(tb) --> 249         raise value     250   C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\result.py in fetchall(self)    1129         try: -> 1130             l = self.process_rows(self._fetchall_impl())    1131             self._soft_close()  C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\result.py in _fetchall_impl(self)    1082         except AttributeError: -> 1083             return self._non_result([])    1084   C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\result.py in _non_result(self, default)    1087             raise exc.ResourceClosedError( -> 1088                 "This result object does not return rows. "    1089                 "It has been closed automatically.",  ResourceClosedError: This result object does not return rows. It has been closed automatically.  During handling of the above exception, another exception occurred:  AttributeError                            Traceback (most recent call last) C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\result.py in _fetchall_impl(self)    1080         try: -> 1081             return self.cursor.fetchall()    1082         except AttributeError:  AttributeError: 'NoneType' object has no attribute 'fetchall'  During handling of the above exception, another exception occurred:  ResourceClosedError                       Traceback (most recent call last) <ipython-input-42-d741fdb8f08f> in <module>     168 except Exception as e:     169     print(e) --> 170     errou= pd.read_sql("INSERT INTO [BD_ANALITICO].[dbo].[LOGS_PYTHON] VALUES ('SUSTENTAVEL','ROTINA COM ERROS',GetDate(),'ERRO')", con= engine)  C:\ProgramData\Anaconda3\lib\site-packages\pandas\io\sql.py in read_sql(sql, con, index_col, coerce_float, params, parse_dates, columns, chunksize)     395             sql, index_col=index_col, params=params,     396             coerce_float=coerce_float, parse_dates=parse_dates, --> 397             chunksize=chunksize)     398      399   C:\ProgramData\Anaconda3\lib\site-packages\pandas\io\sql.py in read_query(self, sql, index_col, coerce_float, parse_dates, params, chunksize)    1070                                         parse_dates=parse_dates)    1071         else: -> 1072             data = result.fetchall()    1073             frame = _wrap_result(data, columns, index_col=index_col,    1074                                  coerce_float=coerce_float,  C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\result.py in fetchall(self)    1134             self.connection._handle_dbapi_exception(    1135                 e, None, None, -> 1136                 self.cursor, self.context)    1137     1138     def fetchmany(self, size=None):  C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\base.py in _handle_dbapi_exception(self, e, statement, parameters, cursor, context)    1414                 )    1415             else: -> 1416                 util.reraise(*exc_info)    1417     1418         finally:  C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\util\compat.py in reraise(tp, value, tb, cause)     247         if value.__traceback__ is not tb:     248             raise value.with_traceback(tb) --> 249         raise value     250      251 else:  C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\result.py in fetchall(self)    1128     1129         try: -> 1130             l = self.process_rows(self._fetchall_impl())    1131             self._soft_close()    1132             return l  C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\result.py in _fetchall_impl(self)    1081             return self.cursor.fetchall()    1082         except AttributeError: -> 1083             return self._non_result([])    1084     1085     def _non_result(self, default):  C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\result.py in _non_result(self, default)    1086         if self._metadata is None:    1087             raise exc.ResourceClosedError( -> 1088                 "This result object does not return rows. "    1089                 "It has been closed automatically.",    1090             )  ResourceClosedError: This result object does not return rows. It has been closed automatically. 

server host key usage problem

I have my server host key(private key) in Openssl format that i want to use for server authentication. I prefer to use the trust model that client local database should associates each host name with the corresponding public host key. Since openssl format key is not supported in openssh architecture, i am looking a solution that should convert my openssl format private key to openssh format private key. Appreciate any help to resolve this problem

After installing ssl certificate for django application on apache server with debian, I am getting Default test page only

Following are my configuration files

<VirtualHost *:80> Redirect permanent / https://www.piping.pro/ ServerName localhost ServerAdmin admin@piping.pro  ErrorLog $  {APACHE_LOG_DIR}/error.log CustomLog $  {APACHE_LOG_DIR}/access.log combined </VirtualHost>  <VirtualHost *:443> ServerName localhost ServerAdmin admin@piping.pro  Alias /static /var/www/static-root <Directory /var/www/static-root>    Require all granted  </Directory>  Alias /media /var/www/media-root <Directory /var/www/media-root>    Require all granted </Directory>  <Directory /var/www/venv/src/mysite>     <Files wsgi.py>         Require all granted     </Files> </Directory>   ErrorLog $  {APACHE_LOG_DIR}/error.log CustomLog $  {APACHE_LOG_DIR}/access.log combined  SSLEngine on SSLCertificateFile /etc/ssl/piping_pro.crt SSLCertificateKeyFile /etc/ssl/private/PrivateKey.key SSLCertificateChainFile /etc/ssl/piping_pro.ca-bundle  </VirtualHost> 

Vault Secret server best practices

Recently Hashicorp released a secrets management solution called Vault.

It is a free and open source general secrets storage and secret generator, acting as a Vault for passwords, encryption keys, and hash salts.

I am wondering if anyone has started using it, and what are best practices for using it?

Has anyone heard any security flaw with it?

Whonix on Linux Server?

I’m thrilled with the Whonix solution. But I don’t like to have all data close to me. I would like to connect to a linux server with desktop interface. On this I would like to be able to work without jerking and problems. I would have liked to install Virtualbox with Whonix. To work with Whonix there.

Is this possible? Most servers do not have HArdware virtualization.

How can I achieve this goal?

changed the name of the computer – SQL server

i changed the computer name, and entered this commands in SQL server management studio (ssms)

sp_dropserver <old_name>;    sp_addserver <new_name>, local;  

i press this query

select * from sys.servers  

this is the result

is this okay? the location, provider string, catalog is NULL?

How can i know if everything changed according to the new Server name? do i need to reinstall SSMS again?

DNS server on AWS : How to use iptables to redirect requests to it

I’m running my own DNS server on an AWS instance. I’ve modified my security group to accept UDP and TCP connections on port 53.

However, my server is running on port 8053 so I somehow need to direct those outside requests going to 53 to 8053.

I’m pretty sure I need to update iptables, but can not find out how. So far, the most promising commands are

sudo iptables -t nat -A OUTPUT -o lo -p tcp --dport 53 -j REDIRECT --to-port 8053 sudo iptables -t nat -A OUTPUT -o lo -p udp --dport 53 -j REDIRECT --to-port 8053  sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 53 -j REDIRECT --to-port 8053 sudo iptables -A PREROUTING -t nat -i eth0 -p udp --dport 53 -j REDIRECT --to-port 8053 

Here’s what the result looks like:

Table: nat Chain PREROUTING (policy ACCEPT) num  target     prot opt source               destination 1    REDIRECT   tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:53 redir ports 8053 2    REDIRECT   udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:53 redir ports 8053  Chain INPUT (policy ACCEPT) num  target     prot opt source               destination  Chain OUTPUT (policy ACCEPT) num  target     prot opt source               destination 1    REDIRECT   udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:53 redir ports 8053 2    REDIRECT   tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:53 redir ports 8053  Chain POSTROUTING (policy ACCEPT) num  target     prot opt source               destination 

However, if I run nmap against this host I get this:

Nmap scan report for xxx.amazonaws.com (x.x.x.x) Host is up (0.040s latency). Not shown: 997 filtered ports PORT   STATE  SERVICE 22/tcp open   ssh 53/tcp closed domain 80/tcp open   http 

I know my DNS server is listening on 8053. What’s going wrong??